ariesy 修复通行费类发票查验无明细问题

release
yefei 2 years ago
parent 306a45983b
commit 052725b75e
  1. 77
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java

@ -183,56 +183,59 @@ public class SDNYMainProcessController extends AbstractController {
return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes)));
} }
//查询底账库是否有对应发票,有则直接返回 //非通行费类发票 先判断底账库中是否已存在
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>(); if(!"32000".equals(pramsMap.get("invoiceType"))) {
recordWrapper.eq("uuid", uuid); //查询底账库是否有对应发票,有则直接返回
BaseTDxRecordInvoice checkInvoiceByUuid = baseTDxRecordInvoiceDao.selectOne(recordWrapper); QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>();
if (checkInvoiceByUuid != null) { recordWrapper.eq("uuid", uuid);
log.info("进项票池已存在发票.直接返回票池信息"); BaseTDxRecordInvoice checkInvoiceByUuid = baseTDxRecordInvoiceDao.selectOne(recordWrapper);
R data = new R(1000, "default success"); if (checkInvoiceByUuid != null) {
String invoiceNo = checkInvoiceByUuid.getInvoiceNo(); log.info("进项票池已存在发票.直接返回票池信息");
QueryWrapper<BaseTDxRecordInvoiceDetail> detailWrapper = new QueryWrapper<>(); R data = new R(1000, "default success");
detailWrapper.eq("uuid", uuid); String invoiceNo = checkInvoiceByUuid.getInvoiceNo();
DynamicContextHolder.push("business" + DbConstant.DETAIL_READ); QueryWrapper<BaseTDxRecordInvoiceDetail> detailWrapper = new QueryWrapper<>();
List<BaseTDxRecordInvoiceDetail> baseTDxRecordInvoiceDetail = baseTDxRecordInvoiceDetailDao.selectList(detailWrapper); detailWrapper.eq("uuid", uuid);
DynamicContextHolder.push("business" + DbConstant.DETAIL_READ);
List<BaseTDxRecordInvoiceDetail> baseTDxRecordInvoiceDetail = baseTDxRecordInvoiceDetailDao.selectList(detailWrapper);
DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ);
JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid); JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid);
JSONArray checkInvoiceDetail = (JSONArray) JSONObject.toJSON(baseTDxRecordInvoiceDetail); JSONArray checkInvoiceDetail = (JSONArray) JSONObject.toJSON(baseTDxRecordInvoiceDetail);
convertToResult(checkInvoice,checkInvoiceDetail); convertToResult(checkInvoice, checkInvoiceDetail);
data.put("data", checkInvoice); data.put("data", checkInvoice);
//查验结果保存 //查验结果保存
// saveCheckLog(pramsMap, checkInvoice); // saveCheckLog(pramsMap, checkInvoice);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
} else { } else {
TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid); TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid);
log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice); log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice);
if (tdxSaleRecordInvoice != null) { if (tdxSaleRecordInvoice != null) {
log.info("销项票池已存在发票.直接返回票池信息"); log.info("销项票池已存在发票.直接返回票池信息");
R data = new R(1000, "default success"); R data = new R(1000, "default success");
String invoiceNo = tdxSaleRecordInvoice.getInvoiceNo(); String invoiceNo = tdxSaleRecordInvoice.getInvoiceNo();
QueryWrapper<RecordInvoiceSaleDetailModel> saleDetailWrapper = new QueryWrapper<>(); QueryWrapper<RecordInvoiceSaleDetailModel> saleDetailWrapper = new QueryWrapper<>();
saleDetailWrapper.eq("invoice_no", invoiceNo); saleDetailWrapper.eq("invoice_no", invoiceNo);
DynamicContextHolder.push(DbConstant.DETAIL_READ); DynamicContextHolder.push(DbConstant.DETAIL_READ);
List<RecordInvoiceSaleDetailModel> recordInvoiceSaleDetailModel = invoiceDownDetaiSaleInsertDao.selectList(saleDetailWrapper); List<RecordInvoiceSaleDetailModel> recordInvoiceSaleDetailModel = invoiceDownDetaiSaleInsertDao.selectList(saleDetailWrapper);
DynamicContextHolder.push(DbConstant.BUSINESS_READ); DynamicContextHolder.push(DbConstant.BUSINESS_READ);
JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice); JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice);
JSONArray saleDetail = (JSONArray) JSONObject.toJSON(recordInvoiceSaleDetailModel); JSONArray saleDetail = (JSONArray) JSONObject.toJSON(recordInvoiceSaleDetailModel);
convertToResult(checkInvoice,saleDetail); convertToResult(checkInvoice, saleDetail);
data.put("data", checkInvoice); data.put("data", checkInvoice);
//查验结果保存 //查验结果保存
// saveCheckLog(pramsMap,checkInvoice); // saveCheckLog(pramsMap,checkInvoice);
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
}
} }
} }

Loading…
Cancel
Save