|
|
|
@ -109,7 +109,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
return post; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String pushInvoiceToRecordInvoice(SNRequestObject snRequestObject, String taxNo, String company) throws Exception { |
|
|
|
|
public String pushInvoiceToRecordInvoice(SNInvoice snInvoice, String taxNo, String company) throws Exception { |
|
|
|
|
|
|
|
|
|
QueryWrapper<BaseTDxTaxCurrent> currentWrapper = new QueryWrapper<>(); |
|
|
|
|
currentWrapper.eq("taxno", taxNo); |
|
|
|
@ -117,12 +117,6 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
BaseTDxTaxCurrent current = baseTDxTaxCurrentDao.selectOne(currentWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList(); |
|
|
|
|
|
|
|
|
|
if (invoiceInfoList != null && invoiceInfoList.size() > 0) { |
|
|
|
|
|
|
|
|
|
for (SNInvoice snInvoice : invoiceInfoList) { |
|
|
|
|
|
|
|
|
|
String fpdm = snInvoice.getInvoiceCode(); |
|
|
|
|
String fphm = snInvoice.getInvoiceNumber(); |
|
|
|
|
|
|
|
|
@ -157,7 +151,10 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
} |
|
|
|
|
recordInvoice.setInvoiceCode(fpdm); |
|
|
|
|
recordInvoice.setInvoiceNo(fphm); |
|
|
|
|
|
|
|
|
|
if (je != null) { |
|
|
|
|
recordInvoice.setInvoiceAmount(new BigDecimal(je)); |
|
|
|
|
} |
|
|
|
|
if (se != null) { |
|
|
|
|
recordInvoice.setTaxAmount(new BigDecimal(se)); |
|
|
|
|
} |
|
|
|
@ -180,40 +177,39 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
} else { |
|
|
|
|
baseTDxRecordInvoiceDao.insert(recordInvoice); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Integer pushInvoiceToRecordInvoice2(SNRequestObject snRequestObject) { |
|
|
|
|
public Integer pushInvoiceToRecordInvoice2(SNInvoice snInvoice,String imageId,String compCode) { |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
|
|
|
|
|
int update = 0; |
|
|
|
|
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList(); |
|
|
|
|
|
|
|
|
|
if (invoiceInfoList != null && invoiceInfoList.size() > 0) { |
|
|
|
|
for (SNInvoice snInvoice : invoiceInfoList) { |
|
|
|
|
String fpdm = snInvoice.getInvoiceCode(); |
|
|
|
|
String fphm = snInvoice.getInvoiceNumber(); |
|
|
|
|
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>(); |
|
|
|
|
recordWrapper.eq("uuid", fpdm + fphm); |
|
|
|
|
BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice(); |
|
|
|
|
recordInvoice.setImageId(snRequestObject.getImageId()); |
|
|
|
|
recordInvoice.setCompCode(snRequestObject.getCompCode()); |
|
|
|
|
recordInvoice.setImageId(imageId); |
|
|
|
|
recordInvoice.setCompCode(compCode); |
|
|
|
|
|
|
|
|
|
update = baseTDxRecordInvoiceDao.update(recordInvoice, recordWrapper); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
String imageId = snRequestObject.getImageId(); |
|
|
|
|
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>(); |
|
|
|
|
recordWrapper.eq("image_id", imageId); |
|
|
|
|
BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice(); |
|
|
|
|
recordInvoice.setImageId(""); |
|
|
|
|
recordInvoice.setCompCode(""); |
|
|
|
|
|
|
|
|
|
update = baseTDxRecordInvoiceDao.update(recordInvoice, recordWrapper); |
|
|
|
|
} |
|
|
|
|
// if (invoiceInfoList != null && invoiceInfoList.size() > 0) {
|
|
|
|
|
// for (SNInvoice snInvoice : invoiceInfoList) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// String imageId = snRequestObject.getImageId();
|
|
|
|
|
// QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>();
|
|
|
|
|
// recordWrapper.eq("image_id", imageId);
|
|
|
|
|
// BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice();
|
|
|
|
|
// recordInvoice.setImageId("");
|
|
|
|
|
// recordInvoice.setCompCode("");
|
|
|
|
|
//
|
|
|
|
|
// update = baseTDxRecordInvoiceDao.update(recordInvoice, recordWrapper);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return update; |
|
|
|
|
} |
|
|
|
@ -555,7 +551,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
return jsonObject; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String updateInvoicePoll(@RequestBody SNRequestObject snRequestObject, String company, String taxNo, TDxInvoiceReimburse reimburse, SNInvoice invoice, String fplxdm, String invoiceCode, String invoiceNo) throws Exception { |
|
|
|
|
public String updateInvoicePoll(String company, String taxNo, TDxInvoiceReimburse reimburse, SNInvoice invoice, String fplxdm,String imageId,String compCode) throws Exception { |
|
|
|
|
String result = "0000"; |
|
|
|
|
|
|
|
|
|
//判断发票类型
|
|
|
|
@ -608,11 +604,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
|| "08".equals(fplxdm) || "10".equals(fplxdm) || "11".equals(fplxdm) || "14".equals(fplxdm) |
|
|
|
|
|| "15".equals(fplxdm) || "31".equals(fplxdm) || "32".equals(fplxdm)) { |
|
|
|
|
//可查验发票,已入库,更新票池
|
|
|
|
|
Integer integer = this.pushInvoiceToRecordInvoice2(snRequestObject); |
|
|
|
|
Integer integer = this.pushInvoiceToRecordInvoice2(invoice,imageId,compCode); |
|
|
|
|
log.info("可查验发票,更新底账库完成"); |
|
|
|
|
} else { |
|
|
|
|
//不可查验发票,未入库,插入票池
|
|
|
|
|
this.pushInvoiceToRecordInvoice(snRequestObject, taxNo, company); |
|
|
|
|
this.pushInvoiceToRecordInvoice(invoice, taxNo, company); |
|
|
|
|
log.info("不可查验发票,插入底账库成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -621,7 +617,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private TDxInvoiceReimburse convertToReimburse(SNInvoice invoice, TDxInvoiceReimburse reimburse, String fplxdm, String company) { |
|
|
|
|
|
|
|
|
|
reimburse.setId(IdUtils.nextId()); |
|
|
|
|
reimburse.setInvoiceType(fplxdm); |
|
|
|
|
reimburse.setInvoiceCode(invoice.getInvoiceCode()); |
|
|
|
|
reimburse.setInvoiceNo(invoice.getInvoiceNumber()); |
|
|
|
|