Просмотр исходного кода

费用匹配关联新车判断规则

cuixinpeng 2 лет назад
Родитель
Сommit
84a82d0733

+ 32 - 3
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.fee.dto.FeeFactorInfoDto;
 import com.ydtech.modules.fee.dto.FeeSchemeReqDto;
 import com.ydtech.modules.fee.dto.FeeSchemeResDto;
 import com.ydtech.modules.fee.service.FeeRuleSchemeService;
+import com.ydtech.modules.ins.model.vo.AccidentResponseVo;
 import com.ydtech.modules.ins.model.vo.CarInfoVo;
 import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.ins.model.vo.QuoteRespVo;
@@ -27,9 +28,13 @@ import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsFeeOrderService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementProductCosts;
+import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlAgreementProductCostsService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocol.service.PtlNewCarJudgeRulesService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
 import org.springframework.stereotype.Service;
@@ -64,7 +69,10 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     private InsAreaCompanyService insAreaCompanyService;
     @Resource
     private PtlAgreementService ptlAgreementService;
-
+    @Resource
+    private PtlNewCarJudgeRulesService ptlNewCarJudgeRulesService;
+    @Resource
+    private PtlAgreementAttributionService ptlAgreementAttributionService;
 
     /**
      * 根据跟单信息,以及配置的费用因子,获取合适的跟单费用
@@ -921,6 +929,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     //----------------------------------------------分割线
 
     public FeeSchemeReqDto getFeeSchemeInfo(BaseQuoteInfoVo quoteInfoVo, QuoteRespVo quoteRespVo, String agreementId, String productId){
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(agreementId);
         CarInfoVo carInfoVo = quoteInfoVo.getCarInfo();
         List<KindInfoVo> kindList = quoteInfoVo.getKindList();
         String thirdPartyInsurance = "";
@@ -974,14 +983,29 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         feeSchemeReqDto.setIsTransfer(isTransfer);//是否过户    1是  0否"
 
         //新旧车判断逻辑,初登日期小于当前日期加9个月
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate currentDate = LocalDate.now();
         if(StringUtils.isNotEmpty(carInfoVo.getRegisterDate())){
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
             LocalDate registerDate = LocalDate.parse(carInfoVo.getRegisterDate(), formatter).plusMonths(9);
-            LocalDate currentDate = LocalDate.now();
             if(currentDate.isBefore(registerDate)){
                 isNewCar = "1";
             }
         }
+        List<PtlNewCarJudgeRules> ptlNewCarJudgeRulesList = ptlNewCarJudgeRulesService.getByCompanyId(ptlAgreementAttribution.getInsCompanyId());
+        if(ptlNewCarJudgeRulesList!=null &&ptlNewCarJudgeRulesList.size()>0){
+            PtlNewCarJudgeRules ptlNewCarJudgeRules = ptlNewCarJudgeRulesList.get(0);
+            if("月".equals(ptlNewCarJudgeRules.getUnitTypeCode())){
+                LocalDate registerDate = LocalDate.parse(carInfoVo.getRegisterDate(), formatter).plusMonths(Integer.parseInt(ptlNewCarJudgeRules.getUnitTypeValue()));
+                if(currentDate.isBefore(registerDate)){
+                    isNewCar = "1";
+                }
+            }else{
+                LocalDate registerDate = LocalDate.parse(carInfoVo.getRegisterDate(), formatter).plusDays(Integer.parseInt(ptlNewCarJudgeRules.getUnitTypeValue()));
+                if(currentDate.isBefore(registerDate)){
+                    isNewCar = "1";
+                }
+            }
+        }
         feeSchemeReqDto.setIsNewCar(isNewCar);//是否新车    1是  0否
         if("1".equals(carInfoVo.getPowertype())||"2".equals(carInfoVo.getPowertype())||"3".equals(carInfoVo.getPowertype())){
             isNewEnergy = "1";
@@ -1029,6 +1053,11 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         BigDecimal jqNoTaxPremium = new BigDecimal(0);
         BigDecimal syNoTaxPremium = new BigDecimal(0);
         InsOrders insOrders = insOrdersService.getById(quoteRespVo.getOrderno());
+        List<AccidentResponseVo> accidentList = quoteRespVo.getAccident();
+        /*BigDecimal accidentActualPremium = new BigDecimal(0);
+        for(AccidentResponseVo accidentResponseVo: accidentList){
+            accidentActualPremium = new BigDecimal(accidentResponseVo.getActualPremium());
+        }*/
         FeeSchemeReqDto feeSchemeReqDto = this.getFeeSchemeInfo(quoteInfoVo,quoteRespVo,agreementId,insOrders.getProductid());
         FeeSchemeResDto feeSchemeResDto = this.matchTheAppropriateFees(feeSchemeReqDto);
         InsFeeOrder insFeeOrder = new InsFeeOrder(feeSchemeReqDto,feeSchemeResDto,businessNo);

+ 2 - 1
src/main/java/com/ydtech/modules/protocol/controller/PtlNewCarJudgeRulesController.java

@@ -56,7 +56,8 @@ public class PtlNewCarJudgeRulesController {
     @GetMapping("/getByCompanyId/{companyId}")
     @ApiOperation("通过保险公司编号查询新车判断规则")
     public HttpResult<List<PtlNewCarJudgeRules>> getByCompanyId(@PathVariable String companyId) {
-        return ptlNewCarJudgeRulesService.getByCompanyId(companyId);
+        List<PtlNewCarJudgeRules> ptlNewCarJudgeRulesList = ptlNewCarJudgeRulesService.getByCompanyId(companyId);
+        return HttpResult.ok(ptlNewCarJudgeRulesList);
     }
 
 }

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/service/PtlNewCarJudgeRulesService.java

@@ -62,6 +62,6 @@ public interface PtlNewCarJudgeRulesService extends IService<PtlNewCarJudgeRules
      * @param companyId 保险公司编号
      * @return List<PtlNonCarInsuranceProduct>
      */
-    HttpResult<List<PtlNewCarJudgeRules>> getByCompanyId(String companyId);
+    List<PtlNewCarJudgeRules> getByCompanyId(String companyId);
 
 }

+ 3 - 3
src/main/java/com/ydtech/modules/protocol/service/impl/PtlNewCarJudgeRulesServiceImpl.java

@@ -74,15 +74,15 @@ public class PtlNewCarJudgeRulesServiceImpl extends ServiceImpl<PtlNewCarJudgeRu
     }
 
     @Override
-    public HttpResult<List<PtlNewCarJudgeRules>> getByCompanyId(String companyId) {
+    public List<PtlNewCarJudgeRules> getByCompanyId(String companyId) {
         String code = "000000";
         String substring = companyId.substring(0, 5);
         String s = substring + code;
         List<PtlNewCarJudgeRules> list = lambdaQuery().eq(PtlNewCarJudgeRules::getCompanyId, s).list();
         if (list != null && !list.isEmpty()) {
-            return HttpResult.ok(list);
+            return list;
         }
-        return HttpResult.ok(Collections.emptyList());
+        return Collections.emptyList();
     }
 
     @Override