|
@@ -3,21 +3,17 @@ package com.jzg.costsorrule.service.impl;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatchRulesAttrLink;
|
|
import com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatchRulesAttrLink;
|
|
|
-import com.jzg.commons.entity.agreement.dispatch.vo.ValidateDispatchRuleVo;
|
|
|
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
|
import com.jzg.commons.entity.scheme.po.PtlSchemeRulesAttrLink;
|
|
import com.jzg.commons.entity.scheme.po.PtlSchemeRulesAttrLink;
|
|
|
-import com.jzg.costsorrule.client.QuoteClient;
|
|
|
|
|
import com.jzg.costsorrule.constants.AttrTypeConstant;
|
|
import com.jzg.costsorrule.constants.AttrTypeConstant;
|
|
|
import com.jzg.costsorrule.constants.OperatorConstant;
|
|
import com.jzg.costsorrule.constants.OperatorConstant;
|
|
|
import com.jzg.costsorrule.model.RuleAttrLinkVo;
|
|
import com.jzg.costsorrule.model.RuleAttrLinkVo;
|
|
|
import com.jzg.costsorrule.service.RuleService;
|
|
import com.jzg.costsorrule.service.RuleService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -28,52 +24,51 @@ public class RuleServiceImpl implements RuleService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 预处理数据
|
|
* 预处理数据
|
|
|
|
|
+ *
|
|
|
* @param attrMap
|
|
* @param attrMap
|
|
|
* @param linkVos
|
|
* @param linkVos
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- private void dealData(Map<String,String> attrMap, List<RuleAttrLinkVo> linkVos){
|
|
|
|
|
|
|
+ private void dealData(Map<String, String> attrMap, List<RuleAttrLinkVo> linkVos) {
|
|
|
//需要截取的字符串
|
|
//需要截取的字符串
|
|
|
- Set<String> idNumbers = Set.of("OwnersInfoIdentifyNumber", "ApplicantIDNumber", "InsuredIDNumber","LicenseNo")
|
|
|
|
|
- .stream().map(String::toLowerCase).collect(Collectors.toSet());
|
|
|
|
|
|
|
+ Set<String> idNumbers = Set.of("OwnersInfoIdentifyNumber", "ApplicantIDNumber", "InsuredIDNumber", "LicenseNo").stream().map(String::toLowerCase).collect(Collectors.toSet());
|
|
|
//boolean 类型的转换
|
|
//boolean 类型的转换
|
|
|
- Set<String> inputTags = Set.of("NewEnergyMark")
|
|
|
|
|
- .stream().map(String::toLowerCase).collect(Collectors.toSet());
|
|
|
|
|
- linkVos.forEach(vo->{
|
|
|
|
|
- if(idNumbers.contains(vo.getAttrCode())){
|
|
|
|
|
|
|
+ Set<String> inputTags = Set.of("NewEnergyMark").stream().map(String::toLowerCase).collect(Collectors.toSet());
|
|
|
|
|
+ linkVos.forEach(vo -> {
|
|
|
|
|
+ if (idNumbers.contains(vo.getAttrCode())) {
|
|
|
String value = attrMap.get(vo.getAttrCode().toLowerCase());
|
|
String value = attrMap.get(vo.getAttrCode().toLowerCase());
|
|
|
String substring = value.substring(0, vo.getMin().length());
|
|
String substring = value.substring(0, vo.getMin().length());
|
|
|
- attrMap.put(vo.getAttrCode(),substring);
|
|
|
|
|
|
|
+ attrMap.put(vo.getAttrCode(), substring);
|
|
|
}
|
|
}
|
|
|
- if(inputTags.contains(vo.getAttrCode())){
|
|
|
|
|
|
|
+ if (inputTags.contains(vo.getAttrCode())) {
|
|
|
String value = attrMap.get(vo.getAttrCode().toLowerCase());
|
|
String value = attrMap.get(vo.getAttrCode().toLowerCase());
|
|
|
- if("false".equals(value)){
|
|
|
|
|
- attrMap.put(vo.getAttrCode(),"0");
|
|
|
|
|
- }else if("true".equals(value)){
|
|
|
|
|
- attrMap.put(vo.getAttrCode(),"1");
|
|
|
|
|
|
|
+ if ("false".equals(value)) {
|
|
|
|
|
+ attrMap.put(vo.getAttrCode(), "0");
|
|
|
|
|
+ } else if ("true".equals(value)) {
|
|
|
|
|
+ attrMap.put(vo.getAttrCode(), "1");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
//处理险种ProductCode-InsruanceProduct 不匹配的情况
|
|
//处理险种ProductCode-InsruanceProduct 不匹配的情况
|
|
|
- attrMap.put("insruanceproduct",attrMap.get("productcode"));
|
|
|
|
|
|
|
+ attrMap.put("insruanceproduct", attrMap.get("productcode"));
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean verificationRule(Map<String,String> maps, List<RuleAttrLinkVo> linkVos,List<PtlAgreementUndwrtRulesAttr> rulesAttrs, StringBuilder logs) {
|
|
|
|
|
|
|
+ public boolean verificationRule(Map<String, String> maps, List<RuleAttrLinkVo> linkVos, List<PtlAgreementUndwrtRulesAttr> rulesAttrs, StringBuilder logs) {
|
|
|
//预处理数据
|
|
//预处理数据
|
|
|
- dealData(maps,linkVos);
|
|
|
|
|
|
|
+ dealData(maps, linkVos);
|
|
|
//匹配费用因子
|
|
//匹配费用因子
|
|
|
for (int i = 0; i < linkVos.size(); i++) {
|
|
for (int i = 0; i < linkVos.size(); i++) {
|
|
|
//判断是否匹配
|
|
//判断是否匹配
|
|
|
// logs.append("费用id:" + agreementProductCosts.get(i).getId() + "\n");
|
|
// logs.append("费用id:" + agreementProductCosts.get(i).getId() + "\n");
|
|
|
// logs.append("费用因子描述:" + agreementProductCosts.get(i).getCostsDescription() + "\n");
|
|
// logs.append("费用因子描述:" + agreementProductCosts.get(i).getCostsDescription() + "\n");
|
|
|
// String attrCode = linkVos.get(i).getAttrCode();
|
|
// String attrCode = linkVos.get(i).getAttrCode();
|
|
|
- if(linkVos.get(i).getAttrCode() != null) {
|
|
|
|
|
|
|
+ if (linkVos.get(i).getAttrCode() != null) {
|
|
|
String attrValue = maps.get(linkVos.get(i).getAttrCode().toLowerCase());
|
|
String attrValue = maps.get(linkVos.get(i).getAttrCode().toLowerCase());
|
|
|
int finalI = i;
|
|
int finalI = i;
|
|
|
- PtlAgreementUndwrtRulesAttr rulesAttr = rulesAttrs.stream().filter(value -> value.getAttrCode().toLowerCase().equals(linkVos.get(finalI).getAttrCode().toLowerCase())).findFirst().orElse(null);
|
|
|
|
|
|
|
+ PtlAgreementUndwrtRulesAttr rulesAttr = rulesAttrs.stream().filter(value -> value.getAttrCode().equalsIgnoreCase(linkVos.get(finalI).getAttrCode())).findFirst().orElse(null);
|
|
|
if (Objects.isNull(attrValue) || Objects.isNull(rulesAttr)) {
|
|
if (Objects.isNull(attrValue) || Objects.isNull(rulesAttr)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -90,25 +85,21 @@ public class RuleServiceImpl implements RuleService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 匹配费用因子
|
|
* 匹配费用因子
|
|
|
|
|
+ *
|
|
|
* @param value 表单值
|
|
* @param value 表单值
|
|
|
* @param linkVo 费用因子
|
|
* @param linkVo 费用因子
|
|
|
* @param rulesAttr 规则因子
|
|
* @param rulesAttr 规则因子
|
|
|
* @param logs 日志
|
|
* @param logs 日志
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- private boolean judgements(String value,
|
|
|
|
|
- RuleAttrLinkVo linkVo,
|
|
|
|
|
- PtlAgreementUndwrtRulesAttr rulesAttr,
|
|
|
|
|
- StringBuilder logs) {
|
|
|
|
|
|
|
+ private boolean judgements(String value, RuleAttrLinkVo linkVo, PtlAgreementUndwrtRulesAttr rulesAttr, StringBuilder logs) {
|
|
|
|
|
|
|
|
boolean useFlag = attrEqual(value, linkVo, rulesAttr);
|
|
boolean useFlag = attrEqual(value, linkVo, rulesAttr);
|
|
|
return useFlag;
|
|
return useFlag;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- private boolean attrEqual(String value,RuleAttrLinkVo linkVo,PtlAgreementUndwrtRulesAttr rulesAttr) {
|
|
|
|
|
|
|
+ private boolean attrEqual(String value, RuleAttrLinkVo linkVo, PtlAgreementUndwrtRulesAttr rulesAttr) {
|
|
|
if (rulesAttr.getAttrType().equals(AttrTypeConstant.CHECKBOX.getCode())) {
|
|
if (rulesAttr.getAttrType().equals(AttrTypeConstant.CHECKBOX.getCode())) {
|
|
|
return checkBoxEqual(linkVo, value);
|
|
return checkBoxEqual(linkVo, value);
|
|
|
} else if (rulesAttr.getAttrType().equals(AttrTypeConstant.INPUTNUMBER.getCode())) {
|
|
} else if (rulesAttr.getAttrType().equals(AttrTypeConstant.INPUTNUMBER.getCode())) {
|
|
@@ -119,7 +110,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
return selectEqual(linkVo, value);
|
|
return selectEqual(linkVo, value);
|
|
|
} else if (rulesAttr.getAttrType().equals(AttrTypeConstant.RADIO.getCode())) {
|
|
} else if (rulesAttr.getAttrType().equals(AttrTypeConstant.RADIO.getCode())) {
|
|
|
return radioEqual(linkVo, value);
|
|
return radioEqual(linkVo, value);
|
|
|
- } else if (rulesAttr.getAttrType().equals(AttrTypeConstant.DATETIME.getCode())){
|
|
|
|
|
|
|
+ } else if (rulesAttr.getAttrType().equals(AttrTypeConstant.DATETIME.getCode())) {
|
|
|
return dateTimeEqual(linkVo, value);
|
|
return dateTimeEqual(linkVo, value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -131,11 +122,10 @@ public class RuleServiceImpl implements RuleService {
|
|
|
if (min == null || min.isEmpty()) {
|
|
if (min == null || min.isEmpty()) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- boolean contains = Arrays.stream(min.split(","))
|
|
|
|
|
- .anyMatch(sp -> sp.trim().equals(value.trim()));
|
|
|
|
|
|
|
+ boolean contains = Arrays.stream(min.split(",")).anyMatch(sp -> sp.trim().equals(value.trim()));
|
|
|
// "1"(EQ):在列表中匹配;"6"(NE):不在列表中匹配
|
|
// "1"(EQ):在列表中匹配;"6"(NE):不在列表中匹配
|
|
|
boolean isEqgate = OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator());
|
|
boolean isEqgate = OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator());
|
|
|
- return isEqgate ? contains : !contains;
|
|
|
|
|
|
|
+ return isEqgate == contains;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private boolean inputNumberEqual(RuleAttrLinkVo linkVo, String value) {
|
|
private boolean inputNumberEqual(RuleAttrLinkVo linkVo, String value) {
|
|
@@ -144,29 +134,17 @@ public class RuleServiceImpl implements RuleService {
|
|
|
double max = linkVo.getMax() != null ? Double.parseDouble(linkVo.getMax()) : Double.MAX_VALUE;
|
|
double max = linkVo.getMax() != null ? Double.parseDouble(linkVo.getMax()) : Double.MAX_VALUE;
|
|
|
//统一处理数值
|
|
//统一处理数值
|
|
|
if (OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator())) {
|
|
if (OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (min <= v && max >= v) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return min <= v && max >= v;
|
|
|
} else if (OperatorConstant.InputNumber.LT.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.InputNumber.LT.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (min > v) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return min > v;
|
|
|
} else if (OperatorConstant.InputNumber.LE.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.InputNumber.LE.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (min >= v) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return min >= v;
|
|
|
} else if (OperatorConstant.InputNumber.GT.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.InputNumber.GT.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (max < v) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return max < v;
|
|
|
} else if (OperatorConstant.InputNumber.GE.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.InputNumber.GE.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (max <= v) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return max <= v;
|
|
|
} else if (OperatorConstant.InputNumber.NE.getCode().equals(linkVo.getOperator())) {// 不包含:不在 [min, max] 区间内
|
|
} else if (OperatorConstant.InputNumber.NE.getCode().equals(linkVo.getOperator())) {// 不包含:不在 [min, max] 区间内
|
|
|
- if (min > v || max < v) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return min > v || max < v;
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -178,8 +156,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
String[] split = min.split(",");
|
|
String[] split = min.split(",");
|
|
|
- List<String> equalsMap = Arrays.asList(
|
|
|
|
|
- "CharacterBasedRating", "JqCharacterBasedRating", "SyCharacterBasedRating");
|
|
|
|
|
|
|
+ List<String> equalsMap = Arrays.asList("CharacterBasedRating", "JqCharacterBasedRating", "SyCharacterBasedRating");
|
|
|
boolean matched;
|
|
boolean matched;
|
|
|
if (equalsMap.contains(linkVo.getAttrCode())) {
|
|
if (equalsMap.contains(linkVo.getAttrCode())) {
|
|
|
matched = Arrays.stream(split).anyMatch(value::equals);
|
|
matched = Arrays.stream(split).anyMatch(value::equals);
|
|
@@ -187,7 +164,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
matched = Arrays.stream(split).anyMatch(value::contains);
|
|
matched = Arrays.stream(split).anyMatch(value::contains);
|
|
|
}
|
|
}
|
|
|
boolean isEqgate = OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator());
|
|
boolean isEqgate = OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator());
|
|
|
- return isEqgate ? matched : !matched;
|
|
|
|
|
|
|
+ return isEqgate == matched;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -198,7 +175,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
}
|
|
}
|
|
|
boolean contains = min.contains(value);
|
|
boolean contains = min.contains(value);
|
|
|
boolean isEqgate = OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator());
|
|
boolean isEqgate = OperatorConstant.InputNumber.EQ.getCode().equals(linkVo.getOperator());
|
|
|
- return isEqgate ? contains : !contains;
|
|
|
|
|
|
|
+ return isEqgate == contains;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private boolean radioEqual(RuleAttrLinkVo linkVo, String value) {
|
|
private boolean radioEqual(RuleAttrLinkVo linkVo, String value) {
|
|
@@ -206,9 +183,11 @@ public class RuleServiceImpl implements RuleService {
|
|
|
//判断如果value 是 boolean值 则将min进行转换为bool
|
|
//判断如果value 是 boolean值 则将min进行转换为bool
|
|
|
boolean minValue = Boolean.valueOf(linkVo.getMin());
|
|
boolean minValue = Boolean.valueOf(linkVo.getMin());
|
|
|
boolean valueBool = Boolean.valueOf(value);
|
|
boolean valueBool = Boolean.valueOf(value);
|
|
|
- if (linkVo.getMin().equals("5") || linkVo.getMin().equals("6")) {
|
|
|
|
|
- minValue = linkVo.getMin().equals("5") ? false : true;
|
|
|
|
|
- valueBool = value.equals("5") ? false : true;
|
|
|
|
|
|
|
+ if (linkVo.getMin() != null) {
|
|
|
|
|
+ if (linkVo.getMin().equals("5") || linkVo.getMin().equals("6")) {
|
|
|
|
|
+ minValue = !linkVo.getMin().equals("5");
|
|
|
|
|
+ valueBool = !value.equals("5");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if (linkVo.getOperator().equals(OperatorConstant.InputNumber.EQ.getCode())) {
|
|
if (linkVo.getOperator().equals(OperatorConstant.InputNumber.EQ.getCode())) {
|
|
|
return minValue == valueBool;
|
|
return minValue == valueBool;
|
|
@@ -216,48 +195,36 @@ public class RuleServiceImpl implements RuleService {
|
|
|
return !(minValue == valueBool);
|
|
return !(minValue == valueBool);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return linkVo.getOperator().equals(OperatorConstant.InputNumber.EQ.getCode()) ? linkVo.getMin().contains(value) : !linkVo.getMin().contains(value);
|
|
|
|
|
|
|
+ return linkVo.getOperator().equals(OperatorConstant.InputNumber.EQ.getCode()) == linkVo.getMin().contains(value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean dateTimeEqual(RuleAttrLinkVo linkVo, String value){
|
|
|
|
|
|
|
+ public boolean dateTimeEqual(RuleAttrLinkVo linkVo, String value) {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- if(Objects.isNull(value) || value.equals("")){
|
|
|
|
|
|
|
+ if (Objects.isNull(value) || value.equals("")) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- LocalDateTime v = LocalDateTime.parse(value,formatter);
|
|
|
|
|
- LocalDateTime min = null,max = null;
|
|
|
|
|
- if(!Objects.isNull(linkVo.getMin())){
|
|
|
|
|
- min = LocalDateTime.parse(linkVo.getMin(),formatter);
|
|
|
|
|
|
|
+ LocalDateTime v = LocalDateTime.parse(value, formatter);
|
|
|
|
|
+ LocalDateTime min = null, max = null;
|
|
|
|
|
+ if (!Objects.isNull(linkVo.getMin())) {
|
|
|
|
|
+ min = LocalDateTime.parse(linkVo.getMin(), formatter);
|
|
|
}
|
|
}
|
|
|
- if(!Objects.isNull(linkVo.getMax())){
|
|
|
|
|
- max = LocalDateTime.parse(linkVo.getMax(),formatter);
|
|
|
|
|
|
|
+ if (!Objects.isNull(linkVo.getMax())) {
|
|
|
|
|
+ max = LocalDateTime.parse(linkVo.getMax(), formatter);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//统一处理数值
|
|
//统一处理数值
|
|
|
if (OperatorConstant.DateTime.EQ.getCode().equals(linkVo.getOperator())) {
|
|
if (OperatorConstant.DateTime.EQ.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (v.isAfter(min) && v.isBefore(max)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return v.isAfter(min) && v.isBefore(max);
|
|
|
} else if (OperatorConstant.DateTime.LT.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.DateTime.LT.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (v.isBefore(min)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return v.isBefore(min);
|
|
|
} else if (OperatorConstant.DateTime.LE.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.DateTime.LE.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (v.isBefore(min) || v.isEqual(min)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return v.isBefore(min) || v.isEqual(min);
|
|
|
} else if (OperatorConstant.DateTime.GT.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.DateTime.GT.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (v.isAfter(max)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return v.isAfter(max);
|
|
|
} else if (OperatorConstant.DateTime.GE.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.DateTime.GE.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (v.isAfter(max) || v.isEqual(max)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return v.isAfter(max) || v.isEqual(max);
|
|
|
} else if (OperatorConstant.DateTime.NE.getCode().equals(linkVo.getOperator())) {
|
|
} else if (OperatorConstant.DateTime.NE.getCode().equals(linkVo.getOperator())) {
|
|
|
- if (!(v.isAfter(min) && v.isBefore(max))) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return !(v.isAfter(min) && v.isBefore(max));
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -266,7 +233,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
//region 表单转换成json对象
|
|
//region 表单转换成json对象
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void traverseJsonObject(JSONObject jsonObject, HashMap<String,String> attrMap) {
|
|
|
|
|
|
|
+ public void traverseJsonObject(JSONObject jsonObject, HashMap<String, String> attrMap) {
|
|
|
if (Objects.isNull(jsonObject)) {
|
|
if (Objects.isNull(jsonObject)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -275,24 +242,23 @@ public class RuleServiceImpl implements RuleService {
|
|
|
String key = entry.getKey();
|
|
String key = entry.getKey();
|
|
|
Object value = entry.getValue();
|
|
Object value = entry.getValue();
|
|
|
|
|
|
|
|
- if(!(value instanceof JSONObject) && !(value instanceof JSONArray)){
|
|
|
|
|
- attrMap.put(key.toLowerCase(),value.toString());
|
|
|
|
|
|
|
+ if (!(value instanceof JSONObject) && !(value instanceof JSONArray)) {
|
|
|
|
|
+ attrMap.put(key.toLowerCase(), value.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 如果值是嵌套的 JSONObject,递归遍历
|
|
// 如果值是嵌套的 JSONObject,递归遍历
|
|
|
if (value instanceof JSONObject) {
|
|
if (value instanceof JSONObject) {
|
|
|
- if(isUserKey(key))
|
|
|
|
|
- {
|
|
|
|
|
- traverseJsonObject((JSONObject) value,attrMap,key);
|
|
|
|
|
- }else{
|
|
|
|
|
- traverseJsonObject((JSONObject) value,attrMap);
|
|
|
|
|
|
|
+ if (isUserKey(key)) {
|
|
|
|
|
+ traverseJsonObject((JSONObject) value, attrMap, key);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ traverseJsonObject((JSONObject) value, attrMap);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 如果值是嵌套的数组(JSONArray),遍历数组
|
|
// 如果值是嵌套的数组(JSONArray),遍历数组
|
|
|
if (value instanceof JSONArray) {
|
|
if (value instanceof JSONArray) {
|
|
|
System.out.println("Nested JSONArray for key: " + key);
|
|
System.out.println("Nested JSONArray for key: " + key);
|
|
|
- traverseJsonArray((JSONArray) value,attrMap);
|
|
|
|
|
|
|
+ traverseJsonArray((JSONArray) value, attrMap);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -304,11 +270,12 @@ public class RuleServiceImpl implements RuleService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 处理车主 投保人 被保人信息
|
|
* 处理车主 投保人 被保人信息
|
|
|
|
|
+ *
|
|
|
* @param jsonObject
|
|
* @param jsonObject
|
|
|
* @param attrMap
|
|
* @param attrMap
|
|
|
* @param parentKey
|
|
* @param parentKey
|
|
|
*/
|
|
*/
|
|
|
- public void traverseJsonObject(JSONObject jsonObject,HashMap<String,String> attrMap,String parentKey) {
|
|
|
|
|
|
|
+ public void traverseJsonObject(JSONObject jsonObject, HashMap<String, String> attrMap, String parentKey) {
|
|
|
if (Objects.isNull(jsonObject)) {
|
|
if (Objects.isNull(jsonObject)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -316,13 +283,13 @@ public class RuleServiceImpl implements RuleService {
|
|
|
String key = entry.getKey();
|
|
String key = entry.getKey();
|
|
|
Object value = entry.getValue();
|
|
Object value = entry.getValue();
|
|
|
|
|
|
|
|
- if(!(value instanceof JSONObject) && !(value instanceof JSONArray)){
|
|
|
|
|
- attrMap.put(parentKey.toLowerCase() + key.toLowerCase(),value.toString());
|
|
|
|
|
|
|
+ if (!(value instanceof JSONObject) && !(value instanceof JSONArray)) {
|
|
|
|
|
+ attrMap.put(parentKey.toLowerCase() + key.toLowerCase(), value.toString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void traverseJsonArray(JSONArray jsonArray,HashMap<String,String> attrMap) {
|
|
|
|
|
|
|
+ public void traverseJsonArray(JSONArray jsonArray, HashMap<String, String> attrMap) {
|
|
|
if (jsonArray == null) {
|
|
if (jsonArray == null) {
|
|
|
System.out.println("JSONArray is null.");
|
|
System.out.println("JSONArray is null.");
|
|
|
return;
|
|
return;
|
|
@@ -338,37 +305,34 @@ public class RuleServiceImpl implements RuleService {
|
|
|
// 如果元素是嵌套的 JSONObject,递归遍历
|
|
// 如果元素是嵌套的 JSONObject,递归遍历
|
|
|
if (element instanceof JSONObject) {
|
|
if (element instanceof JSONObject) {
|
|
|
System.out.println("Nested JSONObject in array at index: " + i);
|
|
System.out.println("Nested JSONObject in array at index: " + i);
|
|
|
- traverseJsonObject((JSONObject) element,attrMap);
|
|
|
|
|
|
|
+ traverseJsonObject((JSONObject) element, attrMap);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 如果元素是嵌套的数组(JSONArray),递归遍历
|
|
// 如果元素是嵌套的数组(JSONArray),递归遍历
|
|
|
if (element instanceof JSONArray) {
|
|
if (element instanceof JSONArray) {
|
|
|
System.out.println("Nested JSONArray in array at index: " + i);
|
|
System.out.println("Nested JSONArray in array at index: " + i);
|
|
|
- traverseJsonArray((JSONArray) element,attrMap);
|
|
|
|
|
|
|
+ traverseJsonArray((JSONArray) element, attrMap);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//判断是否是车主 投保人 被保人信息
|
|
//判断是否是车主 投保人 被保人信息
|
|
|
- public boolean isUserKey(String key){
|
|
|
|
|
- if(key.equals("ownersInfo") || key.equals("policyHolderInfo") || key.equals("insuredPersonInfo")){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ public boolean isUserKey(String key) {
|
|
|
|
|
+ return key.equals("ownersInfo") || key.equals("policyHolderInfo") || key.equals("insuredPersonInfo");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Map<String, List<RuleAttrLinkVo>> convertSchemeRule(Map<String, List<PtlSchemeRulesAttrLink>> schemeRules){
|
|
|
|
|
|
|
+ public Map<String, List<RuleAttrLinkVo>> convertSchemeRule(Map<String, List<PtlSchemeRulesAttrLink>> schemeRules) {
|
|
|
Map<String, List<RuleAttrLinkVo>> convertMaps = new HashMap<>();
|
|
Map<String, List<RuleAttrLinkVo>> convertMaps = new HashMap<>();
|
|
|
for (Map.Entry<String, List<PtlSchemeRulesAttrLink>> entry : schemeRules.entrySet()) {
|
|
for (Map.Entry<String, List<PtlSchemeRulesAttrLink>> entry : schemeRules.entrySet()) {
|
|
|
String key = entry.getKey();
|
|
String key = entry.getKey();
|
|
|
List<RuleAttrLinkVo> vos = new ArrayList<>();
|
|
List<RuleAttrLinkVo> vos = new ArrayList<>();
|
|
|
List<PtlSchemeRulesAttrLink> values = entry.getValue();
|
|
List<PtlSchemeRulesAttrLink> values = entry.getValue();
|
|
|
|
|
|
|
|
- values.forEach(value->{
|
|
|
|
|
|
|
+ values.forEach(value -> {
|
|
|
RuleAttrLinkVo vo = new RuleAttrLinkVo();
|
|
RuleAttrLinkVo vo = new RuleAttrLinkVo();
|
|
|
vo.setMin(value.getMin());
|
|
vo.setMin(value.getMin());
|
|
|
vo.setMax(value.getMax());
|
|
vo.setMax(value.getMax());
|
|
@@ -377,7 +341,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
vo.setMinArray(value.getMinArray().toArray(new String[0]));
|
|
vo.setMinArray(value.getMinArray().toArray(new String[0]));
|
|
|
vos.add(vo);
|
|
vos.add(vo);
|
|
|
});
|
|
});
|
|
|
- convertMaps.put(key,vos);
|
|
|
|
|
|
|
+ convertMaps.put(key, vos);
|
|
|
}
|
|
}
|
|
|
return convertMaps;
|
|
return convertMaps;
|
|
|
}
|
|
}
|
|
@@ -390,7 +354,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
List<RuleAttrLinkVo> vos = new ArrayList<>();
|
|
List<RuleAttrLinkVo> vos = new ArrayList<>();
|
|
|
List<PtlAgreementDispatchRulesAttrLink> values = entry.getValue();
|
|
List<PtlAgreementDispatchRulesAttrLink> values = entry.getValue();
|
|
|
|
|
|
|
|
- values.forEach(value->{
|
|
|
|
|
|
|
+ values.forEach(value -> {
|
|
|
RuleAttrLinkVo vo = new RuleAttrLinkVo();
|
|
RuleAttrLinkVo vo = new RuleAttrLinkVo();
|
|
|
vo.setMin(value.getMin());
|
|
vo.setMin(value.getMin());
|
|
|
vo.setMax(value.getMax());
|
|
vo.setMax(value.getMax());
|
|
@@ -399,7 +363,7 @@ public class RuleServiceImpl implements RuleService {
|
|
|
vo.setMinArray(value.getMinArray().toArray(new String[0]));
|
|
vo.setMinArray(value.getMinArray().toArray(new String[0]));
|
|
|
vos.add(vo);
|
|
vos.add(vo);
|
|
|
});
|
|
});
|
|
|
- convertMaps.put(key,vos);
|
|
|
|
|
|
|
+ convertMaps.put(key, vos);
|
|
|
}
|
|
}
|
|
|
return convertMaps;
|
|
return convertMaps;
|
|
|
}
|
|
}
|