|
@@ -40,22 +40,15 @@ public class BuildDescUtils {
|
|
|
} else if ("radio".equals(attrType)) {
|
|
} else if ("radio".equals(attrType)) {
|
|
|
desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(";\t\t");
|
|
desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(";\t\t");
|
|
|
} else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
|
|
} else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
|
|
|
- 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 : link.getDictLabal()) {
|
|
|
|
|
- if (Arrays.asList(link.getMinArray()).contains(x.getCode())) {
|
|
|
|
|
- ptlAgreementUndwrtRulesDictLabal = x;
|
|
|
|
|
- link.getMinArray()[k] = null;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- desc.append(null != ptlAgreementUndwrtRulesDictLabal ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
|
|
|
|
|
- }
|
|
|
|
|
- // 条件描述后补充一个分号
|
|
|
|
|
- desc.append(",");
|
|
|
|
|
- }else {
|
|
|
|
|
|
|
+ if (link.getMinArray() != null && link.getMinArray().length > 0) {
|
|
|
|
|
+ // minArray 转 Set,避免循环内反复创建 List 做 contains 查找
|
|
|
|
|
+ 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");
|
|
|
|
|
+ } else {
|
|
|
desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(";\t\t");
|
|
desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(";\t\t");
|
|
|
}
|
|
}
|
|
|
} else if ("inputTag".equals(attrType)) {
|
|
} else if ("inputTag".equals(attrType)) {
|
|
@@ -148,29 +141,29 @@ public class BuildDescUtils {
|
|
|
return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
|
|
return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static String selectIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
|
|
|
|
|
|
|
+ public static String selectIdentifying(PtlAgreementUndwrtRulesAttr undwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink link) {
|
|
|
StringBuilder returnMsg = new StringBuilder();
|
|
StringBuilder returnMsg = new StringBuilder();
|
|
|
- returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
|
|
|
|
|
// 兼容 min 逗号分隔存储,保证 minArray 有值
|
|
// 兼容 min 逗号分隔存储,保证 minArray 有值
|
|
|
- if (ptlAgreementProductCostsAttrLink.getMinArray() == null) {
|
|
|
|
|
- String minStr = ptlAgreementProductCostsAttrLink.getMin();
|
|
|
|
|
|
|
+ if (link.getMinArray() == null) {
|
|
|
|
|
+ String minStr = link.getMin();
|
|
|
if (minStr != null && !minStr.isEmpty()) {
|
|
if (minStr != null && !minStr.isEmpty()) {
|
|
|
- ptlAgreementProductCostsAttrLink.setMinArray(minStr.split(","));
|
|
|
|
|
|
|
+ link.setMinArray(minStr.split(","));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
|
|
// 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
|
|
|
- List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(ptlAgreementUndwrtRulesAttr, ptlAgreementProductCostsAttrLink);
|
|
|
|
|
|
|
+ List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(undwrtRulesAttr, link);
|
|
|
|
|
|
|
|
// 用字典标签的 code 匹配 minArray 中的每一项
|
|
// 用字典标签的 code 匹配 minArray 中的每一项
|
|
|
- if (ptlAgreementProductCostsAttrLink.getMinArray() != null) {
|
|
|
|
|
- for (String item : ptlAgreementProductCostsAttrLink.getMinArray()) {
|
|
|
|
|
- PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalList.stream()
|
|
|
|
|
- .filter(x -> x.getCode() != null && x.getCode().equals(item)).findAny().orElse(null);
|
|
|
|
|
- if (ptlAgreementUndwrtRulesDictLabal != null) {
|
|
|
|
|
- returnMsg.append(ptlAgreementUndwrtRulesDictLabal.getName()).append(",");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (link.getMinArray() != null && link.getMinArray().length > 0) {
|
|
|
|
|
+ // minArray 转 Set,避免循环内反复创建 List 做 contains 查找
|
|
|
|
|
+ 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(",");
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return returnMsg.toString();
|
|
return returnMsg.toString();
|
|
|
}
|
|
}
|