|
|
@@ -1,24 +1,35 @@
|
|
|
-package com.jzg.commons.util;
|
|
|
+package com.jzg.organization.component;
|
|
|
|
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Optional;
|
|
|
+import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
public class BuildDescUtils {
|
|
|
|
|
|
|
|
|
+ public static final Map<String, String> CODE_TO_LICENSE_MAP = Map.ofEntries(
|
|
|
+ Map.entry("1401", "晋A"),
|
|
|
+ Map.entry("1402", "晋B"),
|
|
|
+ Map.entry("1403", "晋C"),
|
|
|
+ Map.entry("1404", "晋D"),
|
|
|
+ Map.entry("1405", "晋E"),
|
|
|
+ Map.entry("1406", "晋F"),
|
|
|
+ Map.entry("1407", "晋K"),
|
|
|
+ Map.entry("1408", "晋M"),
|
|
|
+ Map.entry("1409", "晋H"),
|
|
|
+ Map.entry("1410", "晋L"),
|
|
|
+ Map.entry("1411", "晋J")
|
|
|
+ );
|
|
|
+
|
|
|
public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
|
|
|
- StringBuilder desc = new StringBuilder();
|
|
|
+ StringJoiner desc = new StringJoiner(",","","");
|
|
|
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();
|
|
|
for (PtlAgreementUndwrtRulesAttr link : linkList) {
|
|
|
PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = attrMap.get(link.getAttrCode());
|
|
|
if (ptlAgreementUndwrtRulesAttr == null) {
|
|
|
@@ -28,32 +39,24 @@ public class BuildDescUtils {
|
|
|
String attrType = ptlAgreementUndwrtRulesAttr.getAttrType();
|
|
|
|
|
|
if ("inputNumber".equals(attrType)) {
|
|
|
- desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(",");
|
|
|
+ desc.add(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link));
|
|
|
} else if ("radio".equals(attrType)) {
|
|
|
- desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(",");
|
|
|
+ desc.add(radioIdentifying(ptlAgreementUndwrtRulesAttr, link));
|
|
|
} else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
|
|
|
+ StringJoiner license = new StringJoiner(",", ptlAgreementUndwrtRulesAttr.getAttrName() + "包含" ,"");
|
|
|
if(link.getMinArray() != null && link.getMinArray().length > 0){
|
|
|
- desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含");
|
|
|
for (int k=0 ; k<link.getMinArray().length; k++){
|
|
|
- PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = null;
|
|
|
- for (PtlAgreementUndwrtRulesDictLabal x : ptlAgreementUndwrtRulesAttr.getDictLabal()) {
|
|
|
- if (Arrays.asList(link.getMinArray()).contains("select".equals(attrType) ? x.getName() : x.getCode())) {
|
|
|
- ptlAgreementUndwrtRulesDictLabal = x;
|
|
|
- link.getMinArray()[k] = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- desc.append(null != ptlAgreementUndwrtRulesDictLabal ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
|
|
|
+ license.add(CODE_TO_LICENSE_MAP.get(link.getMinArray()[k]));
|
|
|
}
|
|
|
-
|
|
|
}else {
|
|
|
- desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(",");
|
|
|
+ license.add(link.getMin());
|
|
|
}
|
|
|
+ desc.add(license.toString());;
|
|
|
} else if ("inputTag".equals(attrType)) {
|
|
|
if (link.getOperator() != null && "1".equals(link.getOperator())) {
|
|
|
- desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(",");
|
|
|
+ desc.add(ptlAgreementUndwrtRulesAttr.getAttrName() + "包含" + link.getMin());
|
|
|
} else {
|
|
|
- desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(link.getMin()).append(",");
|
|
|
+ desc.add(ptlAgreementUndwrtRulesAttr.getAttrName() + "不包含" + link.getMin());
|
|
|
}
|
|
|
}
|
|
|
}
|