|
|
|
@ -93,25 +93,24 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
// kptype 1蓝票 2红票
|
|
|
|
|
String kpType = billInfo.getKptype(); |
|
|
|
|
|
|
|
|
|
if ("1".equals(kpType)) { |
|
|
|
|
|
|
|
|
|
// 查询用户登记参数
|
|
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
yhdjQueryWrapper.eq("nsrsbh", companyservice.getSellertax()); |
|
|
|
|
yhdjQueryWrapper.eq("identity", companyservice.getIdentity()); |
|
|
|
|
InvoiceAllYhdj invoiceAllYhdj = yhdjMapper.selectOne(yhdjQueryWrapper); |
|
|
|
|
// 查询用户登记参数
|
|
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
yhdjQueryWrapper.eq("nsrsbh", companyservice.getSellertax()); |
|
|
|
|
yhdjQueryWrapper.eq("identity", companyservice.getIdentity()); |
|
|
|
|
InvoiceAllYhdj invoiceAllYhdj = yhdjMapper.selectOne(yhdjQueryWrapper); |
|
|
|
|
|
|
|
|
|
if (BeanUtil.isEmpty(invoiceAllYhdj)) { |
|
|
|
|
return new HXResponse("用户未登记!"); |
|
|
|
|
} |
|
|
|
|
if (BeanUtil.isEmpty(invoiceAllYhdj)) { |
|
|
|
|
return new HXResponse("用户未登记!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryTwoDTO queryDTO = new QueryTwoDTO(); |
|
|
|
|
queryDTO.setDqbm(invoiceAllYhdj.getDqbm()); |
|
|
|
|
queryDTO.setAsync("false"); |
|
|
|
|
queryDTO.setBsrysfzjhm(invoiceAllYhdj.getBsrysfzjhm()); |
|
|
|
|
queryDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh()); |
|
|
|
|
queryDTO.setRequestId("tycxjk"); |
|
|
|
|
QueryTwoDTO queryDTO = new QueryTwoDTO(); |
|
|
|
|
queryDTO.setDqbm(invoiceAllYhdj.getDqbm()); |
|
|
|
|
queryDTO.setAsync("false"); |
|
|
|
|
queryDTO.setBsrysfzjhm(invoiceAllYhdj.getBsrysfzjhm()); |
|
|
|
|
queryDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh()); |
|
|
|
|
queryDTO.setRequestId("tycxjk"); |
|
|
|
|
|
|
|
|
|
if ("1".equals(kpType)) { |
|
|
|
|
// 开票实体转换,校验
|
|
|
|
|
InvoiceAllAddTwoDTO invoiceAllAddTwoDTO = BeanUtil.copyProperties(billInfo, InvoiceAllAddTwoDTO.class); |
|
|
|
|
invoiceAllAddTwoDTO.setDqbm(queryDTO.getDqbm()); |
|
|
|
@ -124,7 +123,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
InvoiceAllAddInfoTwoDTO invoiceAllAddInfoTwoDTO = BeanUtil.copyProperties(billInfo, InvoiceAllAddInfoTwoDTO.class |
|
|
|
|
,"fjxxList","mxList","tdywxx","ext"); |
|
|
|
|
// 发票类型处理
|
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(invoiceAllAddInfoTwoDTO); |
|
|
|
|
|
|
|
|
|
// 明细集合
|
|
|
|
@ -139,7 +137,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
invoiceAllAddInfoTwoDTO.setMxList(mxList); |
|
|
|
|
invoiceAllAddTwoDTO.setJsonData(invoiceAllAddInfoTwoDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 报文转换存储
|
|
|
|
|
billInfo.setCompanyId(companyservice.getCompanyid()); |
|
|
|
|
billInfo.setServiceSupplierKey("JCSK"); |
|
|
|
@ -179,8 +176,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
|
|
|
|
|
// TODO: 2023/4/23 调试
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
Map<String,Object> map = BeanToMapUtils.fastJsonBean2Map(invoiceAllAddTwoDTO); |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.LZFPKJ, WebServiceConstant.URL, JSONUtil.parse(map), companyservice); |
|
|
|
@ -229,9 +224,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if ("2".equals(kpType)) { |
|
|
|
|
|
|
|
|
|
//billinfo => 红字报文
|
|
|
|
|
|
|
|
|
|
AddRedInvoiceTwoDTO addRedInvoiceDTO = BeanUtil.copyProperties(billInfo, AddRedInvoiceTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(addRedInvoiceDTO); |
|
|
|
|
|
|
|
|
@ -339,210 +332,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
@Override |
|
|
|
|
public HXResponse queryInvoice(QueryBillInfoDTO billInfo, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
String systemOrderNo = billInfo.getSystemOrderno(); |
|
|
|
|
BillInfo billInfoResult = billInfoMapper.selectBySystemOrderNo(companyservice.getCompanyid(), systemOrderNo); |
|
|
|
|
|
|
|
|
|
// requestId=OutTradeOrderno
|
|
|
|
|
if (StrUtil.isEmpty(billInfoResult.getOutTradeOrderno())) { |
|
|
|
|
return new HXResponse("未获取到开票记录!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询用户登记参数
|
|
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
yhdjQueryWrapper.eq("nsrsbh", companyservice.getSellertax()); |
|
|
|
|
yhdjQueryWrapper.eq("identity", companyservice.getIdentity()); |
|
|
|
|
InvoiceAllYhdj invoiceAllYhdj = yhdjMapper.selectOne(yhdjQueryWrapper); |
|
|
|
|
|
|
|
|
|
if (BeanUtil.isEmpty(invoiceAllYhdj)) { |
|
|
|
|
return new HXResponse("用户未登记!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryTwoDTO queryDTO = new QueryTwoDTO(); |
|
|
|
|
queryDTO.setDqbm(invoiceAllYhdj.getDqbm()); |
|
|
|
|
queryDTO.setAsync("false"); |
|
|
|
|
queryDTO.setBsrysfzjhm(invoiceAllYhdj.getBsrysfzjhm()); |
|
|
|
|
queryDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh()); |
|
|
|
|
queryDTO.setRequestId("tycxjk"); |
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(queryDTO); |
|
|
|
|
|
|
|
|
|
String requestId = queryDTO.getRequestId(); |
|
|
|
|
String serviceId = ""; |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.TYCXJK, WebServiceConstant.URL, queryDTO, 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)) { |
|
|
|
|
|
|
|
|
|
QueryWrapper<InvoiceAllApiLog> apiLogQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
apiLogQueryWrapper.eq("request_id", requestId); |
|
|
|
|
InvoiceAllApiLog allApiLog = allApiLogMapper.selectOne(apiLogQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(allApiLog) && StrUtil.isNotEmpty(allApiLog.getRequestId())) { |
|
|
|
|
serviceId = allApiLog.getRequestId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "查询成功"); |
|
|
|
|
|
|
|
|
|
String finalServiceId = serviceId; |
|
|
|
|
|
|
|
|
|
if (WebServiceConstant.LZFPKJ.equals(finalServiceId)) { |
|
|
|
|
// 蓝字发票开具
|
|
|
|
|
AddInvoiceTWOVO addInvoiceVO = BeanUtil.copyProperties(data, AddInvoiceTWOVO.class); |
|
|
|
|
|
|
|
|
|
if (BeanUtil.isNotEmpty(addInvoiceVO)) { |
|
|
|
|
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
billInfoQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
BillInfo billInfoR = billInfoMapper.selectOne(billInfoQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(billInfoR)) { |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(invoice)) { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfo, Invoice.class); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} else { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfo, Invoice.class); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} |
|
|
|
|
// 返回数据
|
|
|
|
|
response.put("data", invoice); |
|
|
|
|
} else { |
|
|
|
|
log.error("【金四服务类】【金财数科】【通用查询接口】API请求异常,billInfo未查询到,requestId={}。", requestId); |
|
|
|
|
return new HXResponse("查询错误!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) { |
|
|
|
|
// 获取发票下载地址
|
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String ewmUrl = json.getOrDefault("ewmUrl", "").toString(); |
|
|
|
|
String pdfUrl = json.getOrDefault("pdfUrl", "").toString(); |
|
|
|
|
String ofdUrl = json.getOrDefault("ofdUrl", "").toString(); |
|
|
|
|
String xmlUrl = json.getOrDefault("xmlUrl", "").toString(); |
|
|
|
|
if (StrUtil.isNotEmpty(requestId)) { |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(invoice)) { |
|
|
|
|
invoice.setInvoicePdfUrl(pdfUrl); |
|
|
|
|
invoice.setcOfdUrl(ofdUrl); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// TODO: 2023/3/29 返回数据处理
|
|
|
|
|
} else if (WebServiceConstant.ADD_RED_INVOICE.equals(finalServiceId)) { |
|
|
|
|
// 查找原发票信息
|
|
|
|
|
AddRedInvoiceTWOVO addRedInvoiceVO = BeanUtil.copyProperties(data, AddRedInvoiceTWOVO.class); |
|
|
|
|
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
billInfoQueryWrapper.eq("fpqqlsh", requestId); |
|
|
|
|
BillInfo billInfoR = billInfoMapper.selectOne(billInfoQueryWrapper); |
|
|
|
|
if (billInfoR != null) { |
|
|
|
|
// return AjaxResult.error("未查询到原发票信息");
|
|
|
|
|
// 根据billInfo获得原发票号码
|
|
|
|
|
QueryWrapper<BillInfo> originBillInfoWrapper = new QueryWrapper<>(); |
|
|
|
|
originBillInfoWrapper.eq("origin_fphm", billInfoR.getOriginFphm()); |
|
|
|
|
BillInfo originBillInfo = billInfoMapper.selectOne(originBillInfoWrapper); |
|
|
|
|
if (originBillInfo != null) { |
|
|
|
|
// return AjaxResult.error("未查询到原发票信息");
|
|
|
|
|
// 查找原发票信息
|
|
|
|
|
Invoice originInvoice = invoiceMapper.selectInvoiceByBillInfoId(originBillInfo.getId()); |
|
|
|
|
Invoice invoice = BeanUtil.copyProperties(originInvoice, Invoice.class); |
|
|
|
|
invoice.setFphm(addRedInvoiceVO.getFphm()); |
|
|
|
|
invoice.setBillInfoId(billInfo.getId()); |
|
|
|
|
invoice.setSystemOrderno(billInfo.getSystemOrderno()); |
|
|
|
|
invoice.setOutTradeOrderno(billInfo.getOutTradeOrderno()); |
|
|
|
|
invoice.setFpqqlsh(billInfo.getFpqqlsh()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addRedInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addRedInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addRedInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addRedInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addRedInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addRedInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addRedInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
|
|
|
|
|
response.put("data", invoice); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if (WebServiceConstant.KSHC.equals(finalServiceId)) { |
|
|
|
|
// 快速冲红
|
|
|
|
|
// TODO: 后期存库
|
|
|
|
|
// KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
|
|
|
|
|
// InvoiceAllKschVO invoiceAllKschVO = BeanUtil.copyProperties(kschVO,InvoiceAllKschVO.class);
|
|
|
|
|
|
|
|
|
|
}else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 申请红字信息表
|
|
|
|
|
// TODO: 后期存库
|
|
|
|
|
}else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 查询红字信息表
|
|
|
|
|
|
|
|
|
|
RedInvoiceQueryAllTWOVO redInvoiceQueryAllTWOVO = BeanUtil.copyProperties(data, RedInvoiceQueryAllTWOVO.class); |
|
|
|
|
// 返回报文转换
|
|
|
|
|
List<Redinfo> resultDownload = parseRedINFO(redInvoiceQueryAllTWOVO); |
|
|
|
|
// TODO: 2023/4/6 数据存储
|
|
|
|
|
response.put("data", resultDownload); |
|
|
|
|
}else if (WebServiceConstant.SHHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 审核红字信息表
|
|
|
|
|
// TODO: 后期存库
|
|
|
|
|
}else if (WebServiceConstant.QDFPWJHQ.equals(finalServiceId)) { |
|
|
|
|
// 审核红字信息表
|
|
|
|
|
// TODO: 全电发票文件获取
|
|
|
|
|
} |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【通用查询接口】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return new HXResponse("通用查询接口异常"); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1060,6 +850,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 获取人脸识别二维码*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse qrcode(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
@ -1079,6 +870,16 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.QRCODE); |
|
|
|
|
allApiLog.setSendMsg(JSONUtil.toJsonStr(decryptResult)); |
|
|
|
|
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", "请求成功",json); |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
@ -1367,7 +1168,11 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
apiLogQueryWrapper.eq("request_id", requestId); |
|
|
|
|
InvoiceAllApiLog allApiLog = allApiLogMapper.selectOne(apiLogQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(allApiLog) && StrUtil.isNotEmpty(allApiLog.getRequestId())) { |
|
|
|
|
serviceId = allApiLog.getRequestId(); |
|
|
|
|
serviceId = allApiLog.getUrl(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(BeanUtil.isEmpty(allApiLog)){ |
|
|
|
|
log.error("金四日志表未记录,requestId={},返回结果={}",requestId,data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "查询成功"); |
|
|
|
@ -1376,7 +1181,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
if (WebServiceConstant.LZFPKJ.equals(finalServiceId)) { |
|
|
|
|
// 蓝字发票开具
|
|
|
|
|
AddInvoiceTWOVO addInvoiceVO = BeanUtil.copyProperties(data, AddInvoiceTWOVO.class); |
|
|
|
|
AddInvoiceTWOVO addInvoiceVO = BeanUtil.copyProperties(JSONUtil.parse(data), AddInvoiceTWOVO.class); |
|
|
|
|
|
|
|
|
|
if (BeanUtil.isNotEmpty(addInvoiceVO)) { |
|
|
|
|
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
@ -1387,44 +1192,48 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
invoiceQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
|
|
|
|
|
BillInfo billInfoResult = billInfoMapper.selectBySystemOrderNo(companyservice.getCompanyid(), systemOrderNo); |
|
|
|
|
|
|
|
|
|
if (BeanUtil.isNotEmpty(invoice)) { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfoResult, Invoice.class); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} else { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfoResult, Invoice.class); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
// 根据
|
|
|
|
|
BillInfo billInfoResult = billInfoMapper.selectByOutTradeOrderno(companyservice.getCompanyid(), systemOrderNo); |
|
|
|
|
if(BeanUtil.isNotEmpty(billInfoResult)){ |
|
|
|
|
if (BeanUtil.isNotEmpty(invoice)) { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfoResult, Invoice.class); |
|
|
|
|
invoice.setBillInfoId(billInfoResult.getId()); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} else { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfoResult, Invoice.class); |
|
|
|
|
invoice.setBillInfoId(billInfoResult.getId()); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(addInvoiceVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(addInvoiceVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(addInvoiceVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(addInvoiceVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(addInvoiceVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(addInvoiceVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 返回数据
|
|
|
|
|
response.put("data", invoice); |
|
|
|
@ -1433,6 +1242,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return new HXResponse("查询错误!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) { |
|
|
|
|
// 获取发票下载地址
|
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
@ -1517,6 +1327,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
}else if (WebServiceConstant.QDFPWJHQ.equals(finalServiceId)) { |
|
|
|
|
// 审核红字信息表
|
|
|
|
|
// TODO: 全电发票文件获取
|
|
|
|
|
}else if(WebServiceConstant.QRCODE.equals(finalServiceId)){ |
|
|
|
|
response.put("data", JSONUtil.parse(data)); |
|
|
|
|
} |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|