Browse Source

fix 完善大地保险的核保

liub 3 tháng trước cách đây
mục cha
commit
51326e7e4a

+ 10 - 2
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/build/DaDiCrawlerQuoteResultVoBuild.java

@@ -105,8 +105,16 @@ public class DaDiCrawlerQuoteResultVoBuild {
         int sumPayment = daDiQuoteResponse.getInsurancePlan().getTax().getSumPayment();
         quoteResultsVo.getCosts().setVvTax(String.valueOf(sumPayment));
         //设置非车保费
-        int niPremium = daDiQuoteResponse.getInsurancePlan().getBusinessDuePremium();
-        quoteResultsVo.getCosts().setNiPremium(String.valueOf(niPremium));
+        if (!daDiQuoteResponse.getInsurancePlan().getAccidentInsure().isEmpty()) {
+            int niPremium = daDiQuoteResponse.getInsurancePlan().getAccidentInsure().get(0).getWealthAccPremium();
+            quoteResultsVo.getCosts().setNiPremium(String.valueOf(niPremium));
+        }else if (!daDiQuoteResponse.getInsurancePlan().getHealthInsurance().isEmpty()) {
+            int niPremium = daDiQuoteResponse.getInsurancePlan().getHealthInsurance().get(0).getWealthAccPremium();
+            quoteResultsVo.getCosts().setNiPremium(String.valueOf(niPremium));
+        }else  if (!daDiQuoteResponse.getInsurancePlan().getPropertyInsurance().isEmpty()) {
+            int niPremium = daDiQuoteResponse.getInsurancePlan().getHealthInsurance().get(0).getWealthAccPremium();
+            quoteResultsVo.getCosts().setNiPremium(String.valueOf(niPremium));
+        }
 
         //总保费
         int sumPremium = trafficDuePremium + businessDuePremium + sumPayment;

+ 2 - 1
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/component/DaDiCrawlerRequestComponent.java

@@ -3,6 +3,7 @@ package com.jzg.quotation.dadi.crawler.component;
 import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.jzg.commons.entity.po.SysUploadFiles;
 import com.jzg.commons.entity.quote.vo.AttributionInformationVo;
@@ -440,7 +441,7 @@ public class DaDiCrawlerRequestComponent {
         String url = RequestUrl.CALCULATION_PREMIUM.getRequestUrl(daDiCrawlerProperties.getBaseUrl());
 
         DaDiQuoteRequest daDiQuoteRequest = new DaDiQuoteRequest(quoteVo, orderId, checks, daDiVehicleChannelRequest.getComCode(), daDiInsurancePlanRequest, carModelRequest, daDiVehicleChannelRequest);
-        String requestBody = DaDiAESUtils.encryptStr(JSON.toJSONString(daDiQuoteRequest));
+        String requestBody = DaDiAESUtils.encryptStr(JSON.toJSONString(daDiQuoteRequest, SerializerFeature.DisableCircularReferenceDetect));
         String responseBody = networkRequest.doPost(url, requestBody, headers);
         log.info("\n----------------------> 获取报价信息请求成功, \n----------------------> 响应结果:[{}],", responseBody);
         DaDiBaseResponse daDiBaseResponse = JSONObject.parseObject(responseBody, DaDiBaseResponse.class);

+ 18 - 28
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiInsurancePlanRequest.java

@@ -259,17 +259,17 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
     /**
      * 意外险投保信息(可为空)
      */
-    private List<DaDiJointSalesResponse.InsuranceDTO> accidentInsure;
+    private List<DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO> accidentInsure = new ArrayList<>();
 
     /**
      * 健康险投保信息(可为空)
      */
-    private List<DaDiJointSalesResponse.InsuranceDTO> healthInsure;
+    private List<DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO> healthInsure = new ArrayList<>();
 
     /**
      * 财产险投保信息(可为空)
      */
-    private List<DaDiJointSalesResponse.InsuranceDTO> propertyInsure;
+    private List<DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO> propertyInsure = new ArrayList<>();
 
     /**
      * 总保费
@@ -279,17 +279,17 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
     /**
      * 意外险方案
      */
-    private List<DaDiJointSalesResponse.InsuranceDTO> accidentInsurance;
+    private List<DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO> accidentInsurance = new ArrayList<>();
 
     /**
      * 健康险方案
      */
-    private List<DaDiJointSalesResponse.InsuranceDTO> healthInsurance;
+    private List<DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO> healthInsurance = new ArrayList<>();
 
     /**
      * 财产险方案
      */
-    private List<DaDiJointSalesResponse.InsuranceDTO> propertyInsurance;
+    private List<DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO> propertyInsurance = new ArrayList<>();
 
     /**
      * 再保险项
@@ -454,41 +454,31 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
                 this.wealthAccSeatCount = quoteVo.getCarInfoVo().getSeatCount();
             }
 
-            DaDiJointSalesResponse.InsuranceDTO insuranceListDTO;
-            // 按产品分类拆分到意外险/健康险/财产险
-            List<DaDiJointSalesResponse.InsuranceDTO> accidentList = new ArrayList<>();
-            List<DaDiJointSalesResponse.InsuranceDTO> healthList = new ArrayList<>();
-            List<DaDiJointSalesResponse.InsuranceDTO> propertyList = new ArrayList<>();
-
-
             for (AccidentalDrivingVo accidentalDriving : accidentalDrivings) {
                 for (Map.Entry<String, List<DaDiJointSalesResponse.InsuranceDTO>> stringListEntry : jointSales.toMap().entrySet()) {
                     for (DaDiJointSalesResponse.InsuranceDTO insuranceDTO : stringListEntry.getValue()) {
-                        if (accidentalDriving.getProductCode().equals(insuranceDTO.getFormulaGroupCode())) {
-                            if (accidentalDriving.getProductCode().equals(insuranceDTO.getFormulaGroupCode())) {
-                                insuranceListDTO = insuranceDTO;
-                                insuranceListDTO.setFormulaGroupCode(insuranceDTO.getFormulaGroupCode());
-                                insuranceListDTO.setFormulaGroupName(insuranceDTO.getFormulaGroupName());
-                                insuranceListDTO.setIsNingdeEraVehicleBatteryCheck(insuranceDTO.getIsNingdeEraVehicleBatteryCheck());
+                        for (DaDiJointSalesResponse.InsuranceDTO.JointSalesSolutionVOSDTO jointSalesSolutionVO : insuranceDTO.getJointSalesSolutionVOS()) {
+                            if (accidentalDriving.getProductCode().equals(jointSalesSolutionVO.getFormulaCode())) {
+                                jointSalesSolutionVO.setFormulaGroupCode(insuranceDTO.getFormulaGroupCode());
+                                jointSalesSolutionVO.setFormulaGroupName(insuranceDTO.getFormulaGroupName());
+                                jointSalesSolutionVO.setIsNingdeEraVehicleBatteryCheck(insuranceDTO.getIsNingdeEraVehicleBatteryCheck());
                                 if (stringListEntry.getKey().equals("accidentInsurance")) {
-                                    accidentList.add(insuranceListDTO);
+                                    accidentInsurance.add(jointSalesSolutionVO);
+                                    accidentInsure.add(jointSalesSolutionVO);
                                 } else if (stringListEntry.getKey().equals("healthInsurance")) {
-                                    healthList.add(insuranceListDTO);
+                                    healthInsurance.add(jointSalesSolutionVO);
+                                    healthInsure.add(jointSalesSolutionVO);
                                 } else if (stringListEntry.getKey().equals("propertyInsurance")) {
-                                    propertyList.add(insuranceListDTO);
+                                    propertyInsurance.add(jointSalesSolutionVO);
+                                    propertyInsure.add(jointSalesSolutionVO);
                                 }
+                                break;
                             }
                         }
                     }
                 }
             }
 
-            this.accidentInsurance = accidentList;
-            this.healthInsurance = healthList;
-            this.propertyInsurance = propertyList;
-            this.accidentInsure = accidentList.isEmpty() ? null : accidentList;
-            this.healthInsure = healthList.isEmpty() ? null : healthList;
-            this.propertyInsure = propertyList.isEmpty() ? null : propertyList;
         } else {
             this.wealthAccChecked = "0";
             this.accidentInsurance = new ArrayList<>();

+ 1 - 1
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiQuoteRequest.java

@@ -129,7 +129,7 @@ public class DaDiQuoteRequest extends DaDiBaseRequest {
     /**
      * 投保方案
      */
-    private Object insurancePlan;
+    private DaDiInsurancePlanRequest insurancePlan;
 
     /**
      * 车主信息

+ 4 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiJointSalesResponse.java

@@ -57,10 +57,14 @@ public class DaDiJointSalesResponse extends DaDiBaseResponse{
             private String formulaCode;
             @SerializedName("scene")
             private String scene;
+            @SerializedName("isNingdeEraVehicleBatteryCheck")
+            private String isNingdeEraVehicleBatteryCheck;
             @SerializedName("customElement")
             private String customElement;
             @SerializedName("formulaName")
             private String formulaName;
+            @SerializedName("formulaGroupCode")
+            private String formulaGroupCode;
             @SerializedName("formulaGroupName")
             private String formulaGroupName;
             @SerializedName("productCode")

+ 63 - 1
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/response/DaDiQuoteResponse.java

@@ -140,8 +140,13 @@ public class DaDiQuoteResponse extends DaDiBaseResponse {
         private String trafficProductCode;
         @SerializedName("accidentInsurance")
         private String accidentInsurance;
+        @SerializedName("accidentInsure")
+        private List<AccidentInsureDTO> accidentInsure;
         @SerializedName("healthInsurance")
-        private String healthInsurance;
+        private List<AccidentInsureDTO> healthInsurance;
+        @SerializedName("propertyInsurance")
+        private List<AccidentInsureDTO> propertyInsurance;
+
 
         @NoArgsConstructor
         @Data
@@ -183,6 +188,63 @@ public class DaDiQuoteResponse extends DaDiBaseResponse {
             }
 
         }
+
+        @NoArgsConstructor
+        @Data
+        public static class AccidentInsureDTO {
+            @SerializedName("forms")
+            private List<FormsDTO> forms;
+            @SerializedName("isShowInsured")
+            private String isShowInsured;
+            @SerializedName("jointSalesSolutionItems")
+            private List<JointSalesSolutionItemsDTO> jointSalesSolutionItems;
+            @SerializedName("policyNature")
+            private String policyNature;
+            @SerializedName("wealthAccPremium")
+            private int wealthAccPremium;
+
+            @NoArgsConstructor
+            @Data
+            public static class FormsDTO {
+                @SerializedName("customformcontent")
+                private String customformcontent;
+                @SerializedName("customformtitle")
+                private String customformtitle;
+                @SerializedName("formcategory")
+                private String formcategory;
+                @SerializedName("id")
+                private int id;
+                @SerializedName("plandefid")
+                private long plandefid;
+                @SerializedName("planformid")
+                private String planformid;
+                @SerializedName("productelementcode")
+                private String productelementcode;
+                @SerializedName("productelementid")
+                private String productelementid;
+            }
+
+            @NoArgsConstructor
+            @Data
+            public static class JointSalesSolutionItemsDTO {
+                @SerializedName("defaultAmount")
+                private int defaultAmount;
+                @SerializedName("defaultValue")
+                private int defaultValue;
+                @SerializedName("insureUnit")
+                private String insureUnit;
+                @SerializedName("kindCode")
+                private String kindCode;
+                @SerializedName("kindName")
+                private String kindName;
+                @SerializedName("linkSeats")
+                private int linkSeats;
+                @SerializedName("subsidyAmount")
+                private String subsidyAmount;
+                @SerializedName("subsidyDay")
+                private String subsidyDay;
+            }
+        }
     }
 
     @NoArgsConstructor