销项合并测试:快速红冲

beta-prop-all^2
dongxiaoke 2 years ago
parent 4347adaa71
commit cbe4e54a36
  1. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/jcsk/CxhzJsonDataTwoDTO.java
  2. 1
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/jcsk/KshcTwoDTO.java
  3. 92
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java

@ -30,25 +30,20 @@ public class CxhzJsonDataTwoDTO {
private String kprqz; private String kprqz;
@Alias("billNo") @Alias("billNo")
@NotEmpty
@ApiModelProperty(value = "红字发票信息确认单id") @ApiModelProperty(value = "红字发票信息确认单id")
private String hzfpxxqrdid; private String hzfpxxqrdid;
@Alias("billInfoNo") @Alias("billInfoNo")
@NotEmpty
@ApiModelProperty(value = "红字发票信息确认单编号") @ApiModelProperty(value = "红字发票信息确认单编号")
private String hzfpxxqrdbh; private String hzfpxxqrdbh;
@Alias("originFphm") @Alias("originFphm")
@NotEmpty
@ApiModelProperty(value = "蓝字发票号码") @ApiModelProperty(value = "蓝字发票号码")
private String originFphm; private String originFphm;
@NotEmpty
@ApiModelProperty(value = "每页条数") @ApiModelProperty(value = "每页条数")
private String pageSize; private String pageSize;
@NotEmpty
@ApiModelProperty(value = "页数") @ApiModelProperty(value = "页数")
private String pageNumber; private String pageNumber;

@ -29,7 +29,6 @@ public class KshcTwoDTO {
@ApiModelProperty(value = "纳税人识别号") @ApiModelProperty(value = "纳税人识别号")
private String nsrsbh; private String nsrsbh;
@NotEmpty
private KshcJsonDataTwoDTO jsonData; private KshcJsonDataTwoDTO jsonData;

@ -339,8 +339,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
for (RedInvoiceQueryTWOVO redInvoiceQueryTWOVO : redInvoiceQueryTWOVOS) { for (RedInvoiceQueryTWOVO redInvoiceQueryTWOVO : redInvoiceQueryTWOVOS) {
RedinfoCopyVO redinfoVO = BeanUtil.copyProperties(redInvoiceQueryTWOVO, RedinfoCopyVO.class); RedinfoCopyVO redinfoVO = BeanUtil.copyProperties(redInvoiceQueryTWOVO, RedinfoCopyVO.class);
Redinfo redinfo = BeanUtil.copyProperties(BeanToMapUtils.fastJsonBean2Map(redinfoVO), Redinfo.class);
Redinfo redinfo = BeanUtil.copyProperties(JSONUtil.parseObj(redinfoVO), Redinfo.class);
// TODO: 2023/4/6 明细接口数科还没对 // TODO: 2023/4/6 明细接口数科还没对
// redinfo.setRedinfodetailList(null); // redinfo.setRedinfodetailList(null);
@ -535,7 +534,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
cn.hutool.json.JSONObject result = null; cn.hutool.json.JSONObject result = null;
try { 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 code = result.get("code") != null ? result.get("code").toString() : "";
String msg = result.get("msg") != null ? result.get("msg").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.setDqbm(yhdj.getDqbm());
kshcDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); kshcDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm());
kshcDTO.setJsonData(jsonDataTwoDTO); kshcDTO.setJsonData(jsonDataTwoDTO);
ValidateUtils.validate(kshcDTO); 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; cn.hutool.json.JSONObject result = null;
try { try {
@ -1031,6 +1055,12 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
allApiLog.setCreateTime(new Date()); allApiLog.setCreateTime(new Date());
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
redinfo.setOutTradeOrderno(requestId);
redinfoMapper.updateRedinfo(redinfo);
HXResponse response = new HXResponse("0000", "同步成功", JSONUtil.parse(data));
return response;
} else { } else {
return new HXResponse(msg); return new HXResponse(msg);
} }
@ -1041,8 +1071,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
} }
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
} }
@Override @Override
@ -1421,14 +1450,55 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
} }
} else if (WebServiceConstant.KSHC.equals(finalServiceId)) { } else if (WebServiceConstant.KSHC.equals(finalServiceId)) {
// 快速冲红 // 快速冲红
// TODO: 后期存库 KschTWOVO kschVO = BeanUtil.copyProperties(JSONUtil.parse(data),KschTWOVO.class);
// KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
// InvoiceAllKschVO invoiceAllKschVO = BeanUtil.copyProperties(kschVO,InvoiceAllKschVO.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)) { } 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); List<Redinfo> resultDownload = parseRedINFO(redInvoiceQueryAllTWOVO);
// TODO: 2023/4/6 数据存储 // TODO: 2023/4/6 数据存储
@ -1579,7 +1649,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
RedisCache redisCache = SpringUtils.getBean(RedisCache.class); RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
JSONObject yhdjObj = redisCache.getCacheObject(WebServiceConstant.TOKEN_KEY + sellertax + "_"+ identity); JSONObject yhdjObj = redisCache.getCacheObject(WebServiceConstant.TOKEN_KEY + sellertax + "_"+ identity);
// TODO: 2023/5/17 急急急 // TODO: 2023/5/17
// JSONObject obj = JSONObject.parseObject(info); // JSONObject obj = JSONObject.parseObject(info);
// Long exprieTime = System.currentTimeMillis(); // Long exprieTime = System.currentTimeMillis();
// exprieTime = exprieTime + (int) obj.get("expires_in") * 1000L; // 过期时间 // exprieTime = exprieTime + (int) obj.get("expires_in") * 1000L; // 过期时间