feature: 重汽批量开票回推

master
dongxiaoke 1 year ago
parent e798d9c6c4
commit b8a2181c20
  1. 2
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  2. 4
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java
  3. 18
      jianshui-invoice/src/main/java/com/jianshui/invoice/task/QueryInvoiceTask.java

@ -278,7 +278,7 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
// } // }
// 定时拉取保存发票, TODO 处理开票中的问题 // 定时拉取保存发票, TODO 处理开票中的问题
AsyncManager.me().execute(new QueryInvoiceTask(billInfo, companyservice, this)); AsyncManager.me().execute(new QueryInvoiceTask(billInfo, companyservice, this,null));
HXResponse response = new HXResponse("0000", "同步成功"); HXResponse response = new HXResponse("0000", "同步成功");
response.put("fpqqlsh", billInfo.getSystemOrderno()); response.put("fpqqlsh", billInfo.getSystemOrderno());

@ -376,7 +376,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
} }
// 定时拉取保存发票, TODO 处理开票中的问题 // 定时拉取保存发票, TODO 处理开票中的问题
AsyncManager.me().execute(new QueryInvoiceTask(billInfo, companyservice, this)); AsyncManager.me().execute(new QueryInvoiceTask(billInfo, companyservice, this,invoiceBackMapper));
// 数电的加入金财表 // 数电的加入金财表
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();
@ -3367,7 +3367,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
} }
} }
// 定时拉取保存发票 // 定时拉取保存发票
AsyncManager.me().execute(new QueryInvoiceTask(billInfo, companyservice, this)); AsyncManager.me().execute(new QueryInvoiceTask(billInfo, companyservice, this,invoiceBackMapper));
// 数电的加入金财表 // 数电的加入金财表
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();

