liub 6 dagen geleden
bovenliggende
commit
ca95d436c4

+ 112 - 108
tenant/organization/src/main/java/com/jzg/organization/component/BuildDescUtils.java

@@ -14,160 +14,179 @@ public class BuildDescUtils {
     /**
      * 遍历费用属性描述文字
      *
-     * @param linkList
-     * @param undwrtRulesAttrList
+     * @param linkList            属性记录列表
+     * @param undwrtRulesAttrList 属性定义列表
      * @return
      */
     public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
         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()));
+        // 仅保留当前主体可用(all 或匹配 companyId)的属性定义
+        Map<String, PtlAgreementUndwrtRulesAttr> attrMap = undwrtRulesAttrList.stream()
+                .filter(attr -> "all".equals(attr.getCompanyIds()) || Objects.equals(attr.getCompanyIds(), companyId))
+                .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, Function.identity()));
         // 这里进行排序,保证生成的承保规则描述是有序的
-        linkList = linkList.stream().sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttr::getAttrCode)).toList();
-        List<PtlAgreementUndwrtRulesAttr> sortedLinks = new ArrayList<>(linkList);
+        List<PtlAgreementUndwrtRulesAttr> sortedLinks = linkList.stream()
+                .sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttr::getAttrCode))
+                .toList();
 
         for (PtlAgreementUndwrtRulesAttr link : sortedLinks) {
-            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = attrMap.get(link.getAttrCode());
-            if (ptlAgreementUndwrtRulesAttr == null) {
+            PtlAgreementUndwrtRulesAttr attr = attrMap.get(link.getAttrCode());
+            if (attr == null) {
                 continue;
             }
-
-            String attrType = ptlAgreementUndwrtRulesAttr.getAttrType();
-
+            String attrType = attr.getAttrType();
             if ("inputNumber".equals(attrType)) {
-                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(";\t\t");
+                desc.append(inputNumberDesc(attr.getAttrName(), link.getOperator(), link.getMin(), link.getMax())).append(";\t\t");
             } else if ("radio".equals(attrType)) {
-                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(";\t\t");
+                desc.append(radioDesc(attr, link.getMin())).append(";\t\t");
             } else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
                 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((link.getOperator() != null && "1".equals(link.getOperator())) ? "包含" : "不包含").append(names).append(";\t\t");
+                    String names = joinDictNames(link.getDictLabal(), minCodes, ",");
+                    desc.append(containDesc(attr.getAttrName(), link.getOperator(), names)).append(";\t\t");
                 } else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append((link.getOperator() != null && "1".equals(link.getOperator())) ? "包含" : "不包含").append(link.getMin()).append(";\t\t");
+                    desc.append(containDesc(attr.getAttrName(), link.getOperator(), link.getMin())).append(";\t\t");
                 }
             } else if ("inputTag".equals(attrType)) {
-                desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append((link.getOperator() != null && "1".equals(link.getOperator())) ? "包含" : "不包含").append(link.getMin()).append(";\t\t");
+                desc.append(containDesc(attr.getAttrName(), link.getOperator(), link.getMin())).append(";\t\t");
             }
         }
-        return desc.toString();
-    }
-
-    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());
-
-        return dictLabel.map(dl -> ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + dl.getName()).orElse("");
-    }
-
-    private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
-        String operator = link.getOperator();
-        switch (operator) {
-            case "1":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "范围值" + link.getMin() + "到" + link.getMax();
-            case "2":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + link.getMin();
-            case "3":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + link.getMin();
-            case "4":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + link.getMax();
-            case "5":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + link.getMax();
-            default:
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "未知操作符";
-        }
+        // buildDesc返回的条件间以相邻双逗号分隔,此处合并为单个分号
+        return StringUtils.mergeAdjacentComma(desc.toString());
     }
 
