소스 검색

费用因子 字符型评分判断修改 费用因子 过滤 车辆种类 使用性质 能源类型 增加

785834757 1 년 전
부모
커밋
d550f67256
1개의 변경된 파일66개의 추가작업 그리고 6개의 파일을 삭제
  1. 66 6
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

+ 66 - 6
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -2,6 +2,8 @@ package com.ydtech.modules.fee.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.constants.enums.dict.insurance.EnergyType;
+import com.ydtech.constants.enums.dict.insurance.NatureOfVehicleUse;
+import com.ydtech.constants.enums.dict.insurance.VehicleType;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.service.SysSwitchConfigService;
@@ -22,6 +24,7 @@ import com.ydtech.modules.fee.service.InsFeeOrderConfigService;
 import com.ydtech.modules.fee.service.InsFeeOrderNewHistoryService;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeResultVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeVo;
@@ -33,7 +36,6 @@ import com.ydtech.modules.protocol.service.PtlNewCarJudgeRulesService;
 import com.ydtech.modules.protocols.entity.po.*;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCosts;
 import com.ydtech.modules.protocols.service.*;
-import com.ydtech.utils.BigDecimalUtils;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -127,8 +129,50 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
     @Override
     public void verificationCostFactor(InsAreaCompany insAreaCompany, InsOrders insOrders, StringBuilder logs) {
 
-        List<AgreementProductCosts> agreementProductCosts =
+        List<AgreementProductCosts> agreementProductCostsNoMatched =
                 ptlAgreementProductCostsNewService.costsGetList(insAreaCompany.getAgreementId(), insAreaCompany.getProductid());
+
+        List<AgreementProductCosts> agreementProductCosts = new ArrayList<>();
+
+        //过滤费用因子  根据使用性质,能源种类,车辆种类过滤
+        agreementProductCostsNoMatched.forEach(item->{
+            AtomicBoolean matching = new AtomicBoolean(true);
+            item.getCostsAttrLinks().forEach(attr->{
+                //判断能源类型  燃油 新能源
+                if(attr.getAttrCode().equals("NewEnergy")){
+                    //传入的能源类型
+                    String energyType = EnergyType.isNewEnergy(insOrders.getCarinfo().getString("energyType")) ? "1" : "0";
+                    if(!attr.getMin().equals(energyType)) {
+                        matching.set(false);
+                    }
+                }
+
+                //使用性质 营业  非营业
+                if(attr.getAttrCode().equals("NatureOfUse")){
+                    String[] split = attr.getMin().split(",");
+                    boolean isPipei = false;
+                    for(int i=0;i<split.length;i++){
+                        if(split[i].equals(TypeVehicleMapping.getByCode(insOrders.getCarinfo().getString("vehicleUse")))){
+                            isPipei = true;
+                        }
+                    }
+                    if(!isPipei){
+                        matching.set(false);
+                    }
+                }
+
+                //车辆种类  客车 货车
+                if(attr.getAttrCode().equals("CarType")){
+                    if(!attr.getMin().contains(VehicleType.getByCode(insOrders.getCarinfo().getString("cimodelclass")))){
+                        matching.set(false);
+                    }
+                }
+            });
+            if(matching.get()){
+                agreementProductCosts.add(item);
+            }
+        });
+
 //        if(agreementProductCosts == null || agreementProductCosts.size() == 0){
 //            throw new SystemException("协议费用因子为空");
 //        }
@@ -2843,10 +2887,26 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         //将值进行分割
         String[] split = ptlAgreementProductCostsAttrLink.getMin().split(",");
         AtomicBoolean returnBool = new AtomicBoolean(false);
-        if(ptlAgreementProductCostsAttrLink.getAttrCode().equals("BrandandModel") && ptlAgreementProductCostsAttrLink.getOperator().equals("2")){
-                boolean anyMatch = Arrays.stream(split)
-                        .anyMatch(value::contains);
-                returnBool.set(!anyMatch);
+
+        List<String> equalsMap = new ArrayList<>();
+        //字符型评分
+        equalsMap.add("CharacterBasedRating");
+        //交强字符型评分
+        equalsMap.add("JqCharacterBasedRating");
+        //商业字符型评分
+        equalsMap.add("SyCharacterBasedRating");
+
+
+
+        //equest 等于判断
+        if(equalsMap.contains(ptlAgreementProductCostsAttrLink.getAttrCode())){
+            boolean b = Arrays.stream(split).anyMatch(value::equals);
+            returnBool.set(b);
+        }else if(ptlAgreementProductCostsAttrLink.getAttrCode().equals("BrandandModel") && ptlAgreementProductCostsAttrLink.getOperator().equals("2")){
+            //处理品牌型号  不包含的情况
+            boolean anyMatch = Arrays.stream(split)
+                    .anyMatch(value::contains);
+            returnBool.set(!anyMatch);
         }else {
             boolean anyMatch = Arrays.stream(split)
                     .anyMatch(value::contains);