From 6d0211d6868d0dcb548d7294c07b7002e08c252b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 16 May 2026 09:59:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E7=AD=96=E7=95=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractManageApplicationService.java | 90 ++++++++++--------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java index e6cc462bf..8f5866b86 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java @@ -509,52 +509,60 @@ public class ContractManageApplicationService { .eq(ContractManage::getTopOrganizationId, topOrganizationId) .eq(ContractManage::getCommonContractFlag, 2)); if (UserContractManages != null && UserContractManages.size() > 0) { + //用户合同计费策略 + calucateSubjectStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result); }else{ + //通用合同计费策略 List commonContractManages = contractManageMapper.selectList(new LambdaQueryWrapper() .eq(ContractManage::getDelFlag, 1) .eq(ContractManage::getOrganizationId, organizationId) .eq(ContractManage::getTopOrganizationId, topOrganizationId) .eq(ContractManage::getCommonContractFlag, 1)); - if (commonContractManages != null && commonContractManages.size() > 0) { - ContractManage contractManage = commonContractManages.get(0); - Long contractManageId = contractManage.getContractManageId(); - List contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper() - .eq(ContractManageDetail::getContractManageId, contractManageId) - .eq(ContractManageDetail::getDelFlag, 1)); - if (contractManageDetails != null && contractManageDetails.size() > 0) { - for (ContractManageDetail contractManageDetail : contractManageDetails) { - String code = contractManageDetail.getFirstSubjectCode(); - if (sunjectCode.equals(code)) { - Long accountingStrategyId = contractManageDetail.getAccountingStrategyId(); - BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(accountingStrategyId); - if (billingRule != null) { - Long billingRulesId = billingRule.getBillingRulesId(); - List billingParams = contractManageDetailMapper.getBillingParams(billingRulesId); - if (billingParams != null && billingParams.size() > 0) { - BillingParamsPO billingParam = billingParams.get(0); - String billingParamsJson = billingParam.getBillingParamsJson(); - String preSetRules = billingParam.getPreSetRules(); - Long billingParamsId = billingParam.getBillingParamsId(); - List> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference>>() {}); - for (Map stringObjectMap : billingParamsList) { - String fieldsName = (String) stringObjectMap.get("fieldsName"); - String isShow = (String) stringObjectMap.get("isShow"); - String isFee = (String) stringObjectMap.get("isFee"); - String isPush = (String) stringObjectMap.get("isPush"); - if ("1".equals(isShow)) { - String chargingId = (String) stringObjectMap.get("chargingId"); - String fields = (String) stringObjectMap.get("fields"); - SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn(); - subjectAndPriceReturn.setName(fieldsName); - subjectAndPriceReturn.setChargingId(chargingId); - subjectAndPriceReturn.setFields(fields); - subjectAndPriceReturn.setBillingRulesId(billingRulesId); - subjectAndPriceReturn.setIsShow(isShow); - subjectAndPriceReturn.setIsFee(isFee); - subjectAndPriceReturn.setIsPush(isPush); - subjectAndPriceReturn.setRulesId(billingParamsId); - result.add(subjectAndPriceReturn); - } + calucateSubjectStrategy(commonContractManages, organizationId, topOrganizationId, sunjectCode, result); + } + return result; + } + + private void calucateSubjectStrategy(List commonContractManages, Long organizationId, Long topOrganizationId, String sunjectCode, List result) { + if (commonContractManages != null && commonContractManages.size() > 0) { + ContractManage contractManage = commonContractManages.get(0); + Long contractManageId = contractManage.getContractManageId(); + List contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper() + .eq(ContractManageDetail::getContractManageId, contractManageId) + .eq(ContractManageDetail::getDelFlag, 1)); + if (contractManageDetails != null && contractManageDetails.size() > 0) { + for (ContractManageDetail contractManageDetail : contractManageDetails) { + String code = contractManageDetail.getFirstSubjectCode(); + if (sunjectCode.equals(code)) { + Long accountingStrategyId = contractManageDetail.getAccountingStrategyId(); + BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(accountingStrategyId); + if (billingRule != null) { + Long billingRulesId = billingRule.getBillingRulesId(); + List billingParams = contractManageDetailMapper.getBillingParams(billingRulesId); + if (billingParams != null && billingParams.size() > 0) { + BillingParamsPO billingParam = billingParams.get(0); + String billingParamsJson = billingParam.getBillingParamsJson(); + String preSetRules = billingParam.getPreSetRules(); + Long billingParamsId = billingParam.getBillingParamsId(); + List> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference>>() {}); + for (Map stringObjectMap : billingParamsList) { + String fieldsName = (String) stringObjectMap.get("fieldsName"); + String isShow = (String) stringObjectMap.get("isShow"); + String isFee = (String) stringObjectMap.get("isFee"); + String isPush = (String) stringObjectMap.get("isPush"); + if ("1".equals(isShow)) { + String chargingId = (String) stringObjectMap.get("chargingId"); + String fields = (String) stringObjectMap.get("fields"); + SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn(); + subjectAndPriceReturn.setName(fieldsName); + subjectAndPriceReturn.setChargingId(chargingId); + subjectAndPriceReturn.setFields(fields); + subjectAndPriceReturn.setBillingRulesId(billingRulesId); + subjectAndPriceReturn.setIsShow(isShow); + subjectAndPriceReturn.setIsFee(isFee); + subjectAndPriceReturn.setIsPush(isPush); + subjectAndPriceReturn.setRulesId(billingParamsId); + result.add(subjectAndPriceReturn); } } } @@ -563,10 +571,8 @@ public class ContractManageApplicationService { } } } - return result; } - /** * 新增合同管理 */