计费策略修改

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::getCommonContractFlag, 2));
if (UserContractManages != null && UserContractManages.size() > 0) {
//用户合同计费策略
calucateSubjectStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result);
}else{
//通用合同计费策略
List<ContractManage> commonContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.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<ContractManageDetail> contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper<ContractManageDetail>()
.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<BillingParamsPO> 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<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {});
for (Map<String, Object> 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<ContractManage> commonContractManages, Long organizationId, Long topOrganizationId, String sunjectCode, List<SubjectAndPriceReturn> result) {
if (commonContractManages != null && commonContractManages.size() > 0) {
ContractManage contractManage = commonContractManages.get(0);
Long contractManageId = contractManage.getContractManageId();
List<ContractManageDetail> contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper<ContractManageDetail>()
.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<BillingParamsPO> 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<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {});
for (Map<String, Object> 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;
}
/**
* 新增合同管理
*/