ariesy 推送到S4的时候的数据如果库中没有则增加补充查验入库的操作

release
yefei 2 years ago
parent 735518e926
commit 59eb07d647
  1. 9
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java
  2. 64
      dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java

@ -606,18 +606,13 @@ public class SDNYMainProcessController extends AbstractController {
} else {
object.setZFILED5(environment);
}
// object.setZFILED5(environment);
List<SAPInvoiceInfo> sapInvoiceInfos = new ArrayList<>();
if (invoiceInfoList != null && invoiceInfoList.size() > 0) {
for (SNInvoice invoice : invoiceInfoList) {
String fplxdm = "";
String snFplx = "";
// if (invoice.getPurchaserTaxNo() == null || "".equals(invoice.getPurchaserTaxNo())){
// invoice.setPurchaserTaxNo(taxno);
// }
// if (invoice.getPurchaserName() == null || "".equals(invoice.getPurchaserName())){
// invoice.setPurchaserName(taxname);
// }
result = snPushCheckRecordService.updateInvoicePoll(company, taxno, reimburse, invoice, fplxdm, imageId, compCode);
//价税分离判断

@ -11,6 +11,7 @@ import com.dxhy.common.enums.FplxEnum;
import com.dxhy.common.enums.SNFplxEnum;
import com.dxhy.common.util.InvoiceUtil;
import com.dxhy.common.util.StringHelper;
import com.dxhy.common.utils.R;
import com.dxhy.common.vo.UserInfo;
import com.dxhy.erp.dao.*;
import com.dxhy.erp.entity.*;
@ -30,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -95,6 +97,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
@Resource
private SysDeptDao sysDeptDao;
@Resource
private SNPushCheckRecordService snPushCheckRecordService;
@Resource
private SignSaveInvoiceInfoService signSaveInvoiceInfoService;
@Resource
private TdxPlatformCheckLogService platformCheckLogService;
@ -675,6 +683,62 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
if ("01".equals(fplxdm) || "02".equals(fplxdm) || "03".equals(fplxdm) || "04".equals(fplxdm)
|| "08".equals(fplxdm) || "10".equals(fplxdm) || "11".equals(fplxdm) || "14".equals(fplxdm)
|| "15".equals(fplxdm) || "31".equals(fplxdm) || "32".equals(fplxdm)) {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
String fpdm = invoice.getInvoiceCode();
String fphm = invoice.getInvoiceNumber();
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>();
if (StringUtils.isEmpty(fpdm)) {
recordWrapper.eq("uuid", fphm);
} else {
recordWrapper.eq("uuid", fpdm + fphm);
}
BaseTDxRecordInvoice update = baseTDxRecordInvoiceDao.selectOne(recordWrapper);
Map<String, String> pramsMap = new HashMap<>();
JSONObject checkInvoiceResult = null;
//如果提交的发票信息在底账库不存在,则重新补充查验,插入数据库中.
if (update == null) {
try {
//传入的参数为:{billingDate=2023-04-24, totalAmount=9708.74, purchaserTaxNo=91370000MA3RD38A9Q, invoiceNumber=02014197, invoiceType=10100,
// invoiceCode=3700222130, checkCode=}
pramsMap.put("invoiceCode", fpdm);
pramsMap.put("invoiceNumber", fphm);
if (StringUtils.isNotEmpty(invoice.getBillingDate())) {
String billingDate = invoice.getBillingDate().replaceAll("-", "");
pramsMap.put("billingDate", billingDate);
}
if("31".equals(invoice.getInvoiceType()) || "32".equals(invoice.getInvoiceType())){
pramsMap.put("totalAmount", invoice.getAmountTax());
}else{
pramsMap.put("totalAmount", invoice.getTotalAmount());
}
pramsMap.put("purchaserTaxNo", invoice.getPurchaserTaxNo());
if("31".equals(invoice.getInvoiceType()) || "32".equals(invoice.getInvoiceType())){
pramsMap.put("invoiceType", "21");
}else {
pramsMap.put("invoiceType", invoice.getInvoiceType());
}
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap);
log.info("补充查验结果为:{}", checkInvoiceResult);
} catch (Exception e) {
e.printStackTrace();
log.error("补充查验失败,errormsg:{}", e.getMessage());
}
if (!checkInvoiceResult.containsKey("code")) {
if (!checkInvoiceResult.containsKey("cyjg")) {
checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
log.info("补充查验的结果为:{}", checkInvoiceResult);
signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, "", "1", "business");
}
}
}
DynamicContextHolder.push(DbConstant.BASICS_WRITE);
//可查验发票,已入库,更新票池
Integer integer = this.pushInvoiceToRecordInvoice2(invoice, imageId, compCode);
log.info("可查验发票,更新底账库完成");

Loading…
Cancel
Save