Browse Source

1. 紫金:调整获取支付链接接口归属信息从配置读取
2. 紫金:调整下载保单接口车辆查询列表机构信息参数从配置信息读取

wangrq 3 tháng trước cách đây
mục cha
commit
ef288ac90e

+ 5 - 60
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/service/TKHttpAPIService.java

@@ -446,9 +446,7 @@ public class TKHttpAPIService {
 
         // 车辆所有人信息
         TKCarOwnerVo carOwnerVo = new TKCarOwnerVo();
-
         CustomerInfoVo commonCustomersInfo = commonQuoteVo.getOwnersInfo();
-
         if (commonCustomersInfo != null) {
             carOwnerVo.setCarOwnerNature("1"); // todo
             carOwnerVo.setCertificateType("01");  // 身份证
@@ -502,9 +500,6 @@ public class TKHttpAPIService {
             car.setSeatFlag(1); // todo
             car.setExhaustScale(tkCarModel.getDisplacement().substring(0, tkCarModel.getDisplacement().indexOf(".")));
             car.setPurchasePrice(tkCarModel.getPurchasePrice().substring(0, tkCarModel.getPurchasePrice().indexOf(".")));
-//            car.setVinNo(commonCarInfoVo.getVinNo());
-//            car.setEngineNo(commonCarInfoVo.getEngineNo());
-//            car.setEnrollDate(commonCarInfoVo.getRegisterDate());
 
             Double tonCount = commonCarInfoVo.getTonCountDouble();
             if (tonCount != null && tonCount > 2) {
@@ -549,7 +544,6 @@ public class TKHttpAPIService {
                 // 默认 8B 非营业企业
                 car.setUseNatureCodeCode("8B");
             }
-
             TKSimpleService.setLicenseTypeByLicenseNo(car, car.getLicenseNo());
         }
 
@@ -568,11 +562,8 @@ public class TKHttpAPIService {
 
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("tkCarRequestToken", session.getToken());
-
         StringResponse response = client.request(HttpURL.carModelinfoCheckVehicleType, carModelinfoCheckVehicleTypeParam, httpHeaders, StringResponse.class);
-
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -611,9 +602,7 @@ public class TKHttpAPIService {
         httpHeaders.add("carinsurorderid", param.getOrderID());
 
         SaveBasicInfoResult.Response response = client.request(HttpURL.saveBasicInfo, param, httpHeaders, SaveBasicInfoResult.Response.class);
-
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -633,9 +622,7 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         InitQuoteResult.Response response = client.request(HttpURL.initQuote, param, httpHeaders, InitQuoteResult.Response.class);
-
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -678,9 +665,7 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         PreciseInitResult.Response response = client.request(HttpURL.preciseInit, param, httpHeaders, PreciseInitResult.Response.class);
-
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -689,9 +674,7 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         StringResponse response = client.request(HttpURL.preciseInit, param, httpHeaders, StringResponse.class);
-
         checkResponseUnknownField(response);
-
         return decrypt(response, PreciseInitResult.class);
     }
 
@@ -714,12 +697,8 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         StringResponse response = client.request(HttpURL.preciseInit, param, httpHeaders, StringResponse.class);
-
         checkResponseUnknownField(response);
-
-        PreciseInitResult decrypt = decrypt(response, PreciseInitResult.class);
-
-        return decrypt;
+        return decrypt(response, PreciseInitResult.class);
     }
 
     /**
@@ -737,9 +716,7 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         AgentTaxResult.Response response = client.request(HttpURL.agentTax, param, httpHeaders, AgentTaxResult.Response.class);
-
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -770,9 +747,7 @@ public class TKHttpAPIService {
         }
 
         InitQuotationResult.Response response1 = JsonUtil.readObjcet(json, InitQuotationResult.Response.class);
-
         checkResponseUnknownField(response1);
-
         return response1.getData();
     }
 
@@ -790,9 +765,7 @@ public class TKHttpAPIService {
 
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("tkCarRequestToken", token);
-
         InitQuotationResult.Response response = client.request(HttpURL.initQuotation, param, httpHeaders, InitQuotationResult.Response.class);
-
         return response.getData();
     }
 
@@ -817,7 +790,6 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         SaveQuoteResult.Response response = client.request(HttpURL.saveQuote, param, httpHeaders, SaveQuoteResult.Response.class);
-
         return response.getData();
     }
 
@@ -833,7 +805,6 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         FloatNoticeGetResult.Response response = client.request(HttpURL.floatNoticeGet, param, httpHeaders, FloatNoticeGetResult.Response.class);
-
         return response.getData();
     }
 
@@ -854,13 +825,9 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         StringResponse response = client.request(HttpURL.initProposal, param, httpHeaders, StringResponse.class);
-
         checkResponseUnknownField(response);
-
         InitProposalResult.Response response1 = decrypt(response, InitProposalResult.Response.class);
-
-//        checkResponseUnknownField(response1);
-
+        // checkResponseUnknownField(response1);
         return response1.getData();
     }
 
@@ -882,7 +849,6 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         EngageEngageQueryResult.Response response = client.request(HttpURL.engageEngageQuery, param, httpHeaders, EngageEngageQueryResult.Response.class);
-
         return response.getData();
     }
 
@@ -899,7 +865,6 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         InitFindRiskConfigResult.Response response = client.request(HttpURL.initFindRiskConfig, param, httpHeaders, InitFindRiskConfigResult.Response.class);
-
         return response.getData();
     }
 
@@ -915,7 +880,6 @@ public class TKHttpAPIService {
         httpHeaders.add("tkCarRequestToken", token);
 
         GroupOrderGetNewNoticeStatusResult.Response response = client.request(HttpURL.groupOrderGetNewNoticeStatus, param, httpHeaders, GroupOrderGetNewNoticeStatusResult.Response.class);
-
         return response.getData();
     }
 
@@ -930,10 +894,7 @@ public class TKHttpAPIService {
         httpHeaders.add("Actiontype", actionType);
 
         StringResponse response = client.request(HttpURL.entrance, param, httpHeaders, StringResponse.class);
-
-        B response1 = decrypt(response, responseType);
-
-        return response1;
+        return decrypt(response, responseType);
     }
 
     /**
@@ -948,10 +909,7 @@ public class TKHttpAPIService {
         httpHeaders.add("carssToken", carssToken);
 
         StringResponse response = client.request(HttpURL.entrance, param, httpHeaders, StringResponse.class);
-
-        B response1 = decrypt(response, responseType);
-
-        return response1;
+        return decrypt(response, responseType);
     }
 
     /**
@@ -965,7 +923,6 @@ public class TKHttpAPIService {
         httpHeaders.add("Actiontype", actionType);
 
         StringResponse response = client.request(HttpURL.entrance, param, httpHeaders, StringResponse.class);
-
         return response.getData();
     }
 
@@ -979,9 +936,7 @@ public class TKHttpAPIService {
         httpHeaders.add("Actiontype", actionType);
         httpHeaders.add("tkCarRequestToken", token);
 
-        B response = client.request(HttpURL.entrance, param, httpHeaders, responseType);
-
-        return response;
+        return client.request(HttpURL.entrance, param, httpHeaders, responseType);
     }
 
     /**
@@ -1000,7 +955,6 @@ public class TKHttpAPIService {
         param.setChannelEngages(new ArrayList<>());
 
         EntranceResult.Response response = entranceForJson(token, param, "000012", EntranceResult.Response.class);
-
         return response.getData();
     }
 
@@ -1051,7 +1005,6 @@ public class TKHttpAPIService {
         }
 
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -1070,9 +1023,7 @@ public class TKHttpAPIService {
         param.setUserId(userId);
 
         TKEntranceFor000086Result.Response response = entranceForDecrypt(token, carssToken, param, "000086", TKEntranceFor000086Result.Response.class);
-
         checkResponseUnknownField(response);
-
         return response.getData();
     }
 
@@ -1088,11 +1039,9 @@ public class TKHttpAPIService {
         param.setOrderID(orderId);
 
         String response = entranceForString(token, param, "000133");
-
         if (response != null) {
             response = response.replace("验车码:", "");
         }
-
         return response;
     }
 
@@ -1110,7 +1059,6 @@ public class TKHttpAPIService {
 
         // todo 这个接口,暂时了解到返回的数据的 data 字段是一个字符串格式,内容是 message 消息提示 “暂无模板,请联系客户经理”,怀疑有数据时会变成 json 数据,所以以后可能需要处理此问题。
         StringResponse response = client.request(HttpURL.carCheckAttorneyList, param, httpHeaders, StringResponse.class);
-
         return response.getData();
     }
 
@@ -1154,7 +1102,6 @@ public class TKHttpAPIService {
         // param.setFromId(null);
 
         StringResponse response = client.request(HttpURL.proposalDownload, param, null, StringResponse.class);
-
         return response.getData();
     }
 
@@ -1173,7 +1120,6 @@ public class TKHttpAPIService {
         param.setSubPolicyNo(subPolicyNo);
 
         StringResponse response = client.request(HttpURL.imageDownloadPolicy, param, null, StringResponse.class);
-
         return response.getData();
     }
 
@@ -1286,7 +1232,6 @@ public class TKHttpAPIService {
         StringResponse response = client.request(HttpURL.entrance, param, httpHeaders, StringResponse.class);
         TKEntranceFor000021Result.Response decrypt = decrypt(response, TKEntranceFor000021Result.Response.class);
 
-
         return decrypt.getData();
     }
 

+ 22 - 65
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/service/TKSimpleService.java

@@ -14,6 +14,7 @@ import com.jzg.quotation.taikang.crawler.model.TKLoginSession;
 import com.jzg.quotation.taikang.crawler.model.api.*;
 import com.jzg.quotation.taikang.crawler.model.entity.*;
 import jakarta.annotation.Resource;
+import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -119,64 +120,22 @@ public class TKSimpleService {
      */
     public static void setLicenseTypeByLicenseNo(TKCarInfoVo carInfoVo, String licenseNo) {
         carInfoVo.setLicenseNo(licenseNo);
-
-        String licenseType = null;
-        String licenseTypeChinese = null;
-
-        if (StringUtils.isNotBlank(licenseNo)) {
-
-            if (licenseNo.startsWith("使")) {
-                licenseType = "03";
-                licenseTypeChinese = "使馆汽车号牌";
-            } else if (licenseNo.startsWith("领")) {
-                licenseType = "04";
-                licenseTypeChinese = "领馆汽车号牌";
-            } else if (licenseNo.startsWith("学")) {
-                licenseType = "16";
-                licenseTypeChinese = "教练汽车号牌";
-            } else if (licenseNo.startsWith("警")) {
-                licenseType = "23";
-                licenseTypeChinese = "公安警车号牌";
-            } else if (licenseNo.startsWith("WJ")) {
-                int length = licenseNo.length();
-
-                if (length == 7) {
-                    licenseType = "02";
-                    licenseTypeChinese = "小型汽车号牌";
-                } else if (length == 8) {
-                    licenseType = "52";
-                    licenseTypeChinese = "小型新能源汽车";
-
-                }
-            } else if (TKCommonUtil.isArmyCar(licenseNo)) {
-                licenseType = "32";
-                licenseTypeChinese = "军队号牌";
-            } else {
-                int length = licenseNo.length();
-
-                if (length == 7) {
-                    licenseType = "02";
-                    licenseTypeChinese = "小型汽车号牌";
-                } else if (length == 8) {
-                    licenseType = "52";
-                    licenseTypeChinese = "小型新能源汽车";
-
-                }
-            }
-        }
-
-        carInfoVo.setLicenseType(licenseType);
-        carInfoVo.setLicenseTypeChinese(licenseTypeChinese);
+        LicenseTypeResult result = getLicenseTypeByLicenseNo(licenseNo);
+        carInfoVo.setLicenseType(result.getLicenseType());
+        carInfoVo.setLicenseTypeChinese(result.getLicenseTypeChinese());
     }
 
     public static void setLicenseTypeByLicenseNo(TKCar tkCar, String licenseNo) {
         tkCar.setLicenseNo(licenseNo);
+        LicenseTypeResult result = getLicenseTypeByLicenseNo(licenseNo);
+        tkCar.setLicenseType(result.getLicenseType());
+        tkCar.setLicenseTypeChinese(result.getLicenseTypeChinese());
+    }
 
+    private static LicenseTypeResult getLicenseTypeByLicenseNo(String licenseNo) {
         String licenseType = null;
         String licenseTypeChinese = null;
-
         if (StringUtils.isNotBlank(licenseNo)) {
-
             if (licenseNo.startsWith("使")) {
                 licenseType = "03";
                 licenseTypeChinese = "使馆汽车号牌";
@@ -191,34 +150,39 @@ public class TKSimpleService {
                 licenseTypeChinese = "公安警车号牌";
             } else if (licenseNo.startsWith("WJ")) {
                 int length = licenseNo.length();
-
                 if (length == 7) {
                     licenseType = "02";
                     licenseTypeChinese = "小型汽车号牌";
                 } else if (length == 8) {
                     licenseType = "52";
                     licenseTypeChinese = "小型新能源汽车";
-
                 }
             } else if (TKCommonUtil.isArmyCar(licenseNo)) {
                 licenseType = "32";
                 licenseTypeChinese = "军队号牌";
             } else {
                 int length = licenseNo.length();
-
                 if (length == 7) {
                     licenseType = "02";
                     licenseTypeChinese = "小型汽车号牌";
                 } else if (length == 8) {
                     licenseType = "52";
                     licenseTypeChinese = "小型新能源汽车";
-
                 }
             }
         }
+        return new LicenseTypeResult(licenseType, licenseTypeChinese);
+    }
 
-        tkCar.setLicenseType(licenseType);
-        tkCar.setLicenseTypeChinese(licenseTypeChinese);
+    @Getter
+    private static class LicenseTypeResult {
+        private final String licenseType;
+        private final String licenseTypeChinese;
+
+        private LicenseTypeResult(String licenseType, String licenseTypeChinese) {
+            this.licenseType = licenseType;
+            this.licenseTypeChinese = licenseTypeChinese;
+        }
     }
 
     /**
@@ -257,14 +221,10 @@ public class TKSimpleService {
      */
     public AgentFuzzyResult agentChannel(TKLoginSession session, String mainOrderId, String intermediaryName) {
         List<AgentFuzzyResult> agentFuzzyResults = httpService.agentFuzzy(session.getToken(), session.getTplatformId(), session.getFromid(), mainOrderId, intermediaryName);
-
         if (agentFuzzyResults == null || agentFuzzyResults.isEmpty()) {
             return null;
         }
-
-        AgentFuzzyResult agentFuzzyResult = agentFuzzyResults.get(0);
-
-        return agentFuzzyResult;
+        return agentFuzzyResults.get(0);
     }
 
     /**
@@ -277,9 +237,7 @@ public class TKSimpleService {
      * @return
      */
     public TKAgentQueryResult agentQuery(TKLoginSession session, String mainOrderId, AgentFuzzyResult agentFuzzyResult, String agentCode) {
-        TKAgentQueryResult agentQueryResult = httpService.agentQuery(session.getToken(), session.getTplatformId(), mainOrderId, agentFuzzyResult, agentCode);
-
-        return agentQueryResult;
+        return httpService.agentQuery(session.getToken(), session.getTplatformId(), mainOrderId, agentFuzzyResult, agentCode);
     }
 
     /**
@@ -557,7 +515,6 @@ public class TKSimpleService {
         carOwnerVo.setCarOwnerNature(insOrdersCarUserInfo.getPersonType().toString());
         carOwnerVo.setCertificateType("01");
 
-
         // 投保人信息
         TKAppliInfo appliInfo = new TKAppliInfo();
         appliInfo.setAppliName(carOwnerVo.getName());

+ 2 - 5
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/service/impl/TKQuotationBaseServiceImpl.java

@@ -121,14 +121,12 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
 
         // 查询代理机构
         AgentFuzzyResult agentFuzzyResult = tkSimpleService.agentChannel(session, mainOrderId, intermediaryName);
-
         if (agentFuzzyResult == null) {
             throw new RuntimeException("未能获取代理机构信息!");
         }
 
         // # 查询代理人
         TKAgentQueryResult agentQueryResult = tkSimpleService.agentQuery(session, mainOrderId, agentFuzzyResult, attributionInformationVo.getConfigInfo().get("agentCode"));
-
         if (agentQueryResult == null || agentQueryResult.getErrorMessage() != null) {
             throw new RuntimeException("未能获取代理人信息!");
         }
@@ -139,10 +137,10 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
         // 构建一个区域数据,供后面使用
         TKAreaInfoVo tkAreaInfoVo = tkSimpleService.dataCreateArea(session, mainOrderId, commonQuoteVo.getCarInfoVo(), agentFuzzyResult, attributionInformationVo.getConfigInfo().get("agentCode"), agentQueryResult, province);
 
-        // # 查询车型
+        // 查询车型
         CarModelinfoQueryResult carModelinfoQueryResult = tkSimpleService.queryCarModel(session, mainOrderId, commonQuoteVo.getCarInfoVo(), tkAreaInfoVo, commonQuoteVo.getOwnersInfo());
 
-        // 车管所校验接口  todo 暂时不知道是否需要执行 /car/modelinfo/checkVehicleType 接口
+        // 车管所校验
         httpService.carModelinfoCheckVehicleType(session, commonQuoteVo, mainOrderId, carModelinfoQueryResult);
 
         // # 创建车险投保单
@@ -150,7 +148,6 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
 
         // # 初始化车险投保单,保司返回保单信息(默认选择的交强险,商业险,不推荐的险种内容(有默认选中的),驾乘意外险,泰乐途)
         PreciseInitResult preciseInitResult = tkSimpleService.orderInit(session, mainOrderId);
-
         // 初始化失败,则返回
         QuoteResultsVo quoteResultsVo = tkCrawlerQuoteResultsBuild.buildQuoteFailResultsVo(preciseInitResult);
         if (quoteResultsVo != null) {

+ 1 - 0
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/build/ZiJinCrawlerQuoteRequestBuild.java

@@ -228,6 +228,7 @@ public class ZiJinCrawlerQuoteRequestBuild {
      *
      * @return ZiJinCrawlerQuotationRequest.BaseInfo
      */
+    @NotNull
     private ZiJinCrawlerQuotationRequest.BaseInfo buildBaseInfo(QuoteVo quoteVo, ZiJinCrawlerConfigureParameters parameters, String operatorCode) {
         ZiJinCrawlerQuotationRequest.BaseInfo baseInfo = new ZiJinCrawlerQuotationRequest.BaseInfo();
         baseInfo.setAgentCode(parameters.getAgentCode());

+ 7 - 22
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/component/ZiJinBuildingAttributionInformation.java

@@ -1,14 +1,11 @@
 package com.jzg.quotation.zijin.crawler.component;
 
+import com.alibaba.fastjson.JSON;
+import com.jzg.commons.entity.quote.vo.AttributionInformationVo;
+import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
 import com.jzg.quotation.zijin.crawler.entity.ZiJinCrawlerConfigureParameters;
-import com.jzg.quotation.zijin.crawler.entity.request.ZiJinCrawlerCompaniesRequest;
-import com.jzg.quotation.zijin.crawler.entity.request.quote.ProposalInfoDTO;
-import com.jzg.quotation.zijin.crawler.entity.response.ZiJinCrawlerChannelPackagesResponse;
-import com.jzg.quotation.zijin.crawler.entity.response.ZiJinCrawlerCompaniesResponse;
-import com.jzg.quotation.zijin.crawler.entity.response.ZiJinCrawlerGetSaleInfoResponse;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Component;
 
 /**
@@ -23,22 +20,10 @@ public class ZiJinBuildingAttributionInformation {
 
     private final ZiJinCrawlerRequestComponent boHaiCrawlerRequestComponent;
 
-    public ProposalInfoDTO build(ZiJinCrawlerConfigureParameters parameters, String operatorCode, HttpHeaders headers) {
-        /*try {
-            // 机构查询
-            ZiJinCrawlerCompaniesRequest boHaiCrawlerCompaniesRequest = new ZiJinCrawlerCompaniesRequest(parameters.getCDptCde(), parameters.getLoginCompany(), operatorCode);
-            ZiJinCrawlerCompaniesResponse.ListDTO companies = boHaiCrawlerRequestComponent.companies(boHaiCrawlerCompaniesRequest, parameters.getCDptCde(), headers);
-            // 获取渠道信息
-            ZiJinCrawlerGetSaleInfoResponse saleInfo = boHaiCrawlerRequestComponent.getSaleInfo(operatorCode, headers);
-            // 渠道套餐查询
-            ZiJinCrawlerChannelPackagesRequest boHaiCrawlerChannelPackagesRequest = new ZiJinCrawlerChannelPackagesRequest(parameters, operatorCode);
-            ZiJinCrawlerChannelPackagesResponse boHaiCrawlerChannelPackagesResponse = boHaiCrawlerRequestComponent.channelPackages(boHaiCrawlerChannelPackagesRequest, parameters.getChannelPackages(), headers);
-            return new ProposalInfoDTO(companies, boHaiCrawlerChannelPackagesResponse, saleInfo, parameters.getLoginCompany());
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }*/
-        return null;
+    public ZiJinCrawlerConfigureParameters getZiJinCrawlerConfigureParameters(AttributionInformationVo attributionInformationVo) {
+        ZiJinCrawlerConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(ZiJinCrawlerConfigureParameters.class, attributionInformationVo.getConfigInfo());
+        log.info("紫金爬虫归属配置信息:{}", JSON.toJSONString(parameters));
+        return parameters;
     }
 
 }

+ 10 - 9
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/component/ZiJinCrawlerCacheComponent.java

@@ -19,7 +19,6 @@ import java.time.Duration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @description: 渤海财险爬虫缓存组件实现
@@ -40,7 +39,7 @@ public class ZiJinCrawlerCacheComponent {
     // 紫金财险授权
     public static final String ZIJIN_AUTHORIZATION = "zijin:authorization:";
 
-    //渤海财险授权保存时间
+    // 紫金财险授权保存时间
     public static final int ZIJIN_AUTHORIZATION_TIME = 6;
 
     public static final String BEARER = "Bearer ";
@@ -59,20 +58,20 @@ public class ZiJinCrawlerCacheComponent {
 
     /**
      * 缓存认证信息
+     *
      * @param token
      * @param userCode
-     * @param username
+     * @param
      * @return String
      */
     public String cacheAuthorization(String token, String userCode, String userName) {
         Map<String, String> authorizationMap = new HashMap<>();
-        String authorization = token;
-        authorizationMap.put(AUTHORIZATION, authorization);
+        authorizationMap.put(AUTHORIZATION, token);
         authorizationMap.put(USER_CODE, userCode);
         RMap<Object, Object> map = redissonClient.getMap(ZIJIN_AUTHORIZATION + userCode);
         map.putAll(authorizationMap);
         map.expire(Duration.ofHours(ZIJIN_AUTHORIZATION_TIME));
-        return authorization;
+        return token;
     }
 
     /**
@@ -120,7 +119,8 @@ public class ZiJinCrawlerCacheComponent {
 
     /**
      * 缓存图片信息
-     * @param orderNo 订单号
+     *
+     * @param orderNo  订单号
      * @param dataDTOS 图片信息
      */
     public void cacheImagesInfo(String orderNo, List<ZiJinCrawlerUploadImageInfoListRequest.ItemFileDataListDTO> dataDTOS) {
@@ -130,6 +130,7 @@ public class ZiJinCrawlerCacheComponent {
 
     /**
      * 获取图片信息
+     *
      * @param orderNo 订单号
      * @return 图片信息
      */
@@ -142,8 +143,8 @@ public class ZiJinCrawlerCacheComponent {
     /**
      * 缓存订单信息
      *
-     * @param orderNo   订单号
-     * @param order 报价请求信息
+     * @param orderNo 订单号
+     * @param order   报价请求信息
      */
     public void cacheOrderRequest(String orderNo, ZiJinCrawlerOrder order) {
         String responseStr = JSONObject.toJSONString(order);

+ 32 - 26
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/service/impl/ZiJinCrawlerRequestImpl.java

@@ -16,7 +16,6 @@ import com.jzg.quotation.commons.constant.InsuranceCode;
 import com.jzg.quotation.commons.entity.DetectLoginRequest;
 import com.jzg.quotation.commons.entity.GetCaptchaRequest;
 import com.jzg.quotation.commons.entity.GetCaptchaResponse;
-import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
 import com.jzg.quotation.commons.utils.DateTimeUtil;
 import com.jzg.quotation.commons.utils.TimeProcessing;
 import com.jzg.quotation.zijin.crawler.build.ZiJinCrawlerQuoteRequestBuild;
@@ -38,6 +37,7 @@ import com.jzg.quotation.zijin.crawler.util.Base64ImageExtractor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.http.HttpHeaders;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
@@ -116,9 +116,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
         HttpHeaders headers = ziJinCrawlerQuoteProcessService.getHeaders(attributionInformationVo.getUsername(), attributionInformationVo.getPassword());
         log.info("headers参数的值:{}", JSON.toJSONString(headers));
 
-        // 1.1 解析配置参数
-        ZiJinCrawlerConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(ZiJinCrawlerConfigureParameters.class, attributionInformationVo.getConfigInfo());
-        log.info("parameters参数的值:{}", JSON.toJSONString(parameters));
+        ZiJinCrawlerConfigureParameters parameters = ziJinBuildingAttributionInformation.getZiJinCrawlerConfigureParameters(attributionInformationVo);
 
         try {
             // 查询车辆信息
@@ -250,8 +248,8 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
             AttributionInformationVo attributionInformationVo = paymentLinkVo.getOrder().getAttributionInformationVo();
             log.info("attributionInformationVo对象的值:{}", JSONObject.toJSONString(attributionInformationVo));
             HttpHeaders headers = ziJinCrawlerQuoteProcessService.getHeaders(attributionInformationVo.getUsername(), attributionInformationVo.getPassword());
+            ZiJinCrawlerConfigureParameters parameters = ziJinBuildingAttributionInformation.getZiJinCrawlerConfigureParameters(attributionInformationVo);
             ZiJinCrawlerOrder ziJinCrawlerOrder = ziJinCrawlerOrderService.getByOrdersNo(paymentLinkVo.getOrder().getOrdersNo());
-
             log.info("获取支付链接,订单号:{}", ziJinCrawlerOrder.getOrderNo());
 
             ZiJinCrawlerPaymentLinkRequest ziJinCrawlerPaymentLinkRequest = new ZiJinCrawlerPaymentLinkRequest();
@@ -262,15 +260,15 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
             paymentApplicationDto.setInvokeSystem("0201");
             paymentApplicationDto.setPremium(ziJinCrawlerOrder.getTotalPremium());
             ziJinCrawlerPaymentLinkRequest.setPaymentApplicationDtos(Collections.singletonList(paymentApplicationDto));
-            ziJinCrawlerPaymentLinkRequest.setOperatorCode("214000151");
-            ziJinCrawlerPaymentLinkRequest.setCompanyCode("2140000601");
+            ziJinCrawlerPaymentLinkRequest.setOperatorCode(attributionInformationVo.getUsername());
+            ziJinCrawlerPaymentLinkRequest.setCompanyCode(parameters.getComCode());
 
             // 获取支付链接
             ZiJinCrawlerPaymentLinkResponse ziJinCrawlerPaymentLinkResponse = ziJinCrawlerRequestComponent.payment(ziJinCrawlerPaymentLinkRequest, headers);
             log.info("ziJinCrawlerPaymentLinkResponse参数的值:{}", JSON.toJSONString(ziJinCrawlerPaymentLinkResponse));
             PaymentLinkResultsVo paymentLinkResultsVo = new PaymentLinkResultsVo();
             // 支付链接获取成功
-            if ("0000".equals(ziJinCrawlerPaymentLinkResponse.getRtnCode())) {
+            if (ResponseCode.R_0000.getCode().equals(ziJinCrawlerPaymentLinkResponse.getRtnCode())) {
                 paymentLinkResultsVo.setPayLinkStatus(true);
                 paymentLinkResultsVo.setPaymentLink(ziJinCrawlerPaymentLinkResponse.getWechatUrl());
             } else {
@@ -363,7 +361,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
                 ZiJinCrawlerImageUploadResponse ziJinCrawlerImageUploadResponse = ziJinCrawlerRequestComponent.uploadImage(ziJinCrawlerImageUploadRequest, headers);
                 log.info("影像上传响应,订单号:{},响应:{}", ziJinCrawlerOrder.getOrderNo(), JSON.toJSONString(ziJinCrawlerImageUploadResponse));
 
-                if ("0000".equals(ziJinCrawlerImageUploadResponse.getRtnCode())) {
+                if (ResponseCode.R_0000.getCode().equals(ziJinCrawlerImageUploadResponse.getRtnCode())) {
 
                     ZiJinCrawlerUploadImageInfoListRequest.ItemFileDataListDTO fileInfo = ZiJinCrawlerUploadImageInfoListRequest.ItemFileDataListDTO.builder()
                             .fileId(ziJinCrawlerImageUploadResponse.getFileId())
@@ -398,10 +396,10 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
     }
 
     /**
-     * 根据影像编码获取文件类型
+     * 系统影像编码转换为紫金对应的文件类型代码
      *
      * @param imageCode 影像编码
-     * @return 文件类型
+     * @return 紫金对应的文件类型代码
      */
     private String getFileTypeByImageCode(String imageCode) {
         switch (imageCode) {
@@ -439,20 +437,11 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
             HttpHeaders headers = ziJinCrawlerQuoteProcessService.getHeaders(attributionInformationVo.getUsername(), attributionInformationVo.getPassword());
             ZiJinCrawlerOrder ziJinCrawlerOrder = ziJinCrawlerOrderService.getByOrdersNo(orderStatusVo.getOrder().getOrdersNo());
 
-            ZiJinCrawlerQueryOrderStatusRequest ziJinCrawlerQueryOrderStatusRequest = new ZiJinCrawlerQueryOrderStatusRequest();
-            // 设置请求参数
-            ziJinCrawlerQueryOrderStatusRequest.setOrderStatus(new String[]{});
-            ziJinCrawlerQueryOrderStatusRequest.setOrderNo(ziJinCrawlerOrder.getOrderNo());
-            ziJinCrawlerQueryOrderStatusRequest.setLicenseNo(orderStatusVo.getCarInfo().getLicenseNo());
-            ziJinCrawlerQueryOrderStatusRequest.setUpdateTimeBegin(DateTimeUtil.getLocalDateStr());
-            ziJinCrawlerQueryOrderStatusRequest.setUpdateTimeEnd(DateTimeUtil.getLocalDateStr());
-            ziJinCrawlerQueryOrderStatusRequest.setPageNum(1);
-            ziJinCrawlerQueryOrderStatusRequest.setPageSize(10);
-            ziJinCrawlerQueryOrderStatusRequest.setProductCodeList(new String[]{});
-            ziJinCrawlerQueryOrderStatusRequest.setOrderOrigin("KSCD_PROD,FH_PROD,DP_WXMP,DP_ZYB,RENEWAL_PROD,DP_ZNCD,SHHTB_B,QYYGTB");
+            ZiJinCrawlerQueryOrderStatusRequest ziJinCrawlerQueryOrderStatusRequest = getZiJinCrawlerQueryOrderStatusRequest(orderStatusVo, ziJinCrawlerOrder);
 
             ZiJinCrawlerQueryOrderStatusResponse ziJinCrawlerQueryOrderStatusResponse = ziJinCrawlerRequestComponent.queryOrderStatus(ziJinCrawlerQueryOrderStatusRequest, headers);
             log.info("ziJinCrawlerQueryOrderStatusResponse对象的值:{}", JSON.toJSONString(ziJinCrawlerQueryOrderStatusResponse));
+
             // 获取订单状态
             String orderStatus = ziJinCrawlerQueryOrderStatusResponse.getData().getContent().get(0).getOrderStatus();
             log.info("订单状态:{},中文含义:{}", orderStatus, ziJinCrawlerQueryOrderStatusResponse.getData().getContent().get(0).getOrderStatusCN());
@@ -489,17 +478,18 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
         try {
             log.info("downloadPolicy入参的值:{}", JSONObject.toJSONString(downloadPolicyVo));
             ZiJinCrawlerOrder ziJinCrawlerOrder = ziJinCrawlerOrderService.getByOrdersNo(downloadPolicyVo.getOrder().getOrdersNo());
-
+            AttributionInformationVo attributionInformationVo = downloadPolicyVo.getOrder().getAttributionInformationVo();
+            ZiJinCrawlerConfigureParameters parameters = ziJinBuildingAttributionInformation.getZiJinCrawlerConfigureParameters(attributionInformationVo);
             // 1、查询车辆保单列表(下载保单的前一步操作)
-            ZiJinCrawlerQueryCarPolicyListRequest ziJinCrawlerQueryCarPolicyListRequest = setQueryCarPolicyListRequest(downloadPolicyVo.getBeginDate(), downloadPolicyVo.getEndDate(), "2140000601");
+            ZiJinCrawlerQueryCarPolicyListRequest ziJinCrawlerQueryCarPolicyListRequest = setQueryCarPolicyListRequest(downloadPolicyVo.getBeginDate(), downloadPolicyVo.getEndDate(), parameters.getComCode());
             ZiJinCrawlerQueryCarPolicyListResponse ziJinCrawlerQueryCarPolicyListResponse = ziJinCrawlerRequestComponent.queryCarPolicyList(ziJinCrawlerQueryCarPolicyListRequest);
             log.info("ziJinCrawlerQueryCarPolicyListResponse响应对象的值:{}", JSON.toJSONString(ziJinCrawlerQueryCarPolicyListResponse));
 
             List<ZiJinCrawlerQueryCarPolicyListResponse.PolicyContent> content = ziJinCrawlerQueryCarPolicyListResponse.getData().getPolicyDataInfoDtoList().getContent();
             // 获取所有的保单号
-            List<String> policyNos = content.stream().map(ZiJinCrawlerQueryCarPolicyListResponse.PolicyContent::getPolicyNo).collect(Collectors.toList());
+            List<String> policyNos = content.stream().map(ZiJinCrawlerQueryCarPolicyListResponse.PolicyContent::getPolicyNo).toList();
             // 获取所有的加密验证码
-            List<String> encryptCodes = content.stream().map(ZiJinCrawlerQueryCarPolicyListResponse.PolicyContent::getEncrypt).collect(Collectors.toList());
+            List<String> encryptCodes = content.stream().map(ZiJinCrawlerQueryCarPolicyListResponse.PolicyContent::getEncrypt).toList();
             // 将保单号和加密验证码一一对应
             Map<String, String> policyNoEncryptMap = new LinkedHashMap<>();
             for (int i = 0; i < policyNos.size(); i++) {
@@ -552,6 +542,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
      * @param loginComCode 登录公司编码
      * @return ZiJinCrawlerQueryCarPolicyListRequest
      */
+    @NotNull
     private ZiJinCrawlerQueryCarPolicyListRequest setQueryCarPolicyListRequest(String beginDate, String endDate, String loginComCode) {
         ZiJinCrawlerQueryCarPolicyListRequest ziJinCrawlerQueryCarPolicyListRequest = new ZiJinCrawlerQueryCarPolicyListRequest();
         ziJinCrawlerQueryCarPolicyListRequest.setInputDateBegin(beginDate);
@@ -567,6 +558,21 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
         return ziJinCrawlerQueryCarPolicyListRequest;
     }
 
+    @NotNull
+    private ZiJinCrawlerQueryOrderStatusRequest getZiJinCrawlerQueryOrderStatusRequest(OrderStatusVo orderStatusVo, ZiJinCrawlerOrder ziJinCrawlerOrder) {
+        ZiJinCrawlerQueryOrderStatusRequest ziJinCrawlerQueryOrderStatusRequest = new ZiJinCrawlerQueryOrderStatusRequest();
+        ziJinCrawlerQueryOrderStatusRequest.setOrderStatus(new String[]{});
+        ziJinCrawlerQueryOrderStatusRequest.setOrderNo(ziJinCrawlerOrder.getOrderNo());
+        ziJinCrawlerQueryOrderStatusRequest.setLicenseNo(orderStatusVo.getCarInfo().getLicenseNo());
+        ziJinCrawlerQueryOrderStatusRequest.setUpdateTimeBegin(DateTimeUtil.getLocalDateStr());
+        ziJinCrawlerQueryOrderStatusRequest.setUpdateTimeEnd(DateTimeUtil.getLocalDateStr());
+        ziJinCrawlerQueryOrderStatusRequest.setPageNum(1);
+        ziJinCrawlerQueryOrderStatusRequest.setPageSize(10);
+        ziJinCrawlerQueryOrderStatusRequest.setProductCodeList(new String[]{});
+        ziJinCrawlerQueryOrderStatusRequest.setOrderOrigin("KSCD_PROD,FH_PROD,DP_WXMP,DP_ZYB,RENEWAL_PROD,DP_ZNCD,SHHTB_B,QYYGTB");
+        return ziJinCrawlerQueryOrderStatusRequest;
+    }
+
 
     /**
      * 截取重复投保终保日期的正则表达式