|
|
@@ -515,51 +515,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 +699,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 +721,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("为");
|