|
@@ -20,9 +20,7 @@ public class BuildDescUtils {
|
|
|
*/
|
|
*/
|
|
|
public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
|
|
public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
|
|
|
StringBuilder desc = new StringBuilder();
|
|
StringBuilder desc = new StringBuilder();
|
|
|
- Map<String, PtlAgreementUndwrtRulesAttr> attrMap = undwrtRulesAttrList.stream()
|
|
|
|
|
- .filter(attr -> "all".equals(attr.getCompanyIds()) || (attr.getCompanyIds() != null && attr.getCompanyIds().equals(companyId)))
|
|
|
|
|
- .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, Function.identity()));
|
|
|
|
|
|
|
+ Map<String, PtlAgreementUndwrtRulesAttr> attrMap = undwrtRulesAttrList.stream().filter(attr -> "all".equals(attr.getCompanyIds()) || (attr.getCompanyIds() != null && attr.getCompanyIds().equals(companyId))).collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, Function.identity()));
|
|
|
// 这里进行排序,保证生成的承保规则描述是有序的
|
|
// 这里进行排序,保证生成的承保规则描述是有序的
|
|
|
linkList = linkList.stream().sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttr::getAttrCode)).toList();
|
|
linkList = linkList.stream().sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttr::getAttrCode)).toList();
|
|
|
List<PtlAgreementUndwrtRulesAttr> sortedLinks = new ArrayList<>(linkList);
|
|
List<PtlAgreementUndwrtRulesAttr> sortedLinks = new ArrayList<>(linkList);
|
|
@@ -43,13 +41,18 @@ public class BuildDescUtils {
|
|
|
if (link.getMinArray() != null && link.getMinArray().length > 0) {
|
|
if (link.getMinArray() != null && link.getMinArray().length > 0) {
|
|
|
// minArray 转 Set,避免循环内反复创建 List 做 contains 查找
|
|
// minArray 转 Set,避免循环内反复创建 List 做 contains 查找
|
|
|
Set<String> minCodes = Arrays.stream(link.getMinArray()).collect(Collectors.toSet());
|
|
Set<String> minCodes = Arrays.stream(link.getMinArray()).collect(Collectors.toSet());
|
|
|
- String names = Optional.ofNullable(link.getDictLabal()).orElse(Collections.emptyList()).stream()
|
|
|
|
|
- .filter(labal -> minCodes.contains(labal.getCode()))
|
|
|
|
|
- .map(PtlAgreementUndwrtRulesDictLabal::getName)
|
|
|
|
|
- .collect(Collectors.joining(","));
|
|
|
|
|
- desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(names).append(";\t\t");
|
|
|
|
|
|
|
+ String names = Optional.ofNullable(link.getDictLabal()).orElse(Collections.emptyList()).stream().filter(labal -> minCodes.contains(labal.getCode())).map(PtlAgreementUndwrtRulesDictLabal::getName).collect(Collectors.joining(","));
|
|
|
|
|
+ if (link.getOperator() != null && "1".equals(link.getOperator())) {
|
|
|
|
|
+ desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(names).append(";\t\t");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(names).append(";\t\t");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(";\t\t");
|
|
|
|
|
|
|
+ if (link.getOperator() != null && "1".equals(link.getOperator())) {
|
|
|
|
|
+ desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(";\t\t");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(link.getMin()).append(";\t\t");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} else if ("inputTag".equals(attrType)) {
|
|
} else if ("inputTag".equals(attrType)) {
|
|
|
if (link.getOperator() != null && "1".equals(link.getOperator())) {
|
|
if (link.getOperator() != null && "1".equals(link.getOperator())) {
|
|
@@ -63,12 +66,9 @@ public class BuildDescUtils {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private static String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
|
|
private static String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
|
|
|
- Optional<PtlAgreementUndwrtRulesDictLabal> dictLabel = Optional.ofNullable(
|
|
|
|
|
- ptlAgreementUndwrtRulesAttr.getDictLabal())
|
|
|
|
|
- .flatMap(list -> list.stream().filter(x -> x.getCode().equals(link.getMin())).findFirst());
|
|
|
|
|
|
|
+ Optional<PtlAgreementUndwrtRulesDictLabal> dictLabel = Optional.ofNullable(ptlAgreementUndwrtRulesAttr.getDictLabal()).flatMap(list -> list.stream().filter(x -> x.getCode().equals(link.getMin())).findFirst());
|
|
|
|
|
|
|
|
- return dictLabel.map(dl -> ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + dl.getName())
|
|
|
|
|
- .orElse("");
|
|
|
|
|
|
|
+ return dictLabel.map(dl -> ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + dl.getName()).orElse("");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
|
|
private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
|
|
@@ -105,10 +105,7 @@ public class BuildDescUtils {
|
|
|
|
|
|
|
|
for (int i = 0; i < sortedLinks.size(); i++) {
|
|
for (int i = 0; i < sortedLinks.size(); i++) {
|
|
|
int finalI = i;
|
|
int finalI = i;
|
|
|
- PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream()
|
|
|
|
|
- .filter(x -> x.getAttrCode().equals(sortedLinks.get(finalI).getAttrCode()))
|
|
|
|
|
- .findAny()
|
|
|
|
|
- .get();
|
|
|
|
|
|
|
+ PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(x -> x.getAttrCode().equals(sortedLinks.get(finalI).getAttrCode())).findAny().get();
|
|
|
|
|
|
|
|
//数值范围判断
|
|
//数值范围判断
|
|
|
|
|
|
|
@@ -158,12 +155,13 @@ public class BuildDescUtils {
|
|
|
if (link.getMinArray() != null && link.getMinArray().length > 0) {
|
|
if (link.getMinArray() != null && link.getMinArray().length > 0) {
|
|
|
// minArray 转 Set,避免循环内反复创建 List 做 contains 查找
|
|
// minArray 转 Set,避免循环内反复创建 List 做 contains 查找
|
|
|
Set<String> minCodes = Arrays.stream(link.getMinArray()).collect(Collectors.toSet());
|
|
Set<String> minCodes = Arrays.stream(link.getMinArray()).collect(Collectors.toSet());
|
|
|
- String names = Optional.ofNullable(dictLabalList).orElse(Collections.emptyList()).stream()
|
|
|
|
|
- .filter(labal -> minCodes.contains(labal.getCode()))
|
|
|
|
|
- .map(PtlAgreementUndwrtRulesDictLabal::getName)
|
|
|
|
|
- .collect(Collectors.joining(","));
|
|
|
|
|
- returnMsg.append(undwrtRulesAttr.getAttrName()).append("包含").append(names).append(",");
|
|
|
|
|
|
|
+ String names = Optional.ofNullable(dictLabalList).orElse(Collections.emptyList()).stream().filter(labal -> minCodes.contains(labal.getCode())).map(PtlAgreementUndwrtRulesDictLabal::getName).collect(Collectors.joining(","));
|
|
|
|
|
|
|
|
|
|
+ if (link.getOperator() != null && "1".equals(link.getOperator())) {
|
|
|
|
|
+ returnMsg.append(undwrtRulesAttr.getAttrName()).append("包含").append(names).append(",");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ returnMsg.append(undwrtRulesAttr.getAttrName()).append("不包含").append(names).append(",");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return returnMsg.toString();
|
|
return returnMsg.toString();
|
|
|
}
|
|
}
|
|
@@ -182,9 +180,7 @@ public class BuildDescUtils {
|
|
|
// 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
|
|
// 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
|
|
|
List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(ptlAgreementUndwrtRulesAttr, linkList);
|
|
List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(ptlAgreementUndwrtRulesAttr, linkList);
|
|
|
// code -> 字典标签 映射,避免 O(n²) 循环匹配
|
|
// code -> 字典标签 映射,避免 O(n²) 循环匹配
|
|
|
- Map<String, PtlAgreementUndwrtRulesDictLabal> dictLabalMap = dictLabalList.stream()
|
|
|
|
|
- .filter(x -> x.getCode() != null)
|
|
|
|
|
- .collect(Collectors.toMap(PtlAgreementUndwrtRulesDictLabal::getCode, Function.identity(), (oldItem, newItem) -> newItem));
|
|
|
|
|
|
|
+ Map<String, PtlAgreementUndwrtRulesDictLabal> dictLabalMap = dictLabalList.stream().filter(x -> x.getCode() != null).collect(Collectors.toMap(PtlAgreementUndwrtRulesDictLabal::getCode, Function.identity(), (oldItem, newItem) -> newItem));
|
|
|
for (String code : linkList.getMinArray()) {
|
|
for (String code : linkList.getMinArray()) {
|
|
|
PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalMap.get(code);
|
|
PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalMap.get(code);
|
|
|
returnMsg.append(ptlAgreementUndwrtRulesDictLabal != null ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
|
|
returnMsg.append(ptlAgreementUndwrtRulesDictLabal != null ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
|