helixiao vor 1 Jahr
Ursprung
Commit
4772ca8c66

+ 3 - 3
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/component/ZhongAnCrawlerRequestComponent.java

@@ -75,7 +75,7 @@ public class ZhongAnCrawlerRequestComponent {
             throw new SystemException("缓存中未获取到cookie!");
             throw new SystemException("缓存中未获取到cookie!");
         }
         }
         HttpHeaders headers = new HttpHeaders();
         HttpHeaders headers = new HttpHeaders();
-        headers.add(ZhongAnRequestConstant.COOKIE, cookie);
+        headers.add(ZhongAnRequestConstant.COOKIE, "zaLoginCookieKey="+cookie+"; zaAccountCookieKey=8e7a6cc77ad38097");
         headers.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36");
         headers.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36");
         headers.add("Accept", "application/json, text/plain, */*");
         headers.add("Accept", "application/json, text/plain, */*");
 //        headers.add("Content-Type", "application/json");
 //        headers.add("Content-Type", "application/json");
@@ -197,8 +197,8 @@ public class ZhongAnCrawlerRequestComponent {
 
 
     }
     }
 
 
-    public String quoteBaseInfo(ZhongAnCrawlerQuoteBaseRequest parameters, HttpHeaders headers) {
-        return requestComponent.formDataString(RequestUrl.QUOTE_BASE_QUERY.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), parameters, headers);
+    public ZhongAnCrawlerQuoteBaseResponse quoteBaseInfo(ZhongAnCrawlerQuoteBaseRequest parameters, HttpHeaders headers) {
+        return requestComponent.formData(RequestUrl.QUOTE_BASE_QUERY.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), parameters,ZhongAnCrawlerQuoteBaseResponse.class, headers).getBody();
 
 
     }
     }
 
 

+ 26 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/dto/NonAutoInfoDto.java

@@ -0,0 +1,26 @@
+package com.jzg.quotation.zhongan.crawler.entity.dto;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class NonAutoInfoDto {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+    @JsonProperty("productCode")
+    private String productCode;
+
+    @JsonProperty("insuredFlag")
+    private String insuredFlag;
+
+    @JsonProperty("combination")
+    private String combination;
+
+}

+ 28 - 10
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerQuoteRequest.java

@@ -8,6 +8,8 @@ import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
 import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
 import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
 import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
 import com.jzg.quotation.zhongan.crawler.entity.dto.CoverageInfoDTO;
 import com.jzg.quotation.zhongan.crawler.entity.dto.CoverageInfoDTO;
+import com.jzg.quotation.zhongan.crawler.entity.dto.NonAutoInfoDto;
+import com.jzg.quotation.zhongan.crawler.entity.response.ZhongAnCrawlerQuoteBaseResponse;
 import lombok.Data;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