-
     /**
      * 遍历承保规则属性描述文字
      *
-     * @param linkList
-     * @param undwrtRulesAttrList
+     * @param linkList            规则因子关联记录列表
+     * @param undwrtRulesAttrList 属性定义列表
      * @return
      */
     public static String buildDesc(List<PtlAgreementUndwrtRulesAttrLink> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
         StringBuilder desc = new StringBuilder();
+        // 属性定义按 attrCode 建索引,避免循环内逐条 stream 查找
+        Map<String, PtlAgreementUndwrtRulesAttr> attrMap = undwrtRulesAttrList.stream()
+                .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, Function.identity(), (oldItem, newItem) -> newItem));
         // 这里进行排序,保证生成的承保规则描述是有序的
-        linkList = linkList.stream().sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttrLink::getAttrCode)).toList();
-        List<PtlAgreementUndwrtRulesAttrLink> sortedLinks = new ArrayList<>(linkList);
-
-        for (int i = 0; i < sortedLinks.size(); i++) {
-            int finalI = i;
-            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(x -> x.getAttrCode().equals(sortedLinks.get(finalI).getAttrCode())).findAny().get();
+        List<PtlAgreementUndwrtRulesAttrLink> sortedLinks = linkList.stream()
+                .sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttrLink::getAttrCode))
+                .toList();
 
-            //数值范围判断
-
-            if ("inputNumber".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i))).append(",");
-            }
-            if ("radio".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i))).append(",");
-            }
-            if ("select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(selectIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i)));
-            }
-            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i)));
+        for (PtlAgreementUndwrtRulesAttrLink link : sortedLinks) {
+            PtlAgreementUndwrtRulesAttr attr = attrMap.get(link.getAttrCode());
+            if (attr == null) {
+                continue;
             }
-            if ("inputTag".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append((sortedLinks.get(i).getOperator() != null && sortedLinks.get(i).getOperator().equals("1")) ? "包含" : "不包含").append(sortedLinks.get(i).getMin()).append(",");
+            String attrType = attr.getAttrType();
+            if ("inputNumber".equals(attrType)) {
+                desc.append(inputNumberDesc(attr.getAttrName(), link.getOperator(), link.getMin(), link.getMax())).append(",");
+            } else if ("radio".equals(attrType)) {
+                desc.append(radioDesc(attr, link.getMin())).append(",");
+            } else if ("select".equals(attrType)) {
+                desc.append(selectIdentifying(attr, link));
+            } else if ("checkbox".equals(attrType)) {
+                desc.append(checkBoxIdentifying(attr, link));
+            } else if ("inputTag".equals(attrType)) {
+                desc.append(containDesc(attr.getAttrName(), link.getOperator(), link.getMin())).append(",");
             }
         }
         // 相邻的","或","转换为"或"字
         return StringUtils.convertAdjacentCommaToOr(desc.toString());
     }
 
