|
@@ -1,9 +1,12 @@
|
|
|
package com.jzg.quotation.summary.aop;
|
|
package com.jzg.quotation.summary.aop;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.jzg.commons.constants.quote.enums.quote.EnergyTypeCode;
|
|
import com.jzg.commons.constants.quote.enums.quote.EnergyTypeCode;
|
|
|
import com.jzg.commons.entity.po.PtlAgreementCostRule;
|
|
import com.jzg.commons.entity.po.PtlAgreementCostRule;
|
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttrLink;
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttrLink;
|
|
|
|
|
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
|
|
|
import com.jzg.commons.entity.vo.RuleAttrMappingVo;
|
|
import com.jzg.commons.entity.vo.RuleAttrMappingVo;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -11,11 +14,9 @@ import org.slf4j.LoggerFactory;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 因子匹配类
|
|
* 因子匹配类
|
|
@@ -33,7 +34,7 @@ public class FactorMatch {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public static boolean judgements(List<PtlAgreementCostRule> ptlAgreementCostRuleList, List<RuleAttrMappingVo> ruleAttrMappingVoList,
|
|
public static boolean judgements(List<PtlAgreementCostRule> ptlAgreementCostRuleList, List<RuleAttrMappingVo> ruleAttrMappingVoList,
|
|
|
- List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList, StringBuilder logs) {
|
|
|
|
|
|
|
+ List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList, StringBuilder logs, List<PtlAgreementUndwrtRulesDictLabal> undwrtRulesDictList) {
|
|
|
boolean useFlag = true;
|
|
boolean useFlag = true;
|
|
|
for (PtlAgreementCostRule ptlAgreementProductCostsAttrLink : ptlAgreementCostRuleList) {
|
|
for (PtlAgreementCostRule ptlAgreementProductCostsAttrLink : ptlAgreementCostRuleList) {
|
|
|
//查找规则中的 传值属性
|
|
//查找规则中的 传值属性
|
|
@@ -69,15 +70,33 @@ public class FactorMatch {
|
|
|
.filter(x -> x.getAttrCode().equals(ptlAgreementProductCostsAttrLink.getAttrCode()))
|
|
.filter(x -> x.getAttrCode().equals(ptlAgreementProductCostsAttrLink.getAttrCode()))
|
|
|
.toList();
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
+ Map<String, String> codeToNameMap = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(undwrtRulesDictList)){
|
|
|
|
|
+ Map<Integer, List<PtlAgreementUndwrtRulesDictLabal>> dictMap = undwrtRulesDictList.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(PtlAgreementUndwrtRulesDictLabal::getDictId));
|
|
|
|
|
+ List<PtlAgreementUndwrtRulesDictLabal> ptlAgreementUndwrtRulesDictLabals = dictMap.getOrDefault(ptlAgreementUndwrtRulesAttr.getDictId(), CollUtil.newArrayList());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(ptlAgreementUndwrtRulesDictLabals)){
|
|
|
|
|
+ codeToNameMap = ptlAgreementUndwrtRulesDictLabals.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ PtlAgreementUndwrtRulesDictLabal::getCode,
|
|
|
|
|
+ PtlAgreementUndwrtRulesDictLabal::getName,
|
|
|
|
|
+ (existing, replacement) -> existing
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (ptlAgreementProductCostsAttrLink.getMin() != null) {
|
|
if (ptlAgreementProductCostsAttrLink.getMin() != null) {
|
|
|
- logs.append("检验的值:" + ptlAgreementProductCostsAttrLink.getMin() + "\n");
|
|
|
|
|
|
|
+ String min = codeToNameMap.getOrDefault(ptlAgreementProductCostsAttrLink.getMin(), StrUtil.EMPTY);
|
|
|
|
|
+ logs.append("检验的值:" + (StrUtil.isNotBlank(min) ? min : ptlAgreementProductCostsAttrLink.getMin()) + "\n");
|
|
|
} else {
|
|
} else {
|
|
|
- logs.append("检验的值:" + ptlAgreementProductCostsAttrLink.getMax() + "\n");
|
|
|
|
|
|
|
+ String max = codeToNameMap.getOrDefault(ptlAgreementProductCostsAttrLink.getMax(), StrUtil.EMPTY);
|
|
|
|
|
+ logs.append("检验的值:" + (StrUtil.isNotBlank(max) ? max : ptlAgreementProductCostsAttrLink.getMax()) + "\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- logs.append("传入的值:" + ruleAttrMappingVo.getValue() + "\n");
|
|
|
|
|
|
|
+ String val = codeToNameMap.getOrDefault(ruleAttrMappingVo.getValue(), StrUtil.EMPTY);
|
|
|
|
|
+ logs.append("传入的值:" + (StrUtil.isNotBlank(val) ? val : ruleAttrMappingVo.getValue()) + "\n");
|
|
|
|
|
|
|
|
- if (!collect.isEmpty()) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(collect)) {
|
|
|
// logs.append("<span style=\"color:red;\">规则匹配失败:" + collect.get(0).getAttrName() + "</span>\n");
|
|
// logs.append("<span style=\"color:red;\">规则匹配失败:" + collect.get(0).getAttrName() + "</span>\n");
|
|
|
logs.append("规则匹配失败:" + collect.get(0).getAttrName() + "\n");
|
|
logs.append("规则匹配失败:" + collect.get(0).getAttrName() + "\n");
|
|
|
}
|
|
}
|
|
@@ -90,7 +109,7 @@ public class FactorMatch {
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean judgementsUnderwrite(List<PtlAgreementUndwrtRulesAttrLink> ptlAgreementCostRuleList, List<RuleAttrMappingVo> ruleAttrMappingVoList,
|
|
public static boolean judgementsUnderwrite(List<PtlAgreementUndwrtRulesAttrLink> ptlAgreementCostRuleList, List<RuleAttrMappingVo> ruleAttrMappingVoList,
|
|
|
- List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList, StringBuilder logs) {
|
|
|
|
|
|
|
+ List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList, StringBuilder logs, List<PtlAgreementUndwrtRulesDictLabal> undwrtRulesDictList) {
|
|
|
boolean useFlag = true;
|
|
boolean useFlag = true;
|
|
|
for (PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink : ptlAgreementCostRuleList) {
|
|
for (PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink : ptlAgreementCostRuleList) {
|
|
|
//查找规则中的 传值属性
|
|
//查找规则中的 传值属性
|
|
@@ -134,20 +153,36 @@ public class FactorMatch {
|
|
|
log.info("传入的值:" + ruleAttrMappingVo.getValue());
|
|
log.info("传入的值:" + ruleAttrMappingVo.getValue());
|
|
|
log.info("规则匹配失败:" + ptlAgreementProductCostsAttrLink.getAttrCode());
|
|
log.info("规则匹配失败:" + ptlAgreementProductCostsAttrLink.getAttrCode());
|
|
|
|
|
|
|
|
-
|
|
|
|
|
List<PtlAgreementUndwrtRulesAttr> collect = undwrtRulesAttrList.stream()
|
|
List<PtlAgreementUndwrtRulesAttr> collect = undwrtRulesAttrList.stream()
|
|
|
.filter(x -> x.getAttrCode().equals(ptlAgreementProductCostsAttrLink.getAttrCode()))
|
|
.filter(x -> x.getAttrCode().equals(ptlAgreementProductCostsAttrLink.getAttrCode()))
|
|
|
.toList();
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
+ Map<String, String> codeToNameMap = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(undwrtRulesDictList)){
|
|
|
|
|
+ Map<Integer, List<PtlAgreementUndwrtRulesDictLabal>> dictMap = undwrtRulesDictList.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(PtlAgreementUndwrtRulesDictLabal::getDictId));
|
|
|
|
|
+ List<PtlAgreementUndwrtRulesDictLabal> ptlAgreementUndwrtRulesDictLabals = dictMap.getOrDefault(ptlAgreementUndwrtRulesAttr.getDictId(), CollUtil.newArrayList());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(ptlAgreementUndwrtRulesDictLabals)){
|
|
|
|
|
+ codeToNameMap = ptlAgreementUndwrtRulesDictLabals.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ PtlAgreementUndwrtRulesDictLabal::getCode,
|
|
|
|
|
+ PtlAgreementUndwrtRulesDictLabal::getName,
|
|
|
|
|
+ (existing, replacement) -> existing
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (ptlAgreementProductCostsAttrLink.getMin() != null) {
|
|
if (ptlAgreementProductCostsAttrLink.getMin() != null) {
|
|
|
- logs.append("检验的值4:" + ptlAgreementProductCostsAttrLink.getMin() + "\n");
|
|
|
|
|
|
|
+ String min = codeToNameMap.getOrDefault(ptlAgreementProductCostsAttrLink.getMin(), StrUtil.EMPTY);
|
|
|
|
|
+ logs.append("检验的值4:" + (StrUtil.isNotBlank(min) ? min : ptlAgreementProductCostsAttrLink.getMin()) + "\n");
|
|
|
} else {
|
|
} else {
|
|
|
- logs.append("检验的值5:" + ptlAgreementProductCostsAttrLink.getMax() + "\n");
|
|
|
|
|
|
|
+ String max = codeToNameMap.getOrDefault(ptlAgreementProductCostsAttrLink.getMax(), StrUtil.EMPTY);
|
|
|
|
|
+ logs.append("检验的值5:" + (StrUtil.isNotBlank(max) ? max : ptlAgreementProductCostsAttrLink.getMax()) + "\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- logs.append("传入的值:" + ruleAttrMappingVo.getValue() + "\n");
|
|
|
|
|
|
|
+ String val = codeToNameMap.getOrDefault(ruleAttrMappingVo.getValue(), StrUtil.EMPTY);
|
|
|
|
|
+ logs.append("传入的值:" + (StrUtil.isNotBlank(val) ? val : ruleAttrMappingVo.getValue()) + "\n");
|
|
|
|
|
|
|
|
- if (!collect.isEmpty()) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(collect)) {
|
|
|
logs.append("<span style=\"color:red;\">规则匹配失败:" + collect.get(0).getAttrName() + "</span>\n");
|
|
logs.append("<span style=\"color:red;\">规则匹配失败:" + collect.get(0).getAttrName() + "</span>\n");
|
|
|
}
|
|
}
|
|
|
|
|
|