|
@@ -2,6 +2,7 @@ package com.jzg.quotation.zhongan.crawler.component;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
+import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.quotation.zhongan.crawler.client.LoginResult;
|
|
import com.jzg.quotation.zhongan.crawler.client.LoginResult;
|
|
|
import com.jzg.quotation.zhongan.crawler.entity.request.ZhongAnCrawlerQueryInitInfoRequest;
|
|
import com.jzg.quotation.zhongan.crawler.entity.request.ZhongAnCrawlerQueryInitInfoRequest;
|
|
|
import com.jzg.quotation.zhongan.crawler.entity.response.ZhongAnCrawlerPaymentResponse;
|
|
import com.jzg.quotation.zhongan.crawler.entity.response.ZhongAnCrawlerPaymentResponse;
|
|
@@ -145,26 +146,31 @@ public class ZhongAnCrawlerCacheComponent {
|
|
|
// 发送第一个请求,不跟随重定向
|
|
// 发送第一个请求,不跟随重定向
|
|
|
HttpGet get1 = buildGet(uri1);
|
|
HttpGet get1 = buildGet(uri1);
|
|
|
CloseableHttpResponse resp1 = HTTP_CLIENT.execute(get1, context);
|
|
CloseableHttpResponse resp1 = HTTP_CLIENT.execute(get1, context);
|
|
|
|
|
+ AssertionUtils.isEmpty(resp1, "第一次请求失败,请联系管理员");
|
|
|
String location1 = resp1.getFirstHeader("Location").getValue();
|
|
String location1 = resp1.getFirstHeader("Location").getValue();
|
|
|
resp1.close();
|
|
resp1.close();
|
|
|
// 发送第二个请求
|
|
// 发送第二个请求
|
|
|
HttpGet get2 = buildGet(new URI(location1));
|
|
HttpGet get2 = buildGet(new URI(location1));
|
|
|
CloseableHttpResponse resp2 = HTTP_CLIENT.execute(get2, context);
|
|
CloseableHttpResponse resp2 = HTTP_CLIENT.execute(get2, context);
|
|
|
|
|
+ AssertionUtils.isEmpty(resp2, "第二次请求失败,请联系管理员");
|
|
|
String location2 = getLocationHeader(resp2);
|
|
String location2 = getLocationHeader(resp2);
|
|
|
resp2.close();
|
|
resp2.close();
|
|
|
// 发送第三个请求
|
|
// 发送第三个请求
|
|
|
HttpGet get3 = buildGet(new URI(location2));
|
|
HttpGet get3 = buildGet(new URI(location2));
|
|
|
CloseableHttpResponse resp3 = HTTP_CLIENT.execute(get3, context);
|
|
CloseableHttpResponse resp3 = HTTP_CLIENT.execute(get3, context);
|
|
|
|
|
+ AssertionUtils.isEmpty(resp3, "第三次请求失败,请联系管理员");
|
|
|
String location3 = resp3.getFirstHeader("Location").getValue();
|
|
String location3 = resp3.getFirstHeader("Location").getValue();
|
|
|
resp3.close();
|
|
resp3.close();
|
|
|
// 发送第四个请求
|
|
// 发送第四个请求
|
|
|
HttpGet get4 = buildGet(new URI(location3));
|
|
HttpGet get4 = buildGet(new URI(location3));
|
|
|
CloseableHttpResponse resp4 = HTTP_CLIENT.execute(get4, context);
|
|
CloseableHttpResponse resp4 = HTTP_CLIENT.execute(get4, context);
|
|
|
|
|
+ AssertionUtils.isEmpty(resp4, "第四次请求失败,请联系管理员");
|
|
|
String location4 = resp4.getFirstHeader("Location").getValue();
|
|
String location4 = resp4.getFirstHeader("Location").getValue();
|
|
|
resp4.close();
|
|
resp4.close();
|
|
|
// 第五次请求,拿cookie
|
|
// 第五次请求,拿cookie
|
|
|
HttpGet get5 = buildGet(new URI(location4));
|
|
HttpGet get5 = buildGet(new URI(location4));
|
|
|
CloseableHttpResponse resp5 = HTTP_CLIENT.execute(get5, context);
|
|
CloseableHttpResponse resp5 = HTTP_CLIENT.execute(get5, context);
|
|
|
|
|
+ AssertionUtils.isEmpty(resp5, "第五次请求失败,请联系管理员");
|
|
|
String location5 = resp5.getFirstHeader("Location").getValue();
|
|
String location5 = resp5.getFirstHeader("Location").getValue();
|
|
|
// 提取 zaLoginCookieKey
|
|
// 提取 zaLoginCookieKey
|
|
|
String cookieKey = null;
|
|
String cookieKey = null;
|