helixiao 1 год назад
Родитель
Сommit
ee9b55c8a2

+ 11 - 0
tenant/insurance/quotation-commons/src/main/java/com/jzg/quotation/commons/component/RequestComponent.java

@@ -146,6 +146,17 @@ public class RequestComponent {
                 .toEntity(responseClass)
                 .block();
     }
+    //返回字符串
+    public String baseGetString(String url, Object initDataRequest, HttpHeaders headers) {
+        MultiValueMap<String, String> multiValueMap = RequestObjectConversion.convertMultiValueStringMap(initDataRequest);
+        String requestUrl = buildUrl(url, multiValueMap);
+        return webClient.get()
+                .uri(requestUrl)
+                .headers(setHeaders(headers))
+                .retrieve()
+                .bodyToMono(String.class).doOnNext(responseBody -> System.out.println("响应内容: " + responseBody)) // 打印响应
+                .block();
+    }
 
     /**
      * @param url               请求地址

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

@@ -205,4 +205,23 @@ public class ZhongAnCrawlerRequestComponent {
     public String CacheInput(ZhongAnCrawlerCacheInputRequest cacheInputRequest, HttpHeaders headers) {
         return requestComponent.formDataString(RequestUrl.CACHE_INPUT_KEY.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), cacheInputRequest, headers);
     }
+
+    public String carVinQuery(ZhongAnCrawlerCarVinRequest carVinRequest, HttpHeaders headers) {
+        return requestComponent.formDataString(RequestUrl.CAR_VIN_KEY.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), carVinRequest, headers);
+
+    }
+
+    public String querySpecial(ZhongAnCrawlerQuerySpecialRequest querySpecialRequest, HttpHeaders headers) {
+        return requestComponent.formDataString(RequestUrl.QUERY_SPECIAL.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), querySpecialRequest, headers);
+
+    }
+
+    public String licenseSwitch(ZhongAnCrawlerLicenseSwitchRequest licenseSwitchRequest, HttpHeaders headers) {
+        return requestComponent.formDataString(RequestUrl.LICENCE_SEITCH.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), licenseSwitchRequest, headers);
+
+    }
+
+    public String initDataInfo(ZhongAnCrawlerInitDataRequest initDataRequest, HttpHeaders headers) {
+        return requestComponent.baseGetString(RequestUrl.INIT_DATA_KEY.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()),initDataRequest,headers);
+    }
 }

+ 7 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/constant/enums/RequestUrl.java

@@ -15,7 +15,14 @@ public enum RequestUrl implements CrawlerRequestUrlStandard {
 
     CACHE_INPUT_KEY("/open/bmw/index_controller/cache_input_query.json","校验key缓存"),
 
+    INIT_DATA_KEY("/open/common/init_data_controller/init_data.json","初始化"),
+
+    CAR_VIN_KEY("/open/bmw/car_controller/query_car_info.json","车架查询"),
+
     CAR_QUERY("/open/bmw/car_controller/query_vehicle_model.json", "车型查询"),
+    QUERY_SPECIAL("/open/common/special_flag_controller/query_special_flag.json", "query_special_flag"),
+
+    LICENCE_SEITCH("/open/bmw/index_controller/get_license_switch.json", "get_license_switch"),
 
     CACHE_CAR_QUERY("/open/bmw/car_controller/cache_car_info.json", "缓存车辆信息"),
 

+ 44 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerCarVinRequest.java

@@ -0,0 +1,44 @@
+package com.jzg.quotation.zhongan.crawler.entity.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.commons.entity.quote.vo.QuoteVo;
+import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
+import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
+import lombok.Data;
+
+import java.io.Serial;
+
+@Data
+public class ZhongAnCrawlerCarVinRequest {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+    @JsonProperty("vehicleFrameNo")
+    private String vehicleFrameNo;
+
+    @JsonProperty("passCheck")
+    private String passCheck;
+
+    @JsonProperty("flowId")
+    private String flowId;
+
+    @JsonProperty("page")
+    private String page;
+
+    @JsonProperty("flag")
+    private String flag;
+
+    @JsonProperty("i")
+    private String i;
+
+    public ZhongAnCrawlerCarVinRequest(QuoteVo quoteVo, ZhongAnCrawlerConfigureParameters parameters) {
+        this.setFlowId(parameters.getFlowId());
+        this.setPage(ZhongAnRequestConstant.CAR_QUERY_PAGE);
+        this.setFlag(parameters.getFlag());
+        this.setI(ZhongAnRequestConstant.I_PARAM);
+        this.setVehicleFrameNo(quoteVo.getCarInfoVo().getVinNo());
+
+    }
+
+}

+ 41 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerInitDataRequest.java

@@ -0,0 +1,41 @@
+package com.jzg.quotation.zhongan.crawler.entity.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.commons.entity.quote.vo.QuoteVo;
+import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
+import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
+import lombok.Data;
+
+import java.io.Serial;
+
+@Data
+public class ZhongAnCrawlerInitDataRequest {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+    @JsonProperty("callback")
+    private String callback;
+
+
+    @JsonProperty("flowId")
+    private String flowId;
+
+    @JsonProperty("page")
+    private String page;
+
+    @JsonProperty("flag")
+    private String flag;
+
+    @JsonProperty("i")
+    private String i;
+
+    public ZhongAnCrawlerInitDataRequest(ZhongAnCrawlerConfigureParameters parameters) {
+        this.setFlowId(parameters.getFlowId());
+        this.setPage(ZhongAnRequestConstant.CAR_QUERY_PAGE);
+        this.setFlag("2,3,5");
+        this.setI(ZhongAnRequestConstant.I_PARAM);
+        this.setCallback("__jp1");
+    }
+
+}

+ 44 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerLicenseSwitchRequest.java

@@ -0,0 +1,44 @@
+package com.jzg.quotation.zhongan.crawler.entity.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.commons.entity.quote.vo.QuoteVo;
+import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
+import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
+import lombok.Data;
+
+import java.io.Serial;
+
+@Data
+public class ZhongAnCrawlerLicenseSwitchRequest {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+    @JsonProperty("insurePlaceCode")
+    private String insurePlaceCode;
+
+    @JsonProperty("thirdOrgCode")
+    private String thirdOrgCode;
+
+    @JsonProperty("flowId")
+    private String flowId;
+
+    @JsonProperty("page")
+    private String page;
+
+    @JsonProperty("flag")
+    private String flag;
+
+    @JsonProperty("i")
+    private String i;
+
+    public ZhongAnCrawlerLicenseSwitchRequest(QuoteVo quoteVo, ZhongAnCrawlerConfigureParameters parameters) {
+        this.setFlowId(parameters.getFlowId());
+        this.setPage(ZhongAnRequestConstant.CAR_QUERY_PAGE);
+        this.setFlag(parameters.getFlag());
+        this.setI(ZhongAnRequestConstant.I_PARAM);
+        this.setInsurePlaceCode(quoteVo.getOwnersInfo().getCityCode());
+
+    }
+
+}

+ 45 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerQuerySpecialRequest.java

@@ -0,0 +1,45 @@
+package com.jzg.quotation.zhongan.crawler.entity.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.commons.entity.quote.vo.QuoteVo;
+import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
+import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
+import lombok.Data;
+
+import java.io.Serial;
+
+@Data
+public class ZhongAnCrawlerQuerySpecialRequest {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+    @JsonProperty("vehicleRegisterDate")
+    private String vehicleRegisterDate;
+
+    @JsonProperty("placeCode")
+    private String placeCode;
+
+    @JsonProperty("flowId")
+    private String flowId;
+
+    @JsonProperty("page")
+    private String page;
+
+    @JsonProperty("flag")
+    private String flag;
+
+    @JsonProperty("i")
+    private String i;
+
+    public ZhongAnCrawlerQuerySpecialRequest(QuoteVo quoteVo, ZhongAnCrawlerConfigureParameters parameters) {
+        this.setFlowId(parameters.getFlowId());
+        this.setPage(ZhongAnRequestConstant.CAR_QUERY_PAGE);
+        this.setFlag(parameters.getFlag());
+        this.setI(ZhongAnRequestConstant.I_PARAM);
+        this.setVehicleRegisterDate(quoteVo.getCarInfoVo().getRegisterDate());
+        this.setPlaceCode(quoteVo.getOwnersInfo().getCityCode());
+
+    }
+
+}

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

@@ -90,14 +90,29 @@ public class ZhongAnCrawlerRequestImpl implements ZhongAnCrawlerRequest {
         ZhongAnCrawlerCacheInputRequest cacheInputRequest = new ZhongAnCrawlerCacheInputRequest(quoteVo,parameters);
         String cacheInput = zhongAnCrawlerRequestComponent.CacheInput(cacheInputRequest,headers);
 
+        ZhongAnCrawlerInitDataRequest initDataRequest = new ZhongAnCrawlerInitDataRequest(parameters);
+        String initDataInfo = zhongAnCrawlerRequestComponent.initDataInfo(initDataRequest,headers);
+        //车架查询
+        ZhongAnCrawlerCarVinRequest carVinRequest = new ZhongAnCrawlerCarVinRequest(quoteVo,parameters);
+        String carVinQuery = zhongAnCrawlerRequestComponent.carVinQuery(carVinRequest,headers);
+
+
         //车型查询
         ZhongAnCrawlerCarQueryRequest carQueryRequest = new ZhongAnCrawlerCarQueryRequest(carInfoVo.getBrandName(), parameters);
         List<ZhongAnCrawlerCarQueryResponse.ValueDTO.DataDTO.ResultDTO.VehicleDTO> vehicleDTOList = zhongAnCrawlerRequestComponent.carQuery(carQueryRequest, headers);
         ZhongAnCrawlerCarQueryResponse.ValueDTO.DataDTO.ResultDTO.VehicleDTO vehicleDTO = CarModelsFilterUtils.to(vehicleDTOList, carInfoVo);
 
+        ZhongAnCrawlerQuerySpecialRequest querySpecialRequest = new ZhongAnCrawlerQuerySpecialRequest(quoteVo, parameters);
+        String querySpecial = zhongAnCrawlerRequestComponent.querySpecial(querySpecialRequest,headers);
+
+        ZhongAnCrawlerLicenseSwitchRequest licenseSwitchRequest = new ZhongAnCrawlerLicenseSwitchRequest(quoteVo, parameters);
+        String licenseSwitch = zhongAnCrawlerRequestComponent.licenseSwitch(licenseSwitchRequest,headers);
+
+
         ZhongAnCrawlerCacheCarQueryRequest cacheCarQueryRequest = new ZhongAnCrawlerCacheCarQueryRequest(quoteVo,vehicleDTO,parameters);
         String cacheCarQueryResponse = zhongAnCrawlerRequestComponent.cacheCarInfo(cacheCarQueryRequest,headers);
 
+
         ZhongAnCrawlerQuoteBaseRequest quoteBaseRequest = new ZhongAnCrawlerQuoteBaseRequest(parameters);
         String str = zhongAnCrawlerRequestComponent.quoteBaseInfo(quoteBaseRequest,headers);
 

+ 0 - 653
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/baojia.java

@@ -1,653 +0,0 @@
-//package com.jzg.quotation.zhongan.crawler.service;
-//
-//import com.fasterxml.jackson.core.JsonProcessingException;
-//import com.fasterxml.jackson.databind.JsonNode;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import org.apache.hc.client5.http.classic.methods.HttpPost;
-//import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
-//import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
-//import org.apache.hc.client5.http.impl.classic.HttpClients;
-//import org.apache.hc.core5.http.ContentType;
-//import org.apache.hc.core5.http.io.entity.StringEntity;
-//import org.apache.hc.core5.http.message.BasicHeader;
-//import redis.clients.jedis.Jedis;
-//import java.io.IOException;
-//import java.nio.charset.StandardCharsets;
-//import java.util.*;
-//import java.util.regex.Matcher;
-//import java.util.regex.Pattern;
-//
-//public class InsuranceCalculator {
-//    // 成员变量(对应Python类的self.xxx)
-//    private String flowId;
-//    private Map<String, String> headers = new HashMap<>();
-//    private Map<String, String> cookies = new HashMap<>();
-//    private String quoteId;
-//    private String zhejiuPrice;
-//    private String sanzheChooseFlag;
-//    private String sanzheAmount;
-//    private String sjzerenChooseFlag;
-//    private String sjzerenAmount;
-//    private String ckzerenChooseFlag;
-//    private String ckzerenAmount;
-//    private String ybwSanzheChooseFlag;
-//    private String ybwSanzheAmount;
-//    private String ybwSijiChooseFlag;
-//    private String ybwSijiAmount;
-//    private String ybwCkChooseFlag;
-//    private String ybwCkAmount;
-//    private String huahenChooseFlag;
-//    private String huahenAmount;
-//    private String chesunChooseFlag;
-//    private String fujiaJiejiariChooseFlag;
-//    private String wbdwChooseFlag;
-//    private Map<String, Object> accidentalDriving;
-//    private String jiaoqiangChooseFlag;
-//    private String shangyeChooseFlag;
-//    private String jiaoqiangStartDate;
-//    private String chesunStartDate;
-//    private Integer maxQuoteNum;
-//    private String zaLoginCookieKey;
-//    private String licenseNo;
-//    private String vin;
-//    private String tbIdentifyNumber;
-//    private String username;
-//    private String cftbMessage;
-//    private String jqRepeatinfo;
-//    private String syRepeatinfo;
-//    private String seat;
-//    private Map<String, Object> carInfo = new HashMap<>();
-//    private Map<String, Object> fjxDict = new HashMap<>();
-//    private List<Map<String, Object>> coverageInfo = new ArrayList<>();
-//    private List<Map<String, Object>> nonAutoInfo = new ArrayList<>();
-//    private Map<String, String> data = new HashMap<>();
-//
-//    // JSON解析器
-//    private static final ObjectMapper objectMapper = new ObjectMapper();
-//    // Redis连接(实际使用中建议通过连接池管理)
-//    private Jedis redisConn = new Jedis("localhost", 6379);
-//
-//    /**
-//     * 核心计算方法(对应Python的calculation方法)
-//     */
-//    public Map<String, Object> calculation() throws IOException {
-//        // 第一步:发送基础信息请求
-//        String baseUrl = "https://c.zhongan.com/open/bmw/n/quote_controller/query_quote_base_info.json";
-//        Map<String, String> baseData = new HashMap<>();
-//        baseData.put("flowId", flowId);
-//        baseData.put("page", "/insureProgram");
-//        baseData.put("flag", "0");
-//        baseData.put("i", "e");
-//        baseData.put("quoteType", "0");
-//
-//        String baseResponse = sendPostRequest(baseUrl, headers, cookies, baseData);
-//        // 提取quoteId(正则匹配)
-//        quoteId = extractByRegex(baseResponse, "\"quoteId\":\"(.*?)\"", 1);
-//        // 提取vehicleActualPrice
-//        JsonNode baseJson = objectMapper.readTree(baseResponse);
-//        zhejiuPrice = baseJson.path("value").path("baseInfo").path("vehicleActualPrice").asText("");
-//
-//        // 构建coverageInfo(根据不同选择标志)
-//        buildCoverageInfo(baseResponse);
-//
-//        // 构建nonAutoInfo(驾意险相关)
-//        buildNonAutoInfo();
-//
-//        // 构建报价参数data
-//        buildQuoteData();
-//
-//        // 处理即时起保
-//        handleInstantCoverage();
-//
-//        // 第二步:发送报价请求
-//        return sendQuoteRequest();
-//    }
-//
-//    /**
-//     * 发送POST请求
-//     */
-//    private String sendPostRequest(String url, Map<String, String> headers, Map<String, String> cookies, Map<String, String> data) throws IOException {
-//        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
-//            HttpPost httpPost = new HttpPost(url);
-//
-//            // 设置请求头
-//            if (headers != null) {
-//                headers.forEach((k, v) -> httpPost.addHeader(new BasicHeader(k, v)));
-//            }
-//            // 设置Cookie(合并到header)
-//            if (cookies != null && !cookies.isEmpty()) {
-//                StringBuilder cookieStr = new StringBuilder();
-//                cookies.forEach((k, v) -> cookieStr.append(k).append("=").append(v).append("; "));
-//                httpPost.addHeader("Cookie", cookieStr.toString().trim());
-//            }
-//
-//            // 设置请求体(表单格式)
-//            StringBuilder dataStr = new StringBuilder();
-//            data.forEach((k, v) -> dataStr.append(k).append("=").append(v).append("&"));
-//            httpPost.setEntity(new StringEntity(
-//                    dataStr.toString().replaceAll("&$", ""),
-//                    ContentType.APPLICATION_FORM_URLENCODED.withCharset(StandardCharsets.UTF_8)
-//            ));
-//
-//            // 执行请求
-//            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
-//                return new String(response.getEntity().getContent().readAllBytes(), StandardCharsets.UTF_8);
-//            }
-//        }
-//    }
-//
-//    /**
-//     * 正则提取字符串
-//     */
-//    private String extractByRegex(String text, String regex, int group) {
-//        Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
-//        Matcher matcher = pattern.matcher(text);
-//        if (matcher.find()) {
-//            return matcher.group(group);
-//        }
-//        return "";
-//    }
-//
-//    /**
-//     * 构建coverageInfo列表(对应Python中多个if判断添加coverageInfo的逻辑)
-//     */
-//    private void buildCoverageInfo(String responseText) {
-//        // 第三者责任险
-//        if ("on".equals(sanzheChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", sanzheAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052325" : "1510030944");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 司机责任险
-//        if ("on".equals(sjzerenChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", sjzerenAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052326" : "1510030945");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 乘客责任险
-//        if ("on".equals(ckzerenChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", ckzerenAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052327" : "1510030946");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 医保外第三者
-//        if ("on".equals(ybwSanzheChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", ybwSanzheAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052346" : "1510031007");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 医保外司机
-//        if ("on".equals(ybwSijiChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", ybwSijiAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052347" : "1510031006");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 医保外乘客
-//        if ("on".equals(ybwCkChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", ybwCkAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052348" : "1510030950");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 划痕险相关
-//        if ("on".equals(huahenChooseFlag)) {
-//            addHuahenCoverage(responseText);
-//        }
-//        // 车损险(未选划痕险但选了车损险)
-//        if (!"on".equals(huahenChooseFlag) && "on".equals(chesunChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", zhejiuPrice);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052324" : "1510030943");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 附加节假日
-//        if ("on".equals(fujiaJiejiariChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", sanzheAmount);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", responseText.contains("新能源") ? "1510052345" : "1510031005");
-//            coverageInfo.add(coverage);
-//        }
-//
-//        // 无法找到第三方
-//        if ("on".equals(wbdwChooseFlag)) {
-//            Map<String, Object> coverage = new HashMap<>();
-//            coverage.put("amount", zhejiuPrice);
-//            coverage.put("dutyAttributeType", "02");
-//            coverage.put("dutyAttributeValue", "0");
-//            coverage.put("productId", "1510052328");
-//            coverageInfo.add(coverage);
-//        }
-//    }
-//
-//    /**
-//     * 处理划痕险覆盖信息(含车损险判断)
-//     */
-//    private void addHuahenCoverage(String responseText) {
-//        // 划痕险基础条目
-//        Map<String, Object> huahen = new HashMap<>();
-//        huahen.put("amount", huahenAmount);
-//        huahen.put("dutyAttributeType", "02");
-//        huahen.put("dutyAttributeValue", "0");
-//        huahen.put("productId", responseText.contains("新能源") ? "1510052337" : "1510030949");
-//        coverageInfo.add(huahen);
-//
-//        // 车损险条目(无论是否选车损险,划痕险都需附加)
-//        Map<String, Object> chesun = new HashMap<>();
-//        chesun.put("amount", zhejiuPrice);
-//        chesun.put("dutyAttributeType", "02");
-//        chesun.put("dutyAttributeValue", "0");
-//        chesun.put("productId", responseText.contains("新能源") ? "1510052324" : "1510030943");
-//        coverageInfo.add(chesun);
-//    }
-//
-//    /**
-//     * 构建nonAutoInfo(驾意险相关)
-//     */
-//    private void buildNonAutoInfo() {
-//        if (accidentalDriving != null && !accidentalDriving.isEmpty()) {
-//            Map<String, Object> info = new HashMap<>();
-//            info.put("productCode", "kp_jtywx_v24");
-//            info.put("insuredFlag", "1");
-//            info.put("combination", accidentalDriving.get("combination").toString());
-//            nonAutoInfo.add(info);
-//        } else {
-//            Map<String, Object> info1 = new HashMap<>();
-//            info1.put("productCode", "kp_jtywx_v24");
-//            info1.put("insuredFlag", "0");
-//            nonAutoInfo.add(info1);
-//
-//            Map<String, Object> info2 = new HashMap<>();
-//            info2.put("productCode", "health_jcwy_jtx_v1");
-//            info2.put("insuredFlag", "0");
-//            nonAutoInfo.add(info2);
-//        }
-//    }
-//
-//    /**
-//     * 构建报价参数data
-//     */
-//    private void buildQuoteData() throws JsonProcessingException {
-//        data.put("flowId", flowId);
-//        data.put("page", "/insureProgram");
-//        data.put("flag", "0");
-//        data.put("i", "e");
-//        data.put("nonAutoInfo", objectMapper.writeValueAsString(nonAutoInfo));
-//
-//        // 单交强
-//        if ("on".equals(jiaoqiangChooseFlag) && !"on".equals(shangyeChooseFlag)) {
-//            data.put("addBusi", "0");
-//            data.put("addCompel", "1");
-//            data.put("addTax", "0");
-//            data.put("compelInsEffectiveDate", jiaoqiangStartDate);
-//            data.put("isTrusted", "true");
-//        }
-//        // 单商业
-//        else if (!"on".equals(jiaoqiangChooseFlag) && "on".equals(shangyeChooseFlag)) {
-//            data.put("addBusi", "1");
-//            data.put("coverageInfo", objectMapper.writeValueAsString(coverageInfo));
-//            data.put("addCompel", "0");
-//            data.put("addTax", "0");
-//            data.put("effectiveDate", chesunStartDate);
-//        }
-//        // 交商同投
-//        else if ("on".equals(jiaoqiangChooseFlag) && "on".equals(shangyeChooseFlag)) {
-//            data.put("addBusi", "1");
-//            data.put("coverageInfo", objectMapper.writeValueAsString(coverageInfo));
-//            data.put("addCompel", "1");
-//            data.put("taxType", "PAY_TAXES");
-//            data.put("addTax", "1");
-//            data.put("effectiveDate", chesunStartDate);
-//            data.put("compelInsEffectiveDate", jiaoqiangStartDate);
-//        }
-//    }
-//
-//    /**
-//     * 处理即时起保参数
-//     */
-//    private void handleInstantCoverage() {
-//        boolean jqLongEnough = jiaoqiangStartDate != null && jiaoqiangStartDate.length() > 16;
-//        boolean syLongEnough = chesunStartDate != null && chesunStartDate.length() > 16;
-//
-//        if (jqLongEnough && syLongEnough) {
-//            data.put("compInstantFlag", "1");
-//            data.put("busiInstantFlag", "1");
-//        } else if (jqLongEnough) {
-//            data.put("compInstantFlag", "1");
-//        } else if (syLongEnough) {
-//            data.put("busiInstantFlag", "1");
-//        }
-//    }
-//
-//    /**
-//     * 发送报价请求并处理结果
-//     */
-//    private Map<String, Object> sendQuoteRequest() throws IOException {
-//        if (maxQuoteNum == null) {
-//            return buildErrorResponse(400, "未获取到报价剩余次数", maxQuoteNum);
-//        }
-//        if (maxQuoteNum <= 0) {
-//            return buildErrorResponse(400, "报价剩余次数不足", maxQuoteNum);
-//        }
-//
-//        // 发送报价请求
-//        String quoteUrl = "https://c.zhongan.com/open/bmw/n/quote_controller/premium_trial.json";
-//        maxQuoteNum--;
-//        String quoteResponse = sendPostRequest(quoteUrl, headers, cookies, data);
-//
-//        // 发送理赔信息请求
-//        String claimUrl = "https://c.zhongan.com/open/bmw/n/query_controller/query_busi_claim_info.json";
-//        Map<String, String> claimData = new HashMap<>();
-//        claimData.put("flowId", flowId);
-//        claimData.put("page", "%2FinsureProgram");
-//        claimData.put("i", "e");
-//        claimData.put("flag", "0");
-//        sendPostRequest(claimUrl, headers, cookies, claimData); // 仅发送,不处理返回
-//
-//        // 处理报价响应
-//        JsonNode quoteJson = objectMapper.readTree(quoteResponse);
-//        if (!quoteJson.path("success").asBoolean(true)) {
-//            return buildErrorResponse(400, quoteJson.path("errorMsg").asText("请求失败"), maxQuoteNum);
-//        }
-//
-//        // 处理"您的爱车上一年"相关逻辑(二次报价)
-//        if (quoteResponse.contains("您的爱车上一年")) {
-//            return handleYearlyRenewal(quoteResponse);
-//        } else {
-//            // 直接处理正常报价结果
-//            return handleNormalQuote(quoteResponse);
-//        }
-//    }
-//
-//    /**
-//     * 处理续保相关逻辑(含二次报价)
-//     */
-//    private Map<String, Object> handleYearlyRenewal(String firstResponse) throws IOException {
-//        // 提取续保信息
-//        jqRepeatinfo = extractByRegex(firstResponse, "\"insureMessageF\":\"(.*?)\"", 1);
-//        syRepeatinfo = extractByRegex(firstResponse, "\"insureMessage\":\"(.*?)\"", 1);
-//
-//        // 处理交强险到期日
-//        String jqData = extractByRegex(firstResponse, "交强险于(.*?)到期", 1);
-//        String formattedJqDate = formatDate(jqData);
-//        // 处理商业险到期日
-//        String syData = extractByRegex(firstResponse, "商业险于(.*?)到期", 1);
-//        String formattedSyDate = formatDate(syData);
-//
-//        // 更新data参数并二次报价
-//        data.put("effectiveDate", formattedSyDate != null ? formattedSyDate : chesunStartDate);
-//        data.put("compelInsEffectiveDate", formattedJqDate != null ? formattedJqDate : jiaoqiangStartDate);
-//
-//        if (maxQuoteNum <= 0) {
-//            return buildErrorResponse(400, "报价剩余次数不足", maxQuoteNum);
-//        }
-//        maxQuoteNum--;
-//        String secondUrl = "https://c.zhongan.com/open/bmw/n/quote_controller/premium_trial.json";
-//        String secondResponse = sendPostRequest(secondUrl, headers, cookies, data);
-//
-//        // 若二次响应仍包含续保信息,三次报价(逻辑同Python)
-//        if (secondResponse.contains("您的爱车上一年")) {
-//            // 重复提取和格式化日期(代码省略,同上述逻辑)
-//            // ...(此处省略与上述相同的日期提取和格式化代码)
-//
-//            if (maxQuoteNum <= 0) {
-//                return buildErrorResponse(400, "报价剩余次数不足", maxQuoteNum);
-//            }
-//            maxQuoteNum--;
-//            String thirdResponse = sendPostRequest(secondUrl, headers, cookies, data);
-//            return handleNormalQuote(thirdResponse);
-//        } else {
-//            return handleNormalQuote(secondResponse);
-//        }
-//    }
-//
-//    /**
-//     * 处理正常报价结果
-//     */
-//    private Map<String, Object> handleNormalQuote(String response) throws IOException {
-//        JsonNode json = objectMapper.readTree(response);
-//        // 提取价格信息
-//        String totalPremium = extractByRegex(response, "\"totalPremium\":(.*?),", 1);
-//        String taxPremium = extractByRegex(response, "\"taxPremium\":(.*?),", 1);
-//        String bizPremium = extractByRegex(response, "\"bizTotalPremium\":(.*?),", 1);
-//        String compelPremium = extractByRegex(response, "\"compelPremium\":(.*?),", 1);
-//
-//        // 处理附加险信息
-//        handleCoveragePremium(json, response.contains("新能源"));
-//
-//        // 生成订单号
-//        String plyappno = UUID.randomUUID().toString().replaceAll("-", "");
-//        // 存储Redis信息
-//        saveToRedis(plyappno);
-//
-//        // 处理评分、折扣率
-//        String mark = extractByRegex(response, "policyGradePa\":\"(.*?)\"", 1);
-//        String jqDiscount = extractByRegex(response, "compelDiscount\":\"(.*?)\"", 1);
-//        String syDiscount = extractByRegex(response, "businessDiscount\":\"(.*?)\"", 1);
-//
-//        // 处理起止日期
-//        Map<String, String> dateInfo = handleDateRange();
-//
-//        // 处理驾意险信息
-//        List<Map<String, Object>> fcxInfoList = buildFcxInfoList(json);
-//
-//        // 处理车型信息
-//        Map<String, Object> carInfo = buildCarInfo();
-//
-//        // 处理绿通信息
-//        Map<String, Object> greenWayInfo = handleGreenWay(response);
-//
-//        // 构建返回结果
-//        Map<String, Object> result = new HashMap<>();
-//        result.put("code", 200);
-//        result.put("INSURANCE_TYPE", fjxDict);
-//        result.put("carInsureShiptax", taxPremium);
-//        result.put("busiTotalPremium", bizPremium);
-//        result.put("forceCarInsureRisk", compelPremium);
-//        result.put("carInsureMain", totalPremium);
-//        result.put("plyappno", plyappno);
-//        result.put("message", cftbMessage);
-//        result.put("other", Map.of(
-//                "mark", mark,
-//                "jq_discount", jqDiscount,
-//                "sy_discount", syDiscount,
-//                "isQuoteGreenWay", greenWayInfo.get("isQuoteGreenWay"),
-//                "errorCodeMap", greenWayInfo.get("errorCodeMap"),
-//                "jq_renewalflag", json.path("value").path("datas").path("forceRenewalFlag").asText().equals("ZA") ? "1" : "0",
-//                "sy_renewalflag", json.path("value").path("datas").path("forceRenewalFlag").asText().equals("ZA") ? "1" : "0",
-//                "maxQuoteNum", maxQuoteNum
-//        ));
-//        result.put("jq_startDate", dateInfo.get("jqStartDate"));
-//        result.put("jq_endDate", dateInfo.get("jqEndDate"));
-//        result.put("sy_startDate", dateInfo.get("syStartDate"));
-//        result.put("sy_endDate", dateInfo.get("syEndDate"));
-//        result.put("jq_repeatinfo", jqRepeatinfo);
-//        result.put("sy_repeatinfo", syRepeatinfo);
-//        result.put("drivingInsurances", fcxInfoList);
-//        result.put("carInfo", carInfo);
-//
-//        // 存储结果到Redis
-//        redisConn.hset("zhongan_" + plyappno, "ret", objectMapper.writeValueAsString(result));
-//        return result;
-//    }
-//
-//    /**
-//     * 格式化日期字符串
-//     */
-//    private String formatDate(String dateStr) {
-//        if (dateStr == null || dateStr.isEmpty()) return null;
-//        dateStr = dateStr.replace("年", "-").replace("月", "-").replace("日", "");
-//        // 处理不同长度的日期(逻辑同Python)
-//        // ...(此处省略具体日期格式化代码,可根据Python逻辑实现)
-//        return dateStr;
-//    }
-//
-//    /**
-//     * 处理附加险保费信息
-//     */
-//    private void handleCoveragePremium(JsonNode json, boolean isNewEnergy) {
-//        JsonNode coverageList = json.path("value").path("datas").path("vehiclePremium").path("vehicleCoverageList");
-//        if (coverageList.isArray()) {
-//            for (JsonNode node : coverageList) {
-//                String productId = node.path("productId").asText();
-//                String premium = node.path("totalCoveragePremium").asText();
-//                if (isNewEnergy) {
-//                    mapPremium(productId, premium,
-//                            Map.of("1510052324", "A", "1510052325", "B",
-//                                    "1510052326", "D3", "1510052327", "D4",
-//                                    "1510052345", "BD", "1510030943", "L",
-//                                    "1510052346", "SY_FJ_YBW1", "1510052348", "SY_FJ_YBW2",
-//                                    "1510052347", "SY_FJ_YBW3", "1510052328", "SY_WBDWGZ"));
-//                } else {
-//                    mapPremium(productId, premium,
-//                            Map.of("1510030943", "A", "1510030944", "B",
-//                                    "1510030945", "D3", "1510030946", "D4",
-//                                    "1510031005", "BD", "1510030949", "L",
-//                                    "1510031007", "SY_FJ_YBW1", "1510030950", "SY_FJ_YBW2",
-//                                    "1510031006", "SY_FJ_YBW3"));
-//                }
-//            }
-//        }
-//        fjxDict.put("A_amount", zhejiuPrice);
-//    }
-//
-//    /**
-//     * 映射附加险保费到字典
-//     */
-//    private void mapPremium(String productId, String premium, Map<String, String> mapping) {
-//        if (mapping.containsKey(productId)) {
-//            fjxDict.put(mapping.get(productId), premium);
-//        }
-//    }
-//
-//    /**
-//     * 存储信息到Redis
-//     */
-//    private void saveToRedis(String plyappno) {
-//        redisConn.hset("zhongan_" + plyappno, "flowId", flowId);
-//        redisConn.hset("zhongan_" + plyappno, "zaLoginCookieKey", zaLoginCookieKey);
-//        redisConn.hset("zhongan_" + plyappno, "license", licenseNo);
-//        redisConn.hset("zhongan_" + plyappno, "vin", vin);
-//        redisConn.hset("zhongan_" + plyappno, "tb_identifyNumber", tbIdentifyNumber);
-//        redisConn.hset("zhongan_" + plyappno, "username", username);
-//        redisConn.hset("zhongan_" + plyappno, "jiaoqiang_chooseFlag", jiaoqiangChooseFlag);
-//        redisConn.hset("zhongan_" + plyappno, "shangye_chooseFlag", shangyeChooseFlag);
-//        redisConn.hset("zhongan_" + plyappno, "accidentalDriving", accidentalDriving.toString());
-//        redisConn.expire("zhongan_" + plyappno, 5184000); // 60天过期
-//    }
-//
-//    /**
-//     * 处理日期范围(起保日和到期日)
-//     */
-//    private Map<String, String> handleDateRange() {
-//        Map<String, String> dateInfo = new HashMap<>();
-//        // 逻辑同Python:根据交强和商业险选择情况计算起止日期
-//        // ...(此处省略具体日期计算代码)
-//        return dateInfo;
-//    }
-//
-//    /**
-//     * 构建驾意险信息列表
-//     */
-//    private List<Map<String, Object>> buildFcxInfoList(JsonNode json) {
-//        List<Map<String, Object>> list = new ArrayList<>();
-//        if (accidentalDriving != null && !accidentalDriving.isEmpty()) {
-//            Map<String, Object> info = new HashMap<>();
-//            info.put("name", accidentalDriving.get("name"));
-//            info.put("price", json.path("value").path("datas").path("vehiclePremium").path("nonTotalPremium").asText());
-//            info.put("policy", "");
-//            list.add(info);
-//        }
-//        return list;
-//    }
-//
-//    /**
-//     * 构建车型信息
-//     */
-//    private Map<String, Object> buildCarInfo() {
-//        Map<String, Object> info = new HashMap<>();
-//        info.put("modelcname", carInfo.get("vehicleModelName"));
-//        info.put("modelCode", carInfo.get("vehicleModelCode"));
-//        info.put("exhaustscale", carInfo.get("exhaustMeasure"));
-//        info.put("seatCount", seat);
-//        info.put("purchasePrice", carInfo.get("vehicleAcquisitionPrice"));
-//        info.put("power", carInfo.get("power"));
-//        info.put("caryear", carInfo.get("configName"));
-//        return info;
-//    }
-//
-//    /**
-//     * 处理绿通信息
-//     */
-//    private Map<String, Object> handleGreenWay(String response) throws IOException {
-//        Map<String, Object> greenInfo = new HashMap<>();
-//        String isGreen = extractByRegex(response, "isQuoteGreenWay\":\"(.*?)\"", 1);
-//        greenInfo.put("isQuoteGreenWay", isGreen.isEmpty() ? "0" : isGreen);
-//
-//        if (!isGreen.isEmpty()) {
-//            String greenUrl = "https://c.zhongan.com/open/bmw/quote_controller/get_green_base_info.json";
-//            Map<String, String> greenData = new HashMap<>();
-//            greenData.put("quoteId", quoteId);
-//            greenData.put("flowId", flowId);
-//            greenData.put("page", "%2FinsureProgram");
-//            greenData.put("i", "e");
-//            greenData.put("flag", "0");
-//
-//            String greenResponse = sendPostRequest(greenUrl, headers, cookies, greenData);
-//            JsonNode greenJson = objectMapper.readTree(greenResponse);
-//            JsonNode errorCodeMap = greenJson.path("value").path("datas").path("errorCodeMap");
-//
-//            List<String> errorList = new ArrayList<>();
-//            if (errorCodeMap.isObject()) {
-//                errorCodeMap.fieldNames().forEachRemaining(key ->
-//                        errorList.add(key + ":" + errorCodeMap.path(key).asText())
-//                );
-//            }
-//            greenInfo.put("errorCodeMap", errorList);
-//        } else {
-//            greenInfo.put("errorCodeMap", new ArrayList<>());
-//        }
-//        return greenInfo;
-//    }
-//
-//    /**
-//     * 构建错误响应
-//     */
-//    private Map<String, Object> buildErrorResponse(int code, String message, Integer maxQuoteNum) {
-//        Map<String, Object> error = new HashMap<>();
-//        error.put("code", code);
-//        error.put("message", message);
-//        error.put("other", Map.of("maxQuoteNum", maxQuoteNum));
-//        return error;
-//    }
-//
-//    // Getter和Setter(省略,实际使用中需生成)
-//    // ...
-//}

