费用计算;
This commit is contained in:
+7
-28
@@ -176,6 +176,10 @@ public class ContractManageApplicationService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SubjectAndPriceReturn aReturn = subjectAndPriceReturnList.get(0);
|
||||
Long id = aReturn.getBillingRulesId();
|
||||
BillingRulesPO Rule = contractManageDetailMapper.getBillingRules(id);
|
||||
String billingFormula = Rule.getBillingFormula();
|
||||
for (SubjectAndPriceReturn subjectAndPriceReturn : subjectAndPriceReturnList) {
|
||||
Long billingRulesId = subjectAndPriceReturn.getBillingRulesId();
|
||||
String name = subjectAndPriceReturn.getName();
|
||||
@@ -190,32 +194,6 @@ public class ContractManageApplicationService {
|
||||
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
if (billingParamsList != null && billingParamsList.size() ==2) {
|
||||
Map<String, Object> targetMap = billingParamsList.stream()
|
||||
.filter(map -> name.equals(map.get("fieldsName"))) // 关键匹配条件
|
||||
.findFirst() // 取第一个
|
||||
.orElse(null); // 没找到返回null
|
||||
String chargingId = (String) targetMap.get("chargingId");
|
||||
Integer sort = (Integer) targetMap.get("sort");
|
||||
Map<String, Object> reles = preSetRulesList.get(0);
|
||||
String price = (String) reles.get("fields"+sort);
|
||||
String billingFormula = billingRule.getBillingFormula();
|
||||
billingFormula = billingFormula.replace(chargingId, price);
|
||||
//需要判断阶梯类型进行获取各计费标志的取值,拼接公式
|
||||
List<BillingParamsDetailDTO> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsDetailDTO.class);
|
||||
//将计费参数实体分成两组,即:固定参数和条件参数
|
||||
List<BillingParamsDetailDTO> fixedParamsEntityList = billingParamsEntityList.stream().filter(item -> ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
|
||||
List<BillingParamsDetailDTO> ladderParamsEntityList = billingParamsEntityList.stream().filter(item -> !ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
|
||||
if (fixedParamsEntityList != null && fixedParamsEntityList.size() > 0) {
|
||||
if (subjectAndPriceReturn.getNum() != null) {
|
||||
for (BillingParamsDetailDTO ladderParamsEntity : fixedParamsEntityList) {
|
||||
String chargingId1 = ladderParamsEntity.getChargingId();
|
||||
if (chargingId1 != chargingId) {
|
||||
billingFormula = billingFormula.replace(chargingId1, subjectAndPriceReturn.getNum().toEngineeringString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DynamicCalculationUtil.calculate(billingFormula);
|
||||
} else {
|
||||
Map<String, Object> targetMap = billingParamsList.stream()
|
||||
.filter(map -> name.equals(map.get("fieldsName"))) // 关键匹配条件
|
||||
@@ -225,7 +203,7 @@ public class ContractManageApplicationService {
|
||||
Integer sort = (Integer) targetMap.get("sort");
|
||||
Map<String, Object> reles = preSetRulesList.get(0);
|
||||
String price = (String) reles.get("fields"+sort);
|
||||
String billingFormula = billingRule.getBillingFormula();
|
||||
//String billingFormula = billingRule.getBillingFormula();
|
||||
billingFormula = billingFormula.replace(chargingId, price);
|
||||
//需要判断阶梯类型进行获取各计费标志的取值,拼接公式
|
||||
List<BillingParamsDetailDTO> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsDetailDTO.class);
|
||||
@@ -249,10 +227,11 @@ public class ContractManageApplicationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return DynamicCalculationUtil.calculate(billingFormula);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return DynamicCalculationUtil.calculate(billingFormula);
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user