|
|
@@ -87,12 +87,10 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
private static final String ORIGIN = "https://cspxp.pc.ehuatai.com";
|
|
|
private static final String CONTENT_TYPE_FORM = "application/x-www-form-urlencoded; charset=UTF-8";
|
|
|
private static final String XHR = "XMLHttpRequest";
|
|
|
- private static final String BASE_URL = "https://cspxp.pc.ehuatai.com";
|
|
|
private static final int MAX_RETRIES = 3;
|
|
|
private static final long RETRY_DELAY_MS = 3000;
|
|
|
/** 指数退避倍率:每次重试间隔 = RETRY_DELAY_MS * (BACKOFF_FACTOR ^ 重试次数) */
|
|
|
private static final int BACKOFF_FACTOR = 2;
|
|
|
- private static final long SHORT_DELAY_MS = 100;
|
|
|
private static final String RISK_CODE = "1251";
|
|
|
private static final String XBCOM_CODE = "927";
|
|
|
private static final String SPECIAL_ACCOUNT_XN = "XN92709001";
|
|
|
@@ -393,13 +391,13 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
fd.add("modelcodexh", carDTO.getModelcodexh());
|
|
|
fd.add("VehicleStyleUniqueId", "");
|
|
|
log.info("executeSaveCarQuery,{}",JSONObject.toJSONString(fd));
|
|
|
- post(BASE_URL + "/htcsp/VehicleInfoEntryAction.do?cmd=savecarquery", buildCarQueryHeaders(cookie), fd);
|
|
|
+ post(ORIGIN + "/htcsp/VehicleInfoEntryAction.do?cmd=savecarquery", buildCarQueryHeaders(cookie), fd);
|
|
|
}
|
|
|
|
|
|
private String executeCarModelCodexhQuery(HtCrawlerCarQueryResponse.DataDTO.DataListDTO carDTO,
|
|
|
CarInfoVo car, String cookie, String quotationNo) {
|
|
|
MultiValueMap<String, String> fd = new LinkedMultiValueMap<>();
|
|
|
- fd.add("modelCode", "BCHFCBUB0001");
|
|
|
+ fd.add("modelCode", carDTO.getModelcode());
|
|
|
fd.add("licenseNo", car.getLicenseNo());
|
|
|
fd.add("licenseKindCode", "02 小型汽车号牌");
|
|
|
fd.add("engineNo", car.getEngineNo());
|
|
|
@@ -417,7 +415,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
fd.add("carModelComCode", XBCOM_CODE);
|
|
|
fd.add("quotationNo", quotationNo);
|
|
|
|
|
|
- String carDataResponse = post(BASE_URL + "/htcsp/VehicleInfoEntryAction.do?cmd=carModelCodexhQuery", buildCarModelCodexhHeaders(cookie), fd);
|
|
|
+ String carDataResponse = post(ORIGIN + "/htcsp/VehicleInfoEntryAction.do?cmd=carModelCodexhQuery", buildCarModelCodexhHeaders(cookie), fd);
|
|
|
log.info("carModelCodexhQuery carDataResponse: {}", carDataResponse);
|
|
|
return carDataResponse;
|
|
|
}
|
|
|
@@ -425,7 +423,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
private void executeMessageCentreTimeBoom(String cookie) {
|
|
|
MultiValueMap<String, String> fd = new LinkedMultiValueMap<>();
|
|
|
fd.add("messageType", "0");
|
|
|
- post(BASE_URL + "/htcsp/MessageCentreAction.do?cmd=messageCentreTimeBoom",
|
|
|
+ post(ORIGIN + "/htcsp/MessageCentreAction.do?cmd=messageCentreTimeBoom",
|
|
|
header(b -> { b.add(HtRequestConstant.COOKIE, cookie); b.add("Content-Type", CONTENT_TYPE_FORM); }), fd);
|
|
|
}
|
|
|
|
|
|
@@ -457,7 +455,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
fd.add("handToCount43T3_903", "");
|
|
|
fd.add("isCheckFlag", "1");
|
|
|
|
|
|
- String body = post(BASE_URL + "/htcsp/QuotedPriceAction.do?cmd=getNoCarPreimum",
|
|
|
+ String body = post(ORIGIN + "/htcsp/QuotedPriceAction.do?cmd=getNoCarPreimum",
|
|
|
buildNoCarPremiumHeaders(cookie), fd);
|
|
|
log.info("fcResponse: {}", body);
|
|
|
return str(MAPPER.readValue(body, HashMap.class), "premium");
|
|
|
@@ -851,7 +849,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
// 提交人工核保
|
|
|
MultiValueMap<String, String> data = new LinkedMultiValueMap<>();
|
|
|
data.add("zrgms", ""); data.add("zrgpriority", "1");
|
|
|
- String url = BASE_URL + "/htcsp/checkInsAction.do";
|
|
|
+ String url = ORIGIN + "/htcsp/checkInsAction.do";
|
|
|
Map<String, Object> body = exchangeForm(url, Map.of("cmd", "submitZRG"), data, buildManualUwHeaders());
|
|
|
|
|
|
UnderwritingResultsVo r = new UnderwritingResultsVo();
|
|
|
@@ -861,7 +859,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
r.setSyApplyNo(str(body, "proposal_no_sy"));
|
|
|
|
|
|
// 查询支付链接
|
|
|
- String url2 = BASE_URL + "/htcsp/checkInsAction.do?cmd=queryUnderwriterAdvice";
|
|
|
+ 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()));
|
|
|
@@ -923,7 +921,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
qp.add("Single_system", "10000");
|
|
|
qp.add("checkStatus", "1");
|
|
|
qp.add("quotationno", order.getQuotationRelaNo());
|
|
|
- String body = get(BASE_URL + "/htcsp/PaymentAction.do", buildPaymentListHeaders(req.getCookie()), qp);
|
|
|
+ String body = get(ORIGIN + "/htcsp/PaymentAction.do", buildPaymentListHeaders(req.getCookie()), qp);
|
|
|
//返回的是html 页面,暂不打印
|
|
|
//log.info("queryPaymentList response: {}", body);
|
|
|
return req.getPaymentLink(new HtCrawlerPaymentLinkRequest(params, vo, body), buildPaymentListHeaders(req.getCookie()));
|
|
|
@@ -1017,7 +1015,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
fd.add("tmpbiztype", "P");
|
|
|
fd.add("ownPrintElectronicFlag", "0");
|
|
|
fd.add("isbzdown", "1");
|
|
|
- String body = post(BASE_URL + "/htcsp/DocumentPrintAction.do?cmd=electronicPolicyEndorseDownload",
|
|
|
+ String body = post(ORIGIN + "/htcsp/DocumentPrintAction.do?cmd=electronicPolicyEndorseDownload",
|
|
|
buildDocumentHeaders(req.getCookie()), fd);
|
|
|
HtCrawlerDownloadPolicyResponse res = JSONObject.parseObject(body, HtCrawlerDownloadPolicyResponse.class);
|
|
|
log.info("下载保单响应结果,{}", JSONObject.toJSONString(res));
|
|
|
@@ -1118,7 +1116,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
String jqApplication = "";
|
|
|
String fcxApplication = "";
|
|
|
if ("已通过核保已实收".equals(orderStatus)) {
|
|
|
- orderStatusEnum = InsOrderStatusEnum.valueOf("QUOTE_ING");
|
|
|
+ orderStatusEnum = InsOrderStatusEnum.valueOf("PAY_PENDING");
|
|
|
orderStatus = orderStatusEnum.getCode();
|
|
|
List<Map<String, String>> fcxList = new ArrayList<>();
|
|
|
// 1. 构建请求头 headers
|
|
|
@@ -1362,13 +1360,21 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
|
|
|
// ====================== HTTP 通用工具 ======================
|
|
|
private String get(String url, HttpHeaders headers, MultiValueMap<String, String> params) {
|
|
|
+ log.info("get_url:{}", url);
|
|
|
+ log.info("get_url_params:{}", params);
|
|
|
UriComponentsBuilder b = UriComponentsBuilder.fromHttpUrl(url);
|
|
|
if (params != null) b.queryParams(params);
|
|
|
- return cookieUtils.getRestTemplate().exchange(b.toUriString(), HttpMethod.GET, new HttpEntity<>(headers), String.class).getBody();
|
|
|
+ String body = cookieUtils.getRestTemplate().exchange(b.toUriString(), HttpMethod.GET, new HttpEntity<>(headers), String.class).getBody();
|
|
|
+ log.info("get_url_body:{}", body);
|
|
|
+ return body;
|
|
|
}
|
|
|
|
|
|
private String post(String url, HttpHeaders headers, MultiValueMap<String, String> data) {
|
|
|
- return cookieUtils.getRestTemplate().postForEntity(url, new HttpEntity<>(data, headers), String.class).getBody();
|
|
|
+ log.info("post_url:{}", url);
|
|
|
+ log.info("post_url_data:{}", data);
|
|
|
+ String body = cookieUtils.getRestTemplate().postForEntity(url, new HttpEntity<>(data, headers), String.class).getBody();
|
|
|
+ log.info("post_url_body:{}", body);
|
|
|
+ return body;
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|