|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package com.jianshui.invoice.task; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
@ -17,6 +18,7 @@ import com.jianshui.invoice.domain.*; |
|
|
|
|
import com.jianshui.invoice.domain.dto.ExportVehicleDTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.HXResponse; |
|
|
|
|
import com.jianshui.invoice.factory.IInvoiceServiceFactory; |
|
|
|
|
import com.jianshui.invoice.mapper.BillInfoMapper; |
|
|
|
|
import com.jianshui.invoice.mapper.InvoiceBackMapper; |
|
|
|
|
import com.jianshui.invoice.mapper.InvoiceMapper; |
|
|
|
|
import com.jianshui.invoice.service.IInvoiceApiService; |
|
|
|
@ -54,6 +56,9 @@ public class InvoiceBackTask { |
|
|
|
|
@Autowired |
|
|
|
|
private IInvoiceServiceFactory invoiceServiceFactory; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private BillInfoMapper billInfoMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final String ZQ_BACK_DXHY = "【重汽回调(开票中单据)】"; |
|
|
|
|
|
|
|
|
@ -377,21 +382,33 @@ public class InvoiceBackTask { |
|
|
|
|
log.info(ZQ_BACK_DXHY + "发票回调,订单号{},回调地址{}",id, callBackUrl); |
|
|
|
|
|
|
|
|
|
Invoice invoice = invoiceMapper.selectByOutTradeOrdernoNoUpdateBy(Long.valueOf(identity), id); |
|
|
|
|
if (invoice == null) { |
|
|
|
|
log.info(ZQ_BACK_DXHY + "发票信息未查询到,id={}", id); |
|
|
|
|
invoice = new Invoice(); |
|
|
|
|
invoice.setOutTradeOrderno(invoiceBack.getSystemOrderno()); |
|
|
|
|
invoice.setState(22); |
|
|
|
|
invoice.setMessage( (invoiceBack.getResultMsg() != null && invoiceBack.getResultMsg().length() > 200) ? invoiceBack.getResultMsg().substring(0, 200) : invoiceBack.getResultMsg() ); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (invoice != null) { |
|
|
|
|
log.info("通过Invoice组装,id为:{}",id); |
|
|
|
|
// log.info(ZQ_BACK_DXHY + "发票信息未查询到,id={}", id);
|
|
|
|
|
// invoice = new Invoice();
|
|
|
|
|
// invoice.setOutTradeOrderno(invoiceBack.getSystemOrderno());
|
|
|
|
|
// invoice.setState(22);
|
|
|
|
|
// invoice.setMessage( (invoiceBack.getResultMsg() != null && invoiceBack.getResultMsg().length() > 200) ? invoiceBack.getResultMsg().substring(0, 200) : invoiceBack.getResultMsg() );
|
|
|
|
|
|
|
|
|
|
// 明细重插
|
|
|
|
|
List<InvoiceDetail> invoiceDetailList = invoiceMapper.selectInvoiceIdForInvoiceDetailList(invoice.getId()); |
|
|
|
|
if(!invoiceDetailList.isEmpty()){ |
|
|
|
|
invoice.setInvoiceDetailList(invoiceDetailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Integer state = invoice.getState(); |
|
|
|
|
}else { |
|
|
|
|
log.info("通过billInfo组装,id为:{}",id); |
|
|
|
|
BillInfo billInfo = billInfoMapper.selectByOutTradeOrderno(Long.valueOf(identity), id); |
|
|
|
|
if(BeanUtil.isEmpty(billInfo)){ |
|
|
|
|
log.info("billInfo中不存咋,id为:{}",id); |
|
|
|
|
} |
|
|
|
|
Invoice invoice1 = new Invoice(); |
|
|
|
|
invoice1.setFpqqlsh(billInfo.getFpqqlsh()); |
|
|
|
|
invoice1.setSellerTaxnum(billInfo.getSellerTaxnum()); |
|
|
|
|
invoice1.setOutTradeOrderno(billInfo.getOutTradeOrderno()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Integer state = invoice.getState() != null ? invoice.getState() :1; |
|
|
|
|
log.info(ZQ_BACK_DXHY + "id={},state={}",id,state); |
|
|
|
|
log.info(ZQ_BACK_DXHY + "请求大象接口更新发票状态,id={},state={}",id,state); |
|
|
|
|
|
|
|
|
@ -402,7 +419,7 @@ public class InvoiceBackTask { |
|
|
|
|
BillInfo billInfo = new BillInfo(); |
|
|
|
|
billInfo.setFpqqlsh("[\"" + invoice.getFpqqlsh() + "\"]"); |
|
|
|
|
billInfo.setOutTradeOrderno(invoice.getOutTradeOrderno()); |
|
|
|
|
log.info("发票回调invoice.getOutTradeOrderno()={},invoice.getFpqqlsh()={}",id,invoice.getOutTradeOrderno(),invoice.getFpqqlsh()); |
|
|
|
|
log.info("发票回调invoice.id={},getOutTradeOrderno()={},invoice.getFpqqlsh()={}",id,invoice.getOutTradeOrderno(),invoice.getFpqqlsh()); |
|
|
|
|
HXResponse resultDxhy = invoiceService.batchQueryInvoices(billInfo, "fpqqlsh", companyservice); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|