|
|
|
@ -1,5 +1,10 @@ |
|
|
|
|
package com.jianshui.invoice.service.impl.api; |
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
import com.jianshui.invoice.domain.dto.api.InvoiceAllFileAcquisitionOnTWODTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.InvoiceAllFileAcquisitionTWODTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.InvoiceAllKshcTWODTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.InvoiceAllShhzTWODTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.jcsk.*; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
@ -899,6 +904,10 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 金财数科新增接口 **/ |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object addCallback(HttpServletRequest request) { |
|
|
|
|
return null; |
|
|
|
@ -909,47 +918,310 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse getFileUrl(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
public HXResponse getFileUrl(InvoiceAllFileAcquisitionTWODTO invoiceAllFileAcquisitionTWODTO, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
FileAcquisitionTwoDTO fileAcquisitionDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionTWODTO, FileAcquisitionTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(fileAcquisitionDTO); |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.FPEWMXZ, WebServiceConstant.URL, fileAcquisitionDTO, companyservice); |
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|
if (StrUtil.isEmpty(requestId)) { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.FPEWMXZ); |
|
|
|
|
allApiLog.setSendMsg(fileAcquisitionDTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取发票下载地址】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("获取发票下载地址错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse getFileAcquisitionOn(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
public HXResponse getFileAcquisitionOn(InvoiceAllFileAcquisitionOnTWODTO invoiceAllFileAcquisitionOnTWODTO, Companyservice companyservice) { |
|
|
|
|
FileAcquisitionOnTwoDTO fileAcquisitionOnDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO, FileAcquisitionOnTwoDTO.class); |
|
|
|
|
FileAcquisitionOnDetailTwoDTO fileAcquisitionOnDetailDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO.getJsonData(),FileAcquisitionOnDetailTwoDTO.class); |
|
|
|
|
fileAcquisitionOnDTO.setJsonData(fileAcquisitionOnDetailDTO); |
|
|
|
|
ValidateUtils.validate(fileAcquisitionOnDTO); |
|
|
|
|
ValidateUtils.validate(fileAcquisitionOnDetailDTO); |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.QDFPWJHQ, WebServiceConstant.URL, fileAcquisitionOnDTO, companyservice); |
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|
if (StrUtil.isEmpty(requestId)) { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.QDFPWJHQ); |
|
|
|
|
allApiLog.setSendMsg(fileAcquisitionOnDTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【全电安排文件获取】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("全电发票文件获取错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse qrcode(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.QRCODE, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
|
|
// TODO: 2022/12/11 返回处理 VO整理,数据存储。
|
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
// TODO-kk: 2023/1/16 数据存储再整下
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|
if (StrUtil.isEmpty(requestId)) { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",json); |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("获取二维码错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO 处理日志
|
|
|
|
|
// log.info("【金四服务类】【金财数科】【获取二维码】API请求成功,外部报文返回code。返回信息:{}", result);
|
|
|
|
|
|
|
|
|
|
// return AjaxResult.success(result);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse query(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.QUERY, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
|
|
// TODO: 2022/12/11 返回处理 VO整理,数据存储。
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("发票查询错误"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO 处理日志
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse getPrintXML(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.GET_PRINT_XML, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
|
|
// TODO: 2022/12/11 返回处理 VO整理,数据存储。
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("获取二维码错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO 处理日志
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse issueFastRedInvoice(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
public HXResponse issueFastRedInvoice(InvoiceAllKshcTWODTO invoiceAllKshcDTO, Companyservice companyservice) { |
|
|
|
|
KshcTwoDTO kshcDTO = BeanUtil.copyProperties(invoiceAllKshcDTO, KshcTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(kshcDTO); |
|
|
|
|
ValidateUtils.validate(kshcDTO.getJsonData()); |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.KSHC, WebServiceConstant.URL, kshcDTO, companyservice); |
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|
if (StrUtil.isEmpty(requestId)) { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.KSHC); |
|
|
|
|
allApiLog.setSendMsg(kshcDTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【快速红冲】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("快速红冲错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse invoiceStatic(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
// com.alibaba.fastjson.JSONObject jsonObj = requestBody.getJSONObject("jsonData");
|
|
|
|
|
// if (jsonObj == null) {
|
|
|
|
|
// return AjaxResult.error(ErrorCode.INVOICE_NOT_EXISTS);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.INVOICE_STATIC, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("发票统计错误!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 处理请求
|
|
|
|
|
if (!StringUtils.equals("0000", result.getStr("code"))) { |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。返回信息:{}", result); |
|
|
|
|
return new HXResponse(result.getStr("message")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject data = result.getJSONObject("data"); |
|
|
|
|
if (data == null) { |
|
|
|
|
return new HXResponse("发票统计错误!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info("【金四服务类】【金财数科】【蓝字统计】API请求成功,返回信息:{}", result); |
|
|
|
|
|
|
|
|
|
// String requestId = data.getStr("requestId");
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",data); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse auditRedInfo(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
|
public HXResponse auditRedInfo(InvoiceAllShhzTWODTO invoiceAllShhzTWODTO, Companyservice companyservice) { |
|
|
|
|
// TODO: 2023/3/16 外部报文转数科校验
|
|
|
|
|
|
|
|
|
|
ShhzTwoDTO shhzDTO = BeanUtil.copyProperties(invoiceAllShhzTWODTO,ShhzTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(shhzDTO); |
|
|
|
|
|
|
|
|
|
ShhzJsonDataTwoDTO shhzJsonDataDTO = BeanUtil.copyProperties(shhzDTO.getJsonData(),ShhzJsonDataTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(shhzJsonDataDTO); |
|
|
|
|
|
|
|
|
|
shhzDTO.setJsonData(shhzJsonDataDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.SHHZFPXXQRD, WebServiceConstant.URL, shhzDTO, companyservice); |
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|
if (StrUtil.isEmpty(requestId)) { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.SHHZFPXXQRD); |
|
|
|
|
allApiLog.setSendMsg(shhzDTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【审核红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("审核红字信息表错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功",result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 简税和金财数科 发票类型互换 |
|
|
|
|
* |
|
|
|
|