+ 0 - 503
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/test.java

@@ -1,503 +0,0 @@
-//package com.jzg.quotation.zhongan.crawler.service;
-//
-//import org.apache.http.HttpEntity;
-//import org.apache.http.NameValuePair;
-//import org.apache.http.client.entity.UrlEncodedFormEntity;
-//import org.apache.http.client.methods.CloseableHttpResponse;
-//import org.apache.http.client.methods.HttpPost;
-//import org.apache.http.impl.client.CloseableHttpClient;
-//import org.apache.http.impl.client.HttpClients;
-//import org.apache.http.message.BasicNameValuePair;
-//import org.apache.http.util.EntityUtils;
-//import com.fasterxml.jackson.databind.JsonNode;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import redis.clients.jedis.Jedis;
-//import java.io.IOException;
-//import java.nio.charset.StandardCharsets;
-//import java.text.ParseException;
-//import java.text.SimpleDateFormat;
-//import java.util.*;
-//import java.util.regex.Matcher;
-//import java.util.regex.Pattern;
-//
-//public class ZABfjs {
-//    // 成员变量
-//    private String username;
-//    private int maxQuoteNum;
-//    private String modelCName;
-//    private String engineNo;
-//    private String vin;
-//    private String licenseNo;
-//    private int seatCount;
-//    private String purchasePrice;
-//    private String vehicleUse;
-//    private String limitLoad;
-//    private String cartype;
-//    private String energyType;
-//    private String familyName;
-//    private String identifyNumber;
-//    private String uname;
-//    private String address;
-//    private String phoneNumber;
-//    private String tbIdentifyNumber;
-//    private String tbUname;
-//    private String tbAddress;
-//    private String tbPhoneNumber;
-//    private String bbIdentifyNumber;
-//    private String bbUname;
-//    private String bbAddress;
-//    private String bbPhoneNumber;
-//    private String registerDate;
-//    private String issueDate;
-//    private int isTransfer;
-//    private boolean jiaoqiangChooseFlag;
-//    private boolean chesunChooseFlag;
-//    private String jiaoqiangStartDate;
-//    private String jiaoqiangEndDate;
-//    private String chesunStartDate;
-//    private String chesunEndDate;
-//    private boolean shangyeChooseFlag;
-//    private boolean wbdwChooseFlag;
-//    private boolean sanzheChooseFlag;
-//    private String sanzheAmount;
-//    private boolean sjzerenChooseFlag;
-//    private String sjzerenAmount;
-//    private boolean ckzerenChooseFlag;
-//    private String ckzerenAmount;
-//    private boolean huahenChooseFlag;
-//    private String huahenAmount;
-//    private boolean fujiachesunChooseFlag;
-//    private String fujiachesunAmount;
-//    private boolean fujiasanzheChooseFlag;
-//    private String fujiasanzheAmount;
-//    private boolean fujiasijiChooseFlag;
-//    private String fujiasijiAmount;
-//    private boolean fujiachengkeChooseFlag;
-//    private String fujiachengkeAmount;
-//    private boolean fujiaJiejiariChooseFlag;
-//    private String fujiaJiejiariAmount;
-//    private boolean ybwSanzheChooseFlag;
-//    private String ybwSanzheAmount;
-//    private boolean ybwSijiChooseFlag;
-//    private String ybwSijiAmount;
-//    private boolean ybwCkChooseFlag;
-//    private String ybwCkAmount;
-//    private String accidentalDriving;
-//
-//    // 其他变量
-//    private String zhejiuPrice;
-//    private String cityCode;
-//    private String cityName;
-//    private String zaLoginCookieKey;
-//    private String flowId;
-//    private List<Map<String, Object>> coverageInfo = new ArrayList<>();
-//    private List<Map<String, Object>> nonAutoInfo = new ArrayList<>();
-//    private String isQuoteGreenWay = "";
-//    private String cftbMessage = "";
-//    private double price = 0;
-//    private double chechuan = 0;
-//    private double shangyePrice = 0;
-//    private double jiaoqiangPrice = 0;
-//    private String plyappno;
-//    private Map<String, Integer> fjxDict = new HashMap<String, Integer>() {{
-//        put("A", 0);
-//        put("B", 0);
-//        put("D3", 0);
-//        put("D4", 0);
-//        put("BD", 0);
-//        put("L", 0);
-//        put("SY_FJ_YBW1", 0);
-//        put("SY_FJ_YBW2", 0);
-//        put("SY_FJ_YBW3", 0);
-//    }};
-//    private Map<String, String> headers = new HashMap<String, String>() {{
-//        put("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");
-//    }};
-//    private Map<String, String> cookies;
-//    private Map<String, String> carInfo;
-//    private String quoteId = "";
-//    private String jqRepeatinfo = "";
-//    private String syRepeatinfo = "";
-//    private String yxscType = "";
-//    private String yxscId = "";
-//    private String bjRes = "";
-//    private String desVehicleFrameNo = "";
-//    private String desVehicleEngineNo = "";
-//
-//    // 构造函数
-//    public ZABfjs(String username, int maxQuoteNum, String modelCName, String engineNo, String vin,
-//                  String licenseNo, int seatCount, String purchasePrice, String vehicleUse, String limitLoad,
-//                  String cartype, String energyType, String familyName, String identifyNumber, String uname,
-//                  String address, String phoneNumber, String tbIdentifyNumber, String tbUname, String tbAddress,
-//                  String tbPhoneNumber, String bbIdentifyNumber, String bbUname, String bbAddress,
-//                  String bbPhoneNumber, String registerDate, String issueDate, boolean isTransfer,
-//                  boolean jiaoqiangChooseFlag, boolean chesunChooseFlag, String jiaoqiangStartDate,
-//                  String jiaoqiangEndDate, String chesunStartDate, String chesunEndDate, boolean shangyeChooseFlag,
-//                  boolean wbdwChooseFlag, boolean sanzheChooseFlag, String sanzheAmount, boolean sjzerenChooseFlag,
-//                  String sjzerenAmount, boolean ckzerenChooseFlag, String ckzerenAmount, boolean huahenChooseFlag,
-//                  String huahenAmount, boolean fujiachesunChooseFlag, String fujiachesunAmount,
-//                  boolean fujiasanzheChooseFlag, String fujiasanzheAmount, boolean fujiasijiChooseFlag,
-//                  String fujiasijiAmount, boolean fujiachengkeChooseFlag, String fujiachengkeAmount,
-//                  boolean fujiaJiejiariChooseFlag, String fujiaJiejiariAmount, boolean ybwSanzheChooseFlag,
-//                  String ybwSanzheAmount, boolean ybwSijiChooseFlag, String ybwSijiAmount, boolean ybwCkChooseFlag,
-//                  String ybwCkAmount, String accidentalDriving) {
-//        this.username = username;
-//        this.maxQuoteNum = maxQuoteNum;
-//        this.modelCName = modelCName.replace("牌", "");
-//        this.engineNo = engineNo;
-//        this.vin = vin;
-//        this.licenseNo = licenseNo;
-//        this.seatCount = seatCount;
-//        this.purchasePrice = purchasePrice;
-//        this.vehicleUse = vehicleUse;
-//        this.limitLoad = limitLoad;
-//        this.cartype = cartype;
-//        this.energyType = energyType;
-//        this.familyName = familyName;
-//        this.identifyNumber = identifyNumber;
-//        this.uname = uname;
-//        this.address = address;
-//        this.phoneNumber = phoneNumber;
-//        this.tbIdentifyNumber = tbIdentifyNumber;
-//        this.tbUname = tbUname;
-//        this.tbAddress = tbAddress;
-//        this.tbPhoneNumber = tbPhoneNumber;
-//        this.bbIdentifyNumber = bbIdentifyNumber;
-//        this.bbUname = bbUname;
-//        this.bbAddress = bbAddress;
-//        this.bbPhoneNumber = bbPhoneNumber;
-//        this.registerDate = registerDate;
-//        this.issueDate = issueDate;
-//        this.isTransfer = isTransfer ? 1 : 0;
-//        this.jiaoqiangChooseFlag = jiaoqiangChooseFlag;
-//        this.chesunChooseFlag = chesunChooseFlag;
-//        this.jiaoqiangStartDate = jiaoqiangStartDate;
-//        this.jiaoqiangEndDate = jiaoqiangEndDate;
-//        this.chesunStartDate = chesunStartDate;
-//        this.chesunEndDate = chesunEndDate;
-//        this.shangyeChooseFlag = shangyeChooseFlag;
-//        this.wbdwChooseFlag = wbdwChooseFlag;
-//        this.sanzheChooseFlag = sanzheChooseFlag;
-//        this.sanzheAmount = sanzheAmount;
-//        this.sjzerenChooseFlag = sjzerenChooseFlag;
-//        this.sjzerenAmount = sjzerenAmount;
-//        this.ckzerenChooseFlag = ckzerenChooseFlag;
-//        this.ckzerenAmount = ckzerenAmount;
-//        this.huahenChooseFlag = huahenChooseFlag;
-//        this.huahenAmount = huahenAmount;
-//        this.fujiachesunChooseFlag = fujiachesunChooseFlag;
-//        this.fujiachesunAmount = fujiachesunAmount;
-//        this.fujiasanzheChooseFlag = fujiasanzheChooseFlag;
-//        this.fujiasanzheAmount = fujiasanzheAmount;
-//        this.fujiasijiChooseFlag = fujiasijiChooseFlag;
-//        this.fujiasijiAmount = fujiasijiAmount;
-//        this.fujiachengkeChooseFlag = fujiachengkeChooseFlag;
-//        this.fujiachengkeAmount = fujiachengkeAmount;
-//        this.fujiaJiejiariChooseFlag = fujiaJiejiariChooseFlag;
-//        this.fujiaJiejiariAmount = fujiaJiejiariAmount;
-//        this.ybwSanzheChooseFlag = ybwSanzheChooseFlag;
-//        this.ybwSanzheAmount = ybwSanzheAmount;
-//        this.ybwSijiChooseFlag = ybwSijiChooseFlag;
-//        this.ybwSijiAmount = ybwSijiAmount;
-//        this.ybwCkChooseFlag = ybwCkChooseFlag;
-//        this.ybwCkAmount = ybwCkAmount;
-//        this.accidentalDriving = accidentalDriving;
-//    }
-//
-//    // 获取城市代码
-//    public void getCityCode() {
-//        // 假设license_code是一个包含license和code的列表
-//        for (Map<String, String> item : Config.LICENSE_CODE) {
-//            if (licenseNo.contains(item.get("license"))) {
-//                this.cityCode = item.get("code");
-//                this.cityName = item.get("name");
-//                return;
-//            }
-//        }
-//        // 默认值
-//        this.cityCode = "140100";
-//        this.cityName = "太原市";
-//    }
-//
-//    // 从身份证获取生日
-//    public String getBirthday(String id) {
-//        if (id.length() >= 14) {
-//            return id.substring(6, 10) + "-" + id.substring(10, 12) + "-" + id.substring(12, 14);
-//        }
-//        return "";
-//    }
-//
-//    // 从身份证获取性别
-//    public String getSex(String id) {
-//        if (id.length() >= 17) {
-//            int sexCode = Integer.parseInt(id.substring(16, 17));
-//            return sexCode % 2 == 0 ? "F" : "M";
-//        }
-//        return "";
-//    }
-//
-//    // 获取省份代码
-//    public String[] getProvinceCode(String address) {
-//        String[] result = new String[3];
-//        // 假设city_conde是一个二维数组
-//        for (String[] item : Config.CITY_CODE) {
-//            if (address.contains(item[item.length - 1])) {
-//                result[0] = item[0];
-//                result[1] = item[item.length - 2];
-//                result[2] = item[2];
-//                break;
-//            }
-//        }
-//        return result;
-//    }
-//
-//    // 检查登录状态
-//    public void checkLogin() {// 假设Redis在本地运行
-//        this.zaLoginCookieKey = (String) redissonClient.getMap(zhongAnCrawlerCacheComponent.ZHONGAN_COOKIE + username).get(zhongAnCrawlerCacheComponent.COOKIE);
-//        this.flowId = (String) redissonClient.getMap(zhongAnCrawlerCacheComponent.ZHONGAN_COOKIE + username).get(zhongAnCrawlerCacheComponent.COOKIE);
-//        jedis.close();
-//
-//        if (this.flowId == null || this.flowId.isEmpty()) {
-//            this.flowId = "账号错误";
-//            return;
-//        }
-//
-//        this.cookies = new HashMap<>();
-//        this.cookies.put("zaLoginCookieKey", this.zaLoginCookieKey);
-//
-//        try {
-//            // 发送请求检查登录状态
-//            String url = "https://c.zhongan.com/open/bmw/query_controller/query_policy_list.json";
-//            Map<String, String> params = new HashMap<>();
-//            params.put("status", "4");
-//            params.put("pageIndex", "1");
-//            params.put("queryType", "1");
-//            params.put("flowId", this.flowId);
-//            params.put("page", "%2Forder%2FmyOrders");
-//            params.put("i", "e");
-//            params.put("flag", "0");
-//
-//            String response = sendPostRequest(url, params, headers, cookies);
-//            ObjectMapper mapper = new ObjectMapper();
-//            JsonNode jsonNode = mapper.readTree(response);
-//
-//            if (jsonNode.get("errorCode").asText().isEmpty()) {
-//                // 登录有效,继续其他操作
-//                url = "https://c.zhongan.com/open/bmw/index_controller/cache_input_query.json";
-//                params = new HashMap<>();
-//                params.put("insurePlace", this.cityName);
-//                params.put("insurePlaceCode", this.cityCode);
-//                params.put("thirdOrgCode", "");
-//                params.put("licenseNo", this.licenseNo);
-//                params.put("branchCode", "");
-//                params.put("isOpenRenewalFlag", "0");
-//                params.put("flowId", this.flowId);
-//                params.put("page", "%2FinsureEntry");
-//                params.put("i", "e");
-//                params.put("flag", "0");
-//
-//                sendPostRequest(url, params, headers, cookies);
-//
-//                url = "https://c.zhongan.com/open/bmw/car_controller/query_car_info.json";
-//                params = new HashMap<>();
-//                params.put("vehicleFrameNo", "");
-//                params.put("passCheck", "");
-//                params.put("flowId", this.flowId);
-//                params.put("page", "%2FbaseInfo");
-//                params.put("i", "e");
-//                params.put("flag", "0");
-//
-//                response = sendPostRequest(url, params, headers, cookies);
-//
-//                // 使用正则表达式提取信息
-//                this.desVehicleFrameNo = extractByRegex(response, "desVehicleFrameNo\":\"(.*?)\"");
-//                this.desVehicleEngineNo = extractByRegex(response, "desVehicleEngineNo\":\"(.*?)\"");
-//            } else {
-//                // 登录失效,重新获取用户信息
-//                getUserInfo(username);
-//                checkLogin();
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//    }
-//
-//    // 获取保险结束日期
-//    public String getEndDay(String dateStr) {
-//        try {
-//            String[] parts = dateStr.split("-");
-//            int year = Integer.parseInt(parts[0]) + 1;
-//            String newDateStr = year + "-" + parts[1] + "-" + parts[2];
-//
-//            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//            Date date = sdf.parse(newDateStr);
-//            long timeStamp = date.getTime() / 1000 - 1;
-//            return sdf.format(new Date(timeStamp * 1000));
-//        } catch (Exception e) {
-//            if (e.getMessage().contains("day is out of range for month")) {
-//                try {
-//                    String[] dateTime = dateStr.split(" ");
-//                    String[] dateParts = dateTime[0].split("-");
-//                    int day = Integer.parseInt(dateParts[2]) - 1;
-//                    String newDate = dateParts[0] + "-" + dateParts[1] + "-" + day + " " + dateTime[1];
-//
-//                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                    Date date = sdf.parse(newDate);
-//                    long timeStamp = date.getTime() / 1000 - 1;
-//                    return sdf.format(new Date(timeStamp * 1000));
-//                } catch (Exception ex) {
-//                    ex.printStackTrace();
-//                }
-//            }
-//            e.printStackTrace();
-//        }
-//        return "";
-//    }
-//
-//    // 获取车辆信息
-//    public Map<String, Object> getCarInfo() {
-//        try {
-//            String url = "https://c.zhongan.com/open/bmw/car_controller/query_jyyt_vehicle_model.json";
-//            Map<String, String> params = new HashMap<>();
-//            params.put("vehicleFrameNo", this.vin);
-//            params.put("callVehicleModelLibraryFlag", "0");
-//            params.put("flowId", this.flowId);
-//            params.put("page", "%2FbaseInfo");
-//            params.put("i", "e");
-//            params.put("flag", "0");
-//
-//            String response = sendPostRequest(url, headers, cookies, params);
-//            ObjectMapper mapper = new ObjectMapper();
-//            JsonNode jsonNode = mapper.readTree(response);
-//
-//            JsonNode valueNode = jsonNode.get("value");
-//            if (valueNode != null) {
-//                JsonNode dataNode = valueNode.get("datas");
-//                if (dataNode != null) {
-//                    JsonNode carListNode = dataNode.get("vehicleModelList");
-//                    if (carListNode != null && carListNode.isArray()) {
-//                        // 处理车辆列表
-//                        return processCarList(carListNode);
-//                    }
-//                }
-//            }
-//
-//            // 如果没有找到车辆信息,尝试另一个接口
-//            url = "https://c.zhongan.com/open/bmw/car_controller/query_vehicle_model.json";
-//            params = new HashMap<>();
-//            params.put("vehicleBrand", this.modelCName);
-//            params.put("brandName", "");
-//            params.put("familyName", "");
-//            params.put("familyCode", "");
-//            params.put("engine", "");
-//            params.put("gearboxType", "");
-//            params.put("start", "0");
-//            params.put("limit", "30");
-//            params.put("callVehicleModelLibraryFlag", "1");
-//            params.put("flowId", this.flowId);
-//            params.put("page", "%2FvehicleModel%2Fvehicles");
-//            params.put("i", "e");
-//            params.put("flag", "0");
-//
-//            response = sendPostRequest(url, headers, cookies, params);
-//            jsonNode = mapper.readTree(response);
-//
-//            valueNode = jsonNode.get("value");
-//            if (valueNode != null) {
-//                dataNode = valueNode.get("datas");
-//                if (dataNode != null) {
-//                    JsonNode resultNode = dataNode.get("result");
-//                    if (resultNode != null) {
-//                        JsonNode carList = resultNode.get("vehicleList");
-//                        if (carList != null && carList.isArray()) {
-//                            // 处理车辆列表
-//                            return processCarList(carList);
-//                        }
-//                    }
-//                }
-//            }
-//
-//            Map<String, Object> errorResult = new HashMap<>();
-//            errorResult.put("code", 400);
-//            errorResult.put("message", "未找到车辆信息");
-//            return errorResult;
-//
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            Map<String, Object> errorResult = new HashMap<>();
-//            errorResult.put("code", 500);
-//            errorResult.put("message", "获取车辆信息失败: " + e.getMessage());
-//            return errorResult;
-//        }
-//    }
-//
-//    // 处理车辆列表
-//    private Map<String, Object> processCarList(JsonNode carListNode) throws Exception {
-//        // 实现车辆列表处理逻辑
-//        // 代码太长,这里省略具体实现,保持与Python代码逻辑一致
-//        return new HashMap<>();
-//    }
-//
-//    // 发送POST请求
-//    private String sendPostRequest(String url, Map<String, String> headers, Map<String, String> cookies,
-//                                   Map<String, String> params) throws IOException {
-//        CloseableHttpClient httpClient = HttpClients.createDefault();
-//        HttpPost httpPost = new HttpPost(url);
-//
-//        // 设置 headers
-//        if (headers != null) {
-//            for (Map.Entry<String, String> entry : headers.entrySet()) {
-//                httpPost.setHeader(entry.getKey(), entry.getValue());
-//            }
-//        }
-//
-//        // 设置 cookies
-//        if (cookies != null && !cookies.isEmpty()) {
-//            StringBuilder cookieStr = new StringBuilder();
-//            for (Map.Entry<String, String> entry : cookies.entrySet()) {
-//                cookieStr.append(entry.getKey()).append("=").append(entry.getValue()).append("; ");
-//            }
-//            httpPost.setHeader("Cookie", cookieStr.toString());
-//        }
-//
-//        // 设置参数
-//        if (params != null && !params.isEmpty()) {
-//            List<NameValuePair> nameValuePairs = new ArrayList<>();
-//            for (Map.Entry<String, String> entry : params.entrySet()) {
-//                nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
-//            }
-//            httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, StandardCharsets.UTF_8));
-//        }
-//
-//        try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
-//            HttpEntity entity = response.getEntity();
-//            return EntityUtils.toString(entity, StandardCharsets.UTF_8);
-//        }
-//    }
-//
-//    // 正则表达式提取
-//    private String extractByRegex(String text, String patternStr) {
-//        Pattern pattern = Pattern.compile(patternStr);
-//        Matcher matcher = pattern.matcher(text);
-//        if (matcher.find()) {
-//            return matcher.group(1);
-//        }
-//        return "";
-//    }
-//
-//    // 获取用户信息(假设实现)
-//    private void getUserInfo(String username) {
-//        // 实现获取用户信息的逻辑
-//    }
-//}
-//
-//// 配置类(假设)
-//class Config {
-//    public static final List<Map<String, String>> LICENSE_CODE = new ArrayList<>();
-//    public static final String[][] CITY_CODE = {};
-//
-//    static {
-//        // 初始化license_code数据
-//        // ...
-//    }
-//}