|
|
@@ -1,6 +1,7 @@
|
|
|
package com.jzg.organization.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
@@ -55,6 +56,8 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
|
|
|
|
|
|
@Autowired
|
|
|
private PtlAgreementService ptlAgreementService;
|
|
|
+ @Autowired
|
|
|
+ private PtlAreaLicenseService ptlAreaLicenseService;
|
|
|
|
|
|
/**
|
|
|
* 协议规则列表
|
|
|
@@ -515,51 +518,6 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- public AgreementRulesVo rulesCCC(String ruleId) {
|
|
|
- PtlAgreementUndwrtRules rules = baseMapper.selectById(ruleId);
|
|
|
- if (rules == null) {
|
|
|
- log.info("承保规则不存在, ruleId={}", ruleId);
|
|
|
- return null;
|
|
|
- }
|
|
|
- PtlAgreement agreement = ptlAgreementService.getById(rules.getAgreementId());//协议id
|
|
|
- AgreementRulesVo rulesVo = new AgreementRulesVo();
|
|
|
- BeanUtils.copyProperties(rules, rulesVo);
|
|
|
-
|
|
|
- // 获取费用因子属性(公共逻辑,仅查询一次)
|
|
|
- List<PtlAgreementUndwrtRulesAttr> attrList = agreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
|
|
|
- Map<String, PtlAgreementUndwrtRulesAttr> attrMap = attrList.stream()
|
|
|
- .filter(attr -> "all".equals(attr.getCompanyIds()) || attr.getCompanyIds().equals(agreement.getCompanyId()))
|
|
|
- .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, attr -> attr));
|
|
|
-
|
|
|
- // 确定需要处理的规则ID列表
|
|
|
- List<String> ruleIds;
|
|
|
- if (rules.getParentId() != null && !rules.getParentId().isEmpty()) {
|
|
|
- ruleIds = baseMapper.queryListByParentId(rules.getParentId()).stream()
|
|
|
- .map(AgreementRulesVo::getId).collect(Collectors.toList());
|
|
|
- } else {
|
|
|
- ruleIds = List.of(ruleId);
|
|
|
- }
|
|
|
-
|
|
|
- // 统一组装 groups
|
|
|
- List<RulesGroupParam> groups = new ArrayList<>();
|
|
|
- for (String id : ruleIds) {
|
|
|
- List<PtlAgreementUndwrtRulesAttrLink> linkList = agreementUndwrtRulesAttrLinkService.queryLinkList(id);
|
|
|
- List<PtlAgreementUndwrtRulesAttr> enrichedAttrs = enrichAttrLinks(linkList, attrMap);
|
|
|
- RulesGroupParam group = new RulesGroupParam();
|
|
|
- group.setRulesAttrList(linkList);
|
|
|
- group.setCostsAttrLinks(enrichedAttrs);
|
|
|
- groups.add(group);
|
|
|
- }
|
|
|
- rulesVo.setRulesGroups(groups);
|
|
|
- // 单条模式向后兼容,同时设置 costsAttrLinks
|
|
|
- if (ruleIds.size() == 1) {
|
|
|
- rulesVo.setCostsAttrLinks(groups.get(0).getCostsAttrLinks());
|
|
|
- }
|
|
|
- return rulesVo;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public AgreementRulesVo rulesCopy(String agreementId, String ruleId) {
|
|
|
@@ -744,7 +702,10 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
|
|
|
if ("radio".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
|
|
|
desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i))).append(",");
|
|
|
}
|
|
|
- if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType()) || "select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
|
|
|
+ if ("select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
|
|
|
+ desc.append(selectIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i)));
|
|
|
+ }
|
|
|
+ if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
|
|
|
desc.append(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr,linkList.get(i)));
|
|
|
}
|
|
|
if ("inputTag".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
|
|
|
@@ -763,6 +724,36 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
|
|
|
return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
|
|
|
}
|
|
|
|
|
|
+ private String selectIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
|
|
|
+ StringBuilder returnMsg = new StringBuilder();
|
|
|
+ returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
|
|
|
+ // 兼容 min 逗号分隔存储,保证 minArray 有值
|
|
|
+ if (ptlAgreementProductCostsAttrLink.getMinArray() == null) {
|
|
|
+ String minStr = ptlAgreementProductCostsAttrLink.getMin();
|
|
|
+ if (minStr != null && !minStr.isEmpty()) {
|
|
|
+ ptlAgreementProductCostsAttrLink.setMinArray(minStr.split(","));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
|
|
|
+ List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = new ArrayList<>();
|
|
|
+ if (ptlAgreementProductCostsAttrLink.getDictLabal() != null && !ptlAgreementProductCostsAttrLink.getDictLabal().isEmpty()) {
|
|
|
+ dictLabalList = ptlAgreementProductCostsAttrLink.getDictLabal().toJavaList(PtlAgreementUndwrtRulesDictLabal.class);
|
|
|
+ } else if (ptlAgreementUndwrtRulesAttr.getDictLabal() != null) {
|
|
|
+ dictLabalList = ptlAgreementUndwrtRulesAttr.getDictLabal();
|
|
|
+ }
|
|
|
+ // 用字典标签的 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(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return returnMsg.toString();
|
|
|
+ }
|
|
|
+
|
|
|
private String checkBoxIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink linkList) {
|
|
|
StringBuilder returnMsg = new StringBuilder();
|
|
|
returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
|
|
|
@@ -774,15 +765,20 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
|
|
|
}
|
|
|
}
|
|
|
if (linkList.getMinArray() != null) {
|
|
|
+ StringBuilder licenseInfo = new StringBuilder();
|
|
|
for(int i=0;i<linkList.getMinArray().length;i++) {
|
|
|
int finalI = i;
|
|
|
if(ptlAgreementUndwrtRulesAttr.getAttrCode().equals("LicenseNo") || ptlAgreementUndwrtRulesAttr.getAttrCode().equals("LicenseArea")) {
|
|
|
- returnMsg.append(linkList.getMinArray()[i]).append(",");
|
|
|
+ licenseInfo.append(linkList.getMinArray()[i]).append(",");
|
|
|
}else {
|
|
|
PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x -> x.getCode().equals(linkList.getMinArray()[finalI])).findAny().get();
|
|
|
returnMsg.append(ptlAgreementUndwrtRulesDictLabal.getName()).append(",");
|
|
|
}
|
|
|
}
|
|
|
+ if(StrUtil.isNotEmpty(licenseInfo.toString())){
|
|
|
+ String licenseName = ptlAreaLicenseService.convertAreaNumber2License(licenseInfo.toString());
|
|
|
+ returnMsg.append(licenseName).append(",");
|
|
|
+ }
|
|
|
}
|
|
|
return returnMsg.toString();
|
|
|
}
|