|
|
@@ -28,10 +28,12 @@ import com.ydtech.modules.protocol.entity.po.*;
|
|
|
import com.ydtech.modules.protocol.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
+import org.joda.time.DateTime;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
@@ -92,7 +94,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
//按规则拼接跟单信息
|
|
|
String matchKeyStr=getMatchKeyWithInsuranceInfo(feeSchemeReqDto);
|
|
|
//循环进行各项因子校验
|
|
|
- boolean checkFlag=checkFactorValidWithInsuranceInfo(matchKeyStr,factorToBeVerified);
|
|
|
+ boolean checkFlag=checkFactorValidWithInsuranceInfo(matchKeyStr,factorToBeVerified,factorCost.getProductId());
|
|
|
//如果该方案所有因子都校验通过,则放入符合校验方案列表
|
|
|
if(checkFlag){
|
|
|
validSchemeList.add(factorCost);
|
|
|
@@ -220,8 +222,9 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
* @param factorToBeVerified
|
|
|
* @return
|
|
|
*/
|
|
|
- private boolean checkFactorValidWithInsuranceInfo(String matchKeyStr, Map<Integer, FeeFactorInfoDto> factorToBeVerified) {
|
|
|
+ private boolean checkFactorValidWithInsuranceInfo(String matchKeyStr, Map<Integer, FeeFactorInfoDto> factorToBeVerified,String productId) {
|
|
|
boolean result=false; //默认没有匹配到
|
|
|
+ boolean isConfigFactor=false;//是否配置了因子校验项 默认否
|
|
|
String[] matchKeys= matchKeyStr.split(",");
|
|
|
//循环待校验因子列表
|
|
|
for(Map.Entry<Integer,FeeFactorInfoDto> entry : factorToBeVerified.entrySet()){
|
|
|
@@ -236,6 +239,8 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
//先看该方案是否需要匹配该因子,不需要则跳过本条因子
|
|
|
if(!checkFactorInfo.isNeedMatch()){
|
|
|
continue;
|
|
|
+ }else {
|
|
|
+ isConfigFactor=true;//不跳过因子时,则有配置的因子项
|
|
|
}
|
|
|
//下面处理需要进行匹配的因子
|
|
|
if("1".equals(checkFactorInfo.getMatchType())){//1.单字符串匹配(相等)
|
|
|
@@ -466,6 +471,12 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(productId!=null&&"039999".equals(productId)){
|
|
|
+ if(!isConfigFactor){//如果是兜底配置 且 没有配置因子项时,则认为匹配到
|
|
|
+ result=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -997,9 +1008,29 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
}
|
|
|
feeSchemeReqDto.setIsTransfer(isTransfer);//是否过户 1是 0否"
|
|
|
|
|
|
- //新旧车判断逻辑,初登日期小于当前日期加9个月
|
|
|
+ //新旧车判断逻辑,初登日期小于起保日期加9个月
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
+ //有交强日期时取交强,没有交强时取商业
|
|
|
+ if(StringUtils.isNotEmpty(quoteRespVo.getStartDateJq())){
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date startDate=sdf.parse(quoteRespVo.getStartDateJq());
|
|
|
+ String jqStartDate = sdf.format(startDate);
|
|
|
+ currentDate=LocalDate.parse(jqStartDate, formatter);
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(StringUtils.isNotEmpty(quoteRespVo.getStartDateSy())){
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date startDate=sdf.parse(quoteRespVo.getStartDateSy());
|
|
|
+ String jqStartDate = sdf.format(startDate);
|
|
|
+ currentDate=LocalDate.parse(jqStartDate, formatter);
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
if(StringUtils.isNotEmpty(carInfoVo.getRegisterDate())){
|
|
|
LocalDate registerDate = LocalDate.parse(carInfoVo.getRegisterDate(), formatter).plusMonths(9);
|
|
|
if(currentDate.isBefore(registerDate)){
|
|
|
@@ -1758,7 +1789,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
|
|
|
//按规则拼接跟单信息
|
|
|
String matchKeyStr=getMatchKeyWithInsuranceInfoForRules(feeSchemeReqDto);
|
|
|
//循环进行各项因子校验
|
|
|
- boolean checkFlag=checkFactorValidWithInsuranceInfo(matchKeyStr,factorToBeVerified);
|
|
|
+ boolean checkFlag=checkFactorValidWithInsuranceInfo(matchKeyStr,factorToBeVerified,"");
|
|
|
//如果该方案所有因子都校验通过,则放入符合校验方案列表
|
|
|
if(checkFlag){
|
|
|
//validSchemeList.add(undwrtRules);
|