From e55840c48526353dad4f73836e91ca170e7a1f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 14:41:36 +0800 Subject: [PATCH 01/88] =?UTF-8?q?=E8=A1=A8=E5=88=AB=E5=90=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/materialInventory/MaterialInventoryMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index 8004d7413..3f5e19f8d 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -1864,7 +1864,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN NGWL_TEST_BMS.SETTLEMENT_CUSTOMERS bms ON sys.SETTLEMENT_CUSTOMERS_ID = bms.SETTLEMENT_CUSTOMERS_ID WHERE 1 = 1 - AND CONTRACT_MANAGE_ID = #{contractManageId} AND DEL_FLAG = 1 + AND sys.CONTRACT_MANAGE_ID = #{contractManageId} AND sys.DEL_FLAG = 1 From 9a15dc4978625c07ff34a480edfea8a39a80af8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 15:05:41 +0800 Subject: [PATCH 02/88] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../billingStatement/BillingStatementApplicationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index e31712d19..8c18bd697 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -663,7 +663,7 @@ public class BillingStatementApplicationService { } Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper() - .eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId) + .eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId) .eq(SettlementCustomersParameters::getParametersName, "干仓计费配置")); if (ObjectUtil.isNull(settlementCustomersParameters)) { //结算对象未配置参数 From 9990701c5e9629510debeb3283716b20485f5663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 15:10:41 +0800 Subject: [PATCH 03/88] =?UTF-8?q?=E5=86=BB=E4=BB=93=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=BA=94=E6=94=B6=E5=B8=90=E5=8D=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 455 ++++++++++++++++++ .../facadeApi/BillingStatementApi.java | 3 + 2 files changed, 458 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 8c18bd697..fed8cbd18 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -703,6 +703,56 @@ public class BillingStatementApplicationService { } } } + public void pushBillManageDC(String shipperId) { + SettlementCustomers settlementCustomers = settlementCustomersMapper.selectOne(new LambdaQueryWrapper() + .eq(SettlementCustomers::getSettlementEntityId, shipperId) + .eq(SettlementCustomers::getDelFlag, 1)); + if (ObjectUtil.isNull(settlementCustomers)) { + //未找到结算对象 + return; + } + Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); + SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper() + .eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId) + .eq(SettlementCustomersParameters::getParametersName, "冻仓计费配置")); + if (ObjectUtil.isNull(settlementCustomersParameters)) { + //结算对象未配置参数 + return; + } + String content = settlementCustomersParameters.getContent(); + Map contentMap = JSON.parseObject(content, Map.class); + //主费用开票策略 + String zfycl = (String) contentMap.get("zfycl"); + //附加费用开票策略 + String fjfykpcl = (String) contentMap.get("fjfykpcl"); + //合并开票 + Integer hbcp = (Integer) contentMap.get("hbcp"); + Boolean isMerge = false; + if (hbcp == 1) { + //判断是否合并开票 + isMerge = true; + } + + if (!isMerge) { + //按入仓单和收费事项分开计费 + if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + calcReceiptAndItemSeparatelyDC(settlementCustomersId); + } + //按合同和收费事项分开计费 + else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + calcContractAndItemSeparatelyDC(settlementCustomersId); + } + } else { + //按入仓单和收费事项合并计费 + if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + mergeCalcByReceiptAndItemDC(settlementCustomersId); + } + //按合同和收费事项合并计费 + else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + mergeCalcByContractAndItemDC(settlementCustomersId); + } + } + } /* * 按入仓单和收费事项分开计费 @@ -1108,4 +1158,409 @@ public class BillingStatementApplicationService { } } } + + /* + * 按入仓单和收费事项分开计费(冻仓) + * */ + public void calcReceiptAndItemSeparatelyDC(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String firstSubject = entry.getKey(); + if ("0D01".equals(firstSubject)) { + //主费用 + for (BusinessDocument businessDocument : groupList) { + String businessFlow = businessDocument.getBusinessFlow(); + List billingStatements = billingStatementService.list(new LambdaQueryWrapper() + .eq(BillingStatement::getBusinessFlow, businessFlow) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatements != null && billingStatements.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatements) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } else { + //附加费用 + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } + } + + /* + * 按入仓单和收费事项合并计费(冻仓) + * */ + public void mergeCalcByReceiptAndItemDC(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String originalBusinessNum = entry.getKey(); + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } + + /* + * 按合同和收费事项分开计费(冻仓) + * */ + public void calcContractAndItemSeparatelyDC(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String firstSubject = entry.getKey(); + if ("0D01".equals(firstSubject)) { + //主费用 + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + Map> contractManageIdMap = billingStatementList.stream() + .collect(Collectors.groupingBy(BillingStatement::getContractManageId)); + for (Map.Entry> contractManageIdEntry : contractManageIdMap.entrySet()) { + Long contractManageId = contractManageIdEntry.getKey(); + List billingContractStatementList = contractManageIdEntry.getValue(); + + List billingStatementADDVOS = new ArrayList<>(); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingContractStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } else { + //附加费用 + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } + } + + /* + * 按合同和收费事项合并计费(冻仓) + * */ + public void mergeCalcByContractAndItemDC(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getContractManageId)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + Long contractManageId = entry.getKey(); + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java index c1f898c9b..8fce2f5e5 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java @@ -339,7 +339,10 @@ public class BillingStatementApi extends BaseController { String shipperId = XxlJobHelper.getJobParam(); logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId); try { + //干仓 billingStatementApplicationService.pushBillManage(shipperId); + //冻仓 + billingStatementApplicationService.pushBillManageDC(shipperId); // 设置任务执行结果 XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功"); } catch (Exception e) { From 494f5f8999d12b042008dfda31847adec9da4db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 15:24:59 +0800 Subject: [PATCH 04/88] =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E5=8D=95=E6=8D=AE?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E7=B1=BB=E5=9E=8B=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index fed8cbd18..9df805da9 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -759,7 +759,7 @@ public class BillingStatementApplicationService { * */ public void calcReceiptAndItemSeparately(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getWarehouseType, "干仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -889,7 +889,7 @@ public class BillingStatementApplicationService { * */ public void mergeCalcByReceiptAndItem(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getWarehouseType, "干仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -959,7 +959,7 @@ public class BillingStatementApplicationService { * */ public void calcContractAndItemSeparately(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getWarehouseType, "干仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -1094,7 +1094,7 @@ public class BillingStatementApplicationService { * */ public void mergeCalcByContractAndItem(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getWarehouseType, "干仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -1164,7 +1164,7 @@ public class BillingStatementApplicationService { * */ public void calcReceiptAndItemSeparatelyDC(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getWarehouseType, "冻仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -1294,7 +1294,7 @@ public class BillingStatementApplicationService { * */ public void mergeCalcByReceiptAndItemDC(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getWarehouseType, "冻仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -1364,7 +1364,7 @@ public class BillingStatementApplicationService { * */ public void calcContractAndItemSeparatelyDC(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getWarehouseType, "冻仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); @@ -1499,7 +1499,7 @@ public class BillingStatementApplicationService { * */ public void mergeCalcByContractAndItemDC(Long settlementCustomersId) { List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getBelongModuleCode, "冻仓") + .eq(BusinessDocument::getWarehouseType, "冻仓") .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) .eq(BusinessDocument::getBusinessState, 3) .eq(BusinessDocument::getDelFlag, 1)); From a326af15f742ff5298dab61433ceb738a6e1e12d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 15:28:47 +0800 Subject: [PATCH 05/88] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=B1=87=E7=8E=87?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml b/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml index 82ebab40d..83d62254d 100644 --- a/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml @@ -275,7 +275,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT RATE as "taxRate" FROM - EXPENSE_ACCOUNT + NGWL_TEST_SYSTEM.EXPENSE_ACCOUNT WHERE SUBJECT_CODE = #{subjectCode} AND SUBJECT_NAME = #{subjectName} From 590e840a7b9b07c5c417c8b92cd92c21c05bac6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 15:33:53 +0800 Subject: [PATCH 06/88] =?UTF-8?q?=E6=B1=87=E7=8E=87=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 9df805da9..fae3493b8 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -789,7 +789,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -845,7 +846,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -916,7 +918,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -995,7 +998,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1050,7 +1054,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1121,7 +1126,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1194,7 +1200,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1250,7 +1257,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1321,7 +1329,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1400,7 +1409,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1455,7 +1465,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); @@ -1526,7 +1537,8 @@ public class BillingStatementApplicationService { Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; - Double taxRate = (Double) taxRateMap.get("taxRate"); + BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); + Double taxRate = taxRateBigDecimal.doubleValue(); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); From 1367a1d2251f9f98f4bf338e3003cb459ae17c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 15:45:03 +0800 Subject: [PATCH 07/88] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=8B=BF=E4=B8=8D=E5=88=B0=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 4 + .../BillingStatementApplicationService.java | 84 +++++++++++++------ .../service/BillManageDomainService.java | 58 +++++++++++++ .../BillingStatementDomainService.java | 81 ++++++++++++++++++ 4 files changed, 202 insertions(+), 25 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index f44c3a311..aa6b45f76 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -184,6 +184,10 @@ public class BillManageApplicationService { return billManageDomainService.save(billingStatementDTO); } + public Boolean saveBillJob(BillingStatementDTO billingStatementDTO) { + return billManageDomainService.saveJob(billingStatementDTO); + } + /** * 批量删除账单管理 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index fae3493b8..eaa155b66 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -398,7 +398,15 @@ public class BillingStatementApplicationService { if (!StringUtils.isNotEmpty(billingStatementDTO.getBillingStatementIds())) { throw new ServiceException("所选审核对象不能为空"); } - billingStatementDomainService.reviewBilling(billingStatementDTO); + billingStatementDomainService.reviewBillingJob(billingStatementDTO); + } + + @Transactional + public void reviewBillingJob(BillingStatementDTO billingStatementDTO) { + if (!StringUtils.isNotEmpty(billingStatementDTO.getBillingStatementIds())) { + throw new ServiceException("所选审核对象不能为空"); + } + billingStatementDomainService.reviewBillingJob(billingStatementDTO); } @@ -444,6 +452,32 @@ public class BillingStatementApplicationService { } + @Transactional + public Boolean generateBillsJob(BillingStatementDTO billingStatementDTO) { + //获取当前登录用户信息 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); + } + /* + 首先对账单主体、来源系统、账单类型、组织进行唯一校验 + 对要生成账单的流水加锁 + 然后判断流水状态是否满足生成账单需求 + 最后生成账单 + */ + billingStatementDomainService.checkUniqueEntity(billingStatementDTO.getBillingStatementIds()); + //校验完成后,生成账单 + Boolean flag1 = billManageApplicationService.saveBillJob(billingStatementDTO); + //修改流水状态 + billingStatementDTO.setBillingState(3); + Boolean flag2 = billingStatementDomainService.updateBillingStateJob(billingStatementDTO); + if (flag1 && flag2) { + return true; + } else { + throw new ServiceException("生成账单失败"); + } + } + /** * 批量流水作废 */ @@ -795,7 +829,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -823,7 +857,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } else { @@ -852,7 +886,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -880,7 +914,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -924,7 +958,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -952,7 +986,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -1004,7 +1038,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1031,7 +1065,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } else { @@ -1060,7 +1094,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1088,7 +1122,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -1132,7 +1166,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1160,7 +1194,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -1206,7 +1240,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1234,7 +1268,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } else { @@ -1263,7 +1297,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1291,7 +1325,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -1335,7 +1369,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1363,7 +1397,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -1415,7 +1449,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1442,7 +1476,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } else { @@ -1471,7 +1505,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1499,7 +1533,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } @@ -1543,7 +1577,7 @@ public class BillingStatementApplicationService { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - reviewBilling(billingStatementDTO); + reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); BigDecimal amount = billingStatementDTO.getBillingAmount(); @@ -1571,7 +1605,7 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - generateBills(billingStatementDTO1); + generateBillsJob(billingStatementDTO1); } } } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index 1cfadfa0b..2ab6d5285 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -296,6 +296,64 @@ public class BillManageDomainService { return saveBill(distinctList,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO); } + public Boolean saveJob(BillingStatementDTO billingStatementDTO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); + } + //根据前端传的流水id,查询计费流水信息列表 + Set billingSet = Stream.of(billingStatementDTO.getBillingStatementIds().split(",")).collect(Collectors.toSet()); + BillingStatementDO billingStatementDO = new BillingStatementDO(); + billingStatementDO.setBillingStatementIdSet(billingSet); + List billingStatementPOS = billingStatementDomainService.queryList(billingStatementDO); + + //获取最新一条的业务员信息 + String salesmanId = null; + String salesmanName = null; + if (billingStatementPOS != null && !billingStatementPOS.isEmpty()) { + billingStatementPOS.sort((a, b) -> { + if (a.getCreateTime() == null && b.getCreateTime() == null) return 0; + if (a.getCreateTime() == null) return 1; + if (b.getCreateTime() == null) return -1; + return b.getCreateTime().compareTo(a.getCreateTime()); + }); + salesmanId = billingStatementPOS.get(0).getSalesmanId(); + salesmanName = billingStatementPOS.get(0).getSalesmanName(); + } + + List billingStatementList = billingStatementDTO.getBillingStatementList(); + for (BillingStatementPO billingStatementPO : billingStatementPOS) { + String billingStatementId = billingStatementPO.getBillingStatementId() == null ? "" : String.valueOf(billingStatementPO.getBillingStatementId()); + BillingStatementADDVO billingStatementADDVO = billingStatementList.stream().filter(billingStatementADDVO1 -> billingStatementADDVO1.getBillingStatementId().contains(billingStatementId)).findFirst().orElse(null); + billingStatementPO.setTaxAmount(billingStatementADDVO.getTaxAmount()); // 设置税额 + billingStatementPO.setTaxRate(billingStatementADDVO.getTaxRate()); // 设置税率 + billingStatementPO.setTaxFreeFee(billingStatementADDVO.getTaxFreeFee()); // 设置税免金额 + billingStatementPO.setSettlementCurrency(billingStatementADDVO.getSettlementCurrency());//设置结算币种 + billingStatementPO.setFeeType(billingStatementADDVO.getFeeType()); + billingStatementPO.setInvoiceItem(billingStatementADDVO.getInvoiceItem()); + billingStatementPO.setInvoiceItemName(billingStatementADDVO.getInvoiceItemName()); + billingStatementPO.setBillingAmount(billingStatementADDVO.getBillingAmount()); + billingStatementPO.setBillingStatementIdStr(billingStatementADDVO.getBillingStatementId()); + if (salesmanName != null && !salesmanName.isEmpty() && salesmanId != null && !salesmanId.isEmpty()) { + billingStatementPO.setSalesmanId(salesmanId); + billingStatementPO.setSalesmanName(salesmanName); + } + } + List distinctList = billingStatementPOS.stream() + .filter(Objects::nonNull) + .collect(Collectors.toMap( + BillingStatementPO::getBillingStatementIdStr, // key:去重字段 + po -> po, // value:对象本身 + (existing, replacement) -> existing // 重复时保留第一个 + )) + .values() + .stream().collect(Collectors.toList()); + if(billingStatementPOS==null || billingStatementPOS.size()==0){ + throw new ServiceException("所选流水信息未找到"); + } + return saveBill(distinctList,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO); + } + public List queryListLambda(LambdaQueryWrapper queryWrapper) { return billManageService.list(queryWrapper); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java index 4f517b8da..5b570249d 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java @@ -171,6 +171,48 @@ public class BillingStatementDomainService { return billingStatementService.updateBatchById(billingStatements); } + public Boolean reviewBillingJob(BillingStatementDTO billingStatementDTO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); + } + List billingStatements = new ArrayList<>(); + Set billingSet = Stream.of(billingStatementDTO.getBillingStatementIds().split(",")).collect(Collectors.toSet()); + for (String billingId : billingSet) { + Long billingStatementId = Long.valueOf(billingId); + BillingStatementPO billingStatementPO = billingStatementService.getInfo(billingStatementId); + if(null == billingStatementPO){ + throw new ServiceException("流水不存在"); + } + if(billingStatementPO.getBillingState()!=1){ + throw new ServiceException("该计费流水状态不为待审核,不能进行审核"); + } + if(billingStatementPO.getRedFlushState()==2){ + throw new ServiceException("计费流水"+ billingStatementPO.getBillingFlow() +"已红冲,不能进行审核"); + } + BillingStatement billingStatement = new BillingStatement(); + billingStatement.setBillingStatementId(billingStatementId); + billingStatement.setReviewRemarks(billingStatementDTO.getReviewRemarks()); + if(billingStatementDTO.getAuditOperation()==1){ + //审核通过 + billingStatement.setBillingState(2); + }else { + //审核不通过 + billingStatement.setBillingState(4); + //计费流水审核不通过时,修改业务单据中的状态到已生效 + BusinessDocumentDO businessDocumentDO = new BusinessDocumentDO(); + businessDocumentDO.setBusinessDocumentId(billingStatementPO.getBusinessDocumentId()); + businessDocumentDO.setBusinessState(2); + businessDocumentService.update(businessDocumentDO); + } + billingStatement.setUpdateTime(new Date()); +// billingStatement.setUpdateBy(loginUser.getUserPo().getUserId()); +// billingStatement.setUpdateByName(loginUser.getUserPo().getUserName()); + billingStatements.add(billingStatement); + } + return billingStatementService.updateBatchById(billingStatements); + } + /** * 批量红冲 @@ -299,6 +341,45 @@ public class BillingStatementDomainService { return update; } + public Boolean updateBillingStateJob(BillingStatementDTO billingStatementDTO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); + } + Set billingSet = Stream.of(billingStatementDTO.getBillingStatementIds().split(",")).collect(Collectors.toSet()); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(BillingStatement::getBillingStatementId,billingSet); + + updateWrapper.set(BillingStatement::getBillingState,billingStatementDTO.getBillingState()); +// updateWrapper.set(BillingStatement::getUpdateBy,loginUser.getUserPo().getUserId()); + updateWrapper.set(BillingStatement::getUpdateTime,new Date()); +// updateWrapper.set(BillingStatement::getUpdateByName,loginUser.getUserPo().getUserName()); + updateWrapper.set(BillingStatement::getBillManageId,billingStatementDTO.getBillManageId()); + boolean update = billingStatementService.update(updateWrapper); + List billingStatementList = billingStatementDTO.getBillingStatementList(); + for (BillingStatementADDVO billingStatementADDVO : billingStatementList) { + String billingStatementIds = billingStatementADDVO.getBillingStatementId(); + Set billings = Stream.of(billingStatementIds.split(",")).collect(Collectors.toSet()); + if (billings != null && billings.size() > 0) { + for (String billing : billings) { + Long billingStatementId = Long.valueOf(billing); + Double taxRate = billingStatementADDVO.getTaxRate(); + BillingStatement billingStatement = billingStatementService.getById(billingStatementId); + if (billingStatement != null) { + BigDecimal billingAmount = billingStatement.getBillingAmount(); + BigDecimal taxAmount = billingAmount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = billingAmount.subtract(taxAmount); + billingStatement.setTaxAmount(taxAmount); + billingStatement.setTaxFreeFee(taxFreeFee); + billingStatement.setTaxRate(taxRate); + billingStatementService.updateById(billingStatement); + } + } + } + } + return update; + } + public Boolean nullifyByIds(BillingStatementDTO billingStatementDTO) { LoginUser loginUser = SecurityUtils.getLoginUser(); From 49fb27f2739d0ebe6a36298f7228ba14f86bdef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 16:08:51 +0800 Subject: [PATCH 08/88] =?UTF-8?q?=E6=B5=81=E6=B0=B4=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E5=8F=96=E5=80=BC=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index eaa155b66..3d9dd60e4 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -832,7 +832,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -889,7 +889,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -961,7 +961,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1041,7 +1041,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1097,7 +1097,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1169,7 +1169,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1243,7 +1243,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1372,7 +1372,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1452,7 +1452,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1508,7 +1508,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); @@ -1580,7 +1580,7 @@ public class BillingStatementApplicationService { reviewBillingJob(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); - BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal amount = billingStatement.getBillingAmount(); BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal taxFreeFee = amount.subtract(taxAmount); allAmount.add(amount); From aad54545f1932282bce142ddae392a7960cda541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 16:27:58 +0800 Subject: [PATCH 09/88] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BillManageDomainService.java | 120 +++++++++++++++++- .../BillOperationLogDomainService.java | 8 +- 2 files changed, 126 insertions(+), 2 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index 2ab6d5285..33d3535e3 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -233,6 +233,124 @@ public class BillManageDomainService { return flag && flagTwo && three; } + public Boolean saveBillJob(List billingStatementPOS,String billingRemark,Date billCreateTime,BillingStatementDTO billingStatementDTO) { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (ObjectUtil.isNull(loginUser)) { +//// throw new DigitalLogisticsException(UserError.TIMEOUT); +// } + BigDecimal taxAmount = billingStatementDTO.getTaxAmount(); // 获取税额 + Double taxRate = billingStatementDTO.getTaxRate(); // 获取税率 + BigDecimal taxFreeFee = billingStatementDTO.getTaxFreeFee(); // 获取税免金额 + String settlementCurrency = billingStatementDTO.getSettlementCurrency(); // 获取结算币种 + BillManage billManage = new BillManage(); + billManage.setTaxAmount(taxAmount); + billManage.setTaxRate(taxRate); + billManage.setTaxFreeFee(taxFreeFee); + billManage.setSettlementCurrency(settlementCurrency); +// billManage.setCreateBy(loginUser.getUserPo().getUserId()); +// billManage.setCreateByName(loginUser.getUserPo().getUserName()); + billManage.setCreateTime(billCreateTime==null ? new Date():billCreateTime); + billManage.setDelFlag(1); + billManage.setBillNumber(OrderSequence.getOrderCode("ZD")); + billManage.setTopOrganizationId(billingStatementDTO.getTopOrganizationId()); + billManage.setOrganizationId(billingStatementDTO.getOrganizationId()); + billManage.setOrganizationName(billingStatementDTO.getOrganizationName()); + billManage.setBillType(billingStatementPOS.get(0).getAccountExpenseType()); + billManage.setBelongModule(billingStatementPOS.get(0).getBelongModule()); + billManage.setBelongModuleCode(billingStatementPOS.get(0).getBelongModuleCode()); + billManage.setSettlementCustomersId(billingStatementPOS.get(0).getSettlementCustomersId()); + billManage.setSettlementEntity(billingStatementPOS.get(0).getSettlementEntity()); + billManage.setSettlementCustomersCode(billingStatementPOS.get(0).getSettlementCustomersCode()); + billManage.setSalesmanId(billingStatementPOS.get(0).getSalesmanId()); + billManage.setSalesmanName(billingStatementPOS.get(0).getSalesmanName()); + billManage.setPaymentAccountId(billingStatementPOS.get(0).getPaymentAccountId()); + billManage.setPaymentAccountName(billingStatementPOS.get(0).getPaymentAccountName()); + billManage.setBillRemark(billingRemark); + //查询结算对象信息 + SettlementCustomersPO settlementCustomersPO = settlementCustomersDomainService.getInfo(billingStatementPOS.get(0).getSettlementCustomersId()); + if(null == settlementCustomersPO){ + throw new ServiceException("结算对象信息未找到"); + } + billManage.setSettlementMethod(settlementCustomersPO.getSettlementMethod()); + billManage.setSettlementMethodCode(settlementCustomersPO.getSettlementMethodCode()); +// if(settlementCustomersPO.getMainRole()==1){ +// billManage.setBillType(1); +// }else { +// billManage.setBillType(2); +// } + //计算所有流水列表中的最早周期开始时间和晚周期结束时间 + List cycleBeginTimeSet = billingStatementPOS.stream().map(BillingStatementPO::getCycleBeginTime).collect(Collectors.toList()); + List cycleEndTimeSet = billingStatementPOS.stream().map(BillingStatementPO::getCycleEndTime).collect(Collectors.toList()); + cycleBeginTimeSet.removeIf(Objects::isNull); + cycleEndTimeSet.removeIf(Objects::isNull); + if(cycleBeginTimeSet.size()>0){ + billManage.setCycleBeginTime(Collections.min(cycleBeginTimeSet)); + } + if(cycleEndTimeSet.size()>0){ + billManage.setCycleEndTime(Collections.max(cycleEndTimeSet)); + } + //将所有的流水金额相加 + billManage.setBillTotalAmount(billingStatementPOS.stream().map(BillingStatementPO::getBillingAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); + billManage.setBillAmount(billManage.getBillTotalAmount()); + billManage.setBillAmountUnsettled(billManage.getBillTotalAmount()); + boolean flag = billManageService.save(billManage); + billingStatementDTO.setBillManageId(billManage.getBillManageId()); + List billDetailList = new ArrayList<>(); + for (BillingStatementPO billingStatementPO : billingStatementPOS) { + //生成对账单详情 + BillDetail billDetail = new BillDetail(); + billDetail.setTopOrganizationId(billingStatementPO.getTopOrganizationId()); + billDetail.setOrganizationId(billingStatementPO.getOrganizationId()); + billDetail.setOrganizationName(billingStatementPO.getOrganizationName()); + billDetail.setCreateBy(billManage.getCreateBy()); + billDetail.setCreateByName(billManage.getCreateByName()); + billDetail.setCreateTime(billManage.getCreateTime()); + billDetail.setBillManageId(billManage.getBillManageId()); + billDetail.setBillNumber(billManage.getBillNumber()); + billDetail.setBillingStatementId(billingStatementPO.getBillingStatementId()); + billDetail.setBillingFlow(billingStatementPO.getBillingFlow()); + billDetail.setBillingTotalAmount(billingStatementPO.getBillingAmount()); + billDetail.setBillingAmount(billingStatementPO.getBillingAmount()); + billDetail.setBillType(billingStatementPO.getAccountExpenseType()); + billDetail.setTaxAmount(billingStatementPO.getTaxAmount()); + billDetail.setTaxRate(billingStatementPO.getTaxRate()); + billDetail.setTaxFreeFee(billingStatementPO.getTaxFreeFee()); + billDetail.setSettlementCurrency(billingStatementPO.getSettlementCurrency()); + billDetail.setFeeType(billingStatementPO.getFeeType()); + billDetail.setInvoiceItem(billingStatementPO.getInvoiceItem()); + billDetail.setInvoiceItemName(billingStatementPO.getInvoiceItemName()); + billDetailList.add(billDetail); + } + boolean flagTwo = billDetailDomainService.insertBatch(billDetailList); + //保存账单操作记录 + BillOperationLogDO billOperationLogDO = new BillOperationLogDO(); + billOperationLogDO.setBillManageId(billManage.getBillManageId()); + billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.create_bill_text, billManage.getBillNumber(), billManage.getBillTotalAmount())); + billOperationLogDO.setOperationType(1); + billOperationLogDO.setCreateByName(billManage.getCreateByName()); + billOperationLogDO.setUpdateByName(billManage.getUpdateByName()); + billOperationLogDO.setCreateTime(new Date()); + billOperationLogDO.setUpdateTime(new Date()); + billOperationLogDO.setDelFlag(1); + billOperationLogDO.setCreateBy(billManage.getCreateBy()); + billOperationLogDO.setUpdateBy(billManage.getUpdateBy()); + billOperationLogDO.setTopOrganizationId(billManage.getTopOrganizationId()); + billOperationLogDO.setOrganizationId(billManage.getOrganizationId()); + billOperationLogDO.setOrganizationName(billManage.getOrganizationName()); + + boolean three = billOperationLogDomainService.saveBillOperationLogJob(billOperationLogDO); + //修改流水记录 + /*billingStatementDTO.getBillingStatementList().forEach(billingStatementADDVO -> { + billingStatementMapper.update(null, + new LambdaUpdateWrapper().set(BillingStatement::getTaxAmount,billingStatementADDVO.getTaxAmount()) + .set(BillingStatement::getTaxRate,billingStatementADDVO.getTaxRate()) + .set(BillingStatement::getTaxFreeFee,billingStatementADDVO.getTaxFreeFee()) + .set(BillingStatement::getSettlementCurrency,billingStatementADDVO.getSettlementCurrency()) + .eq(BillingStatement::getBillingStatementId,billingStatementADDVO.getBillingStatementId())); + });*/ + return flag && flagTwo && three; + } + /** * 保存账单 * @param billingStatementDTO @@ -351,7 +469,7 @@ public class BillManageDomainService { if(billingStatementPOS==null || billingStatementPOS.size()==0){ throw new ServiceException("所选流水信息未找到"); } - return saveBill(distinctList,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO); + return saveBillJob(distinctList,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO); } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java index f998836f1..0495eccdb 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java @@ -95,6 +95,12 @@ public class BillOperationLogDomainService { return billOperationLogService.insert(billOperationLogDO); } + public Boolean saveBillOperationLogJob(BillOperationLogDO billOperationLogDO) { + + billOperationLogDO.setDelFlag(1); + return billOperationLogService.insert(billOperationLogDO); + } + /** * 批量保存操作日志 @@ -161,4 +167,4 @@ public class BillOperationLogDomainService { public List getDetailsById(Long billManageId) { return billOperationLogService.getDetailsById(billManageId); } -} +} \ No newline at end of file From cdc8396b579e42c8c2d36ca84445ac05e447b321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 17:45:25 +0800 Subject: [PATCH 10/88] =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=8F=82=E6=95=B0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 3d9dd60e4..c4192c2a6 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -844,6 +844,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -901,6 +902,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -973,6 +975,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1053,6 +1056,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1109,6 +1113,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1181,6 +1186,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1255,6 +1261,8 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1312,6 +1320,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1384,6 +1393,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1464,6 +1474,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1520,6 +1531,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); @@ -1592,6 +1604,7 @@ public class BillingStatementApplicationService { billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVO.setBillingAmount(amount); billingStatementADDVOS.add(billingStatementADDVO); billingStatementIdList.add(String.valueOf(billingStatementId)); From f118c7ff29bda3540012ee3deb8ed1107020d7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 17:58:16 +0800 Subject: [PATCH 11/88] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=BF=A1=E6=81=AF;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 120 ++++++++++++++++-- 1 file changed, 108 insertions(+), 12 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index c4192c2a6..bf8388111 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -816,11 +816,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatements) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -858,6 +863,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -874,11 +882,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -916,6 +929,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -947,11 +963,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -989,6 +1010,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1028,11 +1052,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingContractStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1069,6 +1098,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1085,11 +1117,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1127,6 +1164,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1158,11 +1198,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1200,6 +1245,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1233,11 +1281,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatements) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1276,6 +1329,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1292,11 +1348,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1334,6 +1395,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1365,11 +1429,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1407,6 +1476,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1446,11 +1518,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingContractStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1487,6 +1564,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1503,11 +1583,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1545,6 +1630,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } @@ -1576,11 +1664,16 @@ public class BillingStatementApplicationService { BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; String settlementCurrency = "CNY"; + Long organizationId = null; + Long topOrganizationId = null; + String organizationName = null; for (BillingStatement billingStatement : billingStatementList) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); - Long organizationId = billingStatement.getOrganizationId(); + organizationId = billingStatement.getOrganizationId(); + topOrganizationId = billingStatement.getTopOrganizationId(); + organizationName = billingStatement.getOrganizationName(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); if (taxRateMap == null) continue; BigDecimal taxRateBigDecimal = (BigDecimal) taxRateMap.get("taxRate"); @@ -1618,6 +1711,9 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + billingStatementDTO1.setOrganizationId(organizationId); + billingStatementDTO1.setTopOrganizationId(topOrganizationId); + billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); } } From 2b6777abe41fb1d03533307e141e4f6924445d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 13:47:46 +0800 Subject: [PATCH 12/88] =?UTF-8?q?BI=E6=A8=A1=E5=9D=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BiPlatformRealDataMapper.java | 11 +- .../repository/po/RealBusinessTypeStatPO.java | 8 +- .../po/RealMonthlyTaskDurationPO.java | 29 ++++ .../repository/po/RealOnTimeStatPO.java | 20 +++ .../repository/po/RealTaskTypeStatPO.java | 20 +++ .../repository/po/RealVehicleStatusPO.java | 3 + .../service/BiPlatformRealDataService.java | 156 +++++++++++++++++- .../BiReportSnapshotMapperSupport.java | 2 +- .../service/BiReportSnapshotSyncService.java | 57 +++++-- .../BiSnapshotWeeklyRandomDataBuilder.java | 1 + .../facadeApi/biReport/BiReportApi.java | 4 +- .../biReport/vo/platform/VehicleStatusVO.java | 3 + .../BiPlatformRealDataMapper.xml | 80 +++++++-- 13 files changed, 355 insertions(+), 39 deletions(-) create mode 100644 mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealMonthlyTaskDurationPO.java create mode 100644 mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealOnTimeStatPO.java create mode 100644 mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java index 3a4c041e8..d665e4726 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java @@ -7,6 +7,9 @@ import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformFloorStatPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealOnTimeStatPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskTypeStatPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealMonthlyTaskDurationPO; import java.util.List; @@ -35,9 +38,15 @@ public interface BiPlatformRealDataMapper { /** 任务负荷(今日 24 小时) */ List queryTaskLoadToday(); - /** 今日预约-业务类型统计(按 businessName 分组统计今日预约数量) */ + /** 今日预约-租户统计(按 tenantName 分组统计今日预约数量) */ List queryTodayBusinessTypeStats(); + /** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */ + RealOnTimeStatPO queryTodayOnTimeStats(); + + /** 任务类型统计(当月 OMS 运输订单按业务类型分组:1-跨境 2-国内) */ + List queryMonthTransportOrderByType(); + /** 月台监控-按楼层统计月台车辆(楼层、月台数量、今日预约车辆、当前作业车辆) */ List queryPlatformFloorStats(); diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java index d9df6ab91..7e4dfb70d 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java @@ -5,15 +5,15 @@ import lombok.Data; import java.io.Serializable; /** - * 今日预约-业务类型统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS) - * 按业务类型分组统计今日预约数量 + * 今日预约-租户统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS) + * 按租户名称分组统计今日预约数量 */ @Data public class RealBusinessTypeStatPO implements Serializable { private static final long serialVersionUID = 1L; - /** 业务类型名称(qms_main_business.businessName) */ - private String businessName; + /** 租户名称(qms_main_business.tenantName) */ + private String tenantName; /** 今日预约数量 */ private Long count; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealMonthlyTaskDurationPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealMonthlyTaskDurationPO.java new file mode 100644 index 000000000..9f815b7ba --- /dev/null +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealMonthlyTaskDurationPO.java @@ -0,0 +1,29 @@ +package com.mhd.bi.domain.biPlatformRealData.repository.po; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 本月任务平均时长 / 完成率统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS) + * avgDurationHours:累计 (EXIT_TIME - ENTRY_TIME) 小时数(仅 ENTRY_TIME/EXIT_TIME 都不为空时参与) + * durationCount:参与平均时长统计的有效条数 + * completedCount:已出场(EXIT_TIME IS NOT NULL)且预约日期在本月的数量 + * totalCount:本月(TARGET_DATE)预约总数量 + */ +@Data +public class RealMonthlyTaskDurationPO implements Serializable { + private static final long serialVersionUID = 1L; + + /** 平均作业时长(小时) */ + private Double avgDurationHours; + + /** 参与平均时长统计的有效条数 */ + private Long durationCount; + + /** 本月已出场数量 */ + private Long completedCount; + + /** 本月预约总数量(按 TARGET_DATE 统计) */ + private Long totalCount; +} \ No newline at end of file diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealOnTimeStatPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealOnTimeStatPO.java new file mode 100644 index 000000000..0178405a7 --- /dev/null +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealOnTimeStatPO.java @@ -0,0 +1,20 @@ +package com.mhd.bi.domain.biPlatformRealData.repository.po; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 今日作业准时率统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS) + * 准时率 = 今日实际进场时间在预约日期当天的车辆数 / 今日预约总车辆数 × 100% + */ +@Data +public class RealOnTimeStatPO implements Serializable { + private static final long serialVersionUID = 1L; + + /** 今日预约总车辆数 */ + private Long total; + + /** 今日准时车辆数(已进场且实际进场日期 = 预约日期) */ + private Long onTimeCount; +} \ No newline at end of file diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java new file mode 100644 index 000000000..5f0a29c3c --- /dev/null +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java @@ -0,0 +1,20 @@ +package com.mhd.bi.domain.biPlatformRealData.repository.po; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 任务类型统计(真实数据,来自 NGWL_TEST_OMS.BUSINESS_DOCUMENT_ORDER 运输订单) + * 按业务类型 businessCategory 分组统计当月数量:1-跨境运输 2-国内运输 + */ +@Data +public class RealTaskTypeStatPO implements Serializable { + private static final long serialVersionUID = 1L; + + /** 业务类型:1-跨境 2-国内 */ + private Integer businessCategory; + + /** 该类型当月单量 */ + private Long count; +} \ No newline at end of file diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealVehicleStatusPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealVehicleStatusPO.java index 7f2f782a7..2cc77c420 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealVehicleStatusPO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealVehicleStatusPO.java @@ -16,6 +16,9 @@ public class RealVehicleStatusPO implements Serializable { /** 当前未签到 */ private Long notCheckedIn; + /** 当前等待作业(FLOW_STATUS IN '1','2','3' 已预约/已签到/已叫号) */ + private Long waiting; + /** 当前作业中 */ private Long operatingVehicles; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index 703c71e2a..2b4c65556 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -9,12 +9,17 @@ import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformFloorStatPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealOnTimeStatPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskTypeStatPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealMonthlyTaskDurationPO; import com.mhd.bi.domain.biPlatformSurveillance.repository.mapper.BiPlatformSurveillanceReportMapper; import com.mhd.bi.domain.biSnapshotSync.repository.mapper.BiSnapshotWriteMapper; import com.mhd.bi.domain.biSnapshotSync.support.BiSnapshotWeeklyRandomDataBuilder; import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO; import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO; import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO; +import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskTypeStatisticsVO; +import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskTypeCountItemVO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -91,16 +96,23 @@ public class BiPlatformRealDataService { if (vo.getPlatformOverview() != null) { fp.put("totalPlatforms", vo.getPlatformOverview().getTotalPlatforms()); fp.put("operatingPlatforms", vo.getPlatformOverview().getOperatingPlatforms()); + fp.put("currentOccupancyRate", vo.getPlatformOverview().getCurrentOccupancyRate()); fp.put("todayTasks", vo.getPlatformOverview().getTodayTasks()); } + if (vo.getEfficiencyStatistics() != null) { + fp.put("platformOnTimeRate", vo.getEfficiencyStatistics().getPlatformOnTimeRate()); + } if (vo.getVehicleStatus() != null) { fp.put("todayReservedVehicles", vo.getVehicleStatus().getTodayReservedVehicles()); fp.put("notCheckedIn", vo.getVehicleStatus().getNotCheckedIn()); + fp.put("waiting", vo.getVehicleStatus().getWaiting()); fp.put("operatingVehicles", vo.getVehicleStatus().getOperatingVehicles()); fp.put("completedVehicles", vo.getVehicleStatus().getCompletedVehicles()); } if (vo.getMonthlyTaskStatistics() != null) { fp.put("taskTotal", vo.getMonthlyTaskStatistics().getTaskTotal()); + fp.put("avgTaskDuration", vo.getMonthlyTaskStatistics().getAvgTaskDuration()); + fp.put("taskCompletionRate", vo.getMonthlyTaskStatistics().getTaskCompletionRate()); } if (vo.getVehicles() != null) { List> vehicles = new ArrayList<>(); @@ -126,6 +138,21 @@ public class BiPlatformRealDataService { } fp.put("taskLoadStatistics", loads); } + if (vo.getTaskTypeStatistics() != null) { + Map m = new LinkedHashMap<>(); + m.put("totalTasks", vo.getTaskTypeStatistics().getTotalTasks()); + if (vo.getTaskTypeStatistics().getTaskTypes() != null) { + List> types = new ArrayList<>(); + for (TaskTypeCountItemVO it : vo.getTaskTypeStatistics().getTaskTypes()) { + Map tm = new LinkedHashMap<>(); + tm.put("type", it.getType()); + tm.put("count", it.getCount()); + types.add(tm); + } + m.put("taskTypes", types); + } + fp.put("taskTypeStatistics", m); + } return objectMapper.writeValueAsString(fp); } @@ -166,12 +193,34 @@ public class BiPlatformRealDataService { } } + /** + * 今日作业准时率 = 准时车辆数 / 今日预约车辆总数 × 100% + * 准时:今日(TARGET_DATE=今天)已进场且实际进场时间不超过该预约的预约结束时间 bookingEndTime; + * 实际进场时间超过 bookingEndTime 视为不准时。 + * 今日预约总数为 0 时返回 0。 + */ + public int calcTodayOnTimeRate() { + try { + RealOnTimeStatPO po = biPlatformRealDataMapper.queryTodayOnTimeStats(); + if (po == null) return 0; + long total = po.getTotal() == null ? 0L : po.getTotal(); + long onTime = po.getOnTimeCount() == null ? 0L : po.getOnTimeCount(); + if (total <= 0) return 0; + // 四舍五入到整数百分比 + return (int) Math.round(((double) onTime / (double) total) * 100.0); + } catch (Exception e) { + log.error("【YMS】计算今日作业准时率失败: {}", e.getMessage(), e); + return 0; + } + } + public RealVehicleStatusPO queryVehicleStatusToday() { try { RealVehicleStatusPO po = biPlatformRealDataMapper.queryVehicleStatusToday(); if (po == null) po = new RealVehicleStatusPO(); if (po.getTodayReservedVehicles() == null) po.setTodayReservedVehicles(0L); if (po.getNotCheckedIn() == null) po.setNotCheckedIn(0L); + if (po.getWaiting() == null) po.setWaiting(0L); if (po.getOperatingVehicles() == null) po.setOperatingVehicles(0L); if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L); return po; @@ -180,6 +229,7 @@ public class BiPlatformRealDataService { RealVehicleStatusPO po = new RealVehicleStatusPO(); po.setTodayReservedVehicles(0L); po.setNotCheckedIn(0L); + po.setWaiting(0L); po.setOperatingVehicles(0L); po.setCompletedVehicles(0L); return po; @@ -196,6 +246,21 @@ public class BiPlatformRealDataService { } } + /** + * 本月任务平均时长 / 完成率统计: + * - avgDurationHours:累计(EXIT_TIME - ENTRY_TIME)小时数 / 参与数;任一为空的行不参与 + * - taskCompletionRate:已完成(EXIT_TIME 不为空 且 预约日期在本月)/ 本月预约总数量 ×100 + * 任一查询失败均返回 null,由调用方决定是否覆盖模板值。 + */ + public RealMonthlyTaskDurationPO queryMonthTaskStats() { + try { + return biPlatformRealDataMapper.queryMonthTaskStats(); + } catch (Exception e) { + log.error("【YMS】统计本月任务平均时长/完成率失败: {}", e.getMessage(), e); + return null; + } + } + public List queryTaskLoadToday() { try { return biPlatformRealDataMapper.queryTaskLoadToday(); @@ -206,14 +271,50 @@ public class BiPlatformRealDataService { } /** - * 今日预约-业务类型统计:按业务类型分组统计今日预约数量。 - * 例:今日预约航空打板 3 条 → 返回 {businessName:"航空打板", count:3} + * 任务类型统计:当月 OMS 运输订单按业务类型分组(1-跨境运输,2-国内运输)。 + * 返回 {totalTasks: 当月跨境+国内运输总单量, taskTypes: [{type, count}]} + * 查询失败时返回空结构,不影响写死字段。 + */ + /** + * 任务类型统计:固定输出「跨境运输」「国内运输」两类,count 取当月 OMS 业务单真实单量; + * 当月无数据或查询失败时仍返回两类、count=0(不使用写死模板兜底)。 + */ + public TaskTypeStatisticsVO queryMonthTransportOrderByType() { + int crossBorder = 0; // 跨境运输 BUSINESS_CATEGORY=1 + int domestic = 0; // 国内运输 BUSINESS_CATEGORY=2 + try { + List rows = biPlatformRealDataMapper.queryMonthTransportOrderByType(); + if (rows != null) { + for (RealTaskTypeStatPO r : rows) { + if (r == null || r.getBusinessCategory() == null || r.getCount() == null) { + continue; + } + if (r.getBusinessCategory() == 1) { + crossBorder = r.getCount().intValue(); + } else if (r.getBusinessCategory() == 2) { + domestic = r.getCount().intValue(); + } + } + } + } catch (Exception e) { + log.error("【OMS】统计当月运输订单业务类型失败: {}", e.getMessage(), e); + // 失败时不回退写死模板,保持两类 count=0 + } + List items = new ArrayList<>(); + items.add(TaskTypeCountItemVO.builder().type("跨境运输").count(crossBorder).build()); + items.add(TaskTypeCountItemVO.builder().type("国内运输").count(domestic).build()); + return TaskTypeStatisticsVO.builder().totalTasks(crossBorder + domestic).taskTypes(items).build(); + } + + /** + * 今日预约-租户统计:按租户名称分组统计今日预约数量。 + * 例:今日预约某租户 3 条 → 返回 {tenantName:"某租户", count:3} */ public List queryTodayBusinessTypeStats() { try { return biPlatformRealDataMapper.queryTodayBusinessTypeStats(); } catch (Exception e) { - log.error("【YMS】统计今日业务类型失败: {}", e.getMessage(), e); + log.error("【YMS】统计今日租户预约失败: {}", e.getMessage(), e); return java.util.Collections.emptyList(); } } @@ -271,29 +372,63 @@ public class BiPlatformRealDataService { template.setVehicles(vehicleVos); // 月台实时概览:真实数据源,无条件覆盖 + // 总月台 / 占用月台 来源:YMS 月台管理列表 QMS_WINDOW_INFO(JOB_STATUS=1 表示占用) + // 月台占用率 = 占用 / 全部月台 + // 今日作业任务 来源:QMS_MAIN_BUSINESS 按预约时间 TARGET_DATE = 今天 的全部数量 + // 作业准时率 = 今日(实际进场时间在预约日期当天的车辆数) / 今日预约车辆总数 × 100% if (template.getPlatformOverview() != null) { - RealPlatformOverviewPO ov = queryPlatformOverview(); - int total = ov.getTotalPlatforms().intValue(); - int occ = ov.getOperatingPlatforms().intValue(); + List platformList = queryPlatformInfoList(); + int total = platformList == null ? 0 : platformList.size(); + int occ = 0; + if (platformList != null) { + for (RealPlatformInfoPO p : platformList) { + if (p != null && p.getJobStatus() != null && p.getJobStatus() == 1) { + occ++; + } + } + } double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d; + int todayTasks = (int) countTodayTasks(); template.getPlatformOverview().setTotalPlatforms(total); template.getPlatformOverview().setOperatingPlatforms(occ); template.getPlatformOverview().setCurrentOccupancyRate(rate); - template.getPlatformOverview().setTodayTasks((int) countTodayTasks()); + template.getPlatformOverview().setTodayTasks(todayTasks); + + // 作业准时率:准时车辆数 / 今日预约总数 × 100%(今日总数为 0 时返回 0) + if (template.getEfficiencyStatistics() != null) { + template.getEfficiencyStatistics().setPlatformOnTimeRate(calcTodayOnTimeRate()); + } } - // 作业车辆状态统计:真实数据源,无条件覆盖 + // 作业车辆状态统计:真实数据源,无条件覆盖(含等待作业 waiting = 今日预约且 已预约/已签到/已叫号) if (template.getVehicleStatus() != null) { RealVehicleStatusPO vs = queryVehicleStatusToday(); template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue()); template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue()); + template.getVehicleStatus().setWaiting(vs.getWaiting().intValue()); template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue()); template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue()); } - // 本月任务统计:taskTotal 有真实数据源无条件覆盖;YoY 等无真实数据源保留模板写死值 + // 本月任务统计:taskTotal / avgTaskDuration / taskCompletionRate 均有真实数据源,无条件覆盖;YoY 保留模板写死值 if (template.getMonthlyTaskStatistics() != null) { template.getMonthlyTaskStatistics().setTaskTotal((int) countMonthTasks()); + RealMonthlyTaskDurationPO monthStats = queryMonthTaskStats(); + if (monthStats != null) { + if (monthStats.getAvgDurationHours() != null) { + // 保留两位小数 + double v = monthStats.getAvgDurationHours(); + template.getMonthlyTaskStatistics().setAvgTaskDuration(Math.round(v * 100.0) / 100.0); + } + Long total = monthStats.getTotalCount(); + Long completed = monthStats.getCompletedCount(); + if (total != null && total > 0 && completed != null) { + int rate = (int) Math.round(((double) completed.longValue() / total.longValue()) * 100.0); + template.getMonthlyTaskStatistics().setTaskCompletionRate(rate); + } else { + template.getMonthlyTaskStatistics().setTaskCompletionRate(0); + } + } } // 任务负荷:有真实数据源;真实为空则清空不用模板模拟,有数据则按真实小时覆盖 @@ -313,6 +448,9 @@ public class BiPlatformRealDataService { } } + // 任务类型统计:当月 OMS 业务单真实数据(固定跨境运输/国内运输两类,不使用写死模板兜底) + template.setTaskTypeStatistics(queryMonthTransportOrderByType()); + return template; } diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java index b3ac1ac64..f4b729e9a 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java @@ -87,7 +87,7 @@ public final class BiReportSnapshotMapperSupport { .platformOverview(PlatformOverviewVO.builder() .totalPlatforms(0).currentOccupancyRate(0d).operatingPlatforms(0).todayTasks(0).build()) .vehicleStatus(VehicleStatusVO.builder() - .todayReservedVehicles(0).notCheckedIn(0).operatingVehicles(0).completedVehicles(0).build()) + .todayReservedVehicles(0).notCheckedIn(0).waiting(0).operatingVehicles(0).completedVehicles(0).build()) .avgOperationDurationTrend(Collections.emptyList()) .monthlyTaskStatistics(MonthlyTaskStatisticsVO.builder() .taskTotal(0).taskTotalYoY(0).avgTaskDuration(0d).avgDurationYoY(0) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java index b682590a2..a149ecf61 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java @@ -16,7 +16,7 @@ import com.mhd.bi.interfaces.facadeApi.biReport.vo.warehouseZone.WarehouseOperat import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO; import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO; -import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO; +import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO; import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO; import lombok.RequiredArgsConstructor; @@ -173,18 +173,33 @@ public class BiReportSnapshotSyncService { } // ====== 真实数据:月台实时概览 ====== - RealPlatformOverviewPO ov = biPlatformRealDataService.queryPlatformOverview(); + // 总月台 / 占用月台 来源:YMS 月台管理列表 QMS_WINDOW_INFO(JOB_STATUS=1 表示占用) + // 月台占用率 = 占用 / 全部月台 + // 今日作业任务 来源:QMS_MAIN_BUSINESS 按预约时间 TARGET_DATE = 今天 的全部数量 if (template.getPlatformOverview() != null) { - template.getPlatformOverview().setTotalPlatforms(ov.getTotalPlatforms().intValue()); - template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue()); - int total = ov.getTotalPlatforms().intValue(); - int occ = ov.getOperatingPlatforms().intValue(); + List platformList = biPlatformRealDataService.queryPlatformInfoList(); + int total = platformList == null ? 0 : platformList.size(); + int occ = 0; + if (platformList != null) { + for (RealPlatformInfoPO p : platformList) { + if (p != null && p.getJobStatus() != null && p.getJobStatus() == 1) { + occ++; + } + } + } double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d; + int todayTasks = (int) biPlatformRealDataService.countTodayTasks(); + template.getPlatformOverview().setTotalPlatforms(total); + template.getPlatformOverview().setOperatingPlatforms(occ); template.getPlatformOverview().setCurrentOccupancyRate(rate); - } - long todayTasks = biPlatformRealDataService.countTodayTasks(); - if (template.getPlatformOverview() != null) { - template.getPlatformOverview().setTodayTasks((int) todayTasks); + template.getPlatformOverview().setTodayTasks(todayTasks); + + // 作业准时率 = 准时车辆数 / 今日预约总数 × 100% + // 准时:今日(TARGET_DATE=今天)已进场且 ENTRY_TIME <= bookingEndTime(预约结束时间),超过视为不准时 + // 今日预约总数 = 0 时返回 0 + if (template.getEfficiencyStatistics() != null) { + template.getEfficiencyStatistics().setPlatformOnTimeRate(biPlatformRealDataService.calcTodayOnTimeRate()); + } } // ====== 真实数据:作业车辆状态统计 ====== @@ -192,14 +207,31 @@ public class BiReportSnapshotSyncService { if (template.getVehicleStatus() != null) { template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue()); template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue()); + template.getVehicleStatus().setWaiting(vs.getWaiting().intValue()); template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue()); template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue()); } - // ====== 真实数据:本月任务统计 taskTotal ====== + // ====== 真实数据:本月任务统计 taskTotal / avgTaskDuration / taskCompletionRate ====== long monthTasks = biPlatformRealDataService.countMonthTasks(); if (template.getMonthlyTaskStatistics() != null) { template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks); + com.mhd.bi.domain.biPlatformRealData.repository.po.RealMonthlyTaskDurationPO monthStats = + biPlatformRealDataService.queryMonthTaskStats(); + if (monthStats != null) { + if (monthStats.getAvgDurationHours() != null) { + double v = monthStats.getAvgDurationHours(); + template.getMonthlyTaskStatistics().setAvgTaskDuration(Math.round(v * 100.0) / 100.0); + } + Long total = monthStats.getTotalCount(); + Long completed = monthStats.getCompletedCount(); + if (total != null && total > 0 && completed != null) { + int rate = (int) Math.round(((double) completed.longValue() / total.longValue()) * 100.0); + template.getMonthlyTaskStatistics().setTaskCompletionRate(rate); + } else { + template.getMonthlyTaskStatistics().setTaskCompletionRate(0); + } + } } // ====== 真实数据:任务负荷(今日 24 小时) ====== @@ -218,6 +250,9 @@ public class BiReportSnapshotSyncService { } } + // ====== 真实数据:任务类型统计(当月 OMS 业务单,固定跨境运输/国内运输两类,不使用写死模板兜底) ====== + template.setTaskTypeStatistics(biPlatformRealDataService.queryMonthTransportOrderByType()); + return template; } diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index 79f0cdd1a..81a872259 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -415,6 +415,7 @@ public final class BiSnapshotWeeklyRandomDataBuilder { static final int P_TASKS = 418; static final int P_RESV = 2_850; static final int P_NC = 920; + static final int P_WAIT = 680; static final int P_OPV = 1_180; static final int P_DONE = 1_420; static final String[] P_MO_LABELS = {"5月", "6月", "7月"}; diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java index 108afc412..664ab716b 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java @@ -122,9 +122,9 @@ public class BiReportApi extends BaseController { } /** - * 今日预约-业务类型统计(实时查 YMS 库,不落库) + * 今日预约-租户统计(实时查 YMS 库,不落库) */ - @ApiOperation(value = "今日预约业务类型统计", notes = "按业务类型分组统计今日预约数量,实时查询 YMS 库,不落库;例:航空打板 3 条") + @ApiOperation(value = "今日预约租户统计", notes = "按租户名称分组统计今日预约数量,实时查询 YMS 库,不落库;例:某租户 3 条") @GetMapping("/businessTypeStats") public BiApiResult> businessTypeStats() { List data = biPlatformRealDataService.queryTodayBusinessTypeStats(); diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/VehicleStatusVO.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/VehicleStatusVO.java index f71aefe19..db6015e93 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/VehicleStatusVO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/VehicleStatusVO.java @@ -20,6 +20,9 @@ public class VehicleStatusVO { @ApiModelProperty("当前未签到,单位:辆") private Integer notCheckedIn; + @ApiModelProperty("当前等待作业(已预约/已签到/已叫号),单位:辆") + private Integer waiting; + @ApiModelProperty("当前作业中,单位:辆") private Integer operatingVehicles; diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index d3d0b3c12..ce5d839e4 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -40,43 +40,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM NGWL_TEST_YMS.QMS_WINDOW_INFO - + + + + - + - + + + + @@ -102,6 +145,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY 1 DESC + + + + + + + AND DATE_FORMAT(a.CREATE_TIME, '%Y-%m') = #{billManageDO.billMonth} + AND date_format(a.create_time,'%Y-%m-%d') =]]> #{billManageDO.createTimeStart} From 752216ad45a7182319d0bf4beb65907e01bbe96b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 14:22:58 +0800 Subject: [PATCH 15/88] 31 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index 2572662c1..fa1d95e1a 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # username: nacos # password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From e2bee47aacc7df68a2c88464c86978faea15820b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 9 Sep 2026 14:31:56 +0800 Subject: [PATCH 16/88] =?UTF-8?q?=E6=9C=88=E5=BA=A6=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/BillManageMapper.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd_bms/src/main/resources/mapper/BillManageMapper.xml b/mhd_bms/src/main/resources/mapper/BillManageMapper.xml index a182856f8..e99c7a7f3 100644 --- a/mhd_bms/src/main/resources/mapper/BillManageMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillManageMapper.xml @@ -31,25 +31,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" b.SETTLEMENT_ENTITY AS settlementEntityName, a.ORGANIZATION_ID AS organizationId, a.ORGANIZATION_NAME AS organizationName, - DATE_FORMAT(a.CREATE_TIME, '%Y-%m') AS billMonth, + TO_CHAR(a.CREATE_TIME, 'YYYY-MM') AS billMonth, SUM(a.BILL_AMOUNT) AS totalBillAmount, - SUM(IFNULL(a.BILL_AMOUNT_SETTLEMENT, 0)) AS totalSettledAmount, - SUM(IFNULL(a.BILL_AMOUNT_UNSETTLED, 0)) AS totalUnsettledAmount, + SUM(NVL(a.BILL_AMOUNT_SETTLEMENT, 0)) AS totalSettledAmount, + SUM(NVL(a.BILL_AMOUNT_UNSETTLED, 0)) AS totalUnsettledAmount, COUNT(*) AS billCount, - GROUP_CONCAT(a.BILL_MANAGE_ID) AS billManageIds, + LISTAGG(a.BILL_MANAGE_ID, ',') WITHIN GROUP (ORDER BY a.BILL_MANAGE_ID) AS billManageIds, b.SETTLEMENT_METHOD AS settlementMethod, b.SETTLEMENT_CURRENCY AS settlementCurrency FROM bill_manage a LEFT JOIN SETTLEMENT_CUSTOMERS b ON a.SETTLEMENT_CUSTOMERS_ID = b.SETTLEMENT_CUSTOMERS_ID AND b.del_flag = 1 WHERE a.del_flag = 1 - GROUP BY a.SETTLEMENT_CUSTOMERS_ID, DATE_FORMAT(a.CREATE_TIME, '%Y-%m') - ORDER BY a.CREATE_TIME DESC + GROUP BY a.SETTLEMENT_CUSTOMERS_ID, TO_CHAR(a.CREATE_TIME, 'YYYY-MM'), a.ORGANIZATION_ID, a.ORGANIZATION_NAME, b.SETTLEMENT_ENTITY_ID, b.SETTLEMENT_ENTITY, b.SETTLEMENT_METHOD, b.SETTLEMENT_CURRENCY, a.SETTLEMENT_CUSTOMERS_CODE, a.SETTLEMENT_ENTITY + ORDER BY MAX(a.CREATE_TIME) DESC - AND DATE_FORMAT(a.CREATE_TIME, '%Y-%m') = #{billManageDO.billMonth} + AND TO_CHAR(a.CREATE_TIME, 'YYYY-MM') = #{billManageDO.billMonth} AND date_format(a.create_time,'%Y-%m-%d') =]]> #{billManageDO.createTimeStart} From d2a6a5a4f6b800a56a5014a8b8c881459f985b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 15:12:55 +0800 Subject: [PATCH 17/88] =?UTF-8?q?BI=E5=90=AF=E5=8A=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/biPlatformRealData/BiPlatformRealDataMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index ce5d839e4..beae38d61 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SUM(CASE WHEN TARGET_DATE IS NOT NULL AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS total, SUM(CASE WHEN ENTRY_TIME IS NOT NULL AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) - AND ENTRY_TIME <= BOOKING_END_TIME + AND ENTRY_TIME <= BOOKING_END_TIME THEN 1 ELSE 0 END) AS onTimeCount FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS From a3c0f15e39a910732010665046909ab88e15677a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 15:19:29 +0800 Subject: [PATCH 18/88] 30 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index fa1d95e1a..2572662c1 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # username: nacos # password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From f02a2d52f2fa4d18c02b50d106f17aceda9f7694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 16:24:05 +0800 Subject: [PATCH 19/88] =?UTF-8?q?OMS=E8=B0=83=E6=95=B4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 554 ++++++++++++++++++ .../entity/BusinessDocumentOrder.java | 5 +- .../entity/BusinessDocumentOrderAdjust.java | 93 +++ .../BusinessDocumentOrderAdjustMapper.java | 12 + .../BusinessDocumentOrderAdjustDetail.java | 173 ++++++ ...sinessDocumentOrderAdjustDetailMapper.java | 12 + .../BusinessDocumentOrderAdjustAuditDTO.java | 24 + .../BusinessDocumentOrderAdjustDTO.java | 37 ++ .../BusinessDocumentOrderAdjustQueryDTO.java | 36 ++ .../BusinessDocumentOrderAdjustRecordDTO.java | 59 ++ .../BusinessDocumentOrderApi.java | 65 ++ 11 files changed, 1069 insertions(+), 1 deletion(-) create mode 100644 mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/repository/mapper/BusinessDocumentOrderAdjustMapper.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/repository/mapper/BusinessDocumentOrderAdjustDetailMapper.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustAuditDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustQueryDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java new file mode 100644 index 000000000..44ce3ebbe --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -0,0 +1,554 @@ +package com.mhd.oms.application.service.businessDocumentOrder; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder; +import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper; +import com.mhd.oms.domain.businessDocumentOrderAdjust.entity.BusinessDocumentOrderAdjust; +import com.mhd.oms.domain.businessDocumentOrderAdjust.repository.mapper.BusinessDocumentOrderAdjustMapper; +import com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity.BusinessDocumentOrderAdjustDetail; +import com.mhd.oms.domain.businessDocumentOrderAdjustDetail.repository.mapper.BusinessDocumentOrderAdjustDetailMapper; +import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount; +import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper; +import com.mhd.oms.domain.executeOrder.entity.ExecuteOrder; +import com.mhd.oms.domain.executeOrder.repository.mapper.ExecuteOrderMapper; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustAuditDTO; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustDTO; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustQueryDTO; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustRecordDTO; +import com.mhd.system.api.WlhyServiceFeign; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 运输业务单「订单调整」应用服务 + * + * 规则(定稿): + * 1. 每次调整都生成:1 条主记录 + 1 条明细快照 + * 2. 费用数据源 = 前端回传的费用明细 business_order_account(feeDetailList); + * 主表金额 deliveryFreight 为其 amount 合计(冗余汇总,后端自动算)。 + * 3. 是否需审核:一旦任一「金额」发生变化 + * = feeDetailList 明细 amount 变化,或主表金额列变化 -> 走业务主管审核; + * 否则(仅改非金额字段) -> 直通。 + * 4. 涉及金额提交 -> 仅把业务单 review_status 置为「调整待审核(3)」;主记录 AUDIT_STATUS=0(待审核); + * 不更新业务单数据,不影响其它状态(order_status / execute_status 不动)。 + * 5. 审核通过 -> 覆盖业务单(金额) + 替换费用明细;review_status 一律置为 1(已审核), + * 不影响 order_status / execute_status。 + * 审核驳回 -> 不更新业务单数据,review_status 还原为调整前值(主记录 before_review_status),可再次调整。 + * 6. 直通(未改金额) -> 覆盖业务单可编辑字段 + deliveryFreight(明细合计),并替换 business_order_account + * (逻辑删旧 is_delete=1 + 插新 is_delete=0);不改动任何审核/执行状态。 + * 7. 前端以 amountChanged 告知是否改金额(默认前端判定);未传时后端兜底比对。 + * + * 说明:review_status 原枚举 0未审/1通过/2驳回,新增 3=调整待审核;不改变原有用例。 + * + * @author dev + * @date 2026-09-09 + */ +@Slf4j +@Service +public class BusinessDocumentOrderAdjustService { + + private static final Integer AUDIT_WAIT = 0; // 调整记录:待审核 + private static final Integer AUDIT_PASS = 1; // 调整记录:审核通过 + private static final Integer AUDIT_REJECT = 2; // 调整记录:驳回 + + /** 主表金额(费用)字段,任一变化触发审核 */ + private static final List FEE_FIELDS = Arrays.asList( + "deliveryFreight", "collectedFreight", "uncollectedFreight", "collectLessFreight", + "transportationUnitPrice", "infoFee", "freightUnitPrice", "cargoInsuranceAmount", + "freightCharges", "freightFee", "unloadingFee", "customsFee", "shortageFee", + "miscellaneousFee", "otherFee", "detentionFee"); + + /** 不允许被前端调整覆盖的系统字段 */ + private static final List PROTECTED_FIELDS = Arrays.asList( + "id", "goodsNumber", + "orderStatus", "reviewStatus", "reviewId", "review", "reviewTime", "reviewOpinion", + "salesManager", "auditStatus", "auditBy", "auditTime", + "executeStatus", "executeId", "executeTime", "executor", + "executeOrderId", "executeOrderNumber", "adjustStatus", + "isDelete", "delFlag", "createBy", "createByName", "createTime", + "updateBy", "updateByName", "updateTime", + "pushStatus", "pushTime", "pushBy", "pushByName", + "reviseApplyType", "reviseApplyStatus", "reviseApplyBy", "reviseApplyByName", + "reviseApplyReason", "reviseApplyTime", + "reservationOrderId", "reservationOrderNumber", + "mainOrderId", "mainOrderNum", "mergeOrderId", "mergeOrderNum", + "splicingOrderType", "splicingStatus", "deliveryProgress", + "orgId", "orgName", "organizationId", "organizationName", "topOrganizationId", + "realCreateBy", "realCreateName", "createCompanyId", "createUserId", + "szwlUserId" + ); + + @Autowired + private BusinessDocumentOrderMapper businessDocumentOrderMapper; + + @Autowired + private BusinessOrderAccountMapper businessOrderAccountMapper; + + @Autowired + private BusinessDocumentOrderAdjustMapper adjustMapper; + + @Autowired + private BusinessDocumentOrderAdjustDetailMapper adjustDetailMapper; + + @Autowired + private ExecuteOrderMapper executeOrderMapper; + + @Autowired + private WlhyServiceFeign wlhyServiceFeign; + + /** + * 提交调整 + * 返回 data = [是否需审核, 调整记录ID] + */ + @Transactional(rollbackFor = Exception.class) + public AjaxResult adjust(BusinessDocumentOrderAdjustDTO dto) { + if (dto == null || dto.getOrder() == null || dto.getOrder().getId() == null) { + throw new ServiceException("参数错误:缺少业务单ID(order.id)"); + } + BusinessDocumentOrder dbOrder = businessDocumentOrderMapper.selectById(dto.getOrder().getId()); + if (ObjectUtil.isNull(dbOrder)) { + throw new ServiceException("业务单不存在或已被删除"); + } + BusinessDocumentOrder front = dto.getOrder(); + + // 1. 当前库中费用明细 + List dbFeeList = businessOrderAccountMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessOrderAccount::getOrderId, dbOrder.getId()) + .eq(BusinessOrderAccount::getIsDelete, 0)); + + // 2. 调整后的费用明细(前端);为 null 则视为保持库中不变 + List newFeeList = dto.getFeeDetailList(); + + // 3. 生成"调整后"业务单对象:DB原值 + 前端可编辑字段覆盖(忽略null) + BusinessDocumentOrder afterOrder = buildAfterOrder(dbOrder, front); + + // 4. 若提供了费用明细,则 deliveryFreight(合计)=明细 amount 之和,并联动到 afterOrder + boolean hasFeeDetail = newFeeList != null && !newFeeList.isEmpty(); + if (hasFeeDetail) { + BigDecimal sum = sumAmount(newFeeList); + afterOrder.setDeliveryFreight(sum); + } + + // 5. 判定是否修改了金额:以前端 amountChanged 为准(前端整单回传已自行判定); + // 若前端未传则后端兜底比对(主表金额列 或 明细 amount 变化) + boolean amountChanged; + if (dto.getAmountChanged() != null) { + amountChanged = dto.getAmountChanged(); + } else { + amountChanged = isAmountChanged(dbOrder, front, hasFeeDetail, dbFeeList, newFeeList); + } + + // 6. 写主记录 + LoginUser loginUser = SecurityUtils.getLoginUser(); + Date now = new Date(); + BusinessDocumentOrderAdjust adjust = buildAdjust(dbOrder, loginUser, now, amountChanged, dto.getAdjustReason()); + adjustMapper.insert(adjust); + + // 7. 写明细快照(调整后业务单整行 + 费用明细JSON) + BusinessDocumentOrderAdjustDetail detail = new BusinessDocumentOrderAdjustDetail(); + copySnapshot(afterOrder, detail); + if (hasFeeDetail) { + detail.setFeeDetailJson(JSONUtil.toJsonStr(newFeeList)); + } + detail.setAdjustId(adjust.getId()); + detail.setOrderId(dbOrder.getId()); + detail.setGoodsNumber(dbOrder.getGoodsNumber()); + detail.setCreateBy(adjust.getAdjustBy()); + detail.setCreateName(adjust.getAdjustByName()); + detail.setCreateTime(now); + detail.setDelFlag(1); + adjustDetailMapper.insert(detail); + + if (!amountChanged) { + // 8a. 直通:覆盖主表可编辑字段(含 deliveryFreight 合计) + 替换费用明细;不改动任何审核/执行状态 + saveOrderAndFee(dbOrder.getId(), afterOrder, hasFeeDetail ? newFeeList : dbFeeList, loginUser, now, false, null); + updateAdjustPass(adjust.getId(), adjust.getAdjustBy(), adjust.getAdjustByName(), now, null); + syncTmsAsync(dbOrder.getGoodsNumber(), afterOrder); + } else { + // 8b. 涉及金额:仅把业务单 review_status 置为"调整待审核(3)",其余状态(exec/orderStatus)不动,不更新业务单数据 + BusinessDocumentOrder statusOnly = new BusinessDocumentOrder(); + statusOnly.setId(dbOrder.getId()); + statusOnly.setReviewStatus(3L); // 调整待审核 + businessDocumentOrderMapper.updateById(statusOnly); + } + + return AjaxResult.success(new Object[]{amountChanged, adjust.getId()}); + } + + /** + * 调整记录列表(管理页:查全部,可选按订单/业务单号/审核状态等筛选,配合分页使用) + */ + public List listAdjustRecord(BusinessDocumentOrderAdjustQueryDTO query) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(BusinessDocumentOrderAdjust::getDelFlag, 1); + + // ===== 组织隔离(参考业务单 queryList 口径) ===== + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null && loginUser.getUserPo() != null) { + Long loginOrgId = loginUser.getUserPo().getOrganizationId(); + Long loginTopOrgId = loginUser.getUserPo().getTopOrganizationId(); + // 一级组织非1(集团)时,按一级组织过滤(可看本一级组织下所有) + if (loginTopOrgId != null && loginTopOrgId != 1) { + wrapper.eq(BusinessDocumentOrderAdjust::getTopOrgId, String.valueOf(loginTopOrgId)); + } else if (loginOrgId != null) { + // 否则按当前组织过滤;若查询方显式指定了 organizationId 则以其为准 + Long effOrgId = (query != null && query.getOrganizationId() != null) + ? query.getOrganizationId() : loginOrgId; + if (effOrgId != null) { + wrapper.eq(BusinessDocumentOrderAdjust::getOrgId, String.valueOf(effOrgId)); + } + } + } else if (query != null && query.getOrganizationId() != null) { + wrapper.eq(BusinessDocumentOrderAdjust::getOrgId, String.valueOf(query.getOrganizationId())); + } + + if (query != null) { + if (query.getOrderId() != null) { + wrapper.eq(BusinessDocumentOrderAdjust::getOrderId, query.getOrderId()); + } + if (StrUtil.isNotBlank(query.getGoodsNumber())) { + wrapper.like(BusinessDocumentOrderAdjust::getGoodsNumber, query.getGoodsNumber()); + } + if (query.getIsAudit() != null) { + wrapper.eq(BusinessDocumentOrderAdjust::getIsAudit, query.getIsAudit()); + } + if (query.getAuditStatus() != null) { + wrapper.eq(BusinessDocumentOrderAdjust::getAuditStatus, query.getAuditStatus()); + } + if (StrUtil.isNotBlank(query.getAdjustByName())) { + wrapper.like(BusinessDocumentOrderAdjust::getAdjustByName, query.getAdjustByName()); + } + } + wrapper.orderByDesc(BusinessDocumentOrderAdjust::getAdjustTime); + List list = adjustMapper.selectList(wrapper); + return list.stream().map(a -> { + BusinessDocumentOrderAdjustRecordDTO vo = new BusinessDocumentOrderAdjustRecordDTO(); + BeanUtil.copyProperties(a, vo); + return vo; + }).collect(Collectors.toList()); + } + + /** + * 按业务单查询调整记录(供订单详情页"调整记录"Tab用) + */ + public List listAdjustRecordByOrder(Long orderId) { + BusinessDocumentOrderAdjustQueryDTO query = new BusinessDocumentOrderAdjustQueryDTO(); + query.setOrderId(orderId); + return listAdjustRecord(query); + } + + /** + * 调整记录详情(主记录 + 调整后明细快照) + */ + public BusinessDocumentOrderAdjustRecordDTO getAdjustRecord(Long adjustId) { + BusinessDocumentOrderAdjust adjust = adjustMapper.selectById(adjustId); + if (adjust == null) { + throw new ServiceException("调整记录不存在"); + } + BusinessDocumentOrderAdjustRecordDTO vo = new BusinessDocumentOrderAdjustRecordDTO(); + BeanUtil.copyProperties(adjust, vo); + BusinessDocumentOrderAdjustDetail detail = adjustDetailMapper.selectOne( + new LambdaQueryWrapper() + .eq(BusinessDocumentOrderAdjustDetail::getAdjustId, adjustId) + .eq(BusinessDocumentOrderAdjustDetail::getDelFlag, 1) + .last("LIMIT 1")); + vo.setDetail(detail); + return vo; + } + + /** + * 调整审核(通过/驳回),业务主管操作 + */ + @Transactional(rollbackFor = Exception.class) + public AjaxResult auditAdjust(BusinessDocumentOrderAdjustAuditDTO auditDTO) { + if (auditDTO == null || auditDTO.getAdjustId() == null) { + throw new ServiceException("参数错误:缺少调整记录ID"); + } + BusinessDocumentOrderAdjust adjust = adjustMapper.selectById(auditDTO.getAdjustId()); + if (adjust == null) { + throw new ServiceException("调整记录不存在"); + } + if (adjust.getAuditStatus() == null || adjust.getAuditStatus() != AUDIT_WAIT) { + throw new ServiceException("该调整记录非待审核状态,无法审核"); + } + Integer result = auditDTO.getAuditResult(); + if (result == null || (result != AUDIT_PASS && result != AUDIT_REJECT)) { + throw new ServiceException("审核结果非法"); + } + + LoginUser loginUser = SecurityUtils.getLoginUser(); + String auditBy = loginUser != null ? String.valueOf(loginUser.getUserid()) : null; + String auditByName = loginUser != null && loginUser.getWlhyLoginUser() != null ? loginUser.getWlhyLoginUser().getRealname() : null; + Date now = new Date(); + + if (result == AUDIT_PASS) { + BusinessDocumentOrder order = businessDocumentOrderMapper.selectById(adjust.getOrderId()); + if (ObjectUtil.isNull(order)) { + throw new ServiceException("业务单不存在"); + } + BusinessDocumentOrderAdjustDetail detail = adjustDetailMapper.selectOne( + new LambdaQueryWrapper() + .eq(BusinessDocumentOrderAdjustDetail::getAdjustId, adjust.getId()) + .eq(BusinessDocumentOrderAdjustDetail::getDelFlag, 1) + .last("LIMIT 1")); + + // 还原调整后业务单(从JSON整行快照) + BusinessDocumentOrder snapshot = null; + if (detail != null && StrUtil.isNotBlank(detail.getOrderSnapshotJson())) { + try { + snapshot = JSONUtil.toBean(detail.getOrderSnapshotJson(), BusinessDocumentOrder.class); + } catch (Exception e) { + log.warn("解析调整快照JSON失败", e); + } + } + BusinessDocumentOrder toSave = new BusinessDocumentOrder(); + toSave.setId(order.getId()); + if (snapshot != null) { + BeanUtil.copyProperties(snapshot, toSave, CopyOptions.create().setIgnoreNullValue(true) + .setIgnoreProperties(toArray())); + } else if (detail != null) { + BeanUtil.copyProperties(detail, toSave, CopyOptions.create().setIgnoreNullValue(true) + .setIgnoreProperties(toArray())); + } + + // 还原调整后费用明细(从 feeDetailJson) + List newFeeList = new ArrayList<>(); + if (detail != null && StrUtil.isNotBlank(detail.getFeeDetailJson())) { + try { + newFeeList = JSONUtil.toList(detail.getFeeDetailJson(), BusinessOrderAccount.class); + } catch (Exception e) { + log.warn("解析调整费用明细JSON失败", e); + } + } + // 若快照中有明细合计则保证 deliveryFreight 一致 + if (!newFeeList.isEmpty()) { + toSave.setDeliveryFreight(sumAmount(newFeeList)); + } + // 审核通过后 review_status 一律置为 1(已审核);不影响 order_status / execute_status + toSave.setReviewStatus(1L); + // 覆盖业务单 + 替换费用明细 + saveOrderAndFee(order.getId(), toSave, newFeeList, loginUser, now, false, null); + + updateAdjustPass(adjust.getId(), auditBy, auditByName, now, auditDTO.getAuditRemark()); + syncTmsAsync(order.getGoodsNumber(), toSave); + } else { + adjust.setAuditStatus(AUDIT_REJECT); + adjust.setAuditBy(auditBy); + adjust.setAuditByName(auditByName); + adjust.setAuditTime(now); + adjust.setAuditRemark(auditDTO.getAuditRemark()); + adjust.setUpdateBy(auditBy); + adjust.setUpdateTime(now); + adjustMapper.updateById(adjust); + + // 驳回:不更新业务单数据,仅把 review_status 还原为调整前值(不影响其它状态) + BusinessDocumentOrder statusOnly = new BusinessDocumentOrder(); + statusOnly.setId(adjust.getOrderId()); + statusOnly.setReviewStatus(adjust.getBeforeReviewStatus() == null ? 0L : adjust.getBeforeReviewStatus()); + businessDocumentOrderMapper.updateById(statusOnly); + } + return AjaxResult.success(); + } + + // ===================================================== + // 私有工具 + // ===================================================== + + private BusinessDocumentOrder buildAfterOrder(BusinessDocumentOrder dbOrder, BusinessDocumentOrder front) { + BusinessDocumentOrder after = new BusinessDocumentOrder(); + BeanUtil.copyProperties(dbOrder, after, CopyOptions.create().setIgnoreNullValue(true)); + BeanUtil.copyProperties(front, after, CopyOptions.create().setIgnoreNullValue(true) + .setIgnoreProperties(toArray())); + after.setId(dbOrder.getId()); + return after; + } + + private BusinessDocumentOrderAdjust buildAdjust(BusinessDocumentOrder dbOrder, LoginUser u, Date now, + boolean amountChanged, String reason) { + BusinessDocumentOrderAdjust adjust = new BusinessDocumentOrderAdjust(); + adjust.setOrderId(dbOrder.getId()); + adjust.setGoodsNumber(dbOrder.getGoodsNumber()); + adjust.setAdjustBy(u != null ? String.valueOf(u.getUserid()) : null); + adjust.setAdjustByName(u != null && u.getWlhyLoginUser() != null ? u.getWlhyLoginUser().getRealname() : null); + adjust.setAdjustTime(now); + adjust.setAdjustReason(reason); + adjust.setIsAudit(amountChanged ? 1 : 0); + adjust.setAuditStatus(amountChanged ? AUDIT_WAIT : AUDIT_PASS); + adjust.setBeforeReviewStatus(dbOrder.getReviewStatus()); + // 组织信息:参考业务单口径,取当前登录用户所属组织(调整人归属) + if (u != null && u.getUserPo() != null) { + if (u.getUserPo().getOrganizationId() != null) { + adjust.setOrgId(String.valueOf(u.getUserPo().getOrganizationId())); + } else { + adjust.setOrgId(dbOrder.getOrgId()); + } + if (u.getUserPo().getTopOrganizationId() != null) { + adjust.setTopOrgId(String.valueOf(u.getUserPo().getTopOrganizationId())); + } else if (dbOrder.getTopOrganizationId() != null) { + adjust.setTopOrgId(String.valueOf(dbOrder.getTopOrganizationId())); + } + } else { + adjust.setOrgId(dbOrder.getOrgId()); + if (dbOrder.getTopOrganizationId() != null) { + adjust.setTopOrgId(String.valueOf(dbOrder.getTopOrganizationId())); + } + } + adjust.setCreateBy(adjust.getAdjustBy()); + adjust.setCreateName(adjust.getAdjustByName()); + adjust.setCreateTime(now); + adjust.setDelFlag(1); + return adjust; + } + + /** + * 是否修改了金额:主表金额列变化 或 明细 amount 变化 + */ + private boolean isAmountChanged(BusinessDocumentOrder dbOrder, BusinessDocumentOrder front, + boolean hasFeeDetail, List dbFeeList, + List newFeeList) { + // a) 主表金额列比对 + boolean mainChanged = FEE_FIELDS.stream().anyMatch(field -> { + Object newVal = BeanUtil.getFieldValue(front, field); + if (newVal == null) { + return false; + } + Object oldVal = BeanUtil.getFieldValue(dbOrder, field); + BigDecimal old = oldVal == null ? BigDecimal.ZERO : (BigDecimal) oldVal; + BigDecimal now = (BigDecimal) newVal; + return old.compareTo(now) != 0; + }); + if (mainChanged) { + return true; + } + // b) 若前端未传明细,则只看主表;若传了明细,比较明细金额 + if (!hasFeeDetail) { + return false; + } + // 明细合计对比 + BigDecimal oldSum = sumAmount(dbFeeList); + BigDecimal newSum = sumAmount(newFeeList); + return oldSum.compareTo(newSum) != 0; + } + + private BigDecimal sumAmount(List list) { + BigDecimal sum = BigDecimal.ZERO; + if (list == null) { + return sum; + } + for (BusinessOrderAccount acc : list) { + if (acc.getAmount() != null) { + sum = sum.add(acc.getAmount()); + } + } + return sum; + } + + /** + * 覆盖业务单可编辑字段 + 替换费用明细(逻辑删旧 + 插新) + */ + /** + * 覆盖业务单可编辑字段 + 替换费用明细(逻辑删旧 + 插新) + * @param restoreReview 是否还原审核状态(审核通过/驳回后 true;直通 false 不改任何审核状态) + * @param beforeReviewStatus 调整前 review_status,用于还原 + */ + private void saveOrderAndFee(Long orderId, BusinessDocumentOrder toSave, + List newFeeList, + LoginUser loginUser, Date now, + boolean restoreReview, Long beforeReviewStatus) { + if (restoreReview) { + // 仅还原 review_status 到调整前值;不影响 order_status / execute_status 等其它状态 + toSave.setReviewStatus(beforeReviewStatus == null ? 0L : beforeReviewStatus); + } + businessDocumentOrderMapper.updateById(toSave); + + // 逻辑删旧明细 + List oldFeeList = businessOrderAccountMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessOrderAccount::getOrderId, orderId) + .eq(BusinessOrderAccount::getIsDelete, 0)); + if (oldFeeList != null) { + for (BusinessOrderAccount oldAcc : oldFeeList) { + oldAcc.setIsDelete(1); + oldAcc.setUpdateBy(loginUser != null ? String.valueOf(loginUser.getUserid()) : null); + oldAcc.setUpdateTime(now); + businessOrderAccountMapper.updateById(oldAcc); + } + } + // 插新明细 + if (newFeeList != null && !newFeeList.isEmpty()) { + for (BusinessOrderAccount acc : newFeeList) { + acc.setId(IdUtil.randomUUID()); + acc.setOrderId(String.valueOf(orderId)); + acc.setIsDelete(0); + acc.setCreateBy(loginUser != null ? String.valueOf(loginUser.getUserid()) : null); + acc.setCreateTime(now); + businessOrderAccountMapper.insert(acc); + } + } + } + + private void copySnapshot(BusinessDocumentOrder order, BusinessDocumentOrderAdjustDetail detail) { + BeanUtil.copyProperties(order, detail, CopyOptions.create().setIgnoreNullValue(true) + .setIgnoreProperties("id", "adjustId", "orderId", "createBy", "createName", + "createTime", "updateBy", "updateTime", "delFlag", + "orderSnapshotJson", "feeDetailJson")); + try { + detail.setOrderSnapshotJson(JSONUtil.toJsonStr(order)); + } catch (Exception e) { + log.warn("生成调整快照JSON失败", e); + } + } + + private void updateAdjustPass(Long adjustId, String auditBy, String auditByName, Date auditTime, String remark) { + BusinessDocumentOrderAdjust adjust = new BusinessDocumentOrderAdjust(); + adjust.setId(adjustId); + adjust.setAuditStatus(AUDIT_PASS); + adjust.setAuditBy(auditBy); + adjust.setAuditByName(auditByName); + adjust.setAuditTime(auditTime); + adjust.setAuditRemark(remark); + adjust.setUpdateBy(auditBy); + adjust.setUpdateTime(auditTime); + adjustMapper.updateById(adjust); + } + + private String[] toArray() { + return PROTECTED_FIELDS.toArray(new String[0]); + } + + private void syncTmsAsync(String goodsNumber, BusinessDocumentOrder after) { + try { + List executeOrders = executeOrderMapper.selectList( + new LambdaQueryWrapper() + .eq(ExecuteOrder::getGoodsNumber, goodsNumber) + .eq(ExecuteOrder::getDelFlag, 1)); + if (executeOrders == null || executeOrders.isEmpty()) { + return; + } + log.info("业务单[{}]调整完成,关联执行单[{}]。如需回写TMS请接入TMS改费Feign。", goodsNumber, + executeOrders.stream().map(ExecuteOrder::getGoodsNumber).collect(Collectors.toList())); + } catch (Exception e) { + log.error("同步TMS失败,不影响主流程", e); + } + } +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java index 5734bedad..823941199 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java @@ -659,7 +659,7 @@ public class BusinessDocumentOrder extends BaseVOEntity{ @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") private Date documentDate; - @ApiModelProperty( "审核状态 0-未审核 1-审核通过 2-已驳回") + @ApiModelProperty( "审核状态 0-未审核 1-审核通过 2-已驳回 3-调整待审核") private Long reviewStatus; @ApiModelProperty("审核时间") @@ -825,4 +825,7 @@ public class BusinessDocumentOrder extends BaseVOEntity{ @ApiModelProperty("车次") @Excel(name = "车次") private String shuttleNo; + + @ApiModelProperty("业务单调整状态 0-无 1-调整待审核 2-调整驳回 3-调整已通过") + private Integer adjustStatus; } diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java new file mode 100644 index 000000000..d84a978e3 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java @@ -0,0 +1,93 @@ +package com.mhd.oms.domain.businessDocumentOrderAdjust.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 运输业务单 调整主记录 + * + * @author dev + * @date 2026-09-09 + */ +@Data +@TableName("business_document_order_adjust") +public class BusinessDocumentOrderAdjust implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + @ApiModelProperty("业务单ID") + private Long orderId; + + @ApiModelProperty("业务单号") + private String goodsNumber; + + @ApiModelProperty("调整人账号") + private String adjustBy; + + @ApiModelProperty("调整人姓名") + private String adjustByName; + + @ApiModelProperty("调整时间") + private Date adjustTime; + + @ApiModelProperty("调整原因") + private String adjustReason; + + @ApiModelProperty("是否需要审核 0-否 1-是") + private Integer isAudit; + + @ApiModelProperty("调整前业务单审核状态(review_status原值,用于调整审核通过/驳回后还原,避免影响其它)") + private Long beforeReviewStatus; + + @ApiModelProperty("审核状态 0-待审核 1-审核通过 2-驳回") + private Integer auditStatus; + + @ApiModelProperty("审核人账号") + private String auditBy; + + @ApiModelProperty("审核人姓名") + private String auditByName; + + @ApiModelProperty("审核时间") + private Date auditTime; + + @ApiModelProperty("审核/驳回意见") + private String auditRemark; + + @ApiModelProperty("组织ID") + private String orgId; + + @ApiModelProperty("一级组织ID") + private String topOrgId; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("创建人姓名") + private String createName; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新人") + private String updateBy; + + @ApiModelProperty("更新人姓名") + private String updateName; + + @ApiModelProperty("更新时间") + private Date updateTime; + + @ApiModelProperty("删除标记 1-正常 0-删除") + private Integer delFlag; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/repository/mapper/BusinessDocumentOrderAdjustMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/repository/mapper/BusinessDocumentOrderAdjustMapper.java new file mode 100644 index 000000000..ac740249a --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/repository/mapper/BusinessDocumentOrderAdjustMapper.java @@ -0,0 +1,12 @@ +package com.mhd.oms.domain.businessDocumentOrderAdjust.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.oms.domain.businessDocumentOrderAdjust.entity.BusinessDocumentOrderAdjust; +import org.apache.ibatis.annotations.Mapper; + +/** + * 运输业务单 调整主记录 Mapper + */ +@Mapper +public interface BusinessDocumentOrderAdjustMapper extends BaseMapper { +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java new file mode 100644 index 000000000..178d53c4b --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java @@ -0,0 +1,173 @@ +package com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 运输业务单 调整明细(调整后业务单整行快照) + * + * @author dev + * @date 2026-09-09 + */ +@Data +@TableName("business_document_order_adjust_detail") +public class BusinessDocumentOrderAdjustDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + @ApiModelProperty("关联调整主记录ID") + private Long adjustId; + + @ApiModelProperty("业务单ID") + private Long orderId; + + @ApiModelProperty("业务单号") + private String goodsNumber; + + @ApiModelProperty("货物类型ID") + private String goodsTypeId; + + @ApiModelProperty("货物名称") + private String goodsName; + + @ApiModelProperty("车型") + private String carType; + + @ApiModelProperty("装货地") + private String loadingName; + + @ApiModelProperty("装货地址") + private String loadingAddress; + + @ApiModelProperty("装货时间") + private Date loadingDate; + + @ApiModelProperty("卸货地") + private String unloadName; + + @ApiModelProperty("卸货地址") + private String unloadAddress; + + @ApiModelProperty("卸货时间") + private Date unloadingData; + + @ApiModelProperty("发货人") + private String freighterName; + + @ApiModelProperty("装货电话") + private String loadingPhone; + + @ApiModelProperty("收货人") + private String dischargerName; + + @ApiModelProperty("卸货电话") + private String unloadPhone; + + @ApiModelProperty("备注") + private String remarks; + + @ApiModelProperty("线路") + private String route; + + @ApiModelProperty("单据日期") + private Date documentDate; + + @ApiModelProperty("组织ID") + private String orgId; + + @ApiModelProperty("组织ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + private String organizationName; + + @ApiModelProperty("一级组织ID") + private Long topOrganizationId; + + // ==================== 金额/费用快照 ==================== + @ApiModelProperty("发货运费") + private BigDecimal deliveryFreight; + + @ApiModelProperty("已收运费") + private BigDecimal collectedFreight; + + @ApiModelProperty("未收运费") + private BigDecimal uncollectedFreight; + + @ApiModelProperty("少收运费") + private BigDecimal collectLessFreight; + + @ApiModelProperty("运费单价(元/吨)") + private BigDecimal transportationUnitPrice; + + @ApiModelProperty("信息费") + private BigDecimal infoFee; + + @ApiModelProperty("计费单价") + private BigDecimal freightUnitPrice; + + @ApiModelProperty("货物保险金额") + private BigDecimal cargoInsuranceAmount; + + @ApiModelProperty("运费") + private BigDecimal freightCharges; + + @ApiModelProperty("运费") + private BigDecimal freightFee; + + @ApiModelProperty("卸货费") + private BigDecimal unloadingFee; + + @ApiModelProperty("报关费") + private BigDecimal customsFee; + + @ApiModelProperty("差货费") + private BigDecimal shortageFee; + + @ApiModelProperty("杂费") + private BigDecimal miscellaneousFee; + + @ApiModelProperty("其他费用") + private BigDecimal otherFee; + + @ApiModelProperty("滞车费") + private BigDecimal detentionFee; + + @ApiModelProperty("税率") + private BigDecimal taxRate; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("创建人姓名") + private String createName; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新人") + private String updateBy; + + @ApiModelProperty("更新时间") + private Date updateTime; + + @ApiModelProperty("删除标记 1-正常 0-删除") + private Integer delFlag; + + @ApiModelProperty("调整后业务单整行JSON快照(用于全字段精确还原)") + private String orderSnapshotJson; + + @ApiModelProperty("调整后费用明细JSON快照(business_order_account列表)") + private String feeDetailJson; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/repository/mapper/BusinessDocumentOrderAdjustDetailMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/repository/mapper/BusinessDocumentOrderAdjustDetailMapper.java new file mode 100644 index 000000000..ca694765f --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/repository/mapper/BusinessDocumentOrderAdjustDetailMapper.java @@ -0,0 +1,12 @@ +package com.mhd.oms.domain.businessDocumentOrderAdjustDetail.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity.BusinessDocumentOrderAdjustDetail; +import org.apache.ibatis.annotations.Mapper; + +/** + * 运输业务单 调整明细 Mapper + */ +@Mapper +public interface BusinessDocumentOrderAdjustDetailMapper extends BaseMapper { +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustAuditDTO.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustAuditDTO.java new file mode 100644 index 000000000..f2db85d7d --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustAuditDTO.java @@ -0,0 +1,24 @@ +package com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 运输业务单 调整 审核入参 + */ +@Data +public class BusinessDocumentOrderAdjustAuditDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("调整记录ID(必传)") + private Long adjustId; + + @ApiModelProperty("审核结果 1-通过 2-驳回") + private Integer auditResult; + + @ApiModelProperty("审核/驳回意见") + private String auditRemark; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustDTO.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustDTO.java new file mode 100644 index 000000000..911af0260 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustDTO.java @@ -0,0 +1,37 @@ +package com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust; + +import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder; +import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 运输业务单 调整提交入参 + * + * 前端整单回传 business_document_order 全部字段 + 费用明细 business_order_account: + * - amountChanged=true (本次修改了金额) -> 需要业务主管审核 + * - amountChanged=false (仅改其它字段) -> 无需审核,直接更新 + * + * order: 前端把「调整后」业务单整单字段回传(含 id 定位;deliveryFreight 合计可由后端按明细自动算)。 + * feeDetailList: 调整后费用明细(business_order_account),其 amount 之和 = 主表 deliveryFreight。 + */ +@Data +public class BusinessDocumentOrderAdjustDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("调整后业务单(整单字段,含 id 定位;金额合计 deliveryFreight 可由后端按明细自动算)") + private BusinessDocumentOrder order; + + @ApiModelProperty("调整后费用明细(business_order_account),amount 之和作为主表 deliveryFreight 合计") + private List feeDetailList; + + @ApiModelProperty("是否修改了金额(前端判定传入):true-需审核,false-直通") + private Boolean amountChanged; + + @ApiModelProperty("调整原因") + private String adjustReason; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustQueryDTO.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustQueryDTO.java new file mode 100644 index 000000000..c421705f8 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustQueryDTO.java @@ -0,0 +1,36 @@ +package com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 运输业务单 调整记录 查询条件(管理列表用,可不按订单、查全部) + */ +@Data +public class BusinessDocumentOrderAdjustQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("业务单号(模糊)") + private String goodsNumber; + + @ApiModelProperty("业务单ID") + private Long orderId; + + @ApiModelProperty("是否需要审核 0-否 1-是") + private Integer isAudit; + + @ApiModelProperty("审核状态 0-待审核 1-审核通过 2-驳回") + private Integer auditStatus; + + @ApiModelProperty("调整人姓名(模糊)") + private String adjustByName; + + @ApiModelProperty("所属组织ID(调整人/业务单所属组织)") + private Long organizationId; + + @ApiModelProperty("一级组织ID(组织隔离用)") + private Long topOrganizationId; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java new file mode 100644 index 000000000..1a5a73888 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java @@ -0,0 +1,59 @@ +package com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust; + +import com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity.BusinessDocumentOrderAdjustDetail; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 运输业务单 调整记录(主记录) 列表/详情返回 VO + */ +@Data +public class BusinessDocumentOrderAdjustRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主记录ID") + private Long id; + + @ApiModelProperty("业务单ID") + private Long orderId; + + @ApiModelProperty("业务单号") + private String goodsNumber; + + @ApiModelProperty("调整人账号") + private String adjustBy; + + @ApiModelProperty("调整人姓名") + private String adjustByName; + + @ApiModelProperty("调整时间") + private Date adjustTime; + + @ApiModelProperty("调整原因") + private String adjustReason; + + @ApiModelProperty("是否需要审核 0-否 1-是") + private Integer isAudit; + + @ApiModelProperty("审核状态 0-待审核 1-审核通过 2-驳回") + private Integer auditStatus; + + @ApiModelProperty("审核人账号") + private String auditBy; + + @ApiModelProperty("审核人姓名") + private String auditByName; + + @ApiModelProperty("审核时间") + private Date auditTime; + + @ApiModelProperty("审核/驳回意见") + private String auditRemark; + + @ApiModelProperty("调整后整行快照明细(详情查询时带出)") + private BusinessDocumentOrderAdjustDetail detail; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/businessDocumentOrder/BusinessDocumentOrderApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/businessDocumentOrder/BusinessDocumentOrderApi.java index abce60fdb..217435c2d 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/businessDocumentOrder/BusinessDocumentOrderApi.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/businessDocumentOrder/BusinessDocumentOrderApi.java @@ -10,7 +10,12 @@ import org.springframework.web.bind.annotation.*; import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO; import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO; import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO; +import com.mhd.oms.application.service.businessDocumentOrder.BusinessDocumentOrderAdjustService; import com.mhd.oms.application.service.businessDocumentOrder.BusinessDocumentOrderApplicationService; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustAuditDTO; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustDTO; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustQueryDTO; +import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustRecordDTO; import com.mhd.oms.interfaces.assembler.businessDocumentOrder.BusinessDocumentOrderAssembler; import com.github.pagehelper.PageHelper; import javax.annotation.Resource; @@ -33,6 +38,9 @@ public class BusinessDocumentOrderApi extends BaseController{ @Resource private BusinessDocumentOrderAssembler businessDocumentOrderAssembler; + @Resource + private BusinessDocumentOrderAdjustService businessDocumentOrderAdjustService; + /** * 分页查询【业务单】列表 */ @@ -161,7 +169,64 @@ public class BusinessDocumentOrderApi extends BaseController{ } } + /** + * 订单调整 - 提交调整 + * 若修改了金额字段则进入调整待审核,否则直通更新 + */ + @ApiOperation("订单调整 - 提交调整") + @PostMapping("/adjust") + public AjaxResult adjust(@RequestBody BusinessDocumentOrderAdjustDTO adjustDTO) { + try { + return businessDocumentOrderAdjustService.adjust(adjustDTO); + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } + /** + * 订单调整 - 调整记录列表(查全部,可分页/按业务单号或审核状态筛选) + */ + @ApiOperation("订单调整 - 调整记录列表") + @GetMapping("/listAdjustRecord") + public TableDataInfo listAdjustRecord(BusinessDocumentOrderAdjustQueryDTO query, + @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize) { + PageHelper.startPage(pageNo, pageSize); + List list = businessDocumentOrderAdjustService.listAdjustRecord(query); + return getDataTable(list); + } + /** + * 订单调整 - 按业务单查询调整记录(供订单详情页展示) + */ + @ApiOperation("订单调整 - 按业务单查询调整记录") + @GetMapping("/listAdjustRecordByOrder/{orderId}") + public AjaxResult listAdjustRecordByOrder(@PathVariable("orderId") Long orderId) { + return AjaxResult.success(businessDocumentOrderAdjustService.listAdjustRecordByOrder(orderId)); + } + + /** + * 订单调整 - 调整记录详情 + */ + @ApiOperation("订单调整 - 调整记录详情") + @GetMapping("/getAdjustRecord/{adjustId}") + public AjaxResult getAdjustRecord(@PathVariable("adjustId") Long adjustId) { + return AjaxResult.success(businessDocumentOrderAdjustService.getAdjustRecord(adjustId)); + } + + /** + * 订单调整 - 审核(通过/驳回) + */ + @ApiOperation("订单调整 - 审核") + @PostMapping("/auditAdjust") + public AjaxResult auditAdjust(@RequestBody BusinessDocumentOrderAdjustAuditDTO auditDTO) { + try { + return businessDocumentOrderAdjustService.auditAdjust(auditDTO); + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } } From f991485ba3493c07038946c8d921bd97f4bbdc03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 19:04:01 +0800 Subject: [PATCH 20/88] =?UTF-8?q?OMS=E8=B0=83=E6=95=B4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 2 +- .../businessDocumentOrder/entity/BusinessDocumentOrder.java | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 44ce3ebbe..fb81d9d13 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -83,7 +83,7 @@ public class BusinessDocumentOrderAdjustService { "orderStatus", "reviewStatus", "reviewId", "review", "reviewTime", "reviewOpinion", "salesManager", "auditStatus", "auditBy", "auditTime", "executeStatus", "executeId", "executeTime", "executor", - "executeOrderId", "executeOrderNumber", "adjustStatus", + "executeOrderId", "executeOrderNumber", "isDelete", "delFlag", "createBy", "createByName", "createTime", "updateBy", "updateByName", "updateTime", "pushStatus", "pushTime", "pushBy", "pushByName", diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java index 823941199..29f15fe9c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java @@ -825,7 +825,4 @@ public class BusinessDocumentOrder extends BaseVOEntity{ @ApiModelProperty("车次") @Excel(name = "车次") private String shuttleNo; - - @ApiModelProperty("业务单调整状态 0-无 1-调整待审核 2-调整驳回 3-调整已通过") - private Integer adjustStatus; } From 7b76d5c20328072aa3dfff1b1422d5df0c912b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 19:38:47 +0800 Subject: [PATCH 21/88] =?UTF-8?q?BI=E6=8E=A5=E5=8F=A3=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/mapper/BiPlatformRealDataMapper.java | 2 +- .../repository/po/RealBusinessTypeStatPO.java | 8 ++++---- .../service/BiPlatformRealDataService.java | 6 +++--- .../bi/interfaces/facadeApi/biReport/BiReportApi.java | 4 ++-- .../biPlatformRealData/BiPlatformRealDataMapper.xml | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java index b99f69b53..d0ac6ff44 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java @@ -41,7 +41,7 @@ public interface BiPlatformRealDataMapper { /** 任务负荷(今日 24 小时) */ List queryTaskLoadToday(); - /** 今日预约-租户统计(按 tenantName 分组统计今日预约数量) */ + /** 今日预约-业务类型统计(按 businessName 分组统计今日预约数量) */ List queryTodayBusinessTypeStats(); /** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */ diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java index 7e4dfb70d..d9df6ab91 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealBusinessTypeStatPO.java @@ -5,15 +5,15 @@ import lombok.Data; import java.io.Serializable; /** - * 今日预约-租户统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS) - * 按租户名称分组统计今日预约数量 + * 今日预约-业务类型统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS) + * 按业务类型分组统计今日预约数量 */ @Data public class RealBusinessTypeStatPO implements Serializable { private static final long serialVersionUID = 1L; - /** 租户名称(qms_main_business.tenantName) */ - private String tenantName; + /** 业务类型名称(qms_main_business.businessName) */ + private String businessName; /** 今日预约数量 */ private Long count; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index 2b4c65556..de0a5597e 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -307,14 +307,14 @@ public class BiPlatformRealDataService { } /** - * 今日预约-租户统计:按租户名称分组统计今日预约数量。 - * 例:今日预约某租户 3 条 → 返回 {tenantName:"某租户", count:3} + * 今日预约-业务类型统计:按业务类型分组统计今日预约数量。 + * 例:今日预约航空打板 3 条 → 返回 {businessName:"航空打板", count:3} */ public List queryTodayBusinessTypeStats() { try { return biPlatformRealDataMapper.queryTodayBusinessTypeStats(); } catch (Exception e) { - log.error("【YMS】统计今日租户预约失败: {}", e.getMessage(), e); + log.error("【YMS】统计今日业务类型失败: {}", e.getMessage(), e); return java.util.Collections.emptyList(); } } diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java index 664ab716b..108afc412 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/BiReportApi.java @@ -122,9 +122,9 @@ public class BiReportApi extends BaseController { } /** - * 今日预约-租户统计(实时查 YMS 库,不落库) + * 今日预约-业务类型统计(实时查 YMS 库,不落库) */ - @ApiOperation(value = "今日预约租户统计", notes = "按租户名称分组统计今日预约数量,实时查询 YMS 库,不落库;例:某租户 3 条") + @ApiOperation(value = "今日预约业务类型统计", notes = "按业务类型分组统计今日预约数量,实时查询 YMS 库,不落库;例:航空打板 3 条") @GetMapping("/businessTypeStats") public BiApiResult> businessTypeStats() { List data = biPlatformRealDataService.queryTodayBusinessTypeStats(); diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index beae38d61..7d8e96670 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -111,15 +111,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS - + From 3907b126d95d63213a536059316db5736dfaa5f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 19:42:39 +0800 Subject: [PATCH 22/88] 31 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index 2572662c1..fa1d95e1a 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # username: nacos # password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 698a8ea9a6dbabd98a2289e34a7d01c4e24920aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 20:34:24 +0800 Subject: [PATCH 23/88] =?UTF-8?q?OMS=E8=B0=83=E6=95=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 19 ++++++++++++++++++- .../BusinessDocumentOrderAdjustDetail.java | 4 ++++ .../BusinessDocumentOrderAdjustRecordDTO.java | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index fb81d9d13..68de46eed 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -250,11 +251,27 @@ public class BusinessDocumentOrderAdjustService { /** * 按业务单查询调整记录(供订单详情页"调整记录"Tab用) + * 每条记录同时带出调整后明细快照(detail),前端可自包含展示,无需再单独调详情接口 */ public List listAdjustRecordByOrder(Long orderId) { BusinessDocumentOrderAdjustQueryDTO query = new BusinessDocumentOrderAdjustQueryDTO(); query.setOrderId(orderId); - return listAdjustRecord(query); + List list = listAdjustRecord(query); + if (list == null || list.isEmpty()) { + return list; + } + // 批量取明细快照按 adjust_id 一次性拼上,避免 N+1 + List adjustIds = list.stream() + .map(BusinessDocumentOrderAdjustRecordDTO::getId) + .collect(Collectors.toList()); + List details = adjustDetailMapper.selectList( + new LambdaQueryWrapper() + .in(BusinessDocumentOrderAdjustDetail::getAdjustId, adjustIds) + .eq(BusinessDocumentOrderAdjustDetail::getDelFlag, 1)); + Map detailMap = details.stream() + .collect(Collectors.toMap(BusinessDocumentOrderAdjustDetail::getAdjustId, d -> d, (a, b) -> a)); + list.forEach(vo -> vo.setDetail(detailMap.get(vo.getId()))); + return list; } /** diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java index 178d53c4b..2587cb23d 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java @@ -3,6 +3,8 @@ package com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -24,9 +26,11 @@ public class BusinessDocumentOrderAdjustDetail implements Serializable { @ApiModelProperty("主键") @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) private Long id; @ApiModelProperty("关联调整主记录ID") + @JsonSerialize(using = ToStringSerializer.class) private Long adjustId; @ApiModelProperty("业务单ID") diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java index 1a5a73888..239c67d04 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java @@ -1,5 +1,7 @@ package com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity.BusinessDocumentOrderAdjustDetail; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -16,6 +18,7 @@ public class BusinessDocumentOrderAdjustRecordDTO implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("主记录ID") + @JsonSerialize(using = ToStringSerializer.class) private Long id; @ApiModelProperty("业务单ID") From 0493030620bea438c4b28f4cdd266fdbe29a0ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 22:02:31 +0800 Subject: [PATCH 24/88] =?UTF-8?q?BI=E6=9C=88=E5=8F=B0=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=87=86=E6=97=B6=E7=8E=87=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BiPlatformRealDataService.java | 9 ++++----- .../service/BiReportSnapshotSyncService.java | 4 +--- .../biPlatformRealData/BiPlatformRealDataMapper.xml | 9 +++++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index de0a5597e..6eb351b2d 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -194,9 +194,8 @@ public class BiPlatformRealDataService { } /** - * 今日作业准时率 = 准时车辆数 / 今日预约车辆总数 × 100% - * 准时:今日(TARGET_DATE=今天)已进场且实际进场时间不超过该预约的预约结束时间 bookingEndTime; - * 实际进场时间超过 bookingEndTime 视为不准时。 + * 今日作业准时率 = 今日准时车辆数 / 今日预约总数 × 100%(四舍五入取整) + * 准时:实际进入时间 < 预约日期(TARGET_DATE) + 预约结束时间(BOOKING_END_TIME)。 * 今日预约总数为 0 时返回 0。 */ public int calcTodayOnTimeRate() { @@ -206,7 +205,7 @@ public class BiPlatformRealDataService { long total = po.getTotal() == null ? 0L : po.getTotal(); long onTime = po.getOnTimeCount() == null ? 0L : po.getOnTimeCount(); if (total <= 0) return 0; - // 四舍五入到整数百分比 + // 四舍五入到整数百分比(取整) return (int) Math.round(((double) onTime / (double) total) * 100.0); } catch (Exception e) { log.error("【YMS】计算今日作业准时率失败: {}", e.getMessage(), e); @@ -394,7 +393,7 @@ public class BiPlatformRealDataService { template.getPlatformOverview().setCurrentOccupancyRate(rate); template.getPlatformOverview().setTodayTasks(todayTasks); - // 作业准时率:准时车辆数 / 今日预约总数 × 100%(今日总数为 0 时返回 0) + // 作业准时率(实际进入时间 < 预约日期+预约结束时间 的车辆 / 今日预约总数 × 100% 取整) if (template.getEfficiencyStatistics() != null) { template.getEfficiencyStatistics().setPlatformOnTimeRate(calcTodayOnTimeRate()); } diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java index a149ecf61..297a1331e 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java @@ -194,9 +194,7 @@ public class BiReportSnapshotSyncService { template.getPlatformOverview().setCurrentOccupancyRate(rate); template.getPlatformOverview().setTodayTasks(todayTasks); - // 作业准时率 = 准时车辆数 / 今日预约总数 × 100% - // 准时:今日(TARGET_DATE=今天)已进场且 ENTRY_TIME <= bookingEndTime(预约结束时间),超过视为不准时 - // 今日预约总数 = 0 时返回 0 + // 作业准时率 = 实际进入时间 < 预约日期+预约结束时间 的车辆 / 今日预约总数 × 100%(取整) if (template.getEfficiencyStatistics() != null) { template.getEfficiencyStatistics().setPlatformOnTimeRate(biPlatformRealDataService.calcTodayOnTimeRate()); } diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index 7d8e96670..10fc82463 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -50,16 +50,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" From dea39a1a4bc44892b1a9dd663c33f12c63d8a819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 22:05:47 +0800 Subject: [PATCH 25/88] 30 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index fa1d95e1a..2572662c1 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # username: nacos # password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From ba5d78b36c2072c0929bcd7a1cab258523d8416d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 9 Sep 2026 23:40:33 +0800 Subject: [PATCH 26/88] =?UTF-8?q?=E5=87=86=E6=97=B6=E7=8E=87=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BiPlatformRealDataService.java | 4 ++-- .../biPlatformRealData/BiPlatformRealDataMapper.xml | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index 6eb351b2d..05fe35cb3 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -194,9 +194,9 @@ public class BiPlatformRealDataService { } /** - * 今日作业准时率 = 今日准时车辆数 / 今日预约总数 × 100%(四舍五入取整) + * 今日作业准时率 = 今日准时车辆数 / 今日有入场时间的车辆数 × 100%(四舍五入取整) * 准时:实际进入时间 < 预约日期(TARGET_DATE) + 预约结束时间(BOOKING_END_TIME)。 - * 今日预约总数为 0 时返回 0。 + * 分子分母都只统计有入场时间(ENTRY_TIME 不为空)的车辆;分母为 0 时返回 0。 */ public int calcTodayOnTimeRate() { try { diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index 10fc82463..6f9852c18 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -49,14 +49,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file From 8a31ed997495182924f831e484698ac125b7725e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 11:46:34 +0800 Subject: [PATCH 30/88] =?UTF-8?q?BI=E6=9C=88=E5=8F=B0=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BiPlatformRealDataMapper.java | 2 +- .../repository/po/RealTaskTypeStatPO.java | 10 ++--- .../service/BiPlatformRealDataService.java | 37 ++++++++----------- .../service/BiReportSnapshotSyncService.java | 2 +- .../BiSnapshotWeeklyRandomDataBuilder.java | 1 + .../BiPlatformRealDataMapper.xml | 21 +++++------ 6 files changed, 33 insertions(+), 40 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java index d0ac6ff44..9119cec13 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java @@ -47,7 +47,7 @@ public interface BiPlatformRealDataMapper { /** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */ RealOnTimeStatPO queryTodayOnTimeStats(); - /** 任务类型统计(当月 OMS 运输订单按业务类型分组:1-跨境 2-国内) */ + /** 任务类型统计(本月 YMS QMS_MAIN_BUSINESS 预约按业务类型 BUSINESS_NAME 分组) */ List queryMonthTransportOrderByType(); /** 月台监控-按楼层统计月台车辆(楼层、月台数量、今日预约车辆、当前作业车辆) */ diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java index 5f0a29c3c..bf73ec4b9 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java @@ -5,16 +5,16 @@ import lombok.Data; import java.io.Serializable; /** - * 任务类型统计(真实数据,来自 NGWL_TEST_OMS.BUSINESS_DOCUMENT_ORDER 运输订单) - * 按业务类型 businessCategory 分组统计当月数量:1-跨境运输 2-国内运输 + * 任务类型统计(真实数据,来自 NGWL_TEST_YMS.QMS_MAIN_BUSINESS 预约登记表) + * 按本月预约车辆数(TARGET_DATE 在当前月)以 BUSINESS_NAME 业务类型分组 */ @Data public class RealTaskTypeStatPO implements Serializable { private static final long serialVersionUID = 1L; - /** 业务类型:1-跨境 2-国内 */ - private Integer businessCategory; + /** 业务类型名称(qms_main_business.BUSINESS_NAME) */ + private String businessName; - /** 该类型当月单量 */ + /** 该业务类型本月预约车辆数 */ private Long count; } \ No newline at end of file diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index 05fe35cb3..83acdfa23 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -270,39 +270,32 @@ public class BiPlatformRealDataService { } /** - * 任务类型统计:当月 OMS 运输订单按业务类型分组(1-跨境运输,2-国内运输)。 - * 返回 {totalTasks: 当月跨境+国内运输总单量, taskTypes: [{type, count}]} - * 查询失败时返回空结构,不影响写死字段。 - */ - /** - * 任务类型统计:固定输出「跨境运输」「国内运输」两类,count 取当月 OMS 业务单真实单量; - * 当月无数据或查询失败时仍返回两类、count=0(不使用写死模板兜底)。 + * 任务类型统计:本月(YMS QMS_MAIN_BUSINESS)预约车辆按业务类型 BUSINESS_NAME 分组; + * 返回 {totalTasks: 当月总预约车辆数, taskTypes: [{type: 业务类型名称, count: 该类型预约数}]} + * 按真实 BUSINESS_NAME 分组输出,不固定兜底类别;当月无数据或查询失败时返回空列表。 */ public TaskTypeStatisticsVO queryMonthTransportOrderByType() { - int crossBorder = 0; // 跨境运输 BUSINESS_CATEGORY=1 - int domestic = 0; // 国内运输 BUSINESS_CATEGORY=2 + List items = new ArrayList<>(); + int total = 0; try { List rows = biPlatformRealDataMapper.queryMonthTransportOrderByType(); if (rows != null) { for (RealTaskTypeStatPO r : rows) { - if (r == null || r.getBusinessCategory() == null || r.getCount() == null) { + if (r == null || r.getBusinessName() == null || r.getCount() == null) { continue; } - if (r.getBusinessCategory() == 1) { - crossBorder = r.getCount().intValue(); - } else if (r.getBusinessCategory() == 2) { - domestic = r.getCount().intValue(); - } + int c = r.getCount().intValue(); + items.add(TaskTypeCountItemVO.builder().type(r.getBusinessName()).count(c).build()); + total += c; } } } catch (Exception e) { - log.error("【OMS】统计当月运输订单业务类型失败: {}", e.getMessage(), e); - // 失败时不回退写死模板,保持两类 count=0 + log.error("【YMS】统计当月预约业务类型失败: {}", e.getMessage(), e); + // 查询失败返回空列表(前端会显示空) + items = new ArrayList<>(); + total = 0; } - List items = new ArrayList<>(); - items.add(TaskTypeCountItemVO.builder().type("跨境运输").count(crossBorder).build()); - items.add(TaskTypeCountItemVO.builder().type("国内运输").count(domestic).build()); - return TaskTypeStatisticsVO.builder().totalTasks(crossBorder + domestic).taskTypes(items).build(); + return TaskTypeStatisticsVO.builder().totalTasks(total).taskTypes(items).build(); } /** @@ -447,7 +440,7 @@ public class BiPlatformRealDataService { } } - // 任务类型统计:当月 OMS 业务单真实数据(固定跨境运输/国内运输两类,不使用写死模板兜底) + // 任务类型统计:本月 YMS QMS_MAIN_BUSINESS 按业务类型 BUSINESS_NAME 分组(真实业务数据) template.setTaskTypeStatistics(queryMonthTransportOrderByType()); return template; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java index 297a1331e..d32603d17 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java @@ -248,7 +248,7 @@ public class BiReportSnapshotSyncService { } } - // ====== 真实数据:任务类型统计(当月 OMS 业务单,固定跨境运输/国内运输两类,不使用写死模板兜底) ====== + // ====== 真实数据:任务类型统计(本月 YMS QMS_MAIN_BUSINESS 按业务类型 BUSINESS_NAME 分组) ====== template.setTaskTypeStatistics(biPlatformRealDataService.queryMonthTransportOrderByType()); return template; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index 81a872259..c251c73f1 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -206,6 +206,7 @@ public final class BiSnapshotWeeklyRandomDataBuilder { handled = Math.min(handled, todayAl); int unhandled = Math.max(0, todayAl - handled); + // 月台告警分布:按业务要求,全部置 0 List dist = new ArrayList<>(); for (int i = 0; i < Baseline.P_DIST_T.length; i++) { dist.add(PlatformAlarmDistItemVO.builder() diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index 6f9852c18..03c071e2c 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -148,19 +148,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY 1 DESC - + From b57db4b8cce96faeaad32d87d0e34c5998a3659a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 11:49:34 +0800 Subject: [PATCH 31/88] 30 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index fa1d95e1a..2572662c1 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # username: nacos # password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 3276792bb596e03852c8c29c9ca4f2deb22ea299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 13:20:07 +0800 Subject: [PATCH 32/88] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BiPlatformRealDataService.java | 6 ++++++ .../BiSnapshotWeeklyRandomDataBuilder.java | 21 ++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index 83acdfa23..1905737fe 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -153,6 +153,12 @@ public class BiPlatformRealDataService { } fp.put("taskTypeStatistics", m); } + // 月台告警统计:按业务要求恒为 0,纳入指纹以确保旧快照(可能含非0写死值)能被覆盖更新为 0 + if (vo.getPlatformAlarmStatistics() != null) { + fp.put("todayAlarmTotal", vo.getPlatformAlarmStatistics().getTodayAlarmTotal()); + fp.put("handled", vo.getPlatformAlarmStatistics().getHandled()); + fp.put("unhandled", vo.getPlatformAlarmStatistics().getUnhandled()); + } return objectMapper.writeValueAsString(fp); } diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index c251c73f1..60b0b4ebd 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -185,13 +185,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder { .build()); } + // 月台告警:按业务要求,全部置 0(趋势/统计/分布均不生成写死数据) List alarmTrend = new ArrayList<>(); - for (int i = 0; i < Baseline.P_AL_D.length; i++) { - alarmTrend.add(PlatformAlarmTrendItemVO.builder() - .date(Baseline.P_AL_D[i]) - .alarmCount(Math.max(0, jitterInt(Baseline.P_AL_C[i], r))) - .build()); - } List typeCounts = new ArrayList<>(); for (int i = 0; i < Baseline.P_TT_TYPES.length; i++) { @@ -201,19 +196,11 @@ public final class BiSnapshotWeeklyRandomDataBuilder { .build()); } - int todayAl = Math.max(0, jitterInt(Baseline.P_AL_TOT, r)); - int handled = Math.max(0, jitterInt(Baseline.P_AL_H, r)); - handled = Math.min(handled, todayAl); - int unhandled = Math.max(0, todayAl - handled); + int todayAl = 0; + int handled = 0; + int unhandled = 0; - // 月台告警分布:按业务要求,全部置 0 List dist = new ArrayList<>(); - for (int i = 0; i < Baseline.P_DIST_T.length; i++) { - dist.add(PlatformAlarmDistItemVO.builder() - .type(Baseline.P_DIST_T[i]) - .count(Math.max(0, jitterInt(Baseline.P_DIST_C[i], r))) - .build()); - } return PlatformSurveillanceVO.builder() .vehicles(vehicles) From 3387d1712d58b610ef6b1a878482c156c14de4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 10 Sep 2026 15:33:51 +0800 Subject: [PATCH 33/88] =?UTF-8?q?=E7=BA=A2=E5=86=B2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 16 ++ .../ReceiptManageApplicationService.java | 2 - .../domain/billManage/entity/BillManage.java | 4 +- .../repository/po/BillManagePO.java | 4 +- .../repository/todo/BillManageDO.java | 4 +- .../service/BillManageDomainService.java | 181 ++++++++++++++++++ .../entity/BillOperationLog.java | 4 +- .../repository/po/BillOperationLogPO.java | 4 +- .../repository/todo/BillOperationLogDO.java | 4 +- .../constant/BillLogsConstants.java | 7 + .../dto/billManage/BillManageDTO.java | 8 +- .../dto/billManage/BillManageExportVO.java | 2 +- .../billOperationLog/BillOperationLogDTO.java | 4 +- .../interfaces/facadeApi/BillManageApi.java | 32 ++++ 14 files changed, 257 insertions(+), 19 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index 9105acf2c..a8658a955 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -626,6 +626,22 @@ public class BillManageApplicationService { return originalBill; } + + /** + * 应收账单-红冲 + */ + @Transactional + public Boolean redFlushBill(BillManageDTO billManageDTO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + if (billManageDTO.getBillManageId() == null) { + throw new ServiceException("账单id不能为空"); + } + return billManageDomainService.redFlushBill(billManageDTO); + } + /** * 应收账单-客户确认 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java index 12cba2fde..ab4a85b5a 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java @@ -156,8 +156,6 @@ public class ReceiptManageApplicationService { if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } - //校验支付密码 - CheckPasswordUtil.checkPayPassword(receiptManageDO.getPayPassword(),null); return receiptManageDomainService.cancelCollection(receiptManageDO); } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java index a54201841..9e976a3ab 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java @@ -47,8 +47,8 @@ public class BillManage extends BaseVOEntity{ @Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付") private Integer billType; - @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款)") - @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款") + @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲)") + @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲") private Integer billState; @ApiModelProperty("账单流程节点(1-发起对账,2-客户确认,3-财务审核,4-收款/付款)") diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java index 9a3225e96..40514e1ad 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java @@ -52,8 +52,8 @@ public class BillManagePO extends BaseVOEntity{ @Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付") private Integer billType; - @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款)") - @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款") + @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲)") + @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲") private Integer billState; @ApiModelProperty("账单流程节点(1-发起对账,2-客户确认,3-财务审核,4-收款/付款)") diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java index 142b263d2..8ce1ce70f 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java @@ -47,8 +47,8 @@ public class BillManageDO extends BaseVOEntity{ @Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付") private Integer billType; - @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款)") - @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款") + @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲)") + @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲") private Integer billState; @ApiModelProperty("账单流程节点(1-发起对账,2-客户确认,3-财务审核,4-收款/付款)") diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index aa2b88a53..8272bfe5e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -14,6 +14,7 @@ import com.mhd.bms.domain.billManage.repository.todo.BillDetailDO; import com.mhd.bms.domain.billManage.repository.todo.BillManageDO; import com.mhd.bms.interfaces.dto.billManage.CustomerMonthBillVO; import com.mhd.bms.domain.billOperationLog.entity.BillOperationLog; +import com.mhd.bms.domain.billOperationLog.repository.po.BillOperationLogPO; import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO; import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService; import com.mhd.bms.domain.billingStatement.entity.BillingStatement; @@ -45,6 +46,7 @@ import com.mhd.common.security.utils.SecurityUtils; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -747,6 +749,185 @@ public class BillManageDomainService { return flag && three; } + + /** + * 应收账单红冲:生成一条金额为负数的红冲账单对冲原账单,不操作收款单等数据 + */ + public Boolean redFlushBill(BillManageDTO billManageDTO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + if (null == billManageDTO.getBillManageId()) { + throw new ServiceException("账单id不能为空"); + } + BillManage originalBill = billManageService.getById(billManageDTO.getBillManageId()); + if (null == originalBill || ObjectUtil.equal(originalBill.getDelFlag(), 2)) { + throw new ServiceException("原账单信息未找到,请刷新后重试"); + } + if (ObjectUtil.equal(originalBill.getBillType(), 2)) { + throw new ServiceException("仅支持应收账单红冲"); + } + if (!ObjectUtil.equal(originalBill.getBillState(), 5)) { + throw new ServiceException("仅已收款状态的账单可以红冲,请刷新后重试"); + } + //校验账单是否已红冲,避免重复生成红冲账单 + BillOperationLogDO redFlushLogQuery = new BillOperationLogDO(); + redFlushLogQuery.setBillManageId(originalBill.getBillManageId()); + redFlushLogQuery.setOperationType(13); + List redFlushLogList = billOperationLogDomainService.queryList(redFlushLogQuery); + if (null != redFlushLogList && redFlushLogList.stream().anyMatch(info -> ObjectUtil.equal(info.getDelFlag(), 1))) { + throw new ServiceException("该账单已红冲,不能重复红冲"); + } + //生成红冲账单编号 + String billNumber = OrderSequence.getOrderCode("ZD"); + BigDecimal redFlushAmount = negateAmount(originalBill.getBillAmount()); + //构建红冲账单,金额全部取负对冲原账单 + BillManage redBill = new BillManage(); + BeanUtils.copyProperties(originalBill, redBill); + redBill.setBillManageId(null); + redBill.setBillNumber(billNumber); + redBill.setBillAmount(redFlushAmount); + redBill.setBillTotalAmount(negateAmount(originalBill.getBillTotalAmount())); + redBill.setBillDiscountAmount(negateAmount(originalBill.getBillDiscountAmount())); + redBill.setBillAmountSettlement(negateAmount(originalBill.getBillAmountSettlement())); + redBill.setBillAmountUnsettled(BigDecimal.ZERO); + redBill.setActualReceivedAmount(negateAmount(originalBill.getActualReceivedAmount())); + redBill.setSettlementDiscountsAmount(negateAmount(originalBill.getSettlementDiscountsAmount())); + redBill.setTaxAmount(negateAmount(originalBill.getTaxAmount())); + redBill.setTaxFreeFee(negateAmount(originalBill.getTaxFreeFee())); + //红冲账单状态为红冲、已核对无误 + redBill.setBillState(8); + redBill.setBillStep(4); + redBill.setReconciliationStatus(4); + redBill.setSettlementTime(new Date()); + //重置对账、审核、开票、同步等状态,红冲账单不需要再走这些流程 + redBill.setBillExpectedAmount(null); + redBill.setReconciliationOpinion(null); + redBill.setVoucherAddress(null); + redBill.setFinancialReviewFlag(null); + redBill.setFinancialReviewOpinion(null); + redBill.setIsInvoice(0); + redBill.setInvoiceId(null); + redBill.setInvoiceMakeTime(null); + redBill.setApplyNumber(null); + redBill.setSynchronousStatus(0); + redBill.setSynchronousTime(null); + redBill.setNcId(null); + redBill.setSkSynchronousStatus(0); + redBill.setSkSynchronousTime(null); + redBill.setSkNcId(null); + //红冲原因写入账单备注 + String billRemark = "红冲原账单编号:" + originalBill.getBillNumber(); + if (StringUtils.isNotEmpty(billManageDTO.getRedFlushRemark())) { + billRemark = billRemark + ",红冲原因:" + billManageDTO.getRedFlushRemark(); + } + redBill.setBillRemark(billRemark); + redBill.setDelFlag(1); + redBill.setCreateBy(loginUser.getUserid()); + redBill.setCreateByName(loginUser.getUserPo().getUserName()); + redBill.setCreateTime(new Date()); + redBill.setUpdateBy(loginUser.getUserid()); + redBill.setUpdateByName(loginUser.getUserPo().getUserName()); + redBill.setUpdateTime(new Date()); + Boolean flag = billManageService.save(redBill); + if (!flag || null == redBill.getBillManageId()) { + throw new ServiceException("生成红冲账单失败"); + } + //镜像红冲计费流水(金额取负),并记录原流水id与新流水的映射 + Map statementMapping = new HashMap<>(); + List originalStatementList = billingStatementDomainService.getDetailsByManageId(originalBill.getBillManageId()); + if (null != originalStatementList && originalStatementList.size() > 0) { + for (BillingStatementPO originalStatement : originalStatementList) { + BillingStatementDO redStatement = new BillingStatementDO(); + BeanUtils.copyProperties(originalStatement, redStatement); + redStatement.setBillingStatementId(null); + redStatement.setBillManageId(redBill.getBillManageId()); + redStatement.setBillingFlow(OrderSequence.getOrderCode("JFLS")); + redStatement.setBillingAmount(negateAmount(originalStatement.getBillingAmount())); + redStatement.setTaxAmount(negateAmount(originalStatement.getTaxAmount())); + redStatement.setTaxFreeFee(negateAmount(originalStatement.getTaxFreeFee())); + redStatement.setBillingState(3); + redStatement.setRedFlushState(1); + redStatement.setRedFlushRemark("红冲自计费流水:" + originalStatement.getBillingFlow()); + redStatement.setReviewRemarks(null); + redStatement.setBusinessDocumentId(null); + redStatement.setDelFlag(1); + redStatement.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + redStatement.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + redStatement.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + redStatement.setCreateBy(loginUser.getUserid()); + redStatement.setCreateByName(loginUser.getUserPo().getUserName()); + redStatement.setCreateTime(new Date()); + redStatement.setUpdateBy(loginUser.getUserid()); + redStatement.setUpdateByName(loginUser.getUserPo().getUserName()); + redStatement.setUpdateTime(new Date()); + redStatement.setBillingStatementId(billingStatementDomainService.insertAndReturnId(redStatement)); + statementMapping.put(originalStatement.getBillingStatementId(), redStatement); + } + } + //镜像红冲账单明细(金额取负),并关联新计费流水 + Boolean flagTwo = true; + LambdaQueryWrapper detailQueryWrapper = new LambdaQueryWrapper<>(); + detailQueryWrapper.eq(BillDetail::getBillManageId, originalBill.getBillManageId()); + detailQueryWrapper.eq(BillDetail::getDelFlag, 1); + List originalDetailList = billDetailDomainService.queryByLambda(detailQueryWrapper); + if (null != originalDetailList && originalDetailList.size() > 0) { + List redDetailList = new ArrayList<>(); + for (BillDetail originalDetail : originalDetailList) { + BillDetail redDetail = new BillDetail(); + BeanUtils.copyProperties(originalDetail, redDetail); + redDetail.setBillDetailId(null); + redDetail.setBillManageId(redBill.getBillManageId()); + redDetail.setBillNumber(billNumber); + redDetail.setBillingTotalAmount(negateAmount(originalDetail.getBillingTotalAmount())); + redDetail.setBillingAmount(negateAmount(originalDetail.getBillingAmount())); + redDetail.setBillingDiscountAmount(negateAmount(originalDetail.getBillingDiscountAmount())); + redDetail.setTaxAmount(negateAmount(originalDetail.getTaxAmount())); + redDetail.setTaxFreeFee(negateAmount(originalDetail.getTaxFreeFee())); + redDetail.setBillingExpectedAmount(null); + BillingStatementDO redStatement = statementMapping.get(originalDetail.getBillingStatementId()); + if (null != redStatement) { + redDetail.setBillingStatementId(redStatement.getBillingStatementId()); + redDetail.setBillingFlow(redStatement.getBillingFlow()); + } else { + redDetail.setBillingStatementId(null); + redDetail.setBillingFlow(null); + } + redDetail.setDelFlag(1); + redDetail.setCreateBy(loginUser.getUserid()); + redDetail.setCreateByName(loginUser.getUserPo().getUserName()); + redDetail.setCreateTime(new Date()); + redDetail.setUpdateBy(loginUser.getUserid()); + redDetail.setUpdateByName(loginUser.getUserPo().getUserName()); + redDetail.setUpdateTime(new Date()); + redDetailList.add(redDetail); + } + flagTwo = billDetailDomainService.insertBatch(redDetailList); + } + //红冲账单保存创建账单操作日志 + BillOperationLogDO redBillLog = new BillOperationLogDO(); + redBillLog.setBillManageId(redBill.getBillManageId()); + redBillLog.setOperationInfo(StringUtils.format(BillLogsConstants.create_bill_text, billNumber, redFlushAmount)); + redBillLog.setOperationType(1); + Boolean flagThree = billOperationLogDomainService.saveBillOperationLog(redBillLog); + //原账单保存红冲操作日志 + BillOperationLogDO originalBillLog = new BillOperationLogDO(); + originalBillLog.setBillManageId(originalBill.getBillManageId()); + originalBillLog.setOperationInfo(StringUtils.format(BillLogsConstants.red_flush_bill_text, billNumber, null == redFlushAmount ? BigDecimal.ZERO : redFlushAmount.abs())); + originalBillLog.setOperationType(13); + Boolean flagFour = billOperationLogDomainService.saveBillOperationLog(originalBillLog); + return flag && flagTwo && flagThree && flagFour; + } + + + /** + * 金额取负(空值返回null) + */ + private BigDecimal negateAmount(BigDecimal amount) { + return null == amount ? null : amount.negate(); + } + /** * 更改账单状态(付款) */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/entity/BillOperationLog.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/entity/BillOperationLog.java index 846162667..66100c285 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/entity/BillOperationLog.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/entity/BillOperationLog.java @@ -42,8 +42,8 @@ public class BillOperationLog extends BaseVOEntity{ @Excel(name = "账单管理id") private Long billManageId; - @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款)") - @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款") + @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲)") + @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲") private Integer operationType; @ApiModelProperty("操作信息") diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/po/BillOperationLogPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/po/BillOperationLogPO.java index 602f7370b..91f097ea5 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/po/BillOperationLogPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/po/BillOperationLogPO.java @@ -41,8 +41,8 @@ public class BillOperationLogPO extends BaseVOEntity{ @Excel(name = "账单管理id") private Long billManageId; - @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款)") - @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款") + @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲)") + @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲") private Integer operationType; @ApiModelProperty("操作信息") diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/todo/BillOperationLogDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/todo/BillOperationLogDO.java index 3780e833e..876c0bbe3 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/todo/BillOperationLogDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/todo/BillOperationLogDO.java @@ -42,8 +42,8 @@ public class BillOperationLogDO extends BaseVOEntity{ @Excel(name = "账单管理id") private Long billManageId; - @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款)") - @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款") + @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲)") + @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲") private Integer operationType; @ApiModelProperty("操作信息") diff --git a/mhd_bms/src/main/java/com/mhd/bms/infrastructure/constant/BillLogsConstants.java b/mhd_bms/src/main/java/com/mhd/bms/infrastructure/constant/BillLogsConstants.java index 0df79851a..f63bb1fca 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/infrastructure/constant/BillLogsConstants.java +++ b/mhd_bms/src/main/java/com/mhd/bms/infrastructure/constant/BillLogsConstants.java @@ -112,4 +112,11 @@ public class BillLogsConstants public static final String copy_bill_text = "原账单编号:{},新账单编号:{}"; + /** + * 红冲账单 + * 红冲账单编号:{},红冲金额:{}元 + */ + public static final String red_flush_bill_title = "红冲账单"; + public static final String red_flush_bill_text = "红冲账单编号:{},红冲金额:{}元"; + } diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java index 324daf50e..253b83485 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java @@ -47,8 +47,8 @@ public class BillManageDTO extends BaseVOEntity{ @Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付") private Integer billType; - @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款)") - @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款") + @ApiModelProperty("账单状态(1-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲)") + @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲") private Integer billState; @ApiModelProperty("账单流程节点(1-发起对账,2-客户确认,3-财务审核,4-收款/付款)") @@ -279,4 +279,8 @@ public class BillManageDTO extends BaseVOEntity{ @ApiModelProperty("账单月份(yyyy-MM,按创建时间月份筛选,用于客户月账单分组查询)") private String billMonth; + + @ApiModelProperty("红冲原因") + @Excel(name = "红冲原因") + private String redFlushRemark; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java index e7ce56b74..a0ae318ec 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java @@ -28,7 +28,7 @@ public class BillManageExportVO { @Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付") private Integer billType; - @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款") + @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款,8-红冲") private Integer billState; @Excel(name = "账单流程节点", readConverterExp = "1=-发起对账,2-客户确认,3-财务审核,4-收款/付款") diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billOperationLog/BillOperationLogDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billOperationLog/BillOperationLogDTO.java index 14d064baf..2dbad9cec 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billOperationLog/BillOperationLogDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billOperationLog/BillOperationLogDTO.java @@ -40,8 +40,8 @@ public class BillOperationLogDTO extends BaseVOEntity{ @Excel(name = "账单管理id") private Long billManageId; - @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款)") - @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款") + @ApiModelProperty("操作类型(1-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲)") + @Excel(name = "操作类型", readConverterExp = "1=-创建账单,2-调整账单,3-确认账单,4-发起对账,5-客户确认,6-财务审核,7-收款,8-作废账单,9-删除账单,10-退款,11-付款,12-撤销收款,13-红冲") private Integer operationType; @ApiModelProperty("操作信息") diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java index dc9f21990..43c735d11 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java @@ -396,6 +396,38 @@ public class BillManageApi extends BaseController{ } + @ApiOperation("应收账单-红冲") + @PostMapping("/redFlushBill") + public AjaxResult redFlushBill(@RequestBody BillManageDTO billManageDTO) + { + if(billManageDTO.getBillManageId() == null){ + throw new ServiceException("账单id不能为空"); + } + //加锁 + RLock lock = null; + RedisLockTypeEnum redisLockTypeEnum = RedisLockTypeEnum.BMS; + String key = redisLockTypeEnum.getUniqueKey(UniqueKeyUtil.getBillingKey(String.valueOf(billManageDTO.getBillManageId()))); + try { + lock = redisLock.getRLock(key); + //尝试获取锁 不等待 持有锁10分钟 + if (!lock.tryLock(-1, 10, TimeUnit.MINUTES)) { + lock = null; + throw new ServiceException("账单正在操作中,请稍后重试"); + } + log.info("红冲账单加锁成功"); + billManageApplicationService.redFlushBill(billManageDTO); + return AjaxResult.success("操作成功"); + }catch (Exception e){ + return AjaxResult.error("红冲账单失败:"+e.getMessage()); + } finally { + if (lock != null && lock.isHeldByCurrentThread()){ + lock.unlock(); + log.info("红冲账单释放锁成功"); + } + } + } + + @ApiOperation("应收账单-客户确认") @PostMapping("/customerConfirmation") public AjaxResult customerConfirmation(@RequestBody BillManageDTO billManageDTO) From 65fdac535490947d0d6794ca90adebe3524d9e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 10 Sep 2026 16:18:32 +0800 Subject: [PATCH 34/88] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8F=91=E7=A5=A8;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 532 +++++++++++++++++- 1 file changed, 531 insertions(+), 1 deletion(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index bf8388111..e585c16ab 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mhd.bms.application.server.billManage.BillManageApplicationService; +import com.mhd.bms.domain.billManage.entity.BillDetail; +import com.mhd.bms.domain.billManage.entity.BillManage; +import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService; +import com.mhd.bms.domain.billManage.repository.facade.IBillManageService; import com.mhd.bms.domain.billManage.repository.po.BillManagePO; import com.mhd.bms.domain.billManage.service.BillManageDomainService; import com.mhd.bms.domain.billingStatement.entity.BillingStatement; @@ -16,6 +20,10 @@ import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO; import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementCollectDO; import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO; import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService; +import com.mhd.bms.domain.bmsInvoiceList.repository.facade.IBmsInvoiceListService; +import com.mhd.bms.domain.bmsInvoiceList.repository.todo.BmsInvoiceListAddDTO; +import com.mhd.bms.domain.bmsMakeOutInvoice.entity.BmsMakeOutInvoice; +import com.mhd.bms.domain.bmsMakeOutInvoiceItem.entity.BmsMakeOutInvoiceItem; import com.mhd.bms.domain.businessDocument.entity.BusinessDocument; import com.mhd.bms.domain.businessDocument.repository.facade.IBusinessDocumentService; import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO; @@ -27,6 +35,7 @@ import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.Settle import com.mhd.bms.infrastructure.feign.vo.ContractManagePO; import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO; import com.mhd.bms.interfaces.assembler.billingStatement.BillingStatementAssembler; +import com.mhd.bms.interfaces.dto.billManage.BillManageDTO; import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO; import com.mhd.common.core.domain.po.OrganizationPo; import com.mhd.common.core.domain.po.SysDictDataVo; @@ -85,7 +94,12 @@ public class BillingStatementApplicationService { private SettlementCustomersMapper settlementCustomersMapper; @Autowired private SettlementCustomersParametersMapper settlementCustomersParametersMapper; - + @Autowired + private IBmsInvoiceListService bmsInvoiceListService; + @Autowired + private IBillManageService billManageService; + @Autowired + private IBillDetailService billDetailService; /** * 分页查询计费流水列表 @@ -867,6 +881,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } else { @@ -933,6 +990,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1014,6 +1114,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1102,6 +1245,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } else { @@ -1168,6 +1354,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1249,6 +1478,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1333,6 +1605,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } else { @@ -1399,6 +1714,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1480,6 +1838,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1568,6 +1969,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } else { @@ -1634,6 +2078,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } @@ -1715,6 +2202,49 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTopOrganizationId(topOrganizationId); billingStatementDTO1.setOrganizationName(organizationName); generateBillsJob(billingStatementDTO1); + Long billManageId = billingStatementDTO1.getBillManageId(); + if (ObjectUtil.isNotNull(billManageId)) { + //确认账单 + BillManageDTO params = new BillManageDTO(); + params.setBillManageIds(String.valueOf(billManageId)); + billManageApplicationService.confirmBilling(params); + //申请发票 + BillManage billManage = billManageService.getById(billManageId); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, billManageId) + .eq(BillDetail::getDelFlag, 1)); + BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); + tmsInvoiceListAddDTO.setBillManageId(billManageId); + + if (ObjectUtil.isNotNull(billManage)) { + tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); + tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); + tmsInvoiceListAddDTO.setSettlementEntity(billManage.getSettlementEntity()); + } + List bmsMakeOutInvoices = new ArrayList<>(); + BmsMakeOutInvoice bmsMakeOutInvoice = new BmsMakeOutInvoice(); + bmsMakeOutInvoice.setActualInvoiceCustomerId(String.valueOf(billManage.getSettlementCustomersId())); + bmsMakeOutInvoice.setActualInvoiceCustomerName(billManage.getSettlementEntity()); + + + List bmsMakeOutInvoiceItems = new ArrayList<>(); + for (BillDetail billDetail : billDetails) { + BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem = new BmsMakeOutInvoiceItem(); + bmsMakeOutInvoiceItem.setInvoiceItem(billDetail.getInvoiceItem()); + bmsMakeOutInvoiceItem.setFeeType(billDetail.getFeeType()); + bmsMakeOutInvoiceItem.setInvoiceValue(billDetail.getBillingAmount()); + bmsMakeOutInvoiceItem.setTaxAmount(billDetail.getTaxAmount()); + bmsMakeOutInvoiceItem.setTaxFreeFee(billDetail.getTaxFreeFee()); + bmsMakeOutInvoiceItem.setTaxRate(billDetail.getTaxRate()); + bmsMakeOutInvoiceItem.setRemark("系统定时生成发票"); + bmsMakeOutInvoiceItems.add(bmsMakeOutInvoiceItem); + } + bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItems); + bmsMakeOutInvoices.add(bmsMakeOutInvoice); + tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); + + bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + } } } } From 9704dbfb07e236031a1fe937dd8afb3e9d0bd9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 16:20:59 +0800 Subject: [PATCH 35/88] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=A6=86=E7=9B=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../materialBaseInfo/MaterialBaseInfoApplicationService.java | 5 +++-- .../materialBaseInfo/MaterialBaseInfoAsyncService.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java index 0a9729fd3..45db356c2 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java @@ -573,10 +573,11 @@ public class MaterialBaseInfoApplicationService { normalizeImportBarCodeWhenDuplicateOfHs(row); fillIdsFromExistingMasterData(row); fillOrganizationFromShipperIfNeeded(row); - if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { + // 登录组织优先:以登录账号的组织为准,覆盖货主解析带来的组织,避免用货主组织导致包装规格等主数据查不到 + if (isValidOrgId(loginOrgId)) { row.setOrganizationId(loginOrgId); } - if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { + if (isValidOrgId(loginTopOrgId)) { row.setTopOrganizationId(loginTopOrgId); } fillOrganizationName(row, loginUser); diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java index 5a3554478..d878d0d27 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java @@ -128,10 +128,11 @@ public class MaterialBaseInfoAsyncService { materialBaseInfoApplicationService.normalizeImportBarCodeWhenDuplicateOfHs(row); materialBaseInfoApplicationService.fillIdsFromExistingMasterData(row); materialBaseInfoApplicationService.fillOrganizationFromShipperIfNeeded(row); - if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { + // 登录组织优先:以登录账号的组织为准,覆盖货主解析带来的组织,避免用货主组织(如2841)导致包装规格等主数据查不到 + if (isValidOrgId(loginOrgId)) { row.setOrganizationId(loginOrgId); } - if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { + if (isValidOrgId(loginTopOrgId)) { row.setTopOrganizationId(loginTopOrgId); } materialBaseInfoApplicationService.fillOrganizationName(row, loginUser); From d69af9ef203659606d606a465ad6e1201cddc050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 16:49:24 +0800 Subject: [PATCH 36/88] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../com/mhd/common/core/feign/ThirdPartyServiceFeign.java | 2 +- .../mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 93cb610ff..00e656a88 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -19,7 +19,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 78bce4d42..6b99f0f45 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 9016575f6..0da262497 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.32:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.3:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 750ed853e..12571141a 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.33:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.4:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java index 48bf17cd1..94e7ade76 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java @@ -26,7 +26,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.31:8012", configuration = FeignAutoConfiguration.class) +@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.30:8012", configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java index b54559ade..26c5c12b9 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java +++ b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java @@ -22,7 +22,7 @@ import java.util.Map; /** * 三方服务 Feign */ -@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.31:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.30:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index e8f169bf2..fc7380c20 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -16,7 +16,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -25,7 +25,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 6efd37fe0ea2ed9af397d8883eca83ac9d7a280d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 10 Sep 2026 17:00:48 +0800 Subject: [PATCH 37/88] =?UTF-8?q?json=E8=A7=A3=E6=9E=90=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index e585c16ab..92cd8688a 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -724,7 +724,11 @@ public class BillingStatementApplicationService { //附加费用开票策略 String fjfykpcl = (String) contentMap.get("fjfykpcl"); //合并开票 - Integer hbcp = (Integer) contentMap.get("hbcp"); + Integer hbcp = null; + Object val = contentMap.get("hbcp"); + if(val != null){ + hbcp = val instanceof Integer ? (Integer) val : Integer.valueOf(((String)val).trim()); + } Boolean isMerge = false; if (hbcp == 1) { //判断是否合并开票 From 432f71de064cb40fac8ec0fea1455ac5dff04104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 10 Sep 2026 17:11:12 +0800 Subject: [PATCH 38/88] =?UTF-8?q?json=E8=A7=A3=E6=9E=90=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillingStatementApplicationService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 92cd8688a..9819caf59 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -778,7 +778,11 @@ public class BillingStatementApplicationService { //附加费用开票策略 String fjfykpcl = (String) contentMap.get("fjfykpcl"); //合并开票 - Integer hbcp = (Integer) contentMap.get("hbcp"); + Integer hbcp = null; + Object val = contentMap.get("hbcp"); + if(val != null){ + hbcp = val instanceof Integer ? (Integer) val : Integer.valueOf(((String)val).trim()); + } Boolean isMerge = false; if (hbcp == 1) { //判断是否合并开票 From cf3299165dc0fca5fdb2a3c836a81c9b4b543702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 10 Sep 2026 17:29:09 +0800 Subject: [PATCH 39/88] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=96=B9=E6=B3=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 22 ++++ .../BillingStatementApplicationService.java | 55 +++++---- .../service/BillManageDomainService.java | 26 +++++ .../BillOperationLogDomainService.java | 34 ++++++ .../facade/IBmsInvoiceListService.java | 2 + .../BmsInvoiceListServiceImpl.java | 109 ++++++++++++++++++ .../repository/todo/BmsInvoiceListAddDTO.java | 14 +++ 7 files changed, 237 insertions(+), 25 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index a8658a955..fa8bfc3a3 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -292,6 +292,28 @@ public class BillManageApplicationService { return billManageDomainService.confirmBilling(billManageDO); } + @Transactional + public Boolean confirmBillingJob(BillManageDTO billManageDTO) { + //确认账单:未收款状态之前都可以进行确认账单,跳过核账流程,直接到未收款状态 + if(!StringUtils.isNotEmpty(billManageDTO.getBillManageIds())){ + throw new ServiceException("账单管理ids不能为空"); + } + //校验 + Set billManageIds = Stream.of(billManageDTO.getBillManageIds().split(",")).collect(Collectors.toSet()); + BillManageDO billManageDO = new BillManageDO(); + billManageDO.setBillManageIdSet(billManageIds); + List billManageList = billManageDomainService.queryList(billManageDO); + for (BillManagePO billManage : billManageList) { + if(billManage.getBillState() > 2){ + throw new ServiceException("选中数据"+ billManage.getBillNumber() + "状态不可操作确认账单"); + } + } + billManageDO.setOrganizationId(billManageDTO.getOrganizationId()); + billManageDO.setOrganizationName(billManageDTO.getOrganizationName()); + billManageDO.setTopOrganizationId(billManageDTO.getTopOrganizationId()); + return billManageDomainService.confirmBillingJob(billManageDO); + } + public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) { diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 9819caf59..36976bb93 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -894,7 +894,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -930,7 +930,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1003,7 +1003,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1039,7 +1039,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1127,7 +1127,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1163,7 +1163,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1258,7 +1258,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1294,7 +1294,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1367,7 +1367,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1403,7 +1403,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1491,7 +1491,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1527,7 +1527,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1618,7 +1618,10 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + params.setOrganizationId(organizationId); + params.setTopOrganizationId(topOrganizationId); + params.setOrganizationName(organizationName); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1626,7 +1629,9 @@ public class BillingStatementApplicationService { .eq(BillDetail::getDelFlag, 1)); BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); tmsInvoiceListAddDTO.setBillManageId(billManageId); - + tmsInvoiceListAddDTO.setOrganizationId(organizationId); + tmsInvoiceListAddDTO.setTopOrganizationId(topOrganizationId); + tmsInvoiceListAddDTO.setOrganizationName(organizationName); if (ObjectUtil.isNotNull(billManage)) { tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); @@ -1654,7 +1659,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1727,7 +1732,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1763,7 +1768,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1851,7 +1856,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1887,7 +1892,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1982,7 +1987,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -2018,7 +2023,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -2091,7 +2096,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -2127,7 +2132,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -2215,7 +2220,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -2251,7 +2256,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index 8272bfe5e..ccfc7dc66 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -557,6 +557,32 @@ public class BillManageDomainService { return flag && three; } + public Boolean confirmBillingJob(BillManageDO billManageDO) { + //直接修改状态到未收款3状态 +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); +// } + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(BillManage::getBillManageId,billManageDO.getBillManageIdSet()) + .set(BillManage::getBillStep,4) + .set(BillManage::getBillState,3) +// .set(BillManage::getUpdateBy,loginUser.getUserPo().getUserId()) +// .set(BillManage::getUpdateByName,loginUser.getUserPo().getUserName()) + .set(BillManage::getUpdateTime,new Date()); + boolean flag = billManageService.update(updateWrapper); + //保存账单操作记录 + BillOperationLogDO billOperationLogDO = new BillOperationLogDO(); + billOperationLogDO.setBillManageIdSet(billManageDO.getBillManageIdSet()); + billOperationLogDO.setOperationInfo(BillLogsConstants.confirm_bill_text); + billOperationLogDO.setOperationType(3); + billOperationLogDO.setOrganizationId(billManageDO.getOrganizationId()); + billOperationLogDO.setOrganizationName(billManageDO.getOrganizationName()); + billOperationLogDO.setTopOrganizationId(billManageDO.getTopOrganizationId()); + boolean three = billOperationLogDomainService.saveBillOperationLogBatchJob(billOperationLogDO); + return flag && three; + } + public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) { diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java index 0495eccdb..3dac710a7 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java @@ -139,6 +139,40 @@ public class BillOperationLogDomainService { return billOperationLogService.saveBatch(saveList); } + public Boolean saveBillOperationLogBatchJob(BillOperationLogDO billOperationLogDO) { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); +// } + if(billOperationLogDO.getBillManageIdSet()==null || billOperationLogDO.getBillManageIdSet().size()==0){ + throw new ServiceException("账单集合不能为空"); + } +// String userName = loginUser.getUserPo().getUserName(); +// // 获取登录人id +// Long userId = loginUser.getUserid(); + BillOperationLogDO common = new BillOperationLogDO(); +// common.setCreateByName(userName); +// common.setUpdateByName(userName); + common.setCreateTime(new Date()); + common.setUpdateTime(new Date()); + common.setDelFlag(1); +// common.setCreateBy(userId); +// common.setUpdateBy(userId); +// common.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); +// common.setOrganizationId(loginUser.getUserPo().getOrganizationId()); +// common.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + common.setOperationType(billOperationLogDO.getOperationType()); + common.setOperationInfo(billOperationLogDO.getOperationInfo()); + List saveList = new ArrayList<>(); + for (String billManageId : billOperationLogDO.getBillManageIdSet()) { + BillOperationLog save = new BillOperationLog(); + BeanUtils.copyProperties(common, save); + save.setBillManageId(Long.valueOf(billManageId)); + saveList.add(save); + } + return billOperationLogService.saveBatch(saveList); + } + /** * 批量保存数据 diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java index 3918d6fa6..f4ac9ca67 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java @@ -26,6 +26,8 @@ public interface IBmsInvoiceListService extends IService { void addReceivableBill(BmsInvoiceListAddDTO tmsInvoiceListAddDTO); + void addReceivableBillJob(BmsInvoiceListAddDTO tmsInvoiceListAddDTO); + void update(BmsInvoiceListDTO tmsInvoiceListDTO); int delete(List ids); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java index 9f2015bdb..ddcaef106 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java @@ -216,6 +216,76 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl bmsMakeOutInvoices = bmsInvoiceListAddDTO.getBmsMakeOutInvoices(); + if (ObjectUtil.isNotNull(bmsMakeOutInvoices) && bmsMakeOutInvoices.size() > 0) { + for (BmsMakeOutInvoice bmsMakeOutInvoice : bmsMakeOutInvoices) { + bmsMakeOutInvoice.setInvoiceId(listId); + //bmsMakeOutInvoice.setCreateBy(sysUser.getId()); + bmsMakeOutInvoice.setCreateTime(new Date()); + bmsMakeOutInvoiceMapper.insert(bmsMakeOutInvoice); + for (BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem : bmsMakeOutInvoice.getBmsMakeOutInvoiceItems()) { + bmsMakeOutInvoiceItem.setMakeId(bmsMakeOutInvoice.getId()); + //bmsMakeOutInvoiceItem.setCreateBy(sysUser.getId()); + bmsMakeOutInvoiceItem.setCreateTime(new Date()); + bmsMakeOutInvoiceItemMapper.insert(bmsMakeOutInvoiceItem); + } + } + } + } + +// BillManage billManage = billManageMapper.selectById(bmsInvoiceListAddDTO.getBillManageId()); +// if (billManage != null) { +// billManage.setIsInvoice(1); +// billManage.setInvoiceId(bmsInvoiceList.getId().toString()); +// billManage.setApplyNumber(bmsInvoiceList.getApplyNumber()); +// billManageMapper.updateById(billManage); +// } + List billManageIds = bmsInvoiceListAddDTO.getBillManageIds(); + if (billManageIds != null && billManageIds.size() > 0){ + } else { + billManageIds = new ArrayList<>(); + billManageIds.add(bmsInvoiceListAddDTO.getBillManageId()); + } + List billManages = billManageMapper.selectList(new LambdaQueryWrapper().in(BillManage::getBillManageId, billManageIds)); + if (billManages != null && billManages.size() > 0) { + for (BillManage billManage : billManages) { + billManage.setIsInvoice(1); + billManage.setInvoiceId(bmsInvoiceList.getId().toString()); + billManage.setApplyNumber(bmsInvoiceList.getApplyNumber()); + billManageMapper.updateById(billManage); + } + } + /*AjaxResult ajaxResult = financeServiceFeign.editIsInvoice(transportationId,1,bmsInvoiceList.getId(),"",bmsInvoiceList.getApplyNumber()); + if(!"200".equals(String.valueOf(ajaxResult.get("code")))){ + throw new com.mhd.common.core.exception.ServiceException(ajaxResult.get("msg").toString()); + }*/ + } + @Override public BmsSettlementPartyInvoice selectSettlementPartyInfoByName(String settlementPartyName) { return null; @@ -932,4 +1002,43 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl billManageIds; + /**组织ID*/ + @ApiModelProperty(value = "组织ID") + @Excel(name = "组织ID", width = 15) + private Long organizationId; + + /**组织名称*/ + @ApiModelProperty(value = "组织名称") + @Excel(name = "组织名称", width = 15) + private String organizationName; + + /**一级组织ID*/ + @ApiModelProperty(value = "一级组织ID") + @Excel(name = "一级组织ID", width = 15) + private Long topOrganizationId; } \ No newline at end of file From cd4ceecf989ef80e1414eff8e76c2400dca85f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 20:17:05 +0800 Subject: [PATCH 40/88] =?UTF-8?q?OMS=E8=B0=83=E6=95=B4=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 55 ++++++++++++++++++- .../entity/BusinessDocumentOrder.java | 32 +++++++++++ .../service/OmsAddressMultiService.java | 18 +++++- 3 files changed, 101 insertions(+), 4 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 68de46eed..26aa5a696 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -20,6 +20,7 @@ import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount; import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper; import com.mhd.oms.domain.executeOrder.entity.ExecuteOrder; import com.mhd.oms.domain.executeOrder.repository.mapper.ExecuteOrderMapper; +import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO; import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustAuditDTO; import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustDTO; import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustQueryDTO; @@ -137,12 +138,20 @@ public class BusinessDocumentOrderAdjustService { .eq(BusinessOrderAccount::getOrderId, dbOrder.getId()) .eq(BusinessOrderAccount::getIsDelete, 0)); - // 2. 调整后的费用明细(前端);为 null 则视为保持库中不变 + // 2. 调整后的费用明细(前端);为 null 则视为保持库中不变。 + // 兼容前端两种传法:顶层 feeDetailList,或整单回传 order.businessOrderAccountList List newFeeList = dto.getFeeDetailList(); + if ((newFeeList == null || newFeeList.isEmpty()) && front.getBusinessOrderAccountList() != null) { + newFeeList = front.getBusinessOrderAccountList(); + } // 3. 生成"调整后"业务单对象:DB原值 + 前端可编辑字段覆盖(忽略null) BusinessDocumentOrder afterOrder = buildAfterOrder(dbOrder, front); + // 3.1 地址兼容:前端把地址放在 shipment/receipt 或 loadingAddressList/unloadAddressList, + // 映射到 loading*/unload* 扁平字段(与下单主流程 BusinessDocumentOrderDomainService 一致口径) + applyAddressMapping(afterOrder, front); + // 4. 若提供了费用明细,则 deliveryFreight(合计)=明细 amount 之和,并联动到 afterOrder boolean hasFeeDetail = newFeeList != null && !newFeeList.isEmpty(); if (hasFeeDetail) { @@ -400,6 +409,50 @@ public class BusinessDocumentOrderAdjustService { return after; } + /** + * 地址兼容映射:前端整单回传时地址在 shipment/receipt 或 loadingAddressList/unloadAddressList, + * 这里统一映射到 business_document_order 的 loading 与 unload 系列扁平字段。 + * 口径与 BusinessDocumentOrderDomainService 下单主流程保持一致: + * 装货取第一条地址,卸货取最后一条地址。 + */ + private void applyAddressMapping(BusinessDocumentOrder after, BusinessDocumentOrder front) { + BusinessDocumentAddressMultiDTO loading = null; + BusinessDocumentAddressMultiDTO unloading = null; + + // 优先取 shipment/receipt 单对象,其次取 loadingAddressList/unloadAddressList 集合 + if (front.getShipment() != null) { + loading = front.getShipment(); + } else if (front.getLoadingAddressList() != null && !front.getLoadingAddressList().isEmpty()) { + loading = front.getLoadingAddressList().get(0); + } + if (front.getReceipt() != null) { + unloading = front.getReceipt(); + } else if (front.getUnloadAddressList() != null && !front.getUnloadAddressList().isEmpty()) { + unloading = front.getUnloadAddressList().get(front.getUnloadAddressList().size() - 1); + } + + if (loading != null) { + after.setLoadingAreaId(loading.getAreaCode()); + after.setLoadingName(loading.getAreaName() != null ? loading.getAreaName() : loading.getAreaCode()); + after.setLoadingAddress(loading.getAddress()); + after.setLoadingLongitude(loading.getLongitude()); + after.setLoadingLatitude(loading.getLatitude()); + after.setFreighterName(loading.getContactName()); + after.setLoadingPhone(loading.getContactPhone()); + after.setLoadingDate(loading.getLayDate()); + } + if (unloading != null) { + after.setUnloadAreaId(unloading.getAreaCode()); + after.setUnloadName(unloading.getAreaName() != null ? unloading.getAreaName() : unloading.getAreaCode()); + after.setUnloadAddress(unloading.getAddress()); + after.setUnloadLongitude(unloading.getLongitude()); + after.setUnloadLatitude(unloading.getLatitude()); + after.setDischargerName(unloading.getContactName()); + after.setUnloadPhone(unloading.getContactPhone()); + after.setUnloadingData(unloading.getLayDate()); + } + } + private BusinessDocumentOrderAdjust buildAdjust(BusinessDocumentOrder dbOrder, LoginUser u, Date now, boolean amountChanged, String reason) { BusinessDocumentOrderAdjust adjust = new BusinessDocumentOrderAdjust(); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java index 29f15fe9c..f24f19291 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java @@ -8,6 +8,7 @@ import com.mhd.common.core.web.domain.BaseVOEntity; import java.math.BigDecimal; import lombok.Data; import java.util.Date; +import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.format.annotation.DateTimeFormat; @@ -825,4 +826,35 @@ public class BusinessDocumentOrder extends BaseVOEntity{ @ApiModelProperty("车次") @Excel(name = "车次") private String shuttleNo; + + /** + * 前端整单回传时携带的费用明细(business_order_account),非表字段,仅用于「订单调整」入参接收。 + * 与顶层 feeDetailList 二选一,后端在 adjust() 中做回退兼容。 + */ + @com.baomidou.mybatisplus.annotation.TableField(exist = false) + private List businessOrderAccountList; + + /** + * 前端整单回传时的装货地址(单个),非表字段,仅用于「订单调整」入参接收与映射到 loading* 扁平字段。 + */ + @com.baomidou.mybatisplus.annotation.TableField(exist = false) + private com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO shipment; + + /** + * 前端整单回传时的卸货地址(单个),非表字段,仅用于「订单调整」入参接收与映射到 unload* 扁平字段。 + */ + @com.baomidou.mybatisplus.annotation.TableField(exist = false) + private com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO receipt; + + /** + * 前端整单回传时的装货地址集合,非表字段,仅用于「订单调整」入参接收与映射。 + */ + @com.baomidou.mybatisplus.annotation.TableField(exist = false) + private List loadingAddressList; + + /** + * 前端整单回传时的卸货地址集合,非表字段,仅用于「订单调整」入参接收与映射。 + */ + @com.baomidou.mybatisplus.annotation.TableField(exist = false) + private List unloadAddressList; } diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOrder/service/OmsAddressMultiService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOrder/service/OmsAddressMultiService.java index 3ddce8ecd..70652f315 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOrder/service/OmsAddressMultiService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOrder/service/OmsAddressMultiService.java @@ -610,6 +610,12 @@ public class OmsAddressMultiService implements IOmsAddressMultiService { List tmsOrderAccountList = tmsOrderAddDTO.getTmsOrderAccountList(); if (ObjectUtil.isNotNull(tmsOrderAccountList) && tmsOrderAccountList.size() > 0) { for (OmsOrderAccount tmsOrderAccount : tmsOrderAccountList) { + // 防御:account_id 为空或<=0 时跳过(避免唯一约束撞库 + 插入脏数据) + if (tmsOrderAccount.getAccountId() == null || tmsOrderAccount.getAccountId() <= 0) { + log.warn("订单费用科目 accountId 为空,已跳过该条, orderId={}, subjectName={}", + resevationOrder.getId(), tmsOrderAccount.getSubjectName()); + continue; + } tmsOrderAccount.setIsDelete(0); tmsOrderAccount.setOrderId(String.valueOf(resevationOrder.getId())); tmsOrderAccount.setCreateBy(String.valueOf(userPo.getUserId())); @@ -1116,14 +1122,20 @@ public class OmsAddressMultiService implements IOmsAddressMultiService { if (ObjectUtil.isNotNull(tmsOrderAccountList) && tmsOrderAccountList.size() > 0) { // 先删除旧的费用科目信息 tmsOrderAccountMapper.delete(new LambdaQueryWrapper().eq(OmsOrderAccount::getOrderId, String.valueOf(resevationOrder.getId()))); - + // 插入新的费用科目信息 for (OmsOrderAccount tmsOrderAccount : tmsOrderAccountList) { + // 防御:account_id 为空或<=0 时跳过 + if (tmsOrderAccount.getAccountId() == null || tmsOrderAccount.getAccountId() <= 0) { + log.warn("订单费用科目 accountId 为空,已跳过该条, orderId={}, subjectName={}", + resevationOrder.getId(), tmsOrderAccount.getSubjectName()); + continue; + } tmsOrderAccount.setIsDelete(0); tmsOrderAccount.setOrderId(String.valueOf(resevationOrder.getId())); tmsOrderAccount.setCreateBy(String.valueOf(userPo.getUserId())); tmsOrderAccount.setCreateTime(new Date()); - + // 设置组织信息 if (tmsOrderAddDTO.getOrganizationId() != null) { tmsOrderAccount.setOrganizationId(tmsOrderAddDTO.getOrganizationId()); @@ -1134,7 +1146,7 @@ public class OmsAddressMultiService implements IOmsAddressMultiService { if (tmsOrderAddDTO.getTopOrganizationId() != null) { tmsOrderAccount.setTopOrganizationId(tmsOrderAddDTO.getTopOrganizationId()); } - + tmsOrderAccountMapper.insert(tmsOrderAccount); } } From 60381ad7c9237daccdfd2df10bc9fc8b6bc90332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 20:42:16 +0800 Subject: [PATCH 41/88] =?UTF-8?q?OMS=E8=AE=A2=E5=8D=95=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 26aa5a696..fc5e56476 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -48,8 +48,15 @@ import java.util.stream.Collectors; * 2. 费用数据源 = 前端回传的费用明细 business_order_account(feeDetailList); * 主表金额 deliveryFreight 为其 amount 合计(冗余汇总,后端自动算)。 * 3. 是否需审核:一旦任一「金额」发生变化 - * = feeDetailList 明细 amount 变化,或主表金额列变化 -> 走业务主管审核; + * = feeDetailList 明细 amount 变化,或主表金额/费用列变化 -> 走业务主管审核; * 否则(仅改非金额字段) -> 直通。 + * 「金额/费用」字段涵盖: deliveryFreight / collectedFreight / uncollectedFreight / + * collectLessFreight / transportationUnitPrice / infoFee / freightUnitPrice / + * cargoInsuranceAmount / freightCharges / freightFee / unloadingFee / customsFee / + * shortageFee / miscellaneousFee / otherFee / detentionFee,以及 settlementCurrency / + * paymentAccountId / accountName / accountInformation(结算币种+收款账户任一变化即视为费用变更)。 + * 判定口径: 以后端兜底比对为准(主表金额/费用列 + 明细 amount 合计), + * 前端 amountChanged 仅作提示;后端比对结果与前端 OR 运算,避免前端误传 false 绕过审核。 * 4. 涉及金额提交 -> 仅把业务单 review_status 置为「调整待审核(3)」;主记录 AUDIT_STATUS=0(待审核); * 不更新业务单数据,不影响其它状态(order_status / execute_status 不动)。 * 5. 审核通过 -> 覆盖业务单(金额) + 替换费用明细;review_status 一律置为 1(已审核), @@ -57,7 +64,6 @@ import java.util.stream.Collectors; * 审核驳回 -> 不更新业务单数据,review_status 还原为调整前值(主记录 before_review_status),可再次调整。 * 6. 直通(未改金额) -> 覆盖业务单可编辑字段 + deliveryFreight(明细合计),并替换 business_order_account * (逻辑删旧 is_delete=1 + 插新 is_delete=0);不改动任何审核/执行状态。 - * 7. 前端以 amountChanged 告知是否改金额(默认前端判定);未传时后端兜底比对。 * * 说明:review_status 原枚举 0未审/1通过/2驳回,新增 3=调整待审核;不改变原有用例。 * @@ -72,12 +78,17 @@ public class BusinessDocumentOrderAdjustService { private static final Integer AUDIT_PASS = 1; // 调整记录:审核通过 private static final Integer AUDIT_REJECT = 2; // 调整记录:驳回 - /** 主表金额(费用)字段,任一变化触发审核 */ + /** 主表金额(费用)字段,任一变化触发审核 + * 含: 运费相关 8 项 + 其他费用 8 项 + 结算币种 + 收款账户(3 字段) + * 任意一项变化即需要审核(对应前端"费用合计 / 运费 / 装卸费 / 仓租及柜租(走明细) / + * 保险 / 压车(走明细) / 运输处理费(走明细) / 报关费 / 其他 / 费用合计 / 结算币种 / 收款账户") */ private static final List FEE_FIELDS = Arrays.asList( "deliveryFreight", "collectedFreight", "uncollectedFreight", "collectLessFreight", "transportationUnitPrice", "infoFee", "freightUnitPrice", "cargoInsuranceAmount", "freightCharges", "freightFee", "unloadingFee", "customsFee", "shortageFee", - "miscellaneousFee", "otherFee", "detentionFee"); + "miscellaneousFee", "otherFee", "detentionFee", + // 结算币种 + 收款账户 任一变化也视为费用变更,需审核 + "settlementCurrency", "paymentAccountId", "accountName", "accountInformation"); /** 不允许被前端调整覆盖的系统字段 */ private static final List PROTECTED_FIELDS = Arrays.asList( @@ -159,14 +170,10 @@ public class BusinessDocumentOrderAdjustService { afterOrder.setDeliveryFreight(sum); } - // 5. 判定是否修改了金额:以前端 amountChanged 为准(前端整单回传已自行判定); - // 若前端未传则后端兜底比对(主表金额列 或 明细 amount 变化) - boolean amountChanged; - if (dto.getAmountChanged() != null) { - amountChanged = dto.getAmountChanged(); - } else { - amountChanged = isAmountChanged(dbOrder, front, hasFeeDetail, dbFeeList, newFeeList); - } + // 5. 判定是否修改了金额:以后端兜底比对为准,避免前端误传 false 绕过审核; + // 前端传 true 也尊重;后端比对结果与前端 OR 运算(任一为真则需审核)。 + boolean backendChanged = isAmountChanged(dbOrder, front, hasFeeDetail, dbFeeList, newFeeList); + boolean amountChanged = backendChanged || Boolean.TRUE.equals(dto.getAmountChanged()); // 6. 写主记录 LoginUser loginUser = SecurityUtils.getLoginUser(); From 6282849468d592e76274d92658c3f3cfcdf347a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 21:15:14 +0800 Subject: [PATCH 42/88] =?UTF-8?q?=E9=A9=B3=E5=9B=9E=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 16 ++++++++++++---- .../entity/BusinessDocumentOrder.java | 2 +- .../entity/BusinessDocumentOrderAdjust.java | 10 ++++++++++ .../BusinessDocumentOrderAdjustDetail.java | 12 ++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index fc5e56476..079568f45 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -61,7 +61,8 @@ import java.util.stream.Collectors; * 不更新业务单数据,不影响其它状态(order_status / execute_status 不动)。 * 5. 审核通过 -> 覆盖业务单(金额) + 替换费用明细;review_status 一律置为 1(已审核), * 不影响 order_status / execute_status。 - * 审核驳回 -> 不更新业务单数据,review_status 还原为调整前值(主记录 before_review_status),可再次调整。 + * 审核驳回 -> 不更新业务单数据,review_status 置为「调整驳回(4)」,不影响 order_status/execute_status, + * 可再次调整提交审核。 * 6. 直通(未改金额) -> 覆盖业务单可编辑字段 + deliveryFreight(明细合计),并替换 business_order_account * (逻辑删旧 is_delete=1 + 插新 is_delete=0);不改动任何审核/执行状态。 * @@ -78,6 +79,11 @@ public class BusinessDocumentOrderAdjustService { private static final Integer AUDIT_PASS = 1; // 调整记录:审核通过 private static final Integer AUDIT_REJECT = 2; // 调整记录:驳回 + /** 业务单 review_status:调整待审核(提交涉及金额时置) */ + private static final Long REVIEW_ADJUST_WAIT = 3L; + /** 业务单 review_status:调整驳回(审核驳回时置,与普通驳回 2 区分) */ + private static final Long REVIEW_ADJUST_REJECT = 4L; + /** 主表金额(费用)字段,任一变化触发审核 * 含: 运费相关 8 项 + 其他费用 8 项 + 结算币种 + 收款账户(3 字段) * 任意一项变化即需要审核(对应前端"费用合计 / 运费 / 装卸费 / 仓租及柜租(走明细) / @@ -205,7 +211,7 @@ public class BusinessDocumentOrderAdjustService { // 8b. 涉及金额:仅把业务单 review_status 置为"调整待审核(3)",其余状态(exec/orderStatus)不动,不更新业务单数据 BusinessDocumentOrder statusOnly = new BusinessDocumentOrder(); statusOnly.setId(dbOrder.getId()); - statusOnly.setReviewStatus(3L); // 调整待审核 + statusOnly.setReviewStatus(REVIEW_ADJUST_WAIT); // 调整待审核 businessDocumentOrderMapper.updateById(statusOnly); } @@ -386,6 +392,7 @@ public class BusinessDocumentOrderAdjustService { syncTmsAsync(order.getGoodsNumber(), toSave); } else { adjust.setAuditStatus(AUDIT_REJECT); + adjust.setIsAudit(1); // 走到审核即说明该调整需要审核,保持 is_audit 与 audit_status 语义一致 adjust.setAuditBy(auditBy); adjust.setAuditByName(auditByName); adjust.setAuditTime(now); @@ -394,10 +401,11 @@ public class BusinessDocumentOrderAdjustService { adjust.setUpdateTime(now); adjustMapper.updateById(adjust); - // 驳回:不更新业务单数据,仅把 review_status 还原为调整前值(不影响其它状态) + // 驳回:不更新业务单数据,仅把 review_status 置为「调整驳回(4)」; + // 不影响 order_status / execute_status 等其它单据状态;可再次调整提交审核 BusinessDocumentOrder statusOnly = new BusinessDocumentOrder(); statusOnly.setId(adjust.getOrderId()); - statusOnly.setReviewStatus(adjust.getBeforeReviewStatus() == null ? 0L : adjust.getBeforeReviewStatus()); + statusOnly.setReviewStatus(REVIEW_ADJUST_REJECT); businessDocumentOrderMapper.updateById(statusOnly); } return AjaxResult.success(); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java index f24f19291..e0b2a1bc0 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/entity/BusinessDocumentOrder.java @@ -660,7 +660,7 @@ public class BusinessDocumentOrder extends BaseVOEntity{ @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") private Date documentDate; - @ApiModelProperty( "审核状态 0-未审核 1-审核通过 2-已驳回 3-调整待审核") + @ApiModelProperty( "审核状态 0-未审核 1-审核通过 2-已驳回 3-调整待审核 4-调整驳回") private Long reviewStatus; @ApiModelProperty("审核时间") diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java index d84a978e3..4ea7691f8 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjust/entity/BusinessDocumentOrderAdjust.java @@ -3,8 +3,10 @@ package com.mhd.oms.domain.businessDocumentOrderAdjust.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -38,6 +40,8 @@ public class BusinessDocumentOrderAdjust implements Serializable { private String adjustByName; @ApiModelProperty("调整时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date adjustTime; @ApiModelProperty("调整原因") @@ -59,6 +63,8 @@ public class BusinessDocumentOrderAdjust implements Serializable { private String auditByName; @ApiModelProperty("审核时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date auditTime; @ApiModelProperty("审核/驳回意见") @@ -77,6 +83,8 @@ public class BusinessDocumentOrderAdjust implements Serializable { private String createName; @ApiModelProperty("创建时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; @ApiModelProperty("更新人") @@ -86,6 +94,8 @@ public class BusinessDocumentOrderAdjust implements Serializable { private String updateName; @ApiModelProperty("更新时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; @ApiModelProperty("删除标记 1-正常 0-删除") diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java index 2587cb23d..3aff8a13f 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrderAdjustDetail/entity/BusinessDocumentOrderAdjustDetail.java @@ -3,10 +3,12 @@ package com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; @@ -55,6 +57,8 @@ public class BusinessDocumentOrderAdjustDetail implements Serializable { private String loadingAddress; @ApiModelProperty("装货时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date loadingDate; @ApiModelProperty("卸货地") @@ -64,6 +68,8 @@ public class BusinessDocumentOrderAdjustDetail implements Serializable { private String unloadAddress; @ApiModelProperty("卸货时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date unloadingData; @ApiModelProperty("发货人") @@ -85,6 +91,8 @@ public class BusinessDocumentOrderAdjustDetail implements Serializable { private String route; @ApiModelProperty("单据日期") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date documentDate; @ApiModelProperty("组织ID") @@ -158,12 +166,16 @@ public class BusinessDocumentOrderAdjustDetail implements Serializable { private String createName; @ApiModelProperty("创建时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; @ApiModelProperty("更新人") private String updateBy; @ApiModelProperty("更新时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; @ApiModelProperty("删除标记 1-正常 0-删除") From db31711ad0ffc47d0eba179b42876155c1822029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 21:20:09 +0800 Subject: [PATCH 43/88] =?UTF-8?q?=E9=A9=B3=E5=9B=9E=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustRecordDTO.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java index 239c67d04..ebdacbe4c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/businessDocumentOrderAdjust/BusinessDocumentOrderAdjustRecordDTO.java @@ -1,10 +1,12 @@ package com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.mhd.oms.domain.businessDocumentOrderAdjustDetail.entity.BusinessDocumentOrderAdjustDetail; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -34,6 +36,8 @@ public class BusinessDocumentOrderAdjustRecordDTO implements Serializable { private String adjustByName; @ApiModelProperty("调整时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date adjustTime; @ApiModelProperty("调整原因") @@ -52,6 +56,8 @@ public class BusinessDocumentOrderAdjustRecordDTO implements Serializable { private String auditByName; @ApiModelProperty("审核时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date auditTime; @ApiModelProperty("审核/驳回意见") From 86c4c07708b080cbf32641548432bad66780c455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 21:55:02 +0800 Subject: [PATCH 44/88] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 079568f45..18623eb98 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -506,21 +506,25 @@ public class BusinessDocumentOrderAdjustService { } /** - * 是否修改了金额:主表金额列变化 或 明细 amount 变化 + * 是否修改了金额:主表金额/费用列变化 或 明细 amount 变化 */ private boolean isAmountChanged(BusinessDocumentOrder dbOrder, BusinessDocumentOrder front, boolean hasFeeDetail, List dbFeeList, List newFeeList) { - // a) 主表金额列比对 + // a) 主表金额/费用列比对(金额列用 BigDecimal 比对,字符串列用 equals 比对) boolean mainChanged = FEE_FIELDS.stream().anyMatch(field -> { Object newVal = BeanUtil.getFieldValue(front, field); if (newVal == null) { return false; } Object oldVal = BeanUtil.getFieldValue(dbOrder, field); - BigDecimal old = oldVal == null ? BigDecimal.ZERO : (BigDecimal) oldVal; - BigDecimal now = (BigDecimal) newVal; - return old.compareTo(now) != 0; + if (newVal instanceof BigDecimal || oldVal instanceof BigDecimal) { + BigDecimal old = oldVal == null ? BigDecimal.ZERO : new BigDecimal(oldVal.toString()); + BigDecimal now = new BigDecimal(newVal.toString()); + return old.compareTo(now) != 0; + } + // 字符串字段(结算币种/收款账户等) + return !newVal.toString().equals(oldVal == null ? "" : oldVal.toString()); }); if (mainChanged) { return true; From 8d6c252eb4f2cb63c85bdf3c985d0c38ac0a7bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 22:16:47 +0800 Subject: [PATCH 45/88] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8C=E6=AD=A5TMS?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/WlhyServiceFeign.java | 7 ++ .../BusinessDocumentOrderAdjustService.java | 107 +++++++++++++++++- 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..5b9773fb9 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -536,6 +536,13 @@ public interface WlhyServiceFeign { @PostMapping("/feign/order/add") public AjaxResult add(@RequestBody TmsOrderAddDTO tmsOrderAddDTO); + /** + * 修改运单(OMS调整业务单后同步修改TMS订单) + * @param tmsOrderAddDTO 需携带 TMS 订单 id 定位 + */ + @PostMapping("/feign/order/update") + public AjaxResult update(@RequestBody TmsOrderAddDTO tmsOrderAddDTO); + @GetMapping("/feign/order/cancelIssueDocuments") public AjaxResult cancelIssueDocuments(@RequestParam(name="executeOrderId") String executeOrderId); diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 18623eb98..30564121e 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -7,9 +7,16 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.mhd.common.core.domain.dto.wlhy.TmsAddressMultiDTO; +import com.mhd.common.core.domain.dto.wlhy.TmsCargoInfoDTO; +import com.mhd.common.core.domain.dto.wlhy.TmsOrderAccount; import com.mhd.common.core.exception.ServiceException; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.businessDocumentAddressMulti.entity.BusinessDocumentAddressMulti; +import com.mhd.oms.domain.businessDocumentAddressMulti.repository.mapper.BusinessDocumentAddressMultiMapper; +import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti; +import com.mhd.oms.domain.businessDocumentCargoMulti.repository.mapper.BusinessDocumentCargoMultiMapper; import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder; import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper; import com.mhd.oms.domain.businessDocumentOrderAdjust.entity.BusinessDocumentOrderAdjust; @@ -26,6 +33,7 @@ import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOr import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustQueryDTO; import com.mhd.oms.interfaces.dto.businessDocumentOrderAdjust.BusinessDocumentOrderAdjustRecordDTO; import com.mhd.system.api.WlhyServiceFeign; +import com.mhd.system.api.domain.TmsOrderAddDTO; import com.mhd.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -131,6 +139,12 @@ public class BusinessDocumentOrderAdjustService { @Autowired private ExecuteOrderMapper executeOrderMapper; + @Autowired + private BusinessDocumentCargoMultiMapper businessDocumentCargoMultiMapper; + + @Autowired + private BusinessDocumentAddressMultiMapper businessDocumentAddressMultiMapper; + @Autowired private WlhyServiceFeign wlhyServiceFeign; @@ -634,10 +648,99 @@ public class BusinessDocumentOrderAdjustService { if (executeOrders == null || executeOrders.isEmpty()) { return; } - log.info("业务单[{}]调整完成,关联执行单[{}]。如需回写TMS请接入TMS改费Feign。", goodsNumber, - executeOrders.stream().map(ExecuteOrder::getGoodsNumber).collect(Collectors.toList())); + for (ExecuteOrder executeOrder : executeOrders) { + // 仅已下发 TMS(存在 TMS 单号)的执行单需要同步修改 + if (StrUtil.isBlank(executeOrder.getTmsOrderNumber())) { + continue; + } + syncTmsOrder(executeOrder, after); + } } catch (Exception e) { log.error("同步TMS失败,不影响主流程", e); } } + + /** + * 同步修改单个 TMS 订单:按调整后业务单重新组装 TmsOrderAddDTO, + * 带 executeOrderNumber 定位 TMS 订单,调用 TMS /feign/order/update 接口。 + */ + private void syncTmsOrder(ExecuteOrder executeOrder, BusinessDocumentOrder after) { + TmsOrderAddDTO tmsOrderAddDTO = new TmsOrderAddDTO(); + BeanUtil.copyProperties(after, tmsOrderAddDTO); + tmsOrderAddDTO.setExecuteOrderId(String.valueOf(executeOrder.getId())); + tmsOrderAddDTO.setExecuteOrderNumber(executeOrder.getGoodsNumber()); + tmsOrderAddDTO.setGoodsNumber(after.getGoodsNumber()); + tmsOrderAddDTO.setOrderSource("0"); + + // 货物信息 + List cargoList = businessDocumentCargoMultiMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessDocumentCargoMulti::getOrderId, String.valueOf(after.getId())) + .eq(BusinessDocumentCargoMulti::getDelFlag, 1)); + List cargoInfoList = new ArrayList<>(); + if (cargoList != null) { + for (BusinessDocumentCargoMulti cargo : cargoList) { + TmsCargoInfoDTO dto = new TmsCargoInfoDTO(); + BeanUtil.copyProperties(cargo, dto); + cargoInfoList.add(dto); + } + } + tmsOrderAddDTO.setCargoInfoList(cargoInfoList); + + // 装货地址 + List loadingAddrList = businessDocumentAddressMultiMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessDocumentAddressMulti::getOrderId, String.valueOf(after.getId())) + .eq(BusinessDocumentAddressMulti::getDelFlag, 1) + .eq(BusinessDocumentAddressMulti::getLayType, 1L)); + List loadingAddressList = new ArrayList<>(); + if (loadingAddrList != null) { + for (BusinessDocumentAddressMulti addr : loadingAddrList) { + TmsAddressMultiDTO dto = new TmsAddressMultiDTO(); + BeanUtil.copyProperties(addr, dto); + loadingAddressList.add(dto); + } + } + tmsOrderAddDTO.setLoadingAddressList(loadingAddressList); + + // 卸货地址 + List unloadAddrList = businessDocumentAddressMultiMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessDocumentAddressMulti::getOrderId, String.valueOf(after.getId())) + .eq(BusinessDocumentAddressMulti::getDelFlag, 1) + .eq(BusinessDocumentAddressMulti::getLayType, 2L)); + List unloadAddressList = new ArrayList<>(); + if (unloadAddrList != null) { + for (BusinessDocumentAddressMulti addr : unloadAddrList) { + TmsAddressMultiDTO dto = new TmsAddressMultiDTO(); + BeanUtil.copyProperties(addr, dto); + dto.setLayType(2); + unloadAddressList.add(dto); + } + } + tmsOrderAddDTO.setUnloadAddressList(unloadAddressList); + + // 费用明细 + List accountList = businessOrderAccountMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessOrderAccount::getOrderId, after.getId()) + .eq(BusinessOrderAccount::getIsDelete, 0)); + List tmsOrderAccountList = new ArrayList<>(); + if (accountList != null) { + for (BusinessOrderAccount acc : accountList) { + TmsOrderAccount dto = new TmsOrderAccount(); + BeanUtil.copyProperties(acc, dto); + tmsOrderAccountList.add(dto); + } + } + tmsOrderAddDTO.setTmsOrderAccountList(tmsOrderAccountList); + + AjaxResult result = wlhyServiceFeign.update(tmsOrderAddDTO); + if (result != null && "200".equals(String.valueOf(result.get("code")))) { + log.info("调整后同步修改TMS订单成功,执行单[{}],业务单[{}]", executeOrder.getGoodsNumber(), after.getGoodsNumber()); + } else { + log.error("调整后同步修改TMS订单失败,执行单[{}],返回: {}", executeOrder.getGoodsNumber(), + result == null ? "null" : result.get("msg")); + } + } } From eaeb100b22eedeee6d9de9bb77892eecd2e51865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 22:21:41 +0800 Subject: [PATCH 46/88] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8C=E6=AD=A5TMS?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mhd/system/api/factory/RemoteWlhyFallbackFactory.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWlhyFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWlhyFallbackFactory.java index 489e8e221..54323f191 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWlhyFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWlhyFallbackFactory.java @@ -546,6 +546,11 @@ public class RemoteWlhyFallbackFactory implements FallbackFactory Date: Thu, 10 Sep 2026 22:43:45 +0800 Subject: [PATCH 47/88] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8C=E6=AD=A5TMS?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 30564121e..b2541ca08 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -672,6 +672,17 @@ public class BusinessDocumentOrderAdjustService { tmsOrderAddDTO.setGoodsNumber(after.getGoodsNumber()); tmsOrderAddDTO.setOrderSource("0"); + // TMS 侧 update 按 appointShipperId(业务单货主) 定位货主,需显式带上,口径与下单一致 + if (StrUtil.isNotBlank(after.getAppointShipperId())) { + tmsOrderAddDTO.setAppointShipperId(after.getAppointShipperId()); + } + if (after.getAppointShipper() != null) { + tmsOrderAddDTO.setAppointShipper(after.getAppointShipper()); + } + if (after.getSzwlUserId() != null) { + tmsOrderAddDTO.setSzwlUserId(after.getSzwlUserId()); + } + // 货物信息 List cargoList = businessDocumentCargoMultiMapper.selectList( new LambdaQueryWrapper() From 3b8c0ffe8fb2f3fb893b4c7d156870a5f8ab3ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 22:53:22 +0800 Subject: [PATCH 48/88] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8C=E6=AD=A5TMS?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index b2541ca08..3b11809fe 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -667,6 +667,10 @@ public class BusinessDocumentOrderAdjustService { private void syncTmsOrder(ExecuteOrder executeOrder, BusinessDocumentOrder after) { TmsOrderAddDTO tmsOrderAddDTO = new TmsOrderAddDTO(); BeanUtil.copyProperties(after, tmsOrderAddDTO); + // id 传 OMS 业务单主键:TMS 侧用作 tms_order_account.order_id 口径; + // TMS 的 update 在覆盖前会保留 tms_order 真实主键,不会被污染 + tmsOrderAddDTO.setId(String.valueOf(after.getId())); + // TMS 侧按执行单号定位订单 tmsOrderAddDTO.setExecuteOrderId(String.valueOf(executeOrder.getId())); tmsOrderAddDTO.setExecuteOrderNumber(executeOrder.getGoodsNumber()); tmsOrderAddDTO.setGoodsNumber(after.getGoodsNumber()); From 4b5ed4d0e19f7ad51e392952deb12ac32cd74237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 23:07:59 +0800 Subject: [PATCH 49/88] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8C=E6=AD=A5TMS?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderAdjustService.java | 119 ++++++++++++++---- 1 file changed, 92 insertions(+), 27 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java index 3b11809fe..1411518ec 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderAdjustService.java @@ -608,6 +608,74 @@ public class BusinessDocumentOrderAdjustService { businessOrderAccountMapper.insert(acc); } } + + // 同步地址明细表(business_document_address_multi):逻辑删旧 + 按调整后扁平字段插新 + syncAddressDetail(orderId, toSave, loginUser, now); + } + + /** + * 同步地址明细表:把「调整后业务单」的装/卸货扁平字段写回 business_document_address_multi。 + * 与 applyAddressMapping 口径一致(装货取第一条、卸货取最后一条),此处各保留一条。 + */ + private void syncAddressDetail(Long orderId, BusinessDocumentOrder toSave, LoginUser loginUser, Date now) { + // 逻辑删旧 + List oldList = businessDocumentAddressMultiMapper.selectList( + new LambdaQueryWrapper() + .eq(BusinessDocumentAddressMulti::getOrderId, String.valueOf(orderId)) + .eq(BusinessDocumentAddressMulti::getDelFlag, 1)); + if (oldList != null) { + for (BusinessDocumentAddressMulti old : oldList) { + old.setDelFlag(0); + old.setUpdateBy(loginUser != null ? loginUser.getUserid() : null); + old.setUpdateTime(now); + businessDocumentAddressMultiMapper.updateById(old); + } + } + + Long userId = loginUser != null ? loginUser.getUserid() : null; + // 装货 + BusinessDocumentAddressMulti loading = new BusinessDocumentAddressMulti(); + loading.setOrderId(String.valueOf(orderId)); + loading.setAreaCode(toSave.getLoadingAreaId()); + loading.setAreaName(toSave.getLoadingName()); + loading.setAddress(toSave.getLoadingAddress()); + loading.setLongitude(toSave.getLoadingLongitude()); + loading.setLatitude(toSave.getLoadingLatitude()); + loading.setContactName(toSave.getFreighterName()); + loading.setContactPhone(toSave.getLoadingPhone()); + loading.setLayDate(toSave.getLoadingDate()); + loading.setLayType(1L); + loading.setDelFlag(1); + loading.setOrganizationId(toSave.getOrganizationId()); + loading.setOrganizationName(toSave.getOrganizationName()); + loading.setTopOrganizationId(toSave.getTopOrganizationId()); + loading.setCreateBy(userId); + loading.setCreateTime(now); + loading.setUpdateBy(userId); + loading.setUpdateTime(now); + businessDocumentAddressMultiMapper.insert(loading); + + // 卸货 + BusinessDocumentAddressMulti unload = new BusinessDocumentAddressMulti(); + unload.setOrderId(String.valueOf(orderId)); + unload.setAreaCode(toSave.getUnloadAreaId()); + unload.setAreaName(toSave.getUnloadName()); + unload.setAddress(toSave.getUnloadAddress()); + unload.setLongitude(toSave.getUnloadLongitude()); + unload.setLatitude(toSave.getUnloadLatitude()); + unload.setContactName(toSave.getDischargerName()); + unload.setContactPhone(toSave.getUnloadPhone()); + unload.setLayDate(toSave.getUnloadingData()); + unload.setLayType(2L); + unload.setDelFlag(1); + unload.setOrganizationId(toSave.getOrganizationId()); + unload.setOrganizationName(toSave.getOrganizationName()); + unload.setTopOrganizationId(toSave.getTopOrganizationId()); + unload.setCreateBy(userId); + unload.setCreateTime(now); + unload.setUpdateBy(userId); + unload.setUpdateTime(now); + businessDocumentAddressMultiMapper.insert(unload); } private void copySnapshot(BusinessDocumentOrder order, BusinessDocumentOrderAdjustDetail detail) { @@ -702,37 +770,34 @@ public class BusinessDocumentOrderAdjustService { } tmsOrderAddDTO.setCargoInfoList(cargoInfoList); - // 装货地址 - List loadingAddrList = businessDocumentAddressMultiMapper.selectList( - new LambdaQueryWrapper() - .eq(BusinessDocumentAddressMulti::getOrderId, String.valueOf(after.getId())) - .eq(BusinessDocumentAddressMulti::getDelFlag, 1) - .eq(BusinessDocumentAddressMulti::getLayType, 1L)); + // 装货地址:统一以「调整后业务单」的扁平字段为准,避免明细表(business_document_address_multi)旧值覆盖 + TmsAddressMultiDTO loadingDto = new TmsAddressMultiDTO(); + loadingDto.setAreaCode(after.getLoadingAreaId()); + loadingDto.setAreaName(after.getLoadingName()); + loadingDto.setAddress(after.getLoadingAddress()); + loadingDto.setLongitude(after.getLoadingLongitude()); + loadingDto.setLatitude(after.getLoadingLatitude()); + loadingDto.setContactName(after.getFreighterName()); + loadingDto.setContactPhone(after.getLoadingPhone()); + loadingDto.setLayDate(after.getLoadingDate()); + loadingDto.setLayType(1); List loadingAddressList = new ArrayList<>(); - if (loadingAddrList != null) { - for (BusinessDocumentAddressMulti addr : loadingAddrList) { - TmsAddressMultiDTO dto = new TmsAddressMultiDTO(); - BeanUtil.copyProperties(addr, dto); - loadingAddressList.add(dto); - } - } + loadingAddressList.add(loadingDto); tmsOrderAddDTO.setLoadingAddressList(loadingAddressList); - // 卸货地址 - List unloadAddrList = businessDocumentAddressMultiMapper.selectList( - new LambdaQueryWrapper() - .eq(BusinessDocumentAddressMulti::getOrderId, String.valueOf(after.getId())) - .eq(BusinessDocumentAddressMulti::getDelFlag, 1) - .eq(BusinessDocumentAddressMulti::getLayType, 2L)); + // 卸货地址:同样以「调整后业务单」的扁平字段为准 + TmsAddressMultiDTO unloadDto = new TmsAddressMultiDTO(); + unloadDto.setAreaCode(after.getUnloadAreaId()); + unloadDto.setAreaName(after.getUnloadName()); + unloadDto.setAddress(after.getUnloadAddress()); + unloadDto.setLongitude(after.getUnloadLongitude()); + unloadDto.setLatitude(after.getUnloadLatitude()); + unloadDto.setContactName(after.getDischargerName()); + unloadDto.setContactPhone(after.getUnloadPhone()); + unloadDto.setLayDate(after.getUnloadingData()); + unloadDto.setLayType(2); List unloadAddressList = new ArrayList<>(); - if (unloadAddrList != null) { - for (BusinessDocumentAddressMulti addr : unloadAddrList) { - TmsAddressMultiDTO dto = new TmsAddressMultiDTO(); - BeanUtil.copyProperties(addr, dto); - dto.setLayType(2); - unloadAddressList.add(dto); - } - } + unloadAddressList.add(unloadDto); tmsOrderAddDTO.setUnloadAddressList(unloadAddressList); // 费用明细 From 0077e5d6733e553d4ab104d1791c906c9d2ff726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 23:29:33 +0800 Subject: [PATCH 50/88] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../com/mhd/common/core/feign/ThirdPartyServiceFeign.java | 2 +- .../mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java | 2 +- mhd_oms/src/main/resources/bootstrap.yml | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 93cb610ff..00e656a88 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -19,7 +19,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 78bce4d42..6b99f0f45 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index 5b9773fb9..de45c51b6 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 9016575f6..0da262497 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.32:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.3:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 750ed853e..12571141a 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.33:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.4:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java index 48bf17cd1..94e7ade76 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java @@ -26,7 +26,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.31:8012", configuration = FeignAutoConfiguration.class) +@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.30:8012", configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java index b54559ade..26c5c12b9 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java +++ b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java @@ -22,7 +22,7 @@ import java.util.Map; /** * 三方服务 Feign */ -@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.31:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.30:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index 542b6bce7..ee058f0f6 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 37dd374bda0fd3cedce50c1e5ba10f3701caff66 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Fri, 11 Sep 2026 15:14:46 +0800 Subject: [PATCH 51/88] =?UTF-8?q?fix(wms):=20=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E5=AF=BC=E5=85=A5"=E8=AF=A5=E8=B4=A7=E4=B8=BB=E4=B8=8B?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E8=AF=A5=E6=96=99=E5=8F=B7"?= =?UTF-8?q?=E8=AF=AF=E6=8A=A5=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 根因:Excel客户名称按USER表user_name解析货主ID,同名双账号(如3519/3525)解析到非档案归属账号,带错误shipperId查物料必为空 - 料号匹配:主查询(料号+顶级组织+解析shipperId)为空时,去掉货主条件按档案shipper_name与Excel客户名称等值兜底匹配,命中后以档案货主纠正单据shipperId/shipperCode/shipperName - 新增pickMaterialByCode挑选:料号精确等值优先于LIKE模糊命中,避免子串料号截胡 - SKU校验:档案条码barCode为空时跳过比对,档案有值时仍严格校验 - 校验失败输出诊断日志并附解析shipperId/登录topOrganizationId,区分货主错配(原因A)与组织口径(原因B) --- .../StockInOrderApplicationService.java | 106 ++++++++++++++++-- 1 file changed, 98 insertions(+), 8 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java index 03d02de33..2e6033b25 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java @@ -2040,21 +2040,71 @@ public class StockInOrderApplicationService { r.getMaterialCode(), topOrganizationId, shipperId); List materialList = materialBaseInfoService.queryList(queryDO); log.info("料号查询结果,查询到 {} 条记录", materialList != null ? materialList.size() : 0); - MaterialBaseInfoPO materialBaseInfoPO = null; - if (materialList != null && !materialList.isEmpty()) { - materialBaseInfoPO = materialList.get(0); + MaterialBaseInfoPO materialBaseInfoPO = pickMaterialByCode(materialList, r.getMaterialCode(), shipperId, order.getShipperName()); + // 兜底:按名称解析出的shipperId可能与物料档案shipper_id不一致(系统中存在同名货主账号, + // 按user_name精确匹配解析到了另一个同名列货主),此时去掉货主ID条件再查一次, + // 用物料档案冗余的shipper_name与Excel客户名称等值匹配 + if (materialBaseInfoPO == null && StringUtils.isNotBlank(order.getShipperName())) { + MaterialBaseInfoDO fallbackDO = new MaterialBaseInfoDO(); + fallbackDO.setMaterialCode(r.getMaterialCode()); + if (topOrganizationId != null) { + fallbackDO.setTopOrganizationId(topOrganizationId); + } + List fallbackList = materialBaseInfoService.queryList(fallbackDO); + materialBaseInfoPO = pickMaterialByCode(fallbackList, r.getMaterialCode(), null, order.getShipperName()); + if (materialBaseInfoPO != null) { + log.warn("导入料号校验:按解析shipperId未匹配到物料,已按档案货主名称兜底匹配。料号: [{}], 解析shipperId: {}, 档案shipperId: {}, 档案shipperName: {}", + r.getMaterialCode(), shipperId, materialBaseInfoPO.getShipperId(), materialBaseInfoPO.getShipperName()); + // 以档案货主为准纠正单据货主信息,避免后续shipperParam按错误的shipperId反查覆盖货主名称 + if (materialBaseInfoPO.getShipperId() != null) { + shipperId = materialBaseInfoPO.getShipperId(); + order.setShipperId(shipperId); + } + if (StringUtils.isNotBlank(materialBaseInfoPO.getShipperCode())) { + order.setShipperCode(materialBaseInfoPO.getShipperCode()); + } + if (StringUtils.isNotBlank(materialBaseInfoPO.getShipperName())) { + order.setShipperName(materialBaseInfoPO.getShipperName()); + } + } + } + if (materialBaseInfoPO != null) { materialBaseInfoId = materialBaseInfoPO.getMaterialBaseInfoId(); - log.info("通过料号查询到物料基础信息,料号: {}, 物料ID: {}, 货主ID: {}", + log.info("通过料号查询到物料基础信息,料号: {}, 物料ID: {}, 货主ID: {}", r.getMaterialCode(), materialBaseInfoId, shipperId); } else { // 如果提供了料号但查询不到(或不属于该货主),直接报错,不允许导入 - String errorMsg = String.format("导入失败:该货主下不存在该料号(货主名称=%s,料号=%s)。请确保该料号已在物料管理中创建,且属于该货主", - order.getShipperName(), r.getMaterialCode()); + // 诊断对照查询(仅用于日志定位,不影响流程):去掉货主ID条件再查一次, + // 用于区分两类原因:A-按名称解析出的shipperId与物料档案shipper_id不一致(货主错配); + // B-登录人topOrganizationId与物料档案top_organization_id不一致(组织口径不一致) + try { + MaterialBaseInfoDO diagDO = new MaterialBaseInfoDO(); + diagDO.setMaterialCode(r.getMaterialCode()); + if (topOrganizationId != null) { + diagDO.setTopOrganizationId(topOrganizationId); + } + List diagList = materialBaseInfoService.queryList(diagDO); + if (diagList != null && !diagList.isEmpty()) { + MaterialBaseInfoPO diagPo = diagList.get(0); + log.error("导入料号校验诊断:去掉货主条件后可查到物料,判定为货主解析错配(原因A)。料号: [{}], 解析shipperId: {}, 登录topOrganizationId: {}, 物料ID: {}, 档案shipperId: {}, 档案shipperName: {}, 档案topOrganizationId: {}", + r.getMaterialCode(), shipperId, topOrganizationId, + diagPo.getMaterialBaseInfoId(), diagPo.getShipperId(), diagPo.getShipperName(), diagPo.getTopOrganizationId()); + } else { + log.error("导入料号校验诊断:去掉货主条件后仍查不到物料,判定为组织口径不一致(原因B)。料号: [{}], 解析shipperId: {}, 登录topOrganizationId: {}", + r.getMaterialCode(), shipperId, topOrganizationId); + } + } catch (Exception diagEx) { + log.warn("导入料号校验诊断查询异常,料号: [{}], 错误: {}", r.getMaterialCode(), diagEx.getMessage()); + } + String errorMsg = String.format("导入失败:该货主下不存在该料号(货主名称=%s,料号=%s,解析shipperId=%s,登录topOrganizationId=%s)。请确保该料号已在物料管理中创建,且属于该货主", + order.getShipperName(), r.getMaterialCode(), + shipperId == null ? "空" : shipperId, topOrganizationId == null ? "空" : topOrganizationId); log.error(errorMsg); throw new ServiceException(errorMsg); } // 校验料号与规格型号/SKU码一致性:按料号查到档案后逐项比对,任何一项不符直接报对应错误 - // 双方(trim后)必须完全一致:Excel留空而档案有值、或Excel填了值而档案为空,均视为不一致报错 + // 规格型号(trim后)双方必须完全一致:Excel留空而档案有值、或Excel填了值而档案为空,均视为不一致报错 + // SKU码:档案条码(barCode)为空时跳过比对(存量档案普遍未维护条码);档案有值时仍严格比对 String excelSpec = StringUtils.trimToEmpty(r.getSpecificationModel()); String dbSpec = StringUtils.trimToEmpty(materialBaseInfoPO.getSpecificationModel()); if (!excelSpec.equals(dbSpec)) { @@ -2064,7 +2114,7 @@ public class StockInOrderApplicationService { } String excelSku = StringUtils.trimToEmpty(r.getSkuCode()); String dbSku = StringUtils.trimToEmpty(materialBaseInfoPO.getBarCode()); - if (!excelSku.equals(dbSku)) { + if (StringUtils.isNotEmpty(dbSku) && !excelSku.equals(dbSku)) { throw new ServiceException(String.format("导入失败:料号[%s](商品名称:%s)SKU码与物料档案不一致(Excel:%s / 档案:%s)", r.getMaterialCode(), r.getMaterialName(), excelSku.isEmpty() ? "空" : excelSku, dbSku.isEmpty() ? "空" : dbSku)); @@ -2398,6 +2448,46 @@ public class StockInOrderApplicationService { return oid != null && loginOrganizationId.equals(oid); } + /** + * 导入校验:从按料号(SQL为LIKE模糊)查出的物料列表中挑选匹配记录。 + * 优先级:料号精确等值优先于模糊命中(避免子串料号误匹配); + * 同级内优先 shipperId 精确匹配,其次 shipperName 等值匹配,最后取排序第一条(与原 get(0) 行为一致)。 + */ + private MaterialBaseInfoPO pickMaterialByCode(List materialList, String materialCode, Long shipperId, String shipperName) { + if (materialList == null || materialList.isEmpty()) { + return null; + } + String code = StringUtils.trimToEmpty(materialCode); + String name = StringUtils.trimToEmpty(shipperName); + MaterialBaseInfoPO exactCodeFirst = null; + MaterialBaseInfoPO anyFirst = null; + // 第一轮:料号精确等值中优先 shipperId 精确匹配 + for (MaterialBaseInfoPO po : materialList) { + if (anyFirst == null) { + anyFirst = po; + } + if (StringUtils.isEmpty(code) || !code.equals(StringUtils.trimToEmpty(po.getMaterialCode()))) { + continue; + } + if (exactCodeFirst == null) { + exactCodeFirst = po; + } + if (shipperId != null && shipperId.equals(po.getShipperId())) { + return po; + } + } + // 第二轮:料号精确等值中按档案货主名称等值匹配 + if (StringUtils.isNotEmpty(name)) { + for (MaterialBaseInfoPO po : materialList) { + if (StringUtils.isNotEmpty(code) && code.equals(StringUtils.trimToEmpty(po.getMaterialCode())) + && name.equals(StringUtils.trimToEmpty(po.getShipperName()))) { + return po; + } + } + } + return exactCodeFirst != null ? exactCodeFirst : anyFirst; + } + /** * @description 根据货主名称或编号获取货主ID(用于导入时提前获取货主ID) * @param shipperName 货主名称 From c1bbda9f9a3f95c6dba3411a7f427836568a64f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 11 Sep 2026 15:33:59 +0800 Subject: [PATCH 52/88] =?UTF-8?q?=E6=92=A4=E9=94=80=E4=BB=98=E6=AC=BE?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReceiptManageApplicationService.java | 7 ++ .../service/BillManageDomainService.java | 53 +++++------ .../service/ReceiptManageDomainService.java | 87 ++++++++++++++----- .../facadeApi/ReceiptManageApi.java | 13 +-- 4 files changed, 100 insertions(+), 60 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java index ab4a85b5a..b098b3443 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java @@ -159,6 +159,13 @@ public class ReceiptManageApplicationService { return receiptManageDomainService.cancelCollection(receiptManageDO); } + /** + * 撤销收款-查询账单涉及的收款单id(用于加锁,防止并发撤销时收款单金额重算冲突) + */ + public Set queryCancelCollectionReceiptManageIds(String billManageIds) { + return receiptManageDomainService.queryReceiptManageIdsByBillManageIds(billManageIds); + } + /** * 退款 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index ccfc7dc66..e45e9b25e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -710,62 +710,49 @@ public class BillManageDomainService { /** - * 撤销收款:恢复账单信息并保存撤销收款操作日志 + * 撤销收款:账单恢复为收款为0状态并保存撤销收款操作日志 */ public Boolean cancelCollectionInfo(List receiptDetails) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } - List billManageIds = receiptDetails.stream().map(ReceiptDetail::getBillManageId).collect(Collectors.toList()); + //按账单分组收款明细(一个账单可能对应多个收款单) + Map> billDetailMap = receiptDetails.stream().collect(Collectors.groupingBy(ReceiptDetail::getBillManageId)); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.in(BillManage::getBillManageId,billManageIds); + queryWrapper.in(BillManage::getBillManageId,billDetailMap.keySet()); List billManageList = billManageService.list(queryWrapper); if(billManageList == null || billManageList.size()==0){ throw new ServiceException("账单信息未找到"); } List billManageListSave = new ArrayList<>(); List billOperationLogSave = new ArrayList<>(); - for (ReceiptDetail receiptDetail : receiptDetails) { - BillManage billManage = billManageList.stream().filter(billManage1 -> ObjectUtil.equal(billManage1.getBillManageId(),receiptDetail.getBillManageId())).findAny().orElse(null); - if(null == billManage){ - throw new ServiceException("账单" + receiptDetail.getBillNumber() + "信息未找到,请刷新后重试"); - } - BigDecimal collectedDiscount = receiptDetail.getCollectedDiscount() == null ? BigDecimal.ZERO : receiptDetail.getCollectedDiscount(); - BigDecimal collectedAmount = receiptDetail.getCollectedAmount() == null ? BigDecimal.ZERO : receiptDetail.getCollectedAmount(); - BigDecimal all = collectedAmount.add(collectedDiscount); - BigDecimal billAmountSettlement = billManage.getBillAmountSettlement() == null ? BigDecimal.ZERO : billManage.getBillAmountSettlement(); - //校验已收金额是否足够撤销,避免出现负数 - if (billAmountSettlement.compareTo(all) < 0) { - throw new ServiceException("账单" + billManage.getBillNumber() + "已收金额小于待撤销金额,无法撤销收款,请刷新后重试"); + for (BillManage billManage : billManageList) { + List receiptDetailList = billDetailMap.get(billManage.getBillManageId()); + if(null == receiptDetailList || receiptDetailList.size() == 0){ + continue; } BillManage billManageSave = new BillManage(); billManageSave.setBillManageId(billManage.getBillManageId()); - //扣减已收金额,重新计算未收金额 - billManageSave.setBillAmountSettlement(billAmountSettlement.subtract(all)); - billManageSave.setBillAmountUnsettled(billManage.getBillAmount().subtract(billManageSave.getBillAmountSettlement())); - //扣减实收金额 - BigDecimal actualReceivedAmount = billManage.getActualReceivedAmount() == null ? BigDecimal.ZERO : billManage.getActualReceivedAmount(); - billManageSave.setActualReceivedAmount(actualReceivedAmount.subtract(collectedAmount)); - //扣减结算单优惠金额 - BigDecimal settlementDiscountsAmount = billManage.getSettlementDiscountsAmount() == null ? BigDecimal.ZERO : billManage.getSettlementDiscountsAmount(); - billManageSave.setSettlementDiscountsAmount(settlementDiscountsAmount.subtract(collectedDiscount)); - //恢复账单状态:已收金额为0回到未收款,未收金额为0为已收款,否则为部分收款 - if (billManageSave.getBillAmountSettlement().compareTo(BigDecimal.ZERO) == 0) { - billManageSave.setBillState(3); - } else if (billManageSave.getBillAmountUnsettled().compareTo(BigDecimal.ZERO) == 0) { - billManageSave.setBillState(5); - } else { - billManageSave.setBillState(4); - } + //账单恢复为收款为0状态 + billManageSave.setBillAmountSettlement(BigDecimal.ZERO); + billManageSave.setBillAmountUnsettled(billManage.getBillAmount()); + billManageSave.setActualReceivedAmount(BigDecimal.ZERO); + billManageSave.setSettlementDiscountsAmount(BigDecimal.ZERO); + billManageSave.setBillState(3); billManageSave.setUpdateBy(loginUser.getUserPo().getUserId()); billManageSave.setUpdateByName(loginUser.getUserPo().getUserName()); billManageSave.setUpdateTime(new Date()); billManageListSave.add(billManageSave); + //汇总该账单本次撤销的收款金额与收款单号 + BigDecimal collectedDiscount = receiptDetailList.stream().map(info -> info.getCollectedDiscount() == null ? BigDecimal.ZERO : info.getCollectedDiscount()).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal collectedAmount = receiptDetailList.stream().map(info -> info.getCollectedAmount() == null ? BigDecimal.ZERO : info.getCollectedAmount()).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal all = collectedAmount.add(collectedDiscount); + String collectionNums = receiptDetailList.stream().map(ReceiptDetail::getCollectionNum).filter(StringUtils::isNotEmpty).distinct().collect(Collectors.joining(",")); //保存账单操作记录 BillOperationLog billOperationLog = new BillOperationLog(); billOperationLog.setBillManageId(billManage.getBillManageId()); - billOperationLog.setOperationInfo(StringUtils.format(BillLogsConstants.cancel_collection_bill_text,receiptDetail.getCollectionNum(),all,collectedAmount,collectedDiscount)); + billOperationLog.setOperationInfo(StringUtils.format(BillLogsConstants.cancel_collection_bill_text,collectionNums,all,collectedAmount,collectedDiscount)); billOperationLog.setOperationType(12); billOperationLog.setDelFlag(1); billOperationLogSave.add(billOperationLog); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/service/ReceiptManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/service/ReceiptManageDomainService.java index de0f85653..80a695289 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/service/ReceiptManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/service/ReceiptManageDomainService.java @@ -42,7 +42,9 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -308,57 +310,77 @@ public class ReceiptManageDomainService { if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } - if (null == receiptManageDO.getReceiptManageId()) { - throw new ServiceException("收款单id不能为空"); - } if (StringUtils.isEmpty(receiptManageDO.getBillManageIds())) { throw new ServiceException("撤销账单不能为空"); } - //查询收款单信息 - ReceiptManage receiptManage = receiptManageService.getById(receiptManageDO.getReceiptManageId()); - if (null == receiptManage || ObjectUtil.equal(receiptManage.getDelFlag(), 2)) { - throw new ServiceException("收款单信息未找到或已撤销,请刷新后重试"); - } - if (ObjectUtil.equal(receiptManage.getPaymentStatus(), 2)) { - throw new ServiceException("该收款单已退款,无法撤销收款"); - } - //查询待撤销账单对应的收款明细 Set billManageIdSet = Stream.of(receiptManageDO.getBillManageIds().split(",")).filter(StringUtils::isNotEmpty).map(String::trim).map(Long::valueOf).collect(Collectors.toSet()); + if (billManageIdSet.size() == 0) { + throw new ServiceException("撤销账单不能为空"); + } + //查询账单信息 + LambdaQueryWrapper queryWrapperBill = new LambdaQueryWrapper<>(); + queryWrapperBill.in(BillManage::getBillManageId, billManageIdSet); + queryWrapperBill.eq(BillManage::getDelFlag, 1); + List billManageList = billManageDomainService.queryListLambda(queryWrapperBill); + if (null == billManageList || billManageList.size() == 0) { + throw new ServiceException("账单信息未找到"); + } + if (billManageList.size() != billManageIdSet.size()) { + throw new ServiceException("部分账单信息未找到,请刷新后重试"); + } + //查询账单的全部有效收款明细(一个账单可能对应多个收款单) LambdaQueryWrapper queryWrapperDetail = new LambdaQueryWrapper<>(); - queryWrapperDetail.eq(ReceiptDetail::getReceiptManageId, receiptManageDO.getReceiptManageId()); queryWrapperDetail.in(ReceiptDetail::getBillManageId, billManageIdSet); queryWrapperDetail.eq(ReceiptDetail::getDelFlag, 1); List receiptDetails = receiptDetailDomainService.queryListByLambda(queryWrapperDetail); if (null == receiptDetails || receiptDetails.size() == 0) { throw new ServiceException("账单收款记录不存在或已撤销,请刷新后重试"); } - if (receiptDetails.size() != billManageIdSet.size()) { - throw new ServiceException("部分账单收款记录不存在或已撤销,请刷新后重试"); + //校验每个账单都有收款记录 + Map> billDetailMap = receiptDetails.stream().collect(Collectors.groupingBy(ReceiptDetail::getBillManageId)); + for (BillManage billManage : billManageList) { + if (!billDetailMap.containsKey(billManage.getBillManageId())) { + throw new ServiceException("账单" + billManage.getBillNumber() + "收款记录不存在或已撤销,请刷新后重试"); + } } - //恢复账单信息并保存撤销收款操作日志 + //校验收款单退款状态,已退款的收款单不能撤销收款 + Set receiptManageIdSet = receiptDetails.stream().map(ReceiptDetail::getReceiptManageId).collect(Collectors.toSet()); + LambdaQueryWrapper queryWrapperManage = new LambdaQueryWrapper<>(); + queryWrapperManage.in(ReceiptManage::getReceiptManageId, receiptManageIdSet); + List receiptManageList = receiptManageService.list(queryWrapperManage); + if (null != receiptManageList) { + ReceiptManage refundManage = receiptManageList.stream().filter(info -> ObjectUtil.equal(info.getPaymentStatus(), 2)).findAny().orElse(null); + if (null != refundManage) { + throw new ServiceException("收款单" + refundManage.getCollectionNum() + "已退款,无法撤销收款"); + } + } + //账单恢复为收款为0状态并保存撤销收款操作日志 Boolean flagTwo = billManageDomainService.cancelCollectionInfo(receiptDetails); //逻辑删除收款明细 Boolean flag = receiptDetailDomainService.cancelCollectionDetails(receiptDetails); - //重新计算收款单金额,收款明细已全部撤销时逻辑删除收款单 - Boolean flagThree = updateReceiptManageByCancel(receiptManage); + //按剩余明细重新计算涉及的收款单金额,明细已全部撤销时逻辑删除收款单 + Boolean flagThree = true; + for (Long receiptManageId : receiptManageIdSet) { + flagThree = updateReceiptManageByCancel(receiptManageId) && flagThree; + } return flag && flagTwo && flagThree; } /** * 撤销收款后重新计算收款单信息,收款明细已全部撤销时逻辑删除收款单 */ - private Boolean updateReceiptManageByCancel(ReceiptManage receiptManage) { + private Boolean updateReceiptManageByCancel(Long receiptManageId) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } //查询收款单下剩余未撤销的收款明细 LambdaQueryWrapper queryWrapperDetail = new LambdaQueryWrapper<>(); - queryWrapperDetail.eq(ReceiptDetail::getReceiptManageId, receiptManage.getReceiptManageId()); + queryWrapperDetail.eq(ReceiptDetail::getReceiptManageId, receiptManageId); queryWrapperDetail.eq(ReceiptDetail::getDelFlag, 1); List receiptDetailList = receiptDetailDomainService.queryListByLambda(queryWrapperDetail); ReceiptManage receiptManageSave = new ReceiptManage(); - receiptManageSave.setReceiptManageId(receiptManage.getReceiptManageId()); + receiptManageSave.setReceiptManageId(receiptManageId); receiptManageSave.setUpdateBy(loginUser.getUserPo().getUserId()); receiptManageSave.setUpdateByName(loginUser.getUserPo().getUserName()); receiptManageSave.setUpdateTime(new Date()); @@ -383,6 +405,29 @@ public class ReceiptManageDomainService { return receiptManageService.updateById(receiptManageSave); } + /** + * 撤销收款-查询账单涉及的收款单id(用于加锁,防止并发撤销时收款单金额重算冲突) + */ + public Set queryReceiptManageIdsByBillManageIds(String billManageIds) { + Set receiptManageIdSet = new HashSet<>(); + if (StringUtils.isEmpty(billManageIds)) { + return receiptManageIdSet; + } + Set billManageIdSet = Stream.of(billManageIds.split(",")).filter(StringUtils::isNotEmpty).map(String::trim).map(Long::valueOf).collect(Collectors.toSet()); + if (billManageIdSet.size() == 0) { + return receiptManageIdSet; + } + LambdaQueryWrapper queryWrapperDetail = new LambdaQueryWrapper<>(); + queryWrapperDetail.in(ReceiptDetail::getBillManageId, billManageIdSet); + queryWrapperDetail.eq(ReceiptDetail::getDelFlag, 1); + List receiptDetails = receiptDetailDomainService.queryListByLambda(queryWrapperDetail); + if (null == receiptDetails || receiptDetails.size() == 0) { + return receiptManageIdSet; + } + receiptDetails.forEach(receiptDetail -> receiptManageIdSet.add(receiptDetail.getReceiptManageId())); + return receiptManageIdSet; + } + /** * 查询收款单详情 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ReceiptManageApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ReceiptManageApi.java index b0b76e2eb..c733bde13 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ReceiptManageApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ReceiptManageApi.java @@ -123,9 +123,6 @@ public class ReceiptManageApi extends BaseController{ @PostMapping("/cancelCollection") public AjaxResult cancelCollection(@RequestBody ReceiptManageDTO receiptManageDTO) { - if(null == receiptManageDTO.getReceiptManageId()){ - throw new ServiceException("收款单id不能为空"); - } if(!StringUtils.isNotEmpty(receiptManageDTO.getBillManageIds())){ throw new ServiceException("撤销账单不能为空"); } @@ -134,10 +131,14 @@ public class ReceiptManageApi extends BaseController{ try { RedisLockTypeEnum redisLockTypeEnum = RedisLockTypeEnum.BMS; List locks = new ArrayList<>(); - //收款单id与账单id去重后加锁,避免同一把锁重复加锁 + //账单id与涉及的收款单id去重后加锁,避免同一把锁重复加锁 Set lockKeySet = new LinkedHashSet<>(); - lockKeySet.add(String.valueOf(receiptManageDTO.getReceiptManageId())); - lockKeySet.addAll(Stream.of(receiptManageDTO.getBillManageIds().split(",")).collect(Collectors.toSet())); + lockKeySet.addAll(Stream.of(receiptManageDTO.getBillManageIds().split(",")).filter(StringUtils::isNotEmpty).map(String::trim).collect(Collectors.toSet())); + //查询账单涉及的收款单,一并加锁,避免并发撤销时收款单金额重算冲突 + Set receiptManageIdSet = receiptManageApplicationService.queryCancelCollectionReceiptManageIds(receiptManageDTO.getBillManageIds()); + if (null != receiptManageIdSet) { + receiptManageIdSet.forEach(x -> lockKeySet.add(String.valueOf(x))); + } lockKeySet.forEach(x -> { //获取唯一key值 String key = redisLockTypeEnum.getUniqueKey(UniqueKeyUtil.getBillingKey(x)); From 028afb57d7c2614b1d1ae177ddc4d3ca984986a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E8=BE=89?= <2830717623@qq.com> Date: Fri, 11 Sep 2026 15:45:15 +0800 Subject: [PATCH 53/88] =?UTF-8?q?=E7=94=A8=E6=88=B7-yms=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8E=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UserApplicationService.java | 61 +++++++++++++++++++ .../service/UserYmsDomainService.java | 1 + .../dto/updateDTO/PasswordChangeDTO.java | 20 ++++++ .../mhd/user/interfaces/facade/UserAPI.java | 13 ++++ 4 files changed, 95 insertions(+) create mode 100644 mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/updateDTO/PasswordChangeDTO.java diff --git a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java index 1f44ce5eb..423fe302a 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserApplicationService.java @@ -97,6 +97,7 @@ import com.mhd.system.api.model.LoginUser; import com.mhd.user.interfaces.dto.addDTO.UserDriverDTO; import com.mhd.user.interfaces.dto.queryDTO.UserDocumentWarningQueryDTO; import com.mhd.user.interfaces.dto.updateDTO.UpdateHasDefaultAddressDTO; +import com.mhd.user.interfaces.dto.updateDTO.PasswordChangeDTO; import com.mhd.user.interfaces.facadeApi.Po.UserDriverCountPo; import com.mhd.user.interfaces.vo.QueryAllShipperInfoVo; import lombok.extern.slf4j.Slf4j; @@ -214,6 +215,61 @@ public class UserApplicationService { @Autowired private UserShipperMapper userShipperMapper; + /** + * 修改密码 - 同步 wlhy 与 yms + */ + @Transactional(rollbackFor = Exception.class) + public void changePassword(PasswordChangeDTO passwordChangeDTO) { + // 1. 获取当前登录用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + + Long userId = loginUser.getUserPo().getUserId(); + if (userId == null) { + throw new ServiceException("用户未登录"); + } + + // 2. 查询用户信息 + UserPo userPO = userDomainService.selectByUserId(userId); + UserEntity userEntity = new UserEntity(); + BeanUtils.copyProperties(userPO,userEntity); + if (ObjectUtil.isNull(userEntity)) { + throw new ServiceException("用户不存在"); + } + + // 3. 解密并加密新密码 + String salt = userEntity.getUserSalt(); + String newPassword = decrypt(passwordChangeDTO.getNewPassword()); + String encodedPassword = PasswordUtil.encrypt(userEntity.getUserAccount(), newPassword, salt); + + // 4. 更新本地密码 + UserDO userDO = new UserDO(); + userDO.setUserId(userId); + userDO.setUserPassword(encodedPassword); + userDomainService.updateUser(userDO); + + // 5. 同步到网货平台(wlhy) + try { + userEntity.setUserPassword(encodedPassword); + wlhyDomainService.addOrEditPlatformUser(userEntity); + } catch (Exception e) { + log.warn("同步密码到网货平台失败,但不影响主流程:{}", e.getMessage()); + } + + // 6. 同步到 YMS 平台 + try { + Integer isQueue = userMapper.getOrdIsQueue(userEntity.getOrganizationId()); + if (isQueue != null && isQueue == 1) { + userEntity.setUserPassword(newPassword); + ymsDomainService.addOrEditYmsUser(userEntity); + } + } catch (Exception e) { + log.warn("同步密码到 YMS 平台失败,但不影响主流程:{}", e.getMessage()); + } + } + /** * @Description 查询用户列表 * @Author Alex @@ -1971,6 +2027,11 @@ public class UserApplicationService { if (StrUtil.isEmpty(userDO.getUserName())) { userDO.setUserName("用户" + userDO.getUserPhone().substring(userDO.getUserPhone().length() - 4)); } + //密码为空则给默认密码 + if (StrUtil.isEmpty(userDO.getUserPassword())) { + String defaultPassword = "Aa123456"; + userDO.setUserPassword(PasswordUtil.encrypt(userDO.getUserAccount(), defaultPassword, userDO.getUserSalt())); + } UserEntity userEntity = userDomainService.addUser(userDO); //给小程序注册用户分配默认普通用户角色(must),本组织没有则找上级 userEntity.setUserPassword("Aa123456"); // 三方同步需要密码 diff --git a/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/service/UserYmsDomainService.java b/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/service/UserYmsDomainService.java index 73cfa870d..14c92afd0 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/service/UserYmsDomainService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/service/UserYmsDomainService.java @@ -100,6 +100,7 @@ public class UserYmsDomainService { ymsSysUserDTO.setPhonenumber(userEntity.getUserPhone()); ymsSysUserDTO.setAvatar(userEntity.getAvatar()); ymsSysUserDTO.setUserAccountType(userEntity.getUserAccountType()); + ymsSysUserDTO.setPassword(userEntity.getUserPassword()); if (StringUtils.isNotBlank(userEntity.getRoleCode())){ ymsSysUserDTO.setRoleCodes(Arrays.asList(userEntity.getRoleCode().split(","))); diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/updateDTO/PasswordChangeDTO.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/updateDTO/PasswordChangeDTO.java new file mode 100644 index 000000000..c9839ae26 --- /dev/null +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/dto/updateDTO/PasswordChangeDTO.java @@ -0,0 +1,20 @@ +package com.mhd.user.interfaces.dto.updateDTO; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 修改密码 DTO + * @author AI + * @date 2026/09/10 + */ +@Data +public class PasswordChangeDTO { + + /** + * 新密码 + */ + @NotBlank(message = "新密码不能为空") + private String newPassword; +} \ No newline at end of file diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java index 52d5058f9..dba2ba695 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserAPI.java @@ -32,6 +32,7 @@ import com.mhd.common.security.annotation.InnerAuth; import com.mhd.common.security.service.TokenService; import com.mhd.system.api.model.LoginUser; import com.mhd.user.interfaces.dto.queryDTO.UserDocumentWarningQueryDTO; +import com.mhd.user.interfaces.dto.updateDTO.PasswordChangeDTO; import com.mhd.user.interfaces.dto.updateDTO.UpdateHasDefaultAddressDTO; import com.mhd.user.interfaces.vo.QueryAllShipperInfoVo; import io.swagger.annotations.Api; @@ -1037,4 +1038,16 @@ public class UserAPI extends BaseController { public R finShipperEnterpriseNamedByUserId(@PathVariable("userId") Long userId) { return R.ok(userApplicationService.finShipperEnterpriseNamedByUserId(userId)); } + + /** + * 修改密码 - 同步 wlhy 与 yms + * 根据当前登录用户判断是谁修改,只传新密码,不需要校验旧密码 + */ + @Log(title = "用户中台管理 - 修改密码", description ="修改当前登录用户密码",businessType = BusinessType.UPDATE) + @ApiOperation("修改密码") + @PostMapping("/changePassword") + public AjaxResult changePassword(@RequestBody PasswordChangeDTO passwordChangeDTO) { + userApplicationService.changePassword(passwordChangeDTO); + return AjaxResult.success(); + } } \ No newline at end of file From 3653c379148b8551c05b97314e72858b0ef9ef38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 11 Sep 2026 15:52:02 +0800 Subject: [PATCH 54/88] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BillOperationLogMapper.xml | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml b/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml index 7098fe232..5894f31eb 100644 --- a/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml @@ -12,38 +12,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - and create_by_name like concat('%', #{createByName}, '%') + + and create_by_name like concat('%', #{billOperationLogDO.createByName}, '%') - - and update_by_name like concat('%', #{updateByName}, '%') + + and update_by_name like concat('%', #{billOperationLogDO.updateByName}, '%') - - and top_organization_id = #{topOrganizationId} + + and top_organization_id = #{billOperationLogDO.topOrganizationId} - - and organization_id = #{organizationId} + + and organization_id = #{billOperationLogDO.organizationId} - - and organization_name like concat('%', #{organizationName}, '%') + + and organization_name like concat('%', #{billOperationLogDO.organizationName}, '%') - - and bill_manage_id = #{billManageId} + + and bill_manage_id = #{billOperationLogDO.billManageId} - - and bill_number = #{billNumber} + + and bill_number = #{billOperationLogDO.billNumber} - - and operation_type = #{operationType} + + and operation_type = #{billOperationLogDO.operationType} - - and operation_info = #{operationInfo} + + and operation_info = #{billOperationLogDO.operationInfo} - - and operator = #{operator} + + and operator = #{billOperationLogDO.operator} - - and operation_time = #{operationTime} + + and operation_time = #{billOperationLogDO.operationTime} @@ -64,4 +64,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bill_manage_id = #{billManageIds} ORDER BY create_time ASC - + \ No newline at end of file From 0ca8548c069cb6dce20bd1835c2c90d273764530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 11 Sep 2026 15:56:48 +0800 Subject: [PATCH 55/88] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BillOperationLogMapper.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml b/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml index 5894f31eb..1a55a853e 100644 --- a/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml @@ -30,21 +30,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bill_manage_id = #{billOperationLogDO.billManageId} - - and bill_number = #{billOperationLogDO.billNumber} - + + + and operation_type = #{billOperationLogDO.operationType} and operation_info = #{billOperationLogDO.operationInfo} - - and operator = #{billOperationLogDO.operator} - - - and operation_time = #{billOperationLogDO.operationTime} - + + + + + + From 6613eeb3fba7d668163c2c3658d8d3e92e45c033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 11 Sep 2026 16:36:23 +0800 Subject: [PATCH 56/88] =?UTF-8?q?=E6=89=B9=E9=87=8F=E7=BA=A2=E5=86=B2;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 2 +- .../service/BillManageDomainService.java | 43 ++++++++++++++----- .../interfaces/facadeApi/BillManageApi.java | 29 ++++++++----- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index fa8bfc3a3..5b1c2531a 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -658,7 +658,7 @@ public class BillManageApplicationService { if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } - if (billManageDTO.getBillManageId() == null) { + if (StringUtils.isEmpty(billManageDTO.getBillManageIds())) { throw new ServiceException("账单id不能为空"); } return billManageDomainService.redFlushBill(billManageDTO); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index e45e9b25e..5dfd67dff 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -764,25 +764,48 @@ public class BillManageDomainService { /** - * 应收账单红冲:生成一条金额为负数的红冲账单对冲原账单,不操作收款单等数据 + * 应收账单红冲:生成金额为负数的红冲账单对冲原账单,不操作收款单等数据(支持批量) */ public Boolean redFlushBill(BillManageDTO billManageDTO) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } - if (null == billManageDTO.getBillManageId()) { + if (StringUtils.isEmpty(billManageDTO.getBillManageIds())) { throw new ServiceException("账单id不能为空"); } - BillManage originalBill = billManageService.getById(billManageDTO.getBillManageId()); - if (null == originalBill || ObjectUtil.equal(originalBill.getDelFlag(), 2)) { - throw new ServiceException("原账单信息未找到,请刷新后重试"); + Set billManageIdSet = Stream.of(billManageDTO.getBillManageIds().split(",")).filter(StringUtils::isNotEmpty).map(String::trim).map(Long::valueOf).collect(Collectors.toSet()); + if (billManageIdSet.size() == 0) { + throw new ServiceException("账单id不能为空"); } + //查询账单信息 + LambdaQueryWrapper queryWrapperBill = new LambdaQueryWrapper<>(); + queryWrapperBill.in(BillManage::getBillManageId, billManageIdSet); + queryWrapperBill.eq(BillManage::getDelFlag, 1); + List billManageList = billManageService.list(queryWrapperBill); + if (null == billManageList || billManageList.size() == 0) { + throw new ServiceException("账单信息未找到"); + } + if (billManageList.size() != billManageIdSet.size()) { + throw new ServiceException("部分账单信息未找到,请刷新后重试"); + } + //逐个账单红冲,任一账单校验不通过时事务整体回滚 + Boolean flag = true; + for (BillManage originalBill : billManageList) { + flag = redFlushSingleBill(originalBill, billManageDTO.getRedFlushRemark(), loginUser) && flag; + } + return flag; + } + + /** + * 红冲单个账单:生成金额为负数的红冲账单对冲原账单,同步镜像计费流水与账单明细 + */ + private Boolean redFlushSingleBill(BillManage originalBill, String redFlushRemark, LoginUser loginUser) { if (ObjectUtil.equal(originalBill.getBillType(), 2)) { - throw new ServiceException("仅支持应收账单红冲"); + throw new ServiceException("账单" + originalBill.getBillNumber() + "为付款账单,仅支持应收账单红冲"); } if (!ObjectUtil.equal(originalBill.getBillState(), 5)) { - throw new ServiceException("仅已收款状态的账单可以红冲,请刷新后重试"); + throw new ServiceException("账单" + originalBill.getBillNumber() + "不是已收款状态,仅已收款状态的账单可以红冲,请刷新后重试"); } //校验账单是否已红冲,避免重复生成红冲账单 BillOperationLogDO redFlushLogQuery = new BillOperationLogDO(); @@ -790,7 +813,7 @@ public class BillManageDomainService { redFlushLogQuery.setOperationType(13); List redFlushLogList = billOperationLogDomainService.queryList(redFlushLogQuery); if (null != redFlushLogList && redFlushLogList.stream().anyMatch(info -> ObjectUtil.equal(info.getDelFlag(), 1))) { - throw new ServiceException("该账单已红冲,不能重复红冲"); + throw new ServiceException("账单" + originalBill.getBillNumber() + "已红冲,不能重复红冲"); } //生成红冲账单编号 String billNumber = OrderSequence.getOrderCode("ZD"); @@ -832,8 +855,8 @@ public class BillManageDomainService { redBill.setSkNcId(null); //红冲原因写入账单备注 String billRemark = "红冲原账单编号:" + originalBill.getBillNumber(); - if (StringUtils.isNotEmpty(billManageDTO.getRedFlushRemark())) { - billRemark = billRemark + ",红冲原因:" + billManageDTO.getRedFlushRemark(); + if (StringUtils.isNotEmpty(redFlushRemark)) { + billRemark = billRemark + ",红冲原因:" + redFlushRemark; } redBill.setBillRemark(billRemark); redBill.setDelFlag(1); diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java index 43c735d11..40c7d6c5d 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java @@ -18,6 +18,7 @@ import com.mhd.bms.infrastructure.utils.UniqueKeyUtil; import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO; import com.mhd.bms.interfaces.dto.billManage.BillManageExportVO; import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.utils.StringUtils; import com.mhd.common.core.utils.poi.ExcelUtil; import com.mhd.common.log.annotation.Log; import com.mhd.common.log.enums.BusinessType; @@ -400,18 +401,26 @@ public class BillManageApi extends BaseController{ @PostMapping("/redFlushBill") public AjaxResult redFlushBill(@RequestBody BillManageDTO billManageDTO) { - if(billManageDTO.getBillManageId() == null){ + if(!StringUtils.isNotEmpty(billManageDTO.getBillManageIds())){ throw new ServiceException("账单id不能为空"); } - //加锁 - RLock lock = null; - RedisLockTypeEnum redisLockTypeEnum = RedisLockTypeEnum.BMS; - String key = redisLockTypeEnum.getUniqueKey(UniqueKeyUtil.getBillingKey(String.valueOf(billManageDTO.getBillManageId()))); + //批量加锁 + RedissonMultiLock redissonMultiLock = null; + boolean lockFlag = false; try { - lock = redisLock.getRLock(key); + RedisLockTypeEnum redisLockTypeEnum = RedisLockTypeEnum.BMS; + List locks = new ArrayList<>(); + Set billIdSet = Stream.of(billManageDTO.getBillManageIds().split(",")).filter(StringUtils::isNotEmpty).map(String::trim).collect(Collectors.toSet()); + billIdSet.forEach(x -> { + //获取唯一key值 + String key = redisLockTypeEnum.getUniqueKey(UniqueKeyUtil.getBillingKey(x)); + locks.add(redisLock.getRLock(key)); + }); + redissonMultiLock = new RedissonMultiLock(locks.toArray(new RLock[billIdSet.size()])); //尝试获取锁 不等待 持有锁10分钟 - if (!lock.tryLock(-1, 10, TimeUnit.MINUTES)) { - lock = null; + lockFlag = redissonMultiLock.tryLock(-1, 10, TimeUnit.MINUTES); + if (!lockFlag) { + redissonMultiLock = null; throw new ServiceException("账单正在操作中,请稍后重试"); } log.info("红冲账单加锁成功"); @@ -420,8 +429,8 @@ public class BillManageApi extends BaseController{ }catch (Exception e){ return AjaxResult.error("红冲账单失败:"+e.getMessage()); } finally { - if (lock != null && lock.isHeldByCurrentThread()){ - lock.unlock(); + if (redissonMultiLock != null && lockFlag){ + redissonMultiLock.unlock(); log.info("红冲账单释放锁成功"); } } From 8dfe9545aac50752f17de9f3b563b5d52786370f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E8=BE=89?= <2830717623@qq.com> Date: Fri, 11 Sep 2026 17:22:50 +0800 Subject: [PATCH 57/88] user30 --- mhd-user-center/src/main/resources/bootstrap.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index fd3e72060..43b72842a 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -20,13 +20,13 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 @@ -49,4 +49,8 @@ feign: readTimeout: 120000 mhd-third-party-service: connectTimeout: 10000 - readTimeout: 120000 \ No newline at end of file + readTimeout: 120000 +#wechat: +# miniapp: +# appId: wxc9dd2810a77e4e30 +# appSecret: 9354ff1215a82785ef14f2355fbf2185 \ No newline at end of file From 31c27c16c684deee1273b72ed119640f24697ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E8=BE=89?= <2830717623@qq.com> Date: Fri, 11 Sep 2026 17:28:40 +0800 Subject: [PATCH 58/88] user31 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../com/mhd/common/core/feign/ThirdPartyServiceFeign.java | 2 +- mhd-user-center/src/main/resources/bootstrap.yml | 4 ++-- .../mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 00e656a88..93cb610ff 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -19,7 +19,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 6b99f0f45..78bce4d42 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 0da262497..9016575f6 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.3:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.32:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 12571141a..750ed853e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.4:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.33:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java index 94e7ade76..48bf17cd1 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java @@ -26,7 +26,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.30:8012", configuration = FeignAutoConfiguration.class) +@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.31:8012", configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index 43b72842a..fec383b34 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -20,13 +20,13 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 diff --git a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java index 26c5c12b9..b54559ade 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java +++ b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java @@ -22,7 +22,7 @@ import java.util.Map; /** * 三方服务 Feign */ -@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.30:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.31:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 From 5ba179d29d7a80242e20d4d2a4f558a4becb694b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 11 Sep 2026 17:36:38 +0800 Subject: [PATCH 59/88] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=9C=88=E7=BB=93?= =?UTF-8?q?=E6=8A=A5=E5=91=8A;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 59 +++++++++++++++++++ .../repository/facade/IBillManageService.java | 3 + .../repository/mapper/BillManageMapper.java | 2 + .../persistence/BillManageImpl.java | 8 +++ .../service/BillManageDomainService.java | 4 ++ .../interfaces/facadeApi/BillManageApi.java | 15 +++++ .../resources/mapper/BillManageMapper.xml | 21 +++++++ 7 files changed, 112 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index 5b1c2531a..b5f89a353 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -147,6 +147,65 @@ public class BillManageApplicationService { return billManagePOS; } + public List customerMonthlyReport(BillManageDO billManageDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null && loginUser.getUserPo() != null) { + Long userOrganizationId = loginUser.getUserPo().getOrganizationId(); + Long frontendOrganizationId = billManageDO.getOrganizationId(); // 前端传递的 organizationId + + // 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己 + if (userOrganizationId != null && userOrganizationId == 2827L) { + // 南光组织(organizationId=2827):可以查询所有组织的数据 + if (frontendOrganizationId != null) { + // 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + billManageDO.setOrganizationId(frontendOrganizationId); + billManageDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件 + } else { + // 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + billManageDO.setOrganizationId(null); + billManageDO.setTopOrganizationId(null); + } + } else { + // 其他组织:设置organizationId,只查询当前组织的数据 + // 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (frontendOrganizationId != null && userOrganizationId != null) { + // 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (!frontendOrganizationId.equals(userOrganizationId)) { + // 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询 + billManageDO.setOrganizationId(userOrganizationId); + } + // 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值 + } else { + // 前端没有传递 organizationId,使用当前登录用户的组织ID + if (userOrganizationId != null) { + billManageDO.setOrganizationId(userOrganizationId); + } + } + // 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId + if (billManageDO.getOrganizationId() == null) { + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1) { + billManageDO.setTopOrganizationId(topOrganizationId); + } + } else { + // 对于非2827组织,必须设置 topOrganizationId=2827 + billManageDO.setTopOrganizationId(2827L); + } + } + } + List billManagePOS = billManageDomainService.customerMonthlyReport(billManageDO); + for (BillManagePO billManagePO : billManagePOS) { + String billNumber = billManagePO.getBillNumber(); // 获取账单编号 + // 原有 - 前端列表用,不变 + List billDetails = billDetailMapper.selectList(new LambdaQueryWrapper().eq(BillDetail::getBillNumber, billNumber)); + billManagePO.setBillDetailList(billDetails); + // 新增 - 导出用,LEFT JOIN billing_statement 拿到费用科目 + List billDetailPOs = billDetailMapper.getDetailsByBillManageId(billManagePO.getBillManageId()); + billManagePO.setBillDetailPOList(billDetailPOs); + } + return billManagePOS; + } + /** * 新增账单管理 diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillManageService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillManageService.java index fa7691f69..32ce20c2c 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillManageService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillManageService.java @@ -21,6 +21,9 @@ public interface IBillManageService extends IService */ public List queryList(BillManageDO billManageDO); + + public List customerMonthlyReport(BillManageDO billManageDO); + /** * 客户每月账单分组查询 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java index dc55f5a13..1391b12a7 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java @@ -20,6 +20,8 @@ public interface BillManageMapper extends BaseMapper */ public List queryList(@Param("billManageDO") BillManageDO billManageDO); + public List customerMonthlyReport(@Param("billManageDO") BillManageDO billManageDO); + /** * 客户每月账单分组查询 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java index bac4a51b1..daf5be1c1 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java @@ -127,6 +127,14 @@ public class BillManageImpl extends ServiceImpl im return billManageMapper.queryList(billManageDO); } + @Override + public List customerMonthlyReport(BillManageDO billManageDO) + { + return billManageMapper.customerMonthlyReport(billManageDO); + } + + + /** * 新增账单管理 */ diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index 5dfd67dff..5955c4e63 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -88,6 +88,10 @@ public class BillManageDomainService { return billManageService.queryList(billManageDO); } + public List customerMonthlyReport(BillManageDO billManageDO) { + return billManageService.customerMonthlyReport(billManageDO); + } + /** * 新增账单管理 diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java index 40c7d6c5d..c9c1ec058 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java @@ -547,6 +547,21 @@ public class BillManageApi extends BaseController{ } + /** + * 客户月结报表 + */ + @ApiOperation("客户月结报表") + @GetMapping("/customerMonthlyReport") + public TableDataInfo customerMonthlyReport(BillManageDTO billManageDTO) + { + //转换实体 + BillManageDO billManageDO = new BillManageDO(); + BeanUtils.copyProperties(billManageDTO,billManageDO); + startPage(); + billManageDO.setBillType(1); + List list = billManageApplicationService.customerMonthlyReport(billManageDO); + return getDataTable(list); + } diff --git a/mhd_bms/src/main/resources/mapper/BillManageMapper.xml b/mhd_bms/src/main/resources/mapper/BillManageMapper.xml index e99c7a7f3..3289382d4 100644 --- a/mhd_bms/src/main/resources/mapper/BillManageMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillManageMapper.xml @@ -22,6 +22,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY a.create_time DESC + + SELECT SUM(CASE WHEN TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles, SUM(CASE WHEN FLOW_STATUS = '1' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn, SUM(CASE WHEN FLOW_STATUS IN ('1','2','3') AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS waiting, + SUM(CASE WHEN FLOW_STATUS IN ('2','3','4') AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS callStatusTotal, SUM(CASE WHEN FLOW_STATUS IN ('5','6','7','8','9','10') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles, SUM(CASE WHEN FLOW_STATUS = '11' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS + +