计费策略修改

This commit is contained in:
秦鸿展
2026-05-16 09:59:11 +08:00
parent e85cff8a54
commit 6d0211d686
@@ -509,52 +509,60 @@ public class ContractManageApplicationService {
.eq(ContractManage::getTopOrganizationId, topOrganizationId) .eq(ContractManage::getTopOrganizationId, topOrganizationId)
.eq(ContractManage::getCommonContractFlag, 2)); .eq(ContractManage::getCommonContractFlag, 2));
if (UserContractManages != null && UserContractManages.size() > 0) { if (UserContractManages != null && UserContractManages.size() > 0) {
//用户合同计费策略
calucateSubjectStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result);
}else{ }else{
//通用合同计费策略
List<ContractManage> commonContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>() List<ContractManage> commonContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.eq(ContractManage::getDelFlag, 1) .eq(ContractManage::getDelFlag, 1)
.eq(ContractManage::getOrganizationId, organizationId) .eq(ContractManage::getOrganizationId, organizationId)
.eq(ContractManage::getTopOrganizationId, topOrganizationId) .eq(ContractManage::getTopOrganizationId, topOrganizationId)
.eq(ContractManage::getCommonContractFlag, 1)); .eq(ContractManage::getCommonContractFlag, 1));
if (commonContractManages != null && commonContractManages.size() > 0) { calucateSubjectStrategy(commonContractManages, organizationId, topOrganizationId, sunjectCode, result);
ContractManage contractManage = commonContractManages.get(0); }
Long contractManageId = contractManage.getContractManageId(); return result;
List<ContractManageDetail> contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper<ContractManageDetail>() }
.eq(ContractManageDetail::getContractManageId, contractManageId)
.eq(ContractManageDetail::getDelFlag, 1)); private void calucateSubjectStrategy(List<ContractManage> commonContractManages, Long organizationId, Long topOrganizationId, String sunjectCode, List<SubjectAndPriceReturn> result) {
if (contractManageDetails != null && contractManageDetails.size() > 0) { if (commonContractManages != null && commonContractManages.size() > 0) {
for (ContractManageDetail contractManageDetail : contractManageDetails) { ContractManage contractManage = commonContractManages.get(0);
String code = contractManageDetail.getFirstSubjectCode(); Long contractManageId = contractManage.getContractManageId();
if (sunjectCode.equals(code)) { List<ContractManageDetail> contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper<ContractManageDetail>()
Long accountingStrategyId = contractManageDetail.getAccountingStrategyId(); .eq(ContractManageDetail::getContractManageId, contractManageId)
BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(accountingStrategyId); .eq(ContractManageDetail::getDelFlag, 1));
if (billingRule != null) { if (contractManageDetails != null && contractManageDetails.size() > 0) {
Long billingRulesId = billingRule.getBillingRulesId(); for (ContractManageDetail contractManageDetail : contractManageDetails) {
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(billingRulesId); String code = contractManageDetail.getFirstSubjectCode();
if (billingParams != null && billingParams.size() > 0) { if (sunjectCode.equals(code)) {
BillingParamsPO billingParam = billingParams.get(0); Long accountingStrategyId = contractManageDetail.getAccountingStrategyId();
String billingParamsJson = billingParam.getBillingParamsJson(); BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(accountingStrategyId);
String preSetRules = billingParam.getPreSetRules(); if (billingRule != null) {
Long billingParamsId = billingParam.getBillingParamsId(); Long billingRulesId = billingRule.getBillingRulesId();
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {}); List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(billingRulesId);
for (Map<String, Object> stringObjectMap : billingParamsList) { if (billingParams != null && billingParams.size() > 0) {
String fieldsName = (String) stringObjectMap.get("fieldsName"); BillingParamsPO billingParam = billingParams.get(0);
String isShow = (String) stringObjectMap.get("isShow"); String billingParamsJson = billingParam.getBillingParamsJson();
String isFee = (String) stringObjectMap.get("isFee"); String preSetRules = billingParam.getPreSetRules();
String isPush = (String) stringObjectMap.get("isPush"); Long billingParamsId = billingParam.getBillingParamsId();
if ("1".equals(isShow)) { List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {});
String chargingId = (String) stringObjectMap.get("chargingId"); for (Map<String, Object> stringObjectMap : billingParamsList) {
String fields = (String) stringObjectMap.get("fields"); String fieldsName = (String) stringObjectMap.get("fieldsName");
SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn(); String isShow = (String) stringObjectMap.get("isShow");
subjectAndPriceReturn.setName(fieldsName); String isFee = (String) stringObjectMap.get("isFee");
subjectAndPriceReturn.setChargingId(chargingId); String isPush = (String) stringObjectMap.get("isPush");
subjectAndPriceReturn.setFields(fields); if ("1".equals(isShow)) {
subjectAndPriceReturn.setBillingRulesId(billingRulesId); String chargingId = (String) stringObjectMap.get("chargingId");
subjectAndPriceReturn.setIsShow(isShow); String fields = (String) stringObjectMap.get("fields");
subjectAndPriceReturn.setIsFee(isFee); SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn();
subjectAndPriceReturn.setIsPush(isPush); subjectAndPriceReturn.setName(fieldsName);
subjectAndPriceReturn.setRulesId(billingParamsId); subjectAndPriceReturn.setChargingId(chargingId);
result.add(subjectAndPriceReturn); 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;
} }
/** /**
* 新增合同管理 * 新增合同管理
*/ */