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