-    public static String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
-        PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x -> x.getCode().equals(ptlAgreementProductCostsAttrLink.getMin())).findAny().get();
-        return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
-    }
-
     public static String selectIdentifying(PtlAgreementUndwrtRulesAttr undwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink link) {
         StringBuilder returnMsg = new StringBuilder();
-        // 兼容 min 逗号分隔存储,保证 minArray 有值
-        if (link.getMinArray() == null) {
-            String minStr = link.getMin();
-            if (minStr != null && !minStr.isEmpty()) {
-                link.setMinArray(minStr.split(","));
-            }
-        }
-
+        ensureMinArray(link);
         // 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
         List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(undwrtRulesAttr, link);
-
         // 用字典标签的 code 匹配 minArray 中的每一项
         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((link.getOperator() != null && "1".equals(link.getOperator())) ? "包含" : "不包含").append(names).append(",");
+            String names = joinDictNames(dictLabalList, minCodes, ",");
+            returnMsg.append(containDesc(undwrtRulesAttr.getAttrName(), link.getOperator(), names)).append(",");
         }
         return returnMsg.toString();
     }
 
     public static String checkBoxIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink linkList) {
-        StringBuilder returnMsg = new StringBuilder();
-        returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
-        // 兼容 min 逗号分隔存储,保证 minArray 有值
-        if (linkList.getMinArray() == null) {
-            String minStr = linkList.getMin();
-            if (minStr != null && !minStr.isEmpty()) {
-                linkList.setMinArray(minStr.split(","));
-            }
-        }
+        StringBuilder returnMsg = new StringBuilder(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
+        ensureMinArray(linkList);
         if (linkList.getMinArray() != null) {
             // 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
             List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(ptlAgreementUndwrtRulesAttr, linkList);
             // 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(dictLabal -> dictLabal.getCode() != null)
+                    .collect(Collectors.toMap(PtlAgreementUndwrtRulesDictLabal::getCode, Function.identity(), (oldItem, newItem) -> newItem));
             for (String code : linkList.getMinArray()) {
-                PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalMap.get(code);
-                returnMsg.append(ptlAgreementUndwrtRulesDictLabal != null ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
+                PtlAgreementUndwrtRulesDictLabal dictLabal = dictLabalMap.get(code);
+                returnMsg.append(dictLabal != null ? dictLabal.getName() : "").append(",");
             }
         }
         return returnMsg.toString();
     }
 
+    /**
+     * 拼接"属性名 + 包含/不包含 + 值"
+     */
+    private static String containDesc(String attrName, String operator, String value) {
+        return attrName + ("1".equals(operator) ? "包含" : "不包含") + value;
+    }
+
+    /**
+     * 数值操作符描述拼接(operator: 1区间 2小于 3小于等于 4大于 5大于等于)
+     */
+    private static String inputNumberDesc(String attrName, String operator, String min, String max) {
+        if ("1".equals(operator)) {
+            return attrName + "范围值" + min + "到" + max;
+        } else if ("2".equals(operator)) {
+            return attrName + "小于" + min;
+        } else if ("3".equals(operator)) {
+            return attrName + "小于等于" + min;
+        } else if ("4".equals(operator)) {
+            return attrName + "大于" + max;
+        } else if ("5".equals(operator)) {
+            return attrName + "大于等于" + max;
+        }
+        return "";
+    }
+
+    /**
+     * 单选字典描述拼接:属性名为 + 字典名称
+     */
+    private static String radioDesc(PtlAgreementUndwrtRulesAttr attr, String code) {
+        return Optional.ofNullable(attr.getDictLabal()).orElse(Collections.emptyList()).stream()
+                .filter(dictLabal -> Objects.equals(dictLabal.getCode(), code))
+                .map(PtlAgreementUndwrtRulesDictLabal::getName)
+                .findFirst()
+                .map(name -> attr.getAttrName() + "为" + name)
+                .orElse("");
+    }
+
+    /**
+     * 将字典 code 集合对应的名称按 separator 拼接为字符串
+     */
+    private static String joinDictNames(List<PtlAgreementUndwrtRulesDictLabal> dictLabalList, Set<String> codes, String separator) {
+        return Optional.ofNullable(dictLabalList).orElse(Collections.emptyList()).stream()
+                .filter(dictLabal -> codes.contains(dictLabal.getCode()))
+                .map(PtlAgreementUndwrtRulesDictLabal::getName)
+                .collect(Collectors.joining(separator));
+    }
+
+    /**
+     * 兼容 min 逗号分隔存储:minArray 为空时将 min 按逗号拆分填充
+     */
+    private static void ensureMinArray(PtlAgreementUndwrtRulesAttrLink link) {
+        if (link.getMinArray() == null) {
+            String minStr = link.getMin();
+            if (minStr != null && !minStr.isEmpty()) {
+                link.setMinArray(minStr.split(","));
+            }
+        }
+    }
+
     /**
      * 获取字典标签列表:优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
      */
@@ -181,19 +200,4 @@ public class BuildDescUtils {
         return Collections.emptyList();
     }
 
-    private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
-        if ("1".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "范围值" + ptlAgreementProductCostsAttrLink.getMin() + "到" + ptlAgreementProductCostsAttrLink.getMax();
-        } else if ("2".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + ptlAgreementProductCostsAttrLink.getMin();
-        } else if ("3".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + ptlAgreementProductCostsAttrLink.getMin();
-        } else if ("4".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + ptlAgreementProductCostsAttrLink.getMax();
-        } else if ("5".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + ptlAgreementProductCostsAttrLink.getMax();
-        }
-        return "";
-    }
-
 }