@@ -59,35 +61,51 @@ public class ZhongAnCrawlerQuoteRequest extends ZhongAnCrawlerBaseRequest {
     @JsonProperty("nonAutoInfo")
     @JsonProperty("nonAutoInfo")
     private String nonAutoInfo;
     private String nonAutoInfo;
 
 
-    public ZhongAnCrawlerQuoteRequest(QuoteVo quoteVo, ZhongAnCrawlerConfigureParameters parameters) {
-        super.setFlowId(parameters.getFlowId());
-        super.setPage(ZhongAnRequestConstant.QUOTE_PAGE);
-        super.setFlag(parameters.getFlag());
-        super.setI(ZhongAnRequestConstant.I_PARAM);
+    public ZhongAnCrawlerQuoteRequest(QuoteVo quoteVo, ZhongAnCrawlerConfigureParameters parameters, ZhongAnCrawlerQuoteBaseResponse quoteBaseResponse) {
+        this.setFlowId(parameters.getFlowId());
+        this.setPage(ZhongAnRequestConstant.QUOTE_PAGE);
+        this.setFlag(parameters.getFlag());
+        this.setI(ZhongAnRequestConstant.I_PARAM);
 
 
         RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();
         RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();
         if (biRiskInfoVo != null && biRiskInfoVo.getStartDate() != null) {
         if (biRiskInfoVo != null && biRiskInfoVo.getStartDate() != null) {
             this.addBusi = "1";
             this.addBusi = "1";
+            this.setEffectiveDate(biRiskInfoVo.getStartDate());
         } else {
         } else {
             this.addBusi = "0";
             this.addBusi = "0";
         }
         }
         RiskInfoVo ciRiskInfoVo = quoteVo.getCiRiskInfoVo();
         RiskInfoVo ciRiskInfoVo = quoteVo.getCiRiskInfoVo();
         if (ciRiskInfoVo != null && ciRiskInfoVo.getStartDate() != null) {
         if (ciRiskInfoVo != null && ciRiskInfoVo.getStartDate() != null) {
             this.addCompel = "1";
             this.addCompel = "1";
+            this.setCompelInsEffectiveDate(ciRiskInfoVo.getStartDate());
         } else {
         } else {
             this.addCompel = "0";
             this.addCompel = "0";
         }
         }
-        List<KindInfoVo> kindInfoVoList = quoteVo.getKindInfoVo();
+//        List<KindInfoVo> kindInfoVoList = quoteVo.getKindInfoVo();
+
+        List<ZhongAnCrawlerQuoteBaseResponse.ValueDTO.QuoteCoverageListDTO> quoteCoverageList = quoteBaseResponse.getValue().getQuoteCoverageList();
+
         List<CoverageInfoDTO> coverageInfoDTOS = new ArrayList<>();
         List<CoverageInfoDTO> coverageInfoDTOS = new ArrayList<>();
-        if (kindInfoVoList != null && kindInfoVoList.size() > 0) {
-            for (KindInfoVo kindInfoVo : kindInfoVoList) {
+
+        if (quoteCoverageList != null && quoteCoverageList.size() > 0) {
+            for (ZhongAnCrawlerQuoteBaseResponse.ValueDTO.QuoteCoverageListDTO quoteCoverage: quoteCoverageList) {
                 CoverageInfoDTO coverageInfoDTO = new CoverageInfoDTO();
                 CoverageInfoDTO coverageInfoDTO = new CoverageInfoDTO();
-                coverageInfoDTO.setProductId(kindInfoVo.getKindCode());
-                coverageInfoDTO.setAmount(kindInfoVo.getAmount());
+                coverageInfoDTO.setProductId(quoteCoverage.getProductId());
+                coverageInfoDTO.setAmount(quoteCoverage.getAmount());
                 coverageInfoDTOS.add(coverageInfoDTO);
                 coverageInfoDTOS.add(coverageInfoDTO);
             }
             }
         }
         }
         this.coverageInfo = JSONObject.toJSONString(coverageInfoDTOS);
         this.coverageInfo = JSONObject.toJSONString(coverageInfoDTOS);
+
+        List<NonAutoInfoDto> nonAutoInfoDtos = new ArrayList<>();
+        NonAutoInfoDto jtywxV24 = new NonAutoInfoDto("kp_jtywx_v24", "1", "6");
+        NonAutoInfoDto wjsGabV6 = new NonAutoInfoDto("wjs_gab_v6", "0", null);
+
+        nonAutoInfoDtos.add(jtywxV24);
+        nonAutoInfoDtos.add(wjsGabV6);
+
+        this.nonAutoInfo = JSONObject.toJSONString(nonAutoInfoDtos);
+
     }
     }
 
 
     /**
     /**

+ 246 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/response/ZhongAnCrawlerQuoteBaseResponse.java

@@ -0,0 +1,246 @@
+package com.jzg.quotation.zhongan.crawler.entity.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class ZhongAnCrawlerQuoteBaseResponse {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+    @JsonProperty("errorMsg")
+    private String errorMsg;
+    @JsonProperty("ruleMsgTips")
+    private String ruleMsgTips;
+    @JsonProperty("errorCode")
+    private String errorCode;
+    @JsonProperty("value")
+    private ValueDTO value;
+    @JsonProperty("additionalInfo")
+    private AdditionalInfoDTO additionalInfo;
+    @JsonProperty("success")
+    private Boolean success;
+
+    @NoArgsConstructor
+    @Data
+    public static class ValueDTO {
+        @JsonProperty("quoteCoverageList")
+        private List<QuoteCoverageListDTO> quoteCoverageList;
+        @JsonProperty("showCoverageList")
+        private List<ShowCoverageListDTO> showCoverageList;
+        @JsonProperty("baseInfo")
+        private BaseInfoDTO baseInfo;
+        @JsonProperty("jyxInsureDTOList")
+        private List<JyxInsureDTOListDTO> jyxInsureDTOList;
+        @JsonProperty("amountList")
+        private List<AmountListDTO> amountList;
+
+        @NoArgsConstructor
+        @Data
+        public static class BaseInfoDTO {
+            @JsonProperty("vehicleModelDesc")
+            private String vehicleModelDesc;
+            @JsonProperty("vehicleOwnerName")
+            private String vehicleOwnerName;
+            @JsonProperty("insurePlaceName")
+            private String insurePlaceName;
+            @JsonProperty("insurePlaceCode")
+            private String insurePlaceCode;
+            @JsonProperty("modelEnergyType")
+            private String modelEnergyType;
+            @JsonProperty("vehiclePassengerCap")
+            private Integer vehiclePassengerCap;
+            @JsonProperty("vehicleLicencePlateNo")
+            private String vehicleLicencePlateNo;
+            @JsonProperty("vehicleActualPrice")
+            private String vehicleActualPrice;
+            @JsonProperty("isInsureBusinessInsurance")
+            private String isInsureBusinessInsurance;
+            @JsonProperty("isInsureCompelInsurance")
+            private String isInsureCompelInsurance;
+            @JsonProperty("businessInsEffectiveDate")
+            private Long businessInsEffectiveDate;
+            @JsonProperty("compelInsEffectiveDate")
+            private Long compelInsEffectiveDate;
+            @JsonProperty("syxClassid")
+            private String syxClassid;
+            @JsonProperty("vehicleUsageType")
+            private String vehicleUsageType;
+            @JsonProperty("quoteId")
+            private String quoteId;
+            @JsonProperty("instantEffectiveDate")
+            private Long instantEffectiveDate;
+            @JsonProperty("productModel")
+            private String productModel;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class QuoteCoverageListDTO {
+            @JsonProperty("productDefCode")
+            private String productDefCode;
+            @JsonProperty("policyProductCode")
+            private String policyProductCode;
+            @JsonProperty("productDefName")
+            private String productDefName;
+            @JsonProperty("amount")
+            private String amount;
+            @JsonProperty("standPremium")
+            private String standPremium;
+            @JsonProperty("premium")
+            private String premium;
+            @JsonProperty("isNonDeductible")
+            private Integer isNonDeductible;
+            @JsonProperty("baseRiderType")
+            private String baseRiderType;
+            @JsonProperty("productId")
+            private String productId;
+            @JsonProperty("showOrder")
+            private String showOrder;
+            @JsonProperty("greenWayCoverage")
+            private Boolean greenWayCoverage;
+            @JsonProperty("pureRiskPremium")
+            private String pureRiskPremium;
+            @JsonProperty("premiumRate")
+            private String premiumRate;
+            @JsonProperty("seats")
+            private String seats;
+            @JsonProperty("coverageTemplateCode")
+            private String coverageTemplateCode;
+            @JsonProperty("shortName")
+            private String shortName;
+            @JsonProperty("deductibleFee")
+            private String deductibleFee;
+            @JsonProperty("baseRiskId")
+            private Integer baseRiskId;
+            @JsonProperty("dutyAttributeValue")
+            private String dutyAttributeValue;
+            @JsonProperty("parentTemplateCode")
+            private String parentTemplateCode;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class ShowCoverageListDTO {
+            @JsonProperty("additionalRiderList")
+            private List<AdditionalRiderListDTO> additionalRiderList;
+            @JsonProperty("productId")
+            private Integer productId;
+            @JsonProperty("baseRiderType")
+            private String baseRiderType;
+            @JsonProperty("amount")
+            private String amount;
+            @JsonProperty("totalCoveragePremium")
+            private Double totalCoveragePremium;
+            @JsonProperty("productDefName")
+            private String productDefName;
+            @JsonProperty("isNonDeductible")
+            private Integer isNonDeductible;
+            @JsonProperty("showOrder")
+            private String showOrder;
+
+            @NoArgsConstructor
+            @Data
+            public static class AdditionalRiderListDTO {
+                @JsonProperty("additionalRiderList")
+                private List<?> additionalRiderList;
+                @JsonProperty("productId")
+                private Integer productId;
+                @JsonProperty("baseRiderType")
+                private String baseRiderType;
+                @JsonProperty("baseRiskId")
+                private Integer baseRiskId;
+                @JsonProperty("amount")
+                private String amount;
+                @JsonProperty("totalCoveragePremium")
+                private Double totalCoveragePremium;
+                @JsonProperty("productDefName")
+                private String productDefName;
+                @JsonProperty("isNonDeductible")
+                private Integer isNonDeductible;
+            }
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class JyxInsureDTOListDTO {
+            @JsonProperty("productCode")
+            private String productCode;
+            @JsonProperty("productName")
+            private String productName;
+            @JsonProperty("campaignDefId")
+            private Integer campaignDefId;
+            @JsonProperty("campaignName")
+            private String campaignName;
+            @JsonProperty("agentUserCode")
+            private String agentUserCode;
+            @JsonProperty("showJiaYiXian")
+            private String showJiaYiXian;
+            @JsonProperty("insureJiaYiFlag")
+            private String insureJiaYiFlag;
+            @JsonProperty("vehiclePassengerCap")
+            private Integer vehiclePassengerCap;
+            @JsonProperty("jyxEnsureSeatNo")
+            private Integer jyxEnsureSeatNo;
+            @JsonProperty("jyxPremium")
+            private String jyxPremium;
+            @JsonProperty("combination")
+            private String combination;
+            @JsonProperty("driverAccidentInsuranceFlag")
+            private String driverAccidentInsuranceFlag;
+            @JsonProperty("driverAccidentInsuranceAmountOptions")
+            private String driverAccidentInsuranceAmountOptions;
+            @JsonProperty("zhiYingJyx")
+            private String zhiYingJyx;
+            @JsonProperty("isShortPolicy")
+            private String isShortPolicy;
+            @JsonProperty("supportSingleSell")
+            private String supportSingleSell;
+            @JsonProperty("isSupportInstant")
+            private String isSupportInstant;
+            @JsonProperty("productMode")
+            private String productMode;
+            @JsonProperty("bindInsurance")
+            private String bindInsurance;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class AmountListDTO {
+            @JsonProperty("extraMap")
+            private ExtraMapDTO extraMap;
+            @JsonProperty("id")
+            private Integer id;
+            @JsonProperty("dictId")
+            private Integer dictId;
+            @JsonProperty("parentId")
+            private Integer parentId;
+            @JsonProperty("name")
+            private String name;
+            @JsonProperty("code")
+            private String code;
+            @JsonProperty("extra")
+            private String extra;
+            @JsonProperty("level")
+            private Integer level;
+            @JsonProperty("childItems")
+            private List<?> childItems;
+
+            @NoArgsConstructor
+            @Data
+            public static class ExtraMapDTO {
+            }
+        }
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class AdditionalInfoDTO {
+    }
+}

+ 4 - 2
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/Impl/ZhongAnCrawlerRequestImpl.java

@@ -15,6 +15,7 @@ import com.jzg.commons.entity.quote.vo.image.InsuranceImageVo;
 import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
 import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
 import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
 import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
 import com.jzg.quotation.commons.utils.HttpUtil;
 import com.jzg.quotation.commons.utils.HttpUtil;
+import com.jzg.quotation.zhongan.crawler.JsonUtil;
 import com.jzg.quotation.zhongan.crawler.build.ZhongAnCrawlerQuoteResultsVoBuild;
 import com.jzg.quotation.zhongan.crawler.build.ZhongAnCrawlerQuoteResultsVoBuild;
 import com.jzg.quotation.zhongan.crawler.component.ZhongAnCrawlerCacheComponent;
 import com.jzg.quotation.zhongan.crawler.component.ZhongAnCrawlerCacheComponent;
 import com.jzg.quotation.zhongan.crawler.component.ZhongAnCrawlerRequestComponent;
 import com.jzg.quotation.zhongan.crawler.component.ZhongAnCrawlerRequestComponent;
@@ -114,10 +115,11 @@ public class ZhongAnCrawlerRequestImpl implements ZhongAnCrawlerRequest {
 
 
 
 
         ZhongAnCrawlerQuoteBaseRequest quoteBaseRequest = new ZhongAnCrawlerQuoteBaseRequest(parameters);
         ZhongAnCrawlerQuoteBaseRequest quoteBaseRequest = new ZhongAnCrawlerQuoteBaseRequest(parameters);
-        String str = zhongAnCrawlerRequestComponent.quoteBaseInfo(quoteBaseRequest,headers);
+        ZhongAnCrawlerQuoteBaseResponse quoteBaseResponse = zhongAnCrawlerRequestComponent.quoteBaseInfo(quoteBaseRequest, headers);
+//        ZhongAnCrawlerQuoteBaseResponse zhongAnCrawlerQuoteBaseResponse = JsonUtil.readObjcet(str, ZhongAnCrawlerQuoteBaseResponse.class);
 
 
         //报价
         //报价
-        ZhongAnCrawlerQuoteRequest quoteRequest = new ZhongAnCrawlerQuoteRequest(quoteVo, parameters);
+        ZhongAnCrawlerQuoteRequest quoteRequest = new ZhongAnCrawlerQuoteRequest(quoteVo, parameters,quoteBaseResponse);
         ZhongAnCrawlerQuoteResponse quoteResponse = zhongAnCrawlerRequestComponent.quote(quoteRequest, headers);
         ZhongAnCrawlerQuoteResponse quoteResponse = zhongAnCrawlerRequestComponent.quote(quoteRequest, headers);
         if (quoteResponse != null && StringUtils.isNotEmpty(quoteResponse.getErrorMsg())) {
         if (quoteResponse != null && StringUtils.isNotEmpty(quoteResponse.getErrorMsg())) {
             throw new SystemException("众安财险登录失效,报价失败,联系管理员!");
             throw new SystemException("众安财险登录失效,报价失败,联系管理员!");