|
|
@@ -12,10 +12,8 @@ import com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatchRulesAt
|
|
|
import com.jzg.commons.entity.agreement.dispatch.vo.PtlAgreementDispatchQuery;
|
|
|
import com.jzg.commons.entity.agreement.dispatch.vo.PtlAgreementDispatchVo;
|
|
|
import com.jzg.commons.entity.agreement.po.PtlAgreementAttribution;
|
|
|
-import com.jzg.commons.entity.po.PtlAgreement;
|
|
|
-import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
|
-import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
|
|
|
-import com.jzg.commons.entity.po.SysDict;
|
|
|
+import com.jzg.commons.entity.po.*;
|
|
|
+import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.commons.util.idgen.IdGenerate;
|
|
|
import com.jzg.organization.client.EsmInsCompanyClient;
|
|
|
import com.jzg.organization.mapper.PtlAgreementDispatchActionMapper;
|
|
|
@@ -29,10 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -48,27 +43,22 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
|
|
|
|
|
|
@Autowired
|
|
|
PtlAgreementDispatchRulesAttrLinkMapper rulesAttrLinkMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- PtlAgreementDispatchActionMapper actionMapper;
|
|
|
-
|
|
|
@Autowired
|
|
|
PtlAgreementUndwrtRulesAttrService ptlAgreementUndwrtRulesAttrService;
|
|
|
-
|
|
|
@Autowired
|
|
|
PtlAgreementUndwrtRulesDictLabalService ptlAgreementUndwrtRulesDictLabalService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private PtlAreaLicenseService ptlAreaLicenseService;
|
|
|
@Autowired
|
|
|
SysDictService sysDictService;
|
|
|
-
|
|
|
@Autowired
|
|
|
PtlAgreementService ptlAgreementService;
|
|
|
-
|
|
|
@Autowired
|
|
|
EsmInsCompanyClient esmInsCompanyClient;
|
|
|
-
|
|
|
@Autowired
|
|
|
PtlAgreementDispatchAfterActionMapper afterActionMapper;
|
|
|
+ @Autowired
|
|
|
+ PtlAgreementDispatchActionMapper actionMapper;
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public String addAgreementDispatch(PtlAgreementDispatchVo.DispatchVo ptlAgreementDispatchVo) {
|
|
|
@@ -134,10 +124,14 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
|
|
|
// 查询保司所有的规则属性 然后进行分组
|
|
|
List<PtlAgreementDispatchRulesAttrLink> ptlAgreementDispatchRulesAttrLinks = rulesAttrLinkMapper.selectList(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
|
|
|
.in(PtlAgreementDispatchRulesAttrLink::getDispatchId, dispatchIds));
|
|
|
-
|
|
|
+ ptlAgreementDispatchRulesAttrLinks = ptlAgreementDispatchRulesAttrLinks.stream().peek(action->{
|
|
|
+ String min = action.getMin();
|
|
|
+ if(StringUtils.isNotEmpty(min)){
|
|
|
+ action.setMinArray(Arrays.asList(min.split(",")));
|
|
|
+ }
|
|
|
+ }).toList();
|
|
|
// 获取所有保司的动作
|
|
|
List<PtlAgreementDispatchAction> ptlAgreementDispatchActions = actionMapper.getActions(dispatchIds);
|
|
|
-
|
|
|
// 获取保司的报价失败之后的动作
|
|
|
List<PtlAgreementDispatchAfterAction> ptlAgreementDispatchAfterActions = afterActionMapper.getAfterActions(ptlAgreementDispatchQuery.getCompanyId());
|
|
|
int index = 1;
|
|
|
@@ -145,6 +139,15 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
|
|
|
List<PtlAgreementUndwrtRulesDictLabal> ptlAgreementUndwrtRulesDictLabals = baseMapper.queryAllDictLabal();
|
|
|
Map<String, String> dictLabalId2Name = ptlAgreementUndwrtRulesDictLabals.stream()
|
|
|
.collect(Collectors.toMap(PtlAgreementUndwrtRulesDictLabal::getIdStr, PtlAgreementUndwrtRulesDictLabal::getName));
|
|
|
+ Map<String, PtlAreaLicense> areaLicenseMap = ptlAreaLicenseService.queryAllAreaLicenseMap();
|
|
|
+
|
|
|
+ Map<String,String> operatorMap = new HashMap<>();
|
|
|
+ operatorMap.put("1","包含");
|
|
|
+ operatorMap.put("2","小于");
|
|
|
+ operatorMap.put("3","小于等于");
|
|
|
+ operatorMap.put("4","大于");
|
|
|
+ operatorMap.put("5","大于等于");
|
|
|
+ operatorMap.put("","未知");
|
|
|
for(PtlAgreementDispatch dispatch : ptlAgreementDispatches){
|
|
|
if(dispatch.getDispatchName().isEmpty()){
|
|
|
dispatch.setDispatchName("规则" + index);
|
|
|
@@ -153,41 +156,33 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
|
|
|
List<PtlAgreementDispatchRulesAttrLink> attrLinks = ptlAgreementDispatchRulesAttrLinks.stream().filter(x -> x.getDispatchId().equals(dispatch.getId())).collect(Collectors.toList());
|
|
|
List<PtlAgreementDispatchAction> actions = ptlAgreementDispatchActions.stream().filter(x -> x.getDispatchId().equals(dispatch.getId())).collect(Collectors.toList());
|
|
|
for(PtlAgreementDispatchRulesAttrLink attrlink : attrLinks){
|
|
|
- if (attrlink.getOperator() != null) {
|
|
|
- if (attrlink.getOperator().equals("1")) {
|
|
|
- attrlink.setOperatorDesc("包含");
|
|
|
- }
|
|
|
- if (attrlink.getOperator().equals("2")) {
|
|
|
- attrlink.setOperatorDesc("小于");
|
|
|
- }
|
|
|
- if (attrlink.getOperator().equals("3")) {
|
|
|
- attrlink.setOperatorDesc("小于等于");
|
|
|
- }
|
|
|
- if (attrlink.getOperator().equals("4")) {
|
|
|
- attrlink.setOperatorDesc("大于");
|
|
|
- }
|
|
|
- if (attrlink.getOperator().equals("5")) {
|
|
|
- attrlink.setOperatorDesc("大于等于");
|
|
|
- }
|
|
|
+ log.info("attrlink=[{}]", JSONUtil.toJsonStr(attrlink));
|
|
|
+ attrlink.setOperatorDesc(operatorMap.get(Objects.toString(attrlink.getOperator(),"")));
|
|
|
+ if("LicenseNo".equals(attrlink.getAttrCode())){
|
|
|
+ String minName = ptlAreaLicenseService.convertAreaNumber2License(areaLicenseMap, attrlink.getMin());
|
|
|
+ attrlink.setMinName(minName);
|
|
|
}else{
|
|
|
- attrlink.setOperatorDesc("未知");
|
|
|
+ String minName = dictLabalId2Name.getOrDefault(attrlink.getMin(),attrlink.getMin());
|
|
|
+ String maxName = dictLabalId2Name.getOrDefault(attrlink.getMax(),attrlink.getMax());
|
|
|
+ attrlink.setMinName(minName);
|
|
|
+ attrlink.setMaxName(maxName);
|
|
|
}
|
|
|
- String minName = dictLabalId2Name.getOrDefault(attrlink.getMin(),attrlink.getMin());
|
|
|
- String maxName = dictLabalId2Name.getOrDefault(attrlink.getMax(),attrlink.getMax());
|
|
|
- attrlink.setMinName(minName);
|
|
|
- attrlink.setMaxName(maxName);
|
|
|
PtlAgreementUndwrtRulesAttr undwrtRuleAttrByAttrCode = ptlAgreementUndwrtRulesAttrService.getUndwrtRuleAttrByAttrCode(attrlink.getAttrCode());
|
|
|
- if(undwrtRuleAttrByAttrCode != null && undwrtRuleAttrByAttrCode.getDictId() != null){
|
|
|
+ if(undwrtRuleAttrByAttrCode != null){
|
|
|
attrlink.setAttrCodeName(undwrtRuleAttrByAttrCode.getAttrName());
|
|
|
- List<PtlAgreementUndwrtRulesDictLabal> dictLabelsByTypeCode = ptlAgreementUndwrtRulesDictLabalService.getDictLabelsByTypeCode(undwrtRuleAttrByAttrCode.getDictId());
|
|
|
- PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabelsByTypeCode.stream().filter(x -> x.getCode().equals(attrlink.getMin())).findFirst().orElse(null);
|
|
|
- if(ptlAgreementUndwrtRulesDictLabal != null){
|
|
|
- if(attrlink.getAttrDesc() == null){
|
|
|
- attrlink.setAttrDesc(new ArrayList<>());
|
|
|
+ if(undwrtRuleAttrByAttrCode.getDictId() != null){
|
|
|
+ attrlink.setAttrCodeName(undwrtRuleAttrByAttrCode.getAttrName());
|
|
|
+ List<PtlAgreementUndwrtRulesDictLabal> dictLabelsByTypeCode = ptlAgreementUndwrtRulesDictLabalService.getDictLabelsByTypeCode(undwrtRuleAttrByAttrCode.getDictId());
|
|
|
+ PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabelsByTypeCode.stream().filter(x -> x.getCode().equals(attrlink.getMin())).findFirst().orElse(null);
|
|
|
+ if(ptlAgreementUndwrtRulesDictLabal != null){
|
|
|
+ if(attrlink.getAttrDesc() == null){
|
|
|
+ attrlink.setAttrDesc(new ArrayList<>());
|
|
|
+ }
|
|
|
+ attrlink.getAttrDesc().add(ptlAgreementUndwrtRulesDictLabal.getName());
|
|
|
}
|
|
|
- attrlink.getAttrDesc().add(ptlAgreementUndwrtRulesDictLabal.getName());
|
|
|
}
|
|
|
}
|
|
|
+ log.info("attrlink数据填充完成:attrlink=[{}]",JSONUtil.toJsonStr(attrlink));
|
|
|
}
|
|
|
|
|
|
for(PtlAgreementDispatchAction action : actions){
|