|
|
|
@ -339,8 +339,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
for (RedInvoiceQueryTWOVO redInvoiceQueryTWOVO : redInvoiceQueryTWOVOS) { |
|
|
|
|
|
|
|
|
|
RedinfoCopyVO redinfoVO = BeanUtil.copyProperties(redInvoiceQueryTWOVO, RedinfoCopyVO.class); |
|
|
|
|
|
|
|
|
|
Redinfo redinfo = BeanUtil.copyProperties(JSONUtil.parseObj(redinfoVO), Redinfo.class); |
|
|
|
|
Redinfo redinfo = BeanUtil.copyProperties(BeanToMapUtils.fastJsonBean2Map(redinfoVO), Redinfo.class); |
|
|
|
|
|
|
|
|
|
// TODO: 2023/4/6 明细接口数科还没对
|
|
|
|
|
// redinfo.setRedinfodetailList(null);
|
|
|
|
@ -535,7 +534,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.CXHZFPXXQRD, WebServiceConstant.URL, cxhzDTO, companyservice); |
|
|
|
|
Map<String,Object> mapParam = BeanToMapUtils.fastJsonBean2Map(cxhzDTO); |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.CXHZFPXXQRD, WebServiceConstant.URL, mapParam, companyservice); |
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
@ -1004,8 +1004,32 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
kshcDTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
kshcDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
|
kshcDTO.setJsonData(jsonDataTwoDTO); |
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(kshcDTO); |
|
|
|
|
ValidateUtils.validate(kshcDTO.getJsonData()); |
|
|
|
|
ValidateUtils.validate(jsonDataTwoDTO); |
|
|
|
|
|
|
|
|
|
// redInfo 前置处理 start
|
|
|
|
|
Redinfo redinfo = new Redinfo(); |
|
|
|
|
redinfo.setCompanyId(companyservice.getCompanyid()); |
|
|
|
|
String id = IdUtils.randomSystemOrderno(); |
|
|
|
|
redinfo.setSystemOrderno(id); |
|
|
|
|
redinfo.setOutTradeOrderno(id); |
|
|
|
|
redinfo.setFpqqlsh(id); |
|
|
|
|
redinfo.setRedInfoStatus("0"); |
|
|
|
|
redinfo.setSellerName(companyservice.getSellername()); |
|
|
|
|
redinfo.setSellerTaxnum(companyservice.getSellertax()); |
|
|
|
|
redinfo.setBillInputTime(TimeUtil.dateFormat(new Date(), "yyyyMMddHHmmss")); |
|
|
|
|
// 纸票为必填
|
|
|
|
|
redinfo.setBuyerName("全电"); |
|
|
|
|
redinfo.setBuyerTaxnum("全电"); |
|
|
|
|
redinfo.setSellerName("全电"); |
|
|
|
|
redinfo.setSellerTaxnum("全电"); |
|
|
|
|
redinfo.setServiceSupplierKey("0"); |
|
|
|
|
|
|
|
|
|
redinfo.setOriginFphm(invoiceAllKshcDTO.getYfphm()); |
|
|
|
|
redinfo.setApplyRemark(invoiceAllKshcDTO.getChyydm()); |
|
|
|
|
redinfoMapper.insertRedinfo(redinfo); |
|
|
|
|
// end
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
@ -1031,6 +1055,12 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
redinfo.setOutTradeOrderno(requestId); |
|
|
|
|
redinfoMapper.updateRedinfo(redinfo); |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", JSONUtil.parse(data)); |
|
|
|
|
return response; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
@ -1041,8 +1071,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", result); |
|
|
|
|
return response; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -1421,14 +1450,55 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
} else if (WebServiceConstant.KSHC.equals(finalServiceId)) { |
|
|
|
|
// 快速冲红
|
|
|
|
|
// TODO: 后期存库
|
|
|
|
|
// KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
|
|
|
|
|
// InvoiceAllKschVO invoiceAllKschVO = BeanUtil.copyProperties(kschVO,InvoiceAllKschVO.class);
|
|
|
|
|
KschTWOVO kschVO = BeanUtil.copyProperties(JSONUtil.parse(data),KschTWOVO.class); |
|
|
|
|
|
|
|
|
|
QueryWrapper<Redinfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
billInfoQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
Redinfo billInfoR = redinfoMapper.selectOne(billInfoQueryWrapper); |
|
|
|
|
if (billInfoR != null && StrUtil.isNotEmpty(billInfoR.getOriginFphm())) { |
|
|
|
|
|
|
|
|
|
// 查找原发票信息
|
|
|
|
|
String originFphm = billInfoR.getOriginFphm(); |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("fphm", originFphm); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
|
|
|
|
|
if (BeanUtil.isNotEmpty(kschVO)) { |
|
|
|
|
|
|
|
|
|
//更新蓝字发票状态为冲红 99
|
|
|
|
|
invoice.setState(99); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
|
|
|
|
|
invoice.setId(null); |
|
|
|
|
invoice.setOriginFphm(invoice.getFphm()); |
|
|
|
|
invoice.setFphm(kschVO.getFphm()); |
|
|
|
|
invoice.setBillInfoId(billInfoR.getId()); |
|
|
|
|
invoice.setSystemOrderno(billInfoR.getSystemOrderno()); |
|
|
|
|
invoice.setOutTradeOrderno(requestId); |
|
|
|
|
invoice.setFpqqlsh(billInfoR.getFpqqlsh()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(kschVO.getKprq())); |
|
|
|
|
invoice.setZzfpdm(kschVO.getZzfpdm()); |
|
|
|
|
invoice.setZzfphm(kschVO.getZzfphm()); |
|
|
|
|
//二维码=二维码下载地址
|
|
|
|
|
invoice.setQrCode(kschVO.getEwmUrl()); |
|
|
|
|
//发票 pdf 地址=PDF格式下载地址
|
|
|
|
|
invoice.setInvoicePdfUrl(kschVO.getPdfUrl()); |
|
|
|
|
//发票详情地址=OFD格式下载地址
|
|
|
|
|
invoice.setInvoiceJpgUrl(kschVO.getOfdUrl()); |
|
|
|
|
//ofdUrl=XML格式下载地址
|
|
|
|
|
invoice.setcOfdUrl(kschVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
} |
|
|
|
|
billInfoR.setBillInputTime(kschVO.getKprq()); |
|
|
|
|
redinfoMapper.updateById(billInfoR); |
|
|
|
|
} |
|
|
|
|
response.put("data", JSONUtil.parse(data)); |
|
|
|
|
|
|
|
|
|
} else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 查询红字信息表
|
|
|
|
|
|
|
|
|
|
RedInvoiceQueryAllTWOVO redInvoiceQueryAllTWOVO = BeanUtil.copyProperties(data, RedInvoiceQueryAllTWOVO.class); |
|
|
|
|
RedInvoiceQueryAllTWOVO redInvoiceQueryAllTWOVO = BeanUtil.copyProperties(JSONUtil.parse(data), RedInvoiceQueryAllTWOVO.class); |
|
|
|
|
// 返回报文转换
|
|
|
|
|
List<Redinfo> resultDownload = parseRedINFO(redInvoiceQueryAllTWOVO); |
|
|
|
|
// TODO: 2023/4/6 数据存储
|
|
|
|
@ -1579,7 +1649,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
RedisCache redisCache = SpringUtils.getBean(RedisCache.class); |
|
|
|
|
JSONObject yhdjObj = redisCache.getCacheObject(WebServiceConstant.TOKEN_KEY + sellertax + "_"+ identity); |
|
|
|
|
|
|
|
|
|
// TODO: 2023/5/17 急急急
|
|
|
|
|
// TODO: 2023/5/17
|
|
|
|
|
// JSONObject obj = JSONObject.parseObject(info);
|
|
|
|
|
// Long exprieTime = System.currentTimeMillis();
|
|
|
|
|
// exprieTime = exprieTime + (int) obj.get("expires_in") * 1000L; // 过期时间
|
|
|
|
|