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

华泰cookie信息区分账号改造

lixiaolong 1 месяц назад
Родитель
Сommit
9a609b2257

+ 28 - 23
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/component/HtCrawlerRequestComponent.java

@@ -45,65 +45,71 @@ public class HtCrawlerRequestComponent {
      * @return
      */
     public Map<String, Object> authenticate(LoginDTO loginDTO, int loginsNumber) {
-        if(StringUtils.isNotBlank(huaTaiCrawlerCacheComponent.getCookie()) && StringUtils.isNotBlank(huaTaiCrawlerCacheComponent.getGsInfo())) {
+        String username = loginDTO.getUsername();
+        String comcode  = loginDTO.getComcode();
+
+        String cachedCookie = huaTaiCrawlerCacheComponent.getCookie(username, comcode);
+        String cachedGsInfo = huaTaiCrawlerCacheComponent.getGsInfo(username, comcode);
+        if (StringUtils.isNotBlank(cachedCookie) && StringUtils.isNotBlank(cachedGsInfo)) {
             Map<String, Object> res = new HashMap<>();
-            res.put("cookies", huaTaiCrawlerCacheComponent.getCookie());
-            res.put("gsInfo", huaTaiCrawlerCacheComponent.getGsInfo());
-            res.put("comCode", huaTaiCrawlerCacheComponent.getComCode());
+            res.put("cookies", cachedCookie);
+            res.put("gsInfo", cachedGsInfo);
+            res.put("comCode", huaTaiCrawlerCacheComponent.getComCode(username, comcode));
             return res;
         }
-        Map<String, Object> stringObjectMap = null;
+        Map<String, Object> stringObjectMap;
         try {
-            stringObjectMap = cookieUtils.mainFlow(loginDTO.getUsername(), loginDTO.getPassword(), loginDTO.getComcode(), loginDTO.getUseridname(), loginDTO.getDlrCode(), loginDTO.getDlxyCode(), 9999);
-            if(stringObjectMap == null) return null;
+            stringObjectMap = cookieUtils.mainFlow(username, loginDTO.getPassword(), comcode,
+                    loginDTO.getUseridname(), loginDTO.getDlrCode(), loginDTO.getDlxyCode(), 9999);
+            if (stringObjectMap == null) return null;
             log.info("登录stringObjectMap:{}", JSONObject.toJSONString(stringObjectMap));
-            huaTaiCrawlerCacheComponent.cacheCookie(stringObjectMap.get("cookies").toString());
-            huaTaiCrawlerCacheComponent.cacheGsInfo(stringObjectMap.get("gsInfo").toString());
-            huaTaiCrawlerCacheComponent.cacheComCode(stringObjectMap.get("comCode").toString());
+            huaTaiCrawlerCacheComponent.cacheCookie(username, comcode, stringObjectMap.get("cookies").toString());
+            huaTaiCrawlerCacheComponent.cacheGsInfo(username, comcode, stringObjectMap.get("gsInfo").toString());
+            huaTaiCrawlerCacheComponent.cacheComCode(username, comcode, stringObjectMap.get("comCode").toString());
         } catch (Exception e) {
             throw new RuntimeException("抱歉,无法获取登录信息,请稍后重试");
         }
         return stringObjectMap;
     }
 
-    public String getCookie() {
-        return huaTaiCrawlerCacheComponent.getCookie();
+    // 这三个方法改为带参(原来无参)
+    public String getCookie(String username, String comcode) {
+        return huaTaiCrawlerCacheComponent.getCookie(username, comcode);
     }
 
-    public String getGsInfo() {
-        return huaTaiCrawlerCacheComponent.getGsInfo();
+    public String getGsInfo(String username, String comcode) {
+        return huaTaiCrawlerCacheComponent.getGsInfo(username, comcode);
     }
 
-    public String getHaTaiCookie(String requestUrl) {
-        return huaTaiCrawlerCacheComponent.getCookie();
+    public String getHaTaiCookie(String username, String comcode, String requestUrl) {
+        return huaTaiCrawlerCacheComponent.getCookie(username, comcode);
     }
 
     /**
      * 获取请求头
      * @return
      */
-    public HttpHeaders getHeaders() {
+    public HttpHeaders getHeaders(String username, String comcode) {
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.set("Accept", "application/json, text/javascript, */*; q=0.01");
         httpHeaders.set("Accept-Language", "zh-CN,zh;q=0.9");
         httpHeaders.set("Cache-Control", "no-cache");
         httpHeaders.set("Connection", "keep-alive");
-        httpHeaders.add(HtRequestConstant.COOKIE, huaTaiCrawlerCacheComponent.getCookie());
+        httpHeaders.add(HtRequestConstant.COOKIE, huaTaiCrawlerCacheComponent.getCookie(username, comcode));
         httpHeaders.setContentType(MediaType.valueOf("application/x-www-form-urlencoded; charset=UTF-8"));
         httpHeaders.set("Origin", "https://cspxp.pc.ehuatai.com");
         httpHeaders.set("Pragma", "no-cache");
         httpHeaders.set("Referer", "https://cspxp.pc.ehuatai.com/htcsp/");
         httpHeaders.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36");
-        httpHeaders.set("sec-ch-ua", "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\"");
+        httpHeaders.set("sec-ch-ua", "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand)\";v=\"24\"");
         httpHeaders.set("sec-ch-ua-mobile", "?0");
         httpHeaders.set("sec-ch-ua-platform", "\"Windows\"");
-
         return httpHeaders;
     }
 
-    public HttpHeaders getHeaders1() {
+    public HttpHeaders getHeaders1(String username, String comcode) {
         HttpHeaders headers = new HttpHeaders();
-        headers.add(HtRequestConstant.COOKIE, huaTaiCrawlerCacheComponent.getCookie());
+        headers.add(HtRequestConstant.COOKIE, huaTaiCrawlerCacheComponent.getCookie(username, comcode));
         headers.set("Accept", "application/json, text/javascript, */*; q=0.01");
         headers.set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8");
         headers.set("Cache-Control", "no-cache");
@@ -114,7 +120,6 @@ public class HtCrawlerRequestComponent {
         headers.set("Referer", "https://cspxp.pc.ehuatai.com/htcsp/VehicleInfoEntryAction.do?cmd=startProcess");
         headers.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36");
         headers.set("X-Requested-With", "XMLHttpRequest");
-
         return headers;
     }
 

+ 33 - 29
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/component/HuaTaiCrawlerCacheComponent.java

@@ -18,45 +18,44 @@ public class HuaTaiCrawlerCacheComponent {
     private final RedissonClient redissonClient;
 
     public static final String HUATAI_COOKIE = "huatai:cookie:";
-
     public static final String HUATAI_GSINFO = "huatai:gsinfo:";
-
     public static final String HUATAI_COMCODE = "huatai:comcode:";
-
     public static final String HUATAI_YINGXIANG_UPLOADED = "huatai:yx:";
 
     public static final String COOKIE = "Cookie:";
-
     public static final String GSINFO = "gsInfo:";
-
     public static final String COMCODE = "comCode:";
-
     public static final String YINGXIANG_UPLOADED = "yx:";
 
-    public void cacheCookie(String cookie) {
-        Map<String, String> authorizationMap = new HashMap<>();
+    /**
+     * 用账号维度生成缓存 key。账号唯一标识优先用 username,兜底用 comcode。
+     */
+    private String accountKey(String prefix, String username, String comcode) {
+        String account = org.springframework.util.StringUtils.hasText(username) ? username : comcode;
+        return prefix + account;
+    }
 
-        authorizationMap.put(COOKIE, cookie);
-        RMap<Object, Object> map = redissonClient.getMap(HUATAI_COOKIE);
-        map.putAll(authorizationMap);
+    public void cacheCookie(String username, String comcode, String cookie) {
+        Map<String, String> m = new HashMap<>();
+        m.put(COOKIE, cookie);
+        RMap<Object, Object> map = redissonClient.getMap(accountKey(HUATAI_COOKIE, username, comcode));
+        map.putAll(m);
         map.expire(Duration.ofDays(30L));
     }
 
-    public void cacheGsInfo(String gsinfo) {
-        Map<String, String> authorizationMap = new HashMap<>();
-
-        authorizationMap.put(GSINFO, gsinfo);
-        RMap<Object, Object> map = redissonClient.getMap(HUATAI_GSINFO);
-        map.putAll(authorizationMap);
+    public void cacheGsInfo(String username, String comcode, String gsinfo) {
+        Map<String, String> m = new HashMap<>();
+        m.put(GSINFO, gsinfo);
+        RMap<Object, Object> map = redissonClient.getMap(accountKey(HUATAI_GSINFO, username, comcode));
+        map.putAll(m);
         map.expire(Duration.ofDays(30L));
     }
 
-    public void cacheComCode(String comcode) {
-        Map<String, String> authorizationMap = new HashMap<>();
-
-        authorizationMap.put(COMCODE, comcode);
-        RMap<Object, Object> map = redissonClient.getMap(HUATAI_COMCODE);
-        map.putAll(authorizationMap);
+    public void cacheComCode(String username, String comcode, String comcodeVal) {
+        Map<String, String> m = new HashMap<>();
+        m.put(COMCODE, comcodeVal);
+        RMap<Object, Object> map = redissonClient.getMap(accountKey(HUATAI_COMCODE, username, comcode));
+        map.putAll(m);
         map.expire(Duration.ofDays(30L));
     }
 
@@ -69,20 +68,25 @@ public class HuaTaiCrawlerCacheComponent {
         map.expire(Duration.ofDays(30L));
     }
 
-    public String getCookie() {
-        return (String) redissonClient.getMap(HUATAI_COOKIE).get(COOKIE);
+    public String getCookie(String username, String comcode) {
+        return (String) redissonClient.getMap(accountKey(HUATAI_COOKIE, username, comcode)).get(COOKIE);
     }
 
-    public String getGsInfo() {
-        return (String) redissonClient.getMap(HUATAI_GSINFO).get(GSINFO);
+    public String getGsInfo(String username, String comcode) {
+        return (String) redissonClient.getMap(accountKey(HUATAI_GSINFO, username, comcode)).get(GSINFO);
     }
 
-    public String getComCode() {
-        return (String) redissonClient.getMap(HUATAI_COMCODE).get(COMCODE);
+    public String getComCode(String username, String comcode) {
+        return (String) redissonClient.getMap(accountKey(HUATAI_COMCODE, username, comcode)).get(COMCODE);
     }
 
     public String getYingXiangUploaded() {
         return (String) redissonClient.getMap(HUATAI_YINGXIANG_UPLOADED).get(YINGXIANG_UPLOADED);
     }
 
+    public void clearLoginCache(String username, String comcode) {
+        redissonClient.getMap(accountKey(HUATAI_COOKIE, username, comcode)).delete();
+        redissonClient.getMap(accountKey(HUATAI_GSINFO, username, comcode)).delete();
+        redissonClient.getMap(accountKey(HUATAI_COMCODE, username, comcode)).delete();
+    }
 }

+ 48 - 41
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java

@@ -138,9 +138,11 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
     @Override
     public boolean detectLogin(DetectLoginRequest r) {
-        String cookie = req.getCookie();
+        String username = r.getUsername();   // 若 DetectLoginRequest 无 username,用 r.getAttr().getUsername()
+        String comcode  = r.getPassword();
+        String cookie = req.getCookie(username, comcode);
         if (!StringUtils.hasText(cookie)) {
-            cookie = req.getHaTaiCookie(RequestUrl.NE_COOKIE.getRequestUrl(props.getBaseUrl()));
+            cookie = req.getHaTaiCookie(username, comcode, RequestUrl.NE_COOKIE.getRequestUrl(props.getBaseUrl()));
         }
         return StringUtils.hasText(cookie);
     }
@@ -219,6 +221,8 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         // 构造登录参数
         AttributionInformationVo attr = quoteVo.getOrder().getAttributionInformationVo();
         LoginDTO dto = buildLoginDTO(attr);
+        String username = dto.getUsername();
+        String comcode  = dto.getComcode();
         // 获取登录相关信息
         Map<String, Object> mmap = login(dto);
         // 归属信息
@@ -232,7 +236,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         // 带重试的获取报价编号、车型型号
         Map<String, Object> xbResult = retry(() -> {
             try {
-                String freshCookie = cache.getCookie();
+                String freshCookie = cache.getCookie(username, comcode);
                 String useCookie = StringUtils.hasText(freshCookie) ? freshCookie : cookie;
                 return xbQuery(dto.getUsername(), useCookie, car);
             }
@@ -247,7 +251,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         // 报价前预处理-保存车辆信息、过滤车型等处理
         PreResult pre = null;
         try {
-            pre = prepareQuote(attr, mmap, car, modelcodexh, cache.getCookie(), quotationNo, xbResult, "");
+            pre = prepareQuote(attr, mmap, car, modelcodexh, cache.getCookie(username, comcode), quotationNo, xbResult, "");
         } catch (Exception e) {
             log.error("报价失败:保存车辆信息、过滤车型异常,{}",e.getMessage());
             throw new SystemException(e.getMessage());
@@ -255,7 +259,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         // 报价
         CoreResult core = null;
         try {
-            core = executeQuote(quoteVo, quotationNo, dto, cache.getCookie(), pre, gsInfo, attr);
+            core = executeQuote(quoteVo, quotationNo, dto, cache.getCookie(username, comcode), pre, gsInfo, attr);
         } catch (Exception e) {
             log.error("报价失败,{}",e.getMessage());
             throw new SystemException(e.getMessage());
@@ -287,9 +291,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     }
 
     private void refreshLogin(LoginDTO dto) {
-        cache.cacheCookie("");
-        cache.cacheGsInfo("");
-        cache.cacheComCode("");
+        cache.clearLoginCache(dto.getUsername(), dto.getComcode());
         log.info("refreshLogin gsInfo: {}", JSONObject.toJSONString(login(dto)));
     }
 
@@ -329,9 +331,9 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         HtCrawlerCarQueryResponse.DataDTO dataDTO = null;
         //车辆查询
         if (StringUtils.isBlank(carChange)) {
-            dataDTO = req.carQuery(new HtCrawlerCarQueryRequest(car, modelcodexh, xbResult), req.getHeaders1(), car);
+            dataDTO = req.carQuery(new HtCrawlerCarQueryRequest(car, modelcodexh, xbResult), req.getHeaders1(attr.getUsername(), attr.getConfigInfo().get("comCode")), car);
         } else {
-            HttpHeaders headers = buildReCarQueryHeaders(req.getCookie());
+            HttpHeaders headers = buildReCarQueryHeaders(req.getCookie(attr.getUsername(), attr.getConfigInfo().get("comCode")));
             Map<String, Object> dataDTOMap = new HashMap<>();
             dataDTOMap.put("vehiclemodel", car.getBrandName());
             fillVehicleTypeCodes(car, dataDTOMap, "motortypecode", "motorusagetypecode");
@@ -379,8 +381,8 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         log.info("车辆查询,carDTO,{}",carDTO);
         if (carDTO == null) {
             // 未匹配则第二次carquery,带modelCName-->vehiclemodel
-            //dataDTO = req.carQuery(new HtCrawlerCarQueryRequest2(car), req.getHeaders1(), car);
-            dataDTO = req.carQuery(new HtCrawlerCarQueryRequest(car, "", xbResult), req.getHeaders1(), car);
+            //dataDTO = req.carQuery(new HtCrawlerCarQueryRequest2(car), req.getHeaders1(attr.getUsername(), attr.getConfigInfo().get("comCode")), car);
+            dataDTO = req.carQuery(new HtCrawlerCarQueryRequest(car, "", xbResult), req.getHeaders1(attr.getUsername(), attr.getConfigInfo().get("comCode")), car);
             log.info("未匹配则第二次车辆查询,dataDTO,{}",JSONObject.toJSONString(dataDTO));
             //过滤车辆
             carDTO = CarModelsFilterUtils.to(dataDTO.getDatalist(), car);
@@ -850,7 +852,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
         HtCrawlerSubmitRequest submit = new HtCrawlerSubmitRequest(vo, params, order.getCiCategory(), order.getBiCategory());
         log.info("提交核保参数: {}", JSONObject.toJSONString(submit));
-        String res = req.submit2(submit, req.getHeaders());
+        String res = req.submit2(submit, req.getHeaders(attr.getUsername(), attr.getConfigInfo().get("comCode")));
         log.info("提交核保结果: {}", res);
         //cookie还在,但服务器已断开连接,需重新连接
         if(res.contains("<html>")) {
@@ -891,17 +893,18 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             return r;
         }
         // 转人工处理
-        if (res.contains("infomsg\":\"") && res.contains("htmlMsgTeam\":\"")) return handleManualUnderwriting(order, params);
+        if (res.contains("infomsg\":\"") && res.contains("htmlMsgTeam\":\"")) return handleManualUnderwriting(order, params, attr);
         return r;
     }
 
-    private UnderwritingResultsVo handleManualUnderwriting(HtCrawlerOrder order, HtCrawlerConfigureParameters params) {
+    private UnderwritingResultsVo handleManualUnderwriting(HtCrawlerOrder order, HtCrawlerConfigureParameters params, AttributionInformationVo attr) {
         try {
             // 提交人工核保
             MultiValueMap<String, String> data = new LinkedMultiValueMap<>();
             data.add("zrgms", ""); data.add("zrgpriority", "1");
             String url = ORIGIN + "/htcsp/checkInsAction.do";
-            Map<String, Object> body = exchangeForm(url, Map.of("cmd", "submitZRG"), data, buildManualUwHeaders());
+            String uwCookie = req.getCookie(attr.getUsername(), params.getComCode());
+            Map<String, Object> body = exchangeForm(url, Map.of("cmd", "submitZRG"), data, buildManualUwHeaders(uwCookie));
 
             UnderwritingResultsVo r = new UnderwritingResultsVo();
             r.setUnderwritingStatus(InsOrderStatusEnum.AUDIT_FAIL);
@@ -913,11 +916,11 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             String url2 = ORIGIN + "/htcsp/checkInsAction.do?cmd=queryUnderwriterAdvice";
             MultiValueMap<String, String> d2 = new LinkedMultiValueMap<>();
             d2.add("businessNo", order.getQuotationRelaNo()); d2.add("excet", "");
-            String html = String.valueOf(exchangeForm(url2, null, d2, buildPaymentLinkHeaders()));
+            String html = String.valueOf(exchangeForm(url2, null, d2, buildPaymentLinkHeaders(uwCookie)));
 
             if (html.contains("审核通过")) {
                 HtCrawlerPaymentLinkResponse pl = req.getPaymentLink(
-                        new HtCrawlerPaymentLinkRequest(params, new PaymentLinkVo(), html), buildPaymentLinkHeaders());
+                        new HtCrawlerPaymentLinkRequest(params, new PaymentLinkVo(), html), buildPaymentLinkHeaders(uwCookie));
                 r.setPaymentLink(pl.getImg());
                 r.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
                 return r;
@@ -980,14 +983,15 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         qp.add("Single_system", "10000");
         qp.add("checkStatus", "1");
         qp.add("quotationno", order.getQuotationRelaNo());
-        String body = get(ORIGIN + "/htcsp/PaymentAction.do", buildPaymentListHeaders(req.getCookie()), qp);
+        AttributionInformationVo plAttr = vo.getOrder().getAttributionInformationVo();
+        String body = get(ORIGIN + "/htcsp/PaymentAction.do", buildPaymentListHeaders(req.getCookie(plAttr.getUsername(), plAttr.getConfigInfo().get("comCode"))), qp);
         //返回的是html 页面,暂不打印
         // log.info("queryPaymentList body: {}", body);
         HtCrawlerPaymentLinkRequest htCrawlerPaymentLinkRequest = new HtCrawlerPaymentLinkRequest(params, vo, body);
         log.info("htCrawlerPaymentLinkRequest: {}", JSONObject.toJSONString(htCrawlerPaymentLinkRequest));
         HtCrawlerPaymentLinkResponse paymentLink = new HtCrawlerPaymentLinkResponse();
         try {
-            paymentLink = req.getPaymentLink(htCrawlerPaymentLinkRequest, buildPaymentListHeaders(req.getCookie()));
+            paymentLink = req.getPaymentLink(htCrawlerPaymentLinkRequest, buildPaymentListHeaders(req.getCookie(plAttr.getUsername(), plAttr.getConfigInfo().get("comCode"))));
         } catch (Exception e) {
             log.error(e.getMessage());
             return null;
@@ -997,11 +1001,13 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
     // ====================== Cookie 检查 ======================
     private void doLoginCookie(AttributionInformationVo attr) {
-        if (StringUtils.isBlank(req.getCookie())) {
+        String username = attr.getUsername();
+        String comcode  = attr.getConfigInfo().get("comCode");
+        if (StringUtils.isBlank(req.getCookie(username, comcode))) {                 // 改
             Map<String, Object> m = login(buildLoginDTO(attr));
             String cookie = (String) m.get("cookies");
-            req.getHeaders().remove(HtRequestConstant.COOKIE);
-            req.getHeaders().add(HtRequestConstant.COOKIE, cookie);
+            req.getHeaders(username, comcode).remove(HtRequestConstant.COOKIE);       // getHeaders 改带参
+            req.getHeaders(username, comcode).add(HtRequestConstant.COOKIE, cookie);
         }
     }
 
@@ -1027,24 +1033,24 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             }
         }
 
-        HtCrawlerGerUploadUrlResponse up = req.getUploadUrl(new HtCrawlerGerUploadUrlRequest(quotationRelaNo), buildUploadHeaders(req.getCookie()));
+        HtCrawlerGerUploadUrlResponse up = req.getUploadUrl(new HtCrawlerGerUploadUrlRequest(quotationRelaNo), buildUploadHeaders(req.getCookie(attr.getUsername(), attr.getConfigInfo().get("comCode"))));
         String token = "";
         Map<String, Object> updata = new LinkedHashMap<>();
         if (HtRequestConstant.GET_UPLOAD_URL_SUCCESS.equals(up.getFlag())) {
             token = up.getUrl().substring(up.getUrl().lastIndexOf("=") + 1);
-            updata = fetchUploadInitParam(token);
+            updata = fetchUploadInitParam(token, req.getCookie(attr.getUsername(), attr.getConfigInfo().get("comCode")));
         }
 
         try {
-            new UploadUtil().upLoad(quotationRelaNo, b64List, parseToMap(req.getGsInfo()),
-                    attr.getUsername(), params.getComCode(), convertCookieToMap(req.getCookie()), token, updata, cookieUtils);
+            new UploadUtil().upLoad(quotationRelaNo, b64List, parseToMap(req.getGsInfo(attr.getUsername(), attr.getConfigInfo().get("comCode"))),
+                    attr.getUsername(), params.getComCode(), convertCookieToMap(req.getCookie(attr.getUsername(), attr.getConfigInfo().get("comCode"))), token, updata, cookieUtils);
             cache.cacheYingXiangUploaded(quotationRelaNo);
         } catch (Exception e) { throw new SystemException(e.getMessage()); }
     }
 
-    private Map<String, Object> fetchUploadInitParam(String token) {
+    private Map<String, Object> fetchUploadInitParam(String token, String cookie) {
         HttpHeaders h = new HttpHeaders();
-        h.set(HtRequestConstant.COOKIE, req.getCookie());
+        h.set(HtRequestConstant.COOKIE, cookie);
         h.set("Accept", "application/json, text/plain, */*");
         h.set("Referer", "https://img-web.pc.ehuatai.com/app/upload.img?token=" + token);
         h.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36");
@@ -1084,7 +1090,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         fd.add("ownPrintElectronicFlag", "0");
         fd.add("isbzdown", "1");
         String body = post(ORIGIN + "/htcsp/DocumentPrintAction.do?cmd=electronicPolicyEndorseDownload",
-                buildDocumentHeaders(req.getCookie()), fd);
+                buildDocumentHeaders(req.getCookie(vo.getOrder().getAttributionInformationVo().getUsername(), vo.getOrder().getAttributionInformationVo().getConfigInfo().get("comCode"))), fd);
         HtCrawlerDownloadPolicyResponse res = JSONObject.parseObject(body, HtCrawlerDownloadPolicyResponse.class);
         log.info("华泰电子保单---订单号{},保单号{},下载保单响应结果,{}", order.getOrdersNo(), no, JSONObject.toJSONString(res));
         DownloadPolicyResultVo r = new DownloadPolicyResultVo();
@@ -1102,7 +1108,8 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         // 下载驾意险保单
         if (StringUtils.isNotBlank(order.getJyPolicyno())) {
             // 1. 构造请求头
-            HttpHeaders headers = getHeaders();
+            AttributionInformationVo dlAttr = vo.getOrder().getAttributionInformationVo();
+            HttpHeaders headers = getHeaders(req.getCookie(dlAttr.getUsername(), dlAttr.getConfigInfo().get("comCode")));
 
             // 2. url + query params(cmd=perDocumentPrint)
             String baseUrl = "https://cspxp.pc.ehuatai.com";
@@ -1153,7 +1160,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     }
 
     @NotNull
-    private HttpHeaders getHeaders() {
+    private HttpHeaders getHeaders(String cookie) {
         HttpHeaders headers = new HttpHeaders();
         headers.set("Accept", "application/json, text/javascript, */*; q=0.01");
         headers.set("Accept-Language", "zh-CN,zh;q=0.9");
@@ -1162,7 +1169,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         headers.set("Origin", "https://cspxp.pc.ehuatai.com");
         headers.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36");
         headers.set("X-Requested-With", "XMLHttpRequest");
-        headers.set("Cookie", req.getCookie());
+        headers.set("Cookie", cookie);
         return headers;
     }
 
@@ -1174,7 +1181,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
                 HtCrawlerConfigureParameters.class, attr.getConfigInfo());
         HtCrawlerOrder order = orderService.findByOrdersNo(vo.getOrder().getOrdersNo());
-        String html = req.queryOrderStatus(new HtCrawlerOrderStateRequest(params, order.getQuotationRelaNo()), req.getHeaders());
+        String html = req.queryOrderStatus(new HtCrawlerOrderStateRequest(params, order.getQuotationRelaNo()), req.getHeaders(attr.getUsername(), attr.getConfigInfo().get("comCode")));
         String regex = "<div style=\"display: inline-block;width:50px;text-align: center; \">(.*?)</div>";
         Pattern pattern = Pattern.compile(regex);
         Matcher matcher = pattern.matcher(html);
@@ -1189,7 +1196,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             orderStatus = orderStatusEnum.getCode();
             List<Map<String, String>> fcxList = new ArrayList<>();
             // 1. 构建请求头 headers
-            HttpHeaders headers = getHttpHeaders();
+            HttpHeaders headers = getHttpHeaders(req.getCookie(attr.getUsername(), attr.getConfigInfo().get("comCode")));
 
             // 2. 拼接URL + GET参数 params
             String baseUrl = "https://cspxp.pc.ehuatai.com/htcsp/DocumentPrintAction.do";
@@ -1238,7 +1245,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     }
 
     @NotNull
-    private HttpHeaders getHttpHeaders() {
+    private HttpHeaders getHttpHeaders(String cookie) {
         HttpHeaders headers = new HttpHeaders();
         headers.set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
         headers.set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8");
@@ -1248,7 +1255,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         headers.set("Referer", "https://cspxp.pc.ehuatai.com/htcsp/QuotationQueryAction.do?cmd=quotationListAll");
         headers.set("Upgrade-Insecure-Requests", "1");
         headers.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36");
-        headers.set("Cookie", req.getCookie()); // 塞入cookie
+        headers.set("Cookie", cookie); // 塞入cookie
         return headers;
     }
 
@@ -1394,18 +1401,18 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         });
     }
 
-    private HttpHeaders buildManualUwHeaders() {
+    private HttpHeaders buildManualUwHeaders(String cookie) {
         return header(h -> {
-            h.add(HtRequestConstant.COOKIE, req.getCookie());
+            h.add(HtRequestConstant.COOKIE, cookie);
             h.add("Accept", ACCEPT_JSON);
             h.add("Content-Type", CONTENT_TYPE_FORM);
             h.add("X-Requested-With", XHR);
         });
     }
 
-    private HttpHeaders buildPaymentLinkHeaders() {
+    private HttpHeaders buildPaymentLinkHeaders(String cookie) {
         return header(h -> {
-            h.add(HtRequestConstant.COOKIE, req.getCookie());
+            h.add(HtRequestConstant.COOKIE, cookie);
             h.add("Accept", "text/html, */*; q=0.01");
             h.add("Content-Type", CONTENT_TYPE_FORM);
             h.add("Referer", ORIGIN + "/htcsp/QuotationQueryAction.do?cmd=quotationListAll");