|
|
@ -3,6 +3,7 @@ package com.yxt.supervise.dbcenter.zhj.crawl; |
|
|
|
import cn.hutool.http.HttpRequest; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.yxt.supervise.dbcenter.zhj.crawl.spider.*; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
@ -64,7 +65,7 @@ public class ZhjSpider { |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
List<RespSalesAmount> s = ZhjSpider.crawlSalesAmount("20230508"); |
|
|
|
List<RespSalesAmount> s = ZhjSpider.crawlSalesAmount("20230508"); |
|
|
|
// List<RespSalesDishes> s = ZhjSpider.crawlSalesDishes("20230509", "熟溢香振头店");
|
|
|
|
// List<RespPurchase> s = ZhjSpider.crawlPurchase("20230508");
|
|
|
|
System.out.println(s); |
|
|
@ -171,9 +172,18 @@ public class ZhjSpider { |
|
|
|
} |
|
|
|
|
|
|
|
public static ZhjResp dopost(Map<String, Object> paramMap) { |
|
|
|
HttpRequest request = ZhjSpiderConfig.fillHeaders(HttpRequest.post(url)); |
|
|
|
HttpRequest post = HttpRequest.post(url); |
|
|
|
// post.enableDefaultCookie();
|
|
|
|
// post.disableCookie();
|
|
|
|
HttpRequest request = ZhjSpiderConfig.fillHeaders(post); |
|
|
|
String result = request.form(paramMap).execute().body(); |
|
|
|
L.info("param:{}######result:{}", paramMap.toString(), result); |
|
|
|
L.info("param:{}", paramMap.toString()); |
|
|
|
L.info("######result-111:{}", result); |
|
|
|
if (StringUtils.isBlank(result)) { |
|
|
|
ZhjSpiderConfig.switchVer(); |
|
|
|
result = ZhjSpiderConfig.fillHeaders(post).form(paramMap).execute().body(); |
|
|
|
L.info("######result-222:{}", result); |
|
|
|
} |
|
|
|
ZhjResp bean = JSONUtil.toBean(result, ZhjResp.class); |
|
|
|
return bean; |
|
|
|
} |
|
|
|