diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java b/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java index bd41225e..d9772285 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java +++ b/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))); } - //查询底账库是否有对应发票,有则直接返回 - QueryWrapper recordWrapper = new QueryWrapper<>(); - recordWrapper.eq("uuid", uuid); - BaseTDxRecordInvoice checkInvoiceByUuid = baseTDxRecordInvoiceDao.selectOne(recordWrapper); - if (checkInvoiceByUuid != null) { - log.info("进项票池已存在发票.直接返回票池信息"); - R data = new R(1000, "default success"); - String invoiceNo = checkInvoiceByUuid.getInvoiceNo(); - QueryWrapper detailWrapper = new QueryWrapper<>(); - detailWrapper.eq("uuid", uuid); - DynamicContextHolder.push("business" + DbConstant.DETAIL_READ); - List baseTDxRecordInvoiceDetail = baseTDxRecordInvoiceDetailDao.selectList(detailWrapper); + //非通行费类发票 先判断底账库中是否已存在 + if(!"32000".equals(pramsMap.get("invoiceType"))) { + //查询底账库是否有对应发票,有则直接返回 + QueryWrapper recordWrapper = new QueryWrapper<>(); + recordWrapper.eq("uuid", uuid); + BaseTDxRecordInvoice checkInvoiceByUuid = baseTDxRecordInvoiceDao.selectOne(recordWrapper); + if (checkInvoiceByUuid != null) { + log.info("进项票池已存在发票.直接返回票池信息"); + R data = new R(1000, "default success"); + String invoiceNo = checkInvoiceByUuid.getInvoiceNo(); + QueryWrapper detailWrapper = new QueryWrapper<>(); + detailWrapper.eq("uuid", uuid); + DynamicContextHolder.push("business" + DbConstant.DETAIL_READ); + List baseTDxRecordInvoiceDetail = baseTDxRecordInvoiceDetailDao.selectList(detailWrapper); - DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); + DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); - JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid); - JSONArray checkInvoiceDetail = (JSONArray) JSONObject.toJSON(baseTDxRecordInvoiceDetail); + JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(checkInvoiceByUuid); + JSONArray checkInvoiceDetail = (JSONArray) JSONObject.toJSON(baseTDxRecordInvoiceDetail); - convertToResult(checkInvoice,checkInvoiceDetail); + convertToResult(checkInvoice, checkInvoiceDetail); - data.put("data", checkInvoice); - //查验结果保存 + data.put("data", checkInvoice); + //查验结果保存 // saveCheckLog(pramsMap, checkInvoice); - return ResponseEntity.ok(JSONObject.toJSONString(data)); - } else { - TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid); - log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice); - if (tdxSaleRecordInvoice != null) { - log.info("销项票池已存在发票.直接返回票池信息"); - R data = new R(1000, "default success"); + return ResponseEntity.ok(JSONObject.toJSONString(data)); + } else { + TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid); + log.info("tdxSaleRecordInvoice={}", tdxSaleRecordInvoice); + if (tdxSaleRecordInvoice != null) { + log.info("销项票池已存在发票.直接返回票池信息"); + R data = new R(1000, "default success"); - String invoiceNo = tdxSaleRecordInvoice.getInvoiceNo(); - QueryWrapper saleDetailWrapper = new QueryWrapper<>(); - saleDetailWrapper.eq("invoice_no", invoiceNo); - DynamicContextHolder.push(DbConstant.DETAIL_READ); - List recordInvoiceSaleDetailModel = invoiceDownDetaiSaleInsertDao.selectList(saleDetailWrapper); + String invoiceNo = tdxSaleRecordInvoice.getInvoiceNo(); + QueryWrapper saleDetailWrapper = new QueryWrapper<>(); + saleDetailWrapper.eq("invoice_no", invoiceNo); + DynamicContextHolder.push(DbConstant.DETAIL_READ); + List recordInvoiceSaleDetailModel = invoiceDownDetaiSaleInsertDao.selectList(saleDetailWrapper); - DynamicContextHolder.push(DbConstant.BUSINESS_READ); + DynamicContextHolder.push(DbConstant.BUSINESS_READ); - JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice); - JSONArray saleDetail = (JSONArray) JSONObject.toJSON(recordInvoiceSaleDetailModel); - convertToResult(checkInvoice,saleDetail); + JSONObject checkInvoice = (JSONObject) JSONObject.toJSON(tdxSaleRecordInvoice); + JSONArray saleDetail = (JSONArray) JSONObject.toJSON(recordInvoiceSaleDetailModel); + convertToResult(checkInvoice, saleDetail); - data.put("data", checkInvoice); - //查验结果保存 + data.put("data", checkInvoice); + //查验结果保存 // saveCheckLog(pramsMap,checkInvoice); - return ResponseEntity.ok(JSONObject.toJSONString(data)); + return ResponseEntity.ok(JSONObject.toJSONString(data)); + } } }