|
|
|
@ -124,8 +124,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
ValidateUtils.validate(invoiceAllAddTwoDTO); |
|
|
|
|
|
|
|
|
|
// 忽略明细属性
|
|
|
|
|
InvoiceAllAddInfoTwoDTO invoiceAllAddInfoTwoDTO = BeanUtil.copyProperties(billInfo, InvoiceAllAddInfoTwoDTO.class |
|
|
|
|
, "fjxxList", "mxList", "tdywxx", "ext"); |
|
|
|
|
InvoiceAllAddInfoTwoDTO invoiceAllAddInfoTwoDTO = BeanUtil.copyProperties(billInfo, InvoiceAllAddInfoTwoDTO.class, "fjxxList", "mxList", "tdywxx", "ext"); |
|
|
|
|
// 发票类型处理
|
|
|
|
|
ValidateUtils.validate(invoiceAllAddInfoTwoDTO); |
|
|
|
|
|
|
|
|
@ -207,14 +206,12 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
AsyncManager.me().execute( |
|
|
|
|
new TimerTask() { |
|
|
|
|
AsyncManager.me().execute(new TimerTask() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功"); |
|
|
|
|
response.put("fpqqlsh", requestId); |
|
|
|
@ -1003,8 +1000,21 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse issueFastRedInvoice(InvoiceAllKshcTWODTO invoiceAllKshcDTO, Companyservice companyservice) { |
|
|
|
|
KshcTwoDTO kshcDTO = BeanUtil.copyProperties(invoiceAllKshcDTO, KshcTwoDTO.class); |
|
|
|
|
public HXResponse issueFastRedInvoice(InvoiceAllKshcJsonDataTWODTO invoiceAllKshcDTO, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
// 查询用户信息组装
|
|
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
|
if (BeanUtil.isEmpty(yhdj)) { |
|
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
KshcTwoDTO kshcDTO = new KshcTwoDTO(); |
|
|
|
|
KshcJsonDataTwoDTO jsonDataTwoDTO = BeanUtil.copyProperties(invoiceAllKshcDTO, KshcJsonDataTwoDTO.class); |
|
|
|
|
kshcDTO.setAsync(true); |
|
|
|
|
kshcDTO.setNsrsbh(yhdj.getNsrsbh()); |
|
|
|
|
kshcDTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
kshcDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
|
kshcDTO.setJsonData(jsonDataTwoDTO); |
|
|
|
|
ValidateUtils.validate(kshcDTO); |
|
|
|
|
ValidateUtils.validate(kshcDTO.getJsonData()); |
|
|
|
|
|
|
|
|
@ -1053,42 +1063,72 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
// 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("发票统计错误!"); |
|
|
|
|
// 查询用户信息组装
|
|
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
|
if (BeanUtil.isEmpty(yhdj)) { |
|
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
|
} |
|
|
|
|
StaticTWODTO staticTWODTO = new StaticTWODTO(); |
|
|
|
|
staticTWODTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
staticTWODTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
|
staticTWODTO.setNsrsbh(yhdj.getNsrsbh()); |
|
|
|
|
staticTWODTO.setAsync(true); |
|
|
|
|
|
|
|
|
|
// 处理请求
|
|
|
|
|
if (!StringUtils.equals("0000", result.getStr("code"))) { |
|
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。返回信息:{}", result); |
|
|
|
|
return new HXResponse(result.getStr("message")); |
|
|
|
|
} |
|
|
|
|
ValidateUtils.validate(staticTWODTO); |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject data = result.getJSONObject("data"); |
|
|
|
|
if (data == null) { |
|
|
|
|
return new HXResponse("发票统计错误!"); |
|
|
|
|
} |
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.INVOICE_STATIC, WebServiceConstant.URL, staticTWODTO, companyservice); |
|
|
|
|
|
|
|
|
|
log.info("【金四服务类】【金财数科】【蓝字统计】API请求成功,返回信息:{}", result); |
|
|
|
|
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() : ""; |
|
|
|
|
|
|
|
|
|
// String requestId = data.getStr("requestId");
|
|
|
|
|
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.INVOICE_STATIC); |
|
|
|
|
allApiLog.setSendMsg(staticTWODTO.toString()); |
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", data); |
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", JSONUtil.parse(data)); |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【蓝字统计】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("发票统计错误!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse auditRedInfo(InvoiceAllShhzTWODTO invoiceAllShhzTWODTO, Companyservice companyservice) { |
|
|
|
|
// TODO: 2023/3/16 外部报文转数科校验
|
|
|
|
|
public HXResponse auditRedInfo(InvoiceAllShhzJsonDataTWODTO invoiceAllShhzTWODTO, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
ShhzTwoDTO shhzDTO = BeanUtil.copyProperties(invoiceAllShhzTWODTO, ShhzTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(shhzDTO); |
|
|
|
|
// 查询用户信息组装
|
|
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
|
if (BeanUtil.isEmpty(yhdj)) { |
|
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ShhzJsonDataTwoDTO shhzJsonDataDTO = BeanUtil.copyProperties(shhzDTO.getJsonData(), ShhzJsonDataTwoDTO.class); |
|
|
|
|
ShhzTwoDTO shhzDTO = new ShhzTwoDTO(); |
|
|
|
|
shhzDTO.setAsync("true"); |
|
|
|
|
shhzDTO.setNsrsbh(yhdj.getNsrsbh()); |
|
|
|
|
shhzDTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
shhzDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
|
ShhzJsonDataTwoDTO shhzJsonDataDTO = BeanUtil.copyProperties(invoiceAllShhzTWODTO, ShhzJsonDataTwoDTO.class); |
|
|
|
|
shhzJsonDataDTO.setXsfnsrsbh(yhdj.getNsrsbh()); |
|
|
|
|
ValidateUtils.validate(shhzDTO); |
|
|
|
|
ValidateUtils.validate(shhzJsonDataDTO); |
|
|
|
|
|
|
|
|
|
shhzDTO.setJsonData(shhzJsonDataDTO); |
|
|
|
@ -1118,6 +1158,9 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", result); |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
@ -1125,11 +1168,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【审核红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("审核红字信息表错误!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", result); |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|