@ -42,7 +42,7 @@ public class QueryInvoiceTask extends TimerTask {
private InvoiceBackMapper invoiceBackMapper; private InvoiceBackMapper invoiceBackMapper;
public QueryInvoiceTask(BillInfo billInfo, Companyservice companyservice, IInvoiceApiService invoiceApiService) { public QueryInvoiceTask(BillInfo billInfo, Companyservice companyservice, IInvoiceApiService invoiceApiService,InvoiceBackMapper invoiceBackMapper) {
this.finalBillInfo = billInfo; this.finalBillInfo = billInfo;
this.companyservice = companyservice; this.companyservice = companyservice;
this.invoiceApiService = invoiceApiService; this.invoiceApiService = invoiceApiService;
@ -78,7 +78,7 @@ public class QueryInvoiceTask extends TimerTask {
queryTimes += 1; queryTimes += 1;
redisCache.setCacheObject(keys, queryTimes); redisCache.setCacheObject(keys, queryTimes);
log.error("【定时任务】【发票查询】发票信息不存在或还在开票中,再次进入查询:{}", JSONObject.toJSONString(this.finalBillInfo)); log.error("【定时任务】【发票查询】发票信息不存在或还在开票中,再次进入查询:{}", JSONObject.toJSONString(this.finalBillInfo));
AsyncManager.me().execute(new QueryInvoiceTask(this.finalBillInfo, companyservice, this.invoiceApiService)); AsyncManager.me().execute(new QueryInvoiceTask(this.finalBillInfo, companyservice, this.invoiceApiService,null));
} else if (invoice == null || StringUtils.equalsAny(Integer.toString(invoice.getState()), "2", "22")) { } else if (invoice == null || StringUtils.equalsAny(Integer.toString(invoice.getState()), "2", "22")) {
// 2开票成功 22开票失败 // 2开票成功 22开票失败
// 再次推送 // 再次推送
@ -93,13 +93,13 @@ public class QueryInvoiceTask extends TimerTask {
private void pushCoustomInvoiceInfo(Invoice invoice) { private void pushCoustomInvoiceInfo(Invoice invoice) {
try { try {
log.info("【重汽批量开票】进入发票批量开具回调队列:InvoiceId={}",invoice.getId()); log.info("【重汽批量开票】进入发票批量开具回调队列:InvoiceId={},{}",invoice.getId(),invoiceBackMapper);
String kpStatus = Integer.toString(invoice.getState()).equals("2") ? "0000":"9999"; String kpStatus = Integer.toString(invoice.getState()).equals("2") ? "0000":"9999";
String kpMsg = Integer.toString(invoice.getState()).equals("2") ? "开票成功":"开票失败"; String kpMsg = Integer.toString(invoice.getState()).equals("2") ? "开票成功":"开票失败";
QueryWrapper<InvoiceBack> invoiceBackQueryWrapper = new QueryWrapper<>(); QueryWrapper<InvoiceBack> invoiceBackQueryWrapper = new QueryWrapper<>();
invoiceBackQueryWrapper.eq("system_orderno", invoice.getOutTradeOrderno()); invoiceBackQueryWrapper.eq("system_orderno", invoice.getOutTradeOrderno());
InvoiceBack invoiceBackVali = this.invoiceBackMapper.selectOne(invoiceBackQueryWrapper); InvoiceBack invoiceBackVali = invoiceBackMapper.selectOne(invoiceBackQueryWrapper);
log.info("【重汽批量开票】查询回调表信息:{}",JSONUtil.toJsonStr(invoiceBackVali)); log.info("【重汽批量开票】查询回调表信息:{}",JSONUtil.toJsonStr(invoiceBackVali));
if (BeanUtil.isEmpty(invoiceBackVali)) { if (BeanUtil.isEmpty(invoiceBackVali)) {
@ -108,7 +108,7 @@ public class QueryInvoiceTask extends TimerTask {
invoiceBackVali.setCreateTime(new Date()); invoiceBackVali.setCreateTime(new Date());
invoiceBackVali.setId(IdUtils.randomUUID()); invoiceBackVali.setId(IdUtils.randomUUID());
invoiceBackVali.setIdentity(this.companyservice.getIdentity()); invoiceBackVali.setIdentity(companyservice.getIdentity());
invoiceBackVali.setBackUrl(""); invoiceBackVali.setBackUrl("");
invoiceBackVali.setStatus("0"); invoiceBackVali.setStatus("0");
invoiceBackVali.setCreateTime(new Date()); invoiceBackVali.setCreateTime(new Date());
@ -117,17 +117,17 @@ public class QueryInvoiceTask extends TimerTask {
invoiceBackVali.setResultCode(kpStatus); invoiceBackVali.setResultCode(kpStatus);
invoiceBackVali.setResultMsg(kpMsg); invoiceBackVali.setResultMsg(kpMsg);
invoiceBackVali.setUpdateTime(new Date()); invoiceBackVali.setUpdateTime(new Date());
this.invoiceBackMapper.insertInvoiceBack(invoiceBackVali); invoiceBackMapper.insertInvoiceBack(invoiceBackVali);
} else { } else {
invoiceBackVali.setResultCode(kpStatus); invoiceBackVali.setResultCode(kpStatus);
invoiceBackVali.setResultMsg(kpMsg); invoiceBackVali.setResultMsg(kpMsg);
invoiceBackVali.setStatus("0"); invoiceBackVali.setStatus("0");
invoiceBackVali.setUpdateTime(new Date()); invoiceBackVali.setUpdateTime(new Date());
this.invoiceBackMapper.updateInvoiceBack(invoiceBackVali); invoiceBackMapper.updateInvoiceBack(invoiceBackVali);
} }
log.info("【重汽批量开票】发票回调队列开始回调,组装参数:回调参数={},identity={},invoiceId={}", invoiceBackVali.toString(),this.companyservice.getIdentity(),invoice.getId()); log.info("【重汽批量开票】发票回调队列开始回调,组装参数:回调参数={},identity={},invoiceId={}", invoiceBackVali.toString(),companyservice.getIdentity(),invoice.getId());
this.invoiceApiService.callBackAisino(invoiceBackVali, "", this.companyservice.getIdentity(), invoice.getId()); invoiceApiService.callBackAisino(invoiceBackVali, "", companyservice.getIdentity(), invoice.getId());
log.info("【重汽批量开票】 发票批量开具回调队列处理完成: InvoiceId={}",invoice.getId()); log.info("【重汽批量开票】 发票批量开具回调队列处理完成: InvoiceId={}",invoice.getId());
} catch (Exception e) { } catch (Exception e) {
log.info("【重汽批量开票】发票回调队列失败!invoiceId={},捕捉异常{}", invoice.getId(),e.toString()); log.info("【重汽批量开票】发票回调队列失败!invoiceId={},捕捉异常{}", invoice.getId(),e.toString());

Loading…
Cancel
Save