+ 44 - 44
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -121,7 +121,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         }
         List<String> createdIds = new ArrayList<>();
         for (CostAdd costAdd : costAddList) {
-            for (PtlAgreementCostAdd ptlAgreementCostAdd : costAdd.getPtlAgreementCostAddList()){
+            for (PtlAgreementCostAdd ptlAgreementCostAdd : costAdd.getPtlAgreementCostAddList()) {
                 // 规则条件 min 根据 minArray 重组:多选/下拉等多值场景前端以数组提交,落库需以逗号分隔
                 if (CollUtil.isNotEmpty(ptlAgreementCostAdd.getRuleConditions())) {
                     ptlAgreementCostAdd.getRuleConditions().forEach(item -> {
@@ -130,10 +130,10 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                         }
                     });
                 }
-                if (ListUtils.hasDuplicates(ptlAgreementCostAdd.getRuleConditions())){
+                if (ListUtils.hasDuplicates(ptlAgreementCostAdd.getRuleConditions())) {
                     throw new SystemException("添加数据存在相同费用规则,请检查");
                 }
-                if(StrUtil.isEmpty(costAdd.getPtlAgreementId())){
+                if (StrUtil.isEmpty(costAdd.getPtlAgreementId())) {
                     log.info("新增费用的时候,需要指定关联的协议信息。ptlAgreemenCostAdd=[{}]", JSONUtil.toJsonStr(ptlAgreemenCostAdd));
                     return HttpResult.error("新增费用的时候,需要指定关联的协议信息");
                 }
@@ -182,7 +182,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         // 校验ptlAgreementCostTypeList 数据  exportKeepPointRatio 不能大于 export
         if (!CollectionUtils.isEmpty(ptlAgreementCostEnd.getPtlAgreementCostTypeList())) {
             for (PtlAgreementCostEnd.PtlAgreementCostTypeDto ptlAgreementCostTypeDto : ptlAgreementCostEnd.getPtlAgreementCostTypeList()) {
-                if (null != ptlAgreementCostTypeDto.getExportKeepPointRatio() && null != ptlAgreementCostTypeDto.getExport()){
+                if (null != ptlAgreementCostTypeDto.getExportKeepPointRatio() && null != ptlAgreementCostTypeDto.getExport()) {
                     if (ptlAgreementCostTypeDto.getExportKeepPointRatio().compareTo(ptlAgreementCostTypeDto.getExport()) > 0) {
                         return HttpResult.error("出口留点比例不能大于出口比例");
                     }
@@ -202,13 +202,13 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         }
         // 处理minArray
         if (!CollectionUtils.isEmpty(ptlAgreementCostEnd.getRuleConditions())) {
-            ptlAgreementCostEnd.getRuleConditions().forEach(item->{
+            ptlAgreementCostEnd.getRuleConditions().forEach(item -> {
                 StringBuilder min = new StringBuilder();
-                if(item.getMinArray() != null && item.getMinArray().size() > 0){
-                    item.getMinArray().forEach(kk->{
+                if (item.getMinArray() != null && item.getMinArray().size() > 0) {
+                    item.getMinArray().forEach(kk -> {
                         min.append(kk).append(",");
                     });
-                    min.substring(0,min.length()-1);
+                    min.substring(0, min.length() - 1);
                     item.setMin(min.toString());
                 }
             });
@@ -218,36 +218,35 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     }
 
 
-    public String buildDescString(String companyId, List<?> list){
-        if (CollectionUtils.isEmpty(list)){
+    public String buildDescString(String companyId, List<?> list) {
+        if (CollectionUtils.isEmpty(list)) {
             return null;
         }
         String desc = BuildDescUtils.buildDesc(companyId, BeanUtil.copyToList(list, PtlAgreementUndwrtRulesAttr.class), agreementUndwrtRulesAttrService.getUndwrtRulesAttrList());
-        // buildDesc返回的条件间以相邻双逗号分隔,此处合并为单个分号
-        return StringUtils.mergeAdjacentComma(desc);
+        return desc;
     }
 
-    public boolean verify(PtlAgreementCostAdd ptlAgreementCostAdd){
+    public boolean verify(PtlAgreementCostAdd ptlAgreementCostAdd) {
         CostAgreementParam costAgreementParam = new CostAgreementParam();
         costAgreementParam.setPtlAgreementId(ptlAgreementCostAdd.getPtlAgreementId());
         costAgreementParam.setCoverRuleId(ptlAgreementCostAdd.getCoverRuleId());
         List<PtlAgreementCostVo> voList = queryByAgreementId(costAgreementParam);
-        if (CollectionUtils.isEmpty(voList)){
+        if (CollectionUtils.isEmpty(voList)) {
             return false;
         }
         // 比较规则是否相同
         Map<String, List<PtlAgreementCostVo>> listMap = voList.stream().filter(v -> Constants.ENABLE == v.getIsEnabled() && Constants.EFFECTIVE == v.getIsValid()).collect(Collectors.groupingBy(PtlAgreementCostVo::getProductId));
         List<PtlAgreementCostVo> ptlAgreementCostVos = listMap.get(ptlAgreementCostAdd.getProductId());
-        if (CollectionUtils.isEmpty(ptlAgreementCostVos)){
+        if (CollectionUtils.isEmpty(ptlAgreementCostVos)) {
             return false;
         }
         List<RuleConditionsVerify> ruleConditionsVerifies = BeanUtil.copyToList(ptlAgreementCostAdd.getRuleConditions(), RuleConditionsVerify.class);
-        if (CollectionUtils.isEmpty(ruleConditionsVerifies)){
+        if (CollectionUtils.isEmpty(ruleConditionsVerifies)) {
             return false;
         }
         for (PtlAgreementCostVo ptlAgreementCostVo : ptlAgreementCostVos) {
             List<RuleConditionsVerify> verifies = BeanUtil.copyToList(ptlAgreementCostVo.getRuleConditions(), RuleConditionsVerify.class);
-            if (ObjectUtil.equals(verifies,ruleConditionsVerifies)){
+            if (ObjectUtil.equals(verifies, ruleConditionsVerifies)) {
                 return true;
             }
         }
@@ -265,7 +264,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     public HttpResult<PtlAgreementCostVo> queryById(Long id) {
         log.info("查询协议的费用信息:协议费用id=[{}]", id);
         PtlAgreementCostVo ptlAgreementCostVo = ptlAgreementCostMapper.queryById(id);
-        if (ObjectUtil.isEmpty(ptlAgreementCostVo)){
+        if (ObjectUtil.isEmpty(ptlAgreementCostVo)) {
             return HttpResult.ok(ptlAgreementCostVo);
         }
         RList<SysDict> rules = redissonClient.getList(DICT_REDIS_KEY + "rule_operator");
@@ -279,10 +278,10 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                 ruleCondition.setMin(value);
             }
             String attrType = ruleCondition.getAttrType();
-            if (StringUtils.isNotEmpty(attrType) && java.util.Arrays.stream(COST_TYPE_DICT_KEY).anyMatch(attrType::equals)){
-                if (StringUtils.isNotEmpty(ruleCondition.getMin()) && ruleCondition.getMin().contains(",")){
+            if (StringUtils.isNotEmpty(attrType) && java.util.Arrays.stream(COST_TYPE_DICT_KEY).anyMatch(attrType::equals)) {
+                if (StringUtils.isNotEmpty(ruleCondition.getMin()) && ruleCondition.getMin().contains(",")) {
                     ruleCondition.setMinArray(Arrays.asList(ruleCondition.getMin().split(",")));
-                }else {
+                } else {
                     ruleCondition.setMinArray(Collections.singletonList(ruleCondition.getMin()));
                     //ruleCondition.setMinArray(Collections.singletonList(ruleCondition.getMin()));
                 }
@@ -304,21 +303,21 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     }
 
 
-    private List<PtlAgreementCostVo> queryByAgreementId(CostAgreementParam costAgreementParam){
+    private List<PtlAgreementCostVo> queryByAgreementId(CostAgreementParam costAgreementParam) {
         return ptlAgreementCostMapper.queryByAgreementId(costAgreementParam);
     }
 
 
     @Override
-    public HttpResult enableDisableByIds(List<String> ids,Boolean isEnabled) {
-        if (CollectionUtils.isEmpty(ids)){
+    public HttpResult enableDisableByIds(List<String> ids, Boolean isEnabled) {
+        if (CollectionUtils.isEmpty(ids)) {
             return HttpResult.error("参数不能为空");
         }
         PtlAgreementCost ptlAgreementCost = new PtlAgreementCost();
         ptlAgreementCost.setIsEnabled(isEnabled ? 0 : 1);
         ptlAgreementCost.setIsValid(isEnabled ? 0 : 1);
-        return baseMapper.update(ptlAgreementCost,new LambdaQueryWrapper<>(PtlAgreementCost.class)
-                .in(PtlAgreementCost::getId,ids)) > 0 ?
+        return baseMapper.update(ptlAgreementCost, new LambdaQueryWrapper<>(PtlAgreementCost.class)
+                .in(PtlAgreementCost::getId, ids)) > 0 ?
                 HttpResult.ok(isEnabled ? "启用成功" : "禁用成功") : HttpResult.error(isEnabled ? "启用失败" : "禁用失败");
     }
 
@@ -326,7 +325,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     public void updateAuditMethod(List<Long> ids) {
         PtlAgreementCost ptlAgreementCost = new PtlAgreementCost();
         ptlAgreementCost.setAuditMethod(0);
-        baseMapper.update(ptlAgreementCost,new LambdaQueryWrapper<>(PtlAgreementCost.class).in(PtlAgreementCost::getId,ids));
+        baseMapper.update(ptlAgreementCost, new LambdaQueryWrapper<>(PtlAgreementCost.class).in(PtlAgreementCost::getId, ids));
     }
 
     @Override
@@ -367,9 +366,9 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                     }
                 }
             }
-            if(isSuccessful) {
+            if (isSuccessful) {
                 return HttpResult.ok("审核成功", costReviewParam.isAutomatic() ? nextDataID() : null);
-            }else{
+            } else {
                 return HttpResult.ok("驳回成功", costReviewParam.isAutomatic() ? nextDataID() : null);
             }
         } catch (SystemException e) {
@@ -413,7 +412,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 //            LocalDateTime localDateTime = end.plusDays(1).atStartOfDay();
 //            costParam.setAuditTimeEnd(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
 //        }
-        if(StrUtil.isNotEmpty(costParam.getCompanyId())){
+        if (StrUtil.isNotEmpty(costParam.getCompanyId())) {
             HttpResult<List<String>> res = esmInsCompanyClient.queryOwnAndSubCompandyIds(costParam.getCompanyId());
             costParam.setCompanyIdList(res.getData());
         }
@@ -425,16 +424,16 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         Page<CostManagementVo> costManagementVoPage = baseMapper.pageList(costParam.getPage(), costParam);
         // 按承保规则属性 sort 正序,重新排列 cost_rules 各段描述
         reorderCostRules(costManagementVoPage.getRecords());
-        costManagementVoPage.getRecords().forEach(item->{
-            if(item.getCostRules() != null && !item.getCostRules().isEmpty()){
-                item.setCostRules(item.getCostRules().substring(0,item.getCostRules().length()-1));
+        costManagementVoPage.getRecords().forEach(item -> {
+            if (item.getCostRules() != null && !item.getCostRules().isEmpty()) {
+                item.setCostRules(item.getCostRules().substring(0, item.getCostRules().length() - 1));
             }
-            if(item.getRuleDescription() != null && !item.getRuleDescription().isEmpty()){
-                item.setRuleDescription(item.getRuleDescription().substring(0,item.getRuleDescription().length()-1));
+            if (item.getRuleDescription() != null && !item.getRuleDescription().isEmpty()) {
+                item.setRuleDescription(item.getRuleDescription().substring(0, item.getRuleDescription().length() - 1));
             }
             // ruleDescription中出现两个相邻的","或","时,转换为"或"字
             item.setRuleDescription(StringUtils.convertAdjacentCommaToOr(item.getRuleDescription()));
-            item.setAuditPersonName(userName2Name.getOrDefault(item.getAuditPerson(),item.getAuditPerson()));
+            item.setAuditPersonName(userName2Name.getOrDefault(item.getAuditPerson(), item.getAuditPerson()));
         });
         return HttpResult.ok(costManagementVoPage);
     }
@@ -506,9 +505,9 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         List<String> newCostId = new ArrayList<>();
         List<String> costIds = costCopyParam.getCostIds();
         StringBuilder errMsg = new StringBuilder();
-        costIds.forEach(oldCostId-> {
+        costIds.forEach(oldCostId -> {
             PtlAgreementCost ptlAgreementCost = ptlAgreementCostMapper.selectById(oldCostId);
-            if(ptlAgreementCost != null){
+            if (ptlAgreementCost != null) {
                 List<PtlAgreementCostType> ptlAgreementCostTypes = ptlAgreementCostTypeMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostType>()
                         .eq(PtlAgreementCostType::getPtlAgreementCostId, ptlAgreementCost.getId()));
                 List<PtlAgreementCostRule> ptlAgreementCostRules = ptlAgreementCostRuleMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostRule>()
@@ -522,10 +521,10 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                 ptlAgreementCost.setCostDescribe(ptlAgreementCost.getCostDescribe());
                 ptlAgreementCost.setCreateTime(LocalDateTime.now());
                 ptlAgreementCost.setUpdateTime(LocalDateTime.now());
-                if(costCopyParam.getProductId() != null && !costCopyParam.getProductId().isEmpty()){
+                if (costCopyParam.getProductId() != null && !costCopyParam.getProductId().isEmpty()) {
                     ptlAgreementCost.setProductId(costCopyParam.getProductId());
                 }
-                if(costCopyParam.getProductName() != null && !costCopyParam.getProductName().isEmpty()){
+                if (costCopyParam.getProductName() != null && !costCopyParam.getProductName().isEmpty()) {
                     ptlAgreementCost.setProductName(costCopyParam.getProductName());
                 }
 
@@ -555,7 +554,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                         })
                         .collect(Collectors.toList());
 
-                ptlAgreementCostRules.forEach(item->{
+                ptlAgreementCostRules.forEach(item -> {
                     item.setId(IdGenerate.nextId());
                     item.setPtlAgreementCostId(costId);
                 });
@@ -565,13 +564,13 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                 ptlAgreementCostRuleMapper.insert(ptlAgreementCostRules);
                 newCostId.add(ptlAgreementCost.getId());
 
-            }else{
-                errMsg.append("costId为"+oldCostId+"的费用信息已被删除");
+            } else {
+                errMsg.append("costId为" + oldCostId + "的费用信息已被删除");
             }
 
 
         });
-        return HttpResult.ok(errMsg.toString(),newCostId);
+        return HttpResult.ok(errMsg.toString(), newCostId);
     }
 
     @Override
@@ -635,6 +634,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                 ? HttpResult.ok("批量修改成功,共修改 " + finalCostIds.size() + " 条记录")
                 : HttpResult.error("批量修改失败");
     }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResult<String> batchAdjustCostRatio(PtlAgreementCostBatchAdjustParam param) {