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 8f5866b86..0a48641b3 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 @@ -275,64 +275,16 @@ public class ContractManageApplicationService { .eq(ContractManage::getTopOrganizationId, topOrganizationId) .eq(ContractManage::getCommonContractFlag, 2)); if (UserContractManages != null && UserContractManages.size() > 0) { - }else{ + //用户合同计费策略 + calucateSubjectAndPriceStrategy(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> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference>>() {}); - List> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference>>() {}); - Map stringObjectMap1 = preSetRulesList.get(0); - 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(isFee)) { - Integer sort = (Integer) stringObjectMap.get("sort"); - String chargingId = (String) stringObjectMap.get("chargingId"); - String fields = (String) stringObjectMap.get("fields"); - String price = (String) stringObjectMap1.get("fields" + sort); - SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn(); - subjectAndPriceReturn.setName(fieldsName); - subjectAndPriceReturn.setPrice(new BigDecimal(price)); - subjectAndPriceReturn.setChargingId(chargingId); - subjectAndPriceReturn.setFields(fields); - subjectAndPriceReturn.setBillingRulesId(billingRulesId); - subjectAndPriceReturn.setIsShow(isShow); - subjectAndPriceReturn.setIsFee(isFee); - subjectAndPriceReturn.setIsPush(isPush); - subjectAndPriceReturn.setRulesId(billingParamsId); - result.add(subjectAndPriceReturn); - } - } - } - } - } - } - } - } + calucateSubjectAndPriceStrategy(commonContractManages, organizationId, topOrganizationId, sunjectCode, result); } return result; } @@ -573,6 +525,61 @@ public class ContractManageApplicationService { } } + private void calucateSubjectAndPriceStrategy(List contractManages, Long organizationId, Long topOrganizationId, String sunjectCode, List result) { + if (contractManages != null && contractManages.size() > 0) { + ContractManage contractManage = contractManages.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> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference>>() {}); + List> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference>>() {}); + Map stringObjectMap1 = preSetRulesList.get(0); + 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(isFee)) { + Integer sort = (Integer) stringObjectMap.get("sort"); + String chargingId = (String) stringObjectMap.get("chargingId"); + String fields = (String) stringObjectMap.get("fields"); + String price = (String) stringObjectMap1.get("fields" + sort); + SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn(); + subjectAndPriceReturn.setName(fieldsName); + subjectAndPriceReturn.setPrice(new BigDecimal(price)); + subjectAndPriceReturn.setChargingId(chargingId); + subjectAndPriceReturn.setFields(fields); + subjectAndPriceReturn.setBillingRulesId(billingRulesId); + subjectAndPriceReturn.setIsShow(isShow); + subjectAndPriceReturn.setIsFee(isFee); + subjectAndPriceReturn.setIsPush(isPush); + subjectAndPriceReturn.setRulesId(billingParamsId); + result.add(subjectAndPriceReturn); + } + } + } + } + } + } + } + } + } + /** * 新增合同管理 */