From 5d59447798ea70957ee57981123908311a029b95 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Wed, 19 Feb 2025 23:18:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9A=84tokenredis=E5=AD=98=E5=82=A8=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../suofeiya/job/SpiderDataJob.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/SpiderDataJob.java diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/SpiderDataJob.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/SpiderDataJob.java new file mode 100644 index 000000000..2f6f46ec2 --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/job/SpiderDataJob.java @@ -0,0 +1,55 @@ +package com.logpm.factorydata.suofeiya.job; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; + +import java.util.HashMap; +import java.util.Map; + +public class SpiderDataJob { + + public static void main(String[] args) { + String url = "https://portal.sfygroup.com/reporthome/rest/loadingHeader/all?_dc=1739871711195&page=1&start=0&limit=100&filtersRaw=[{\"id\":null,\"property\":\"A.DEAL_DATE\",\"value\":\"2025-02-11\",\"operator\":\">=\",\"sql\":null},{\"id\":null,\"property\":\"A.DEAL_DATE\",\"value\":\"2025-02-19\",\"operator\":\"<\",\"sql\":null}]"; +// // 发起http请求 获取返回的数据 走get请求 +// +// +// + Map heads = new HashMap<>(); + heads.put("Content-Type", "application/json;charset=UTF-8"); +// heads.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"); +// heads.put("Host", "portal.sfygroup.com"); +// heads.put("Accept", "*/*"); + + heads.put("Cookie", init()); +// heads.put("Referer", "http://portal.sfygroup.com/reporthome/rest/reporthome/reporthomeUI?username=18166360906&password=02a962f8b9dfdbe85ee37b3f9b99fd8fcb48e73a65c9009e92ab81c508dcdca261af7efc1644002d0f371e5001c30a8f&menuType=loadingheader/loadingheader.jsp"); + HttpRequest get = HttpUtil.createGet(url).addHeaders(heads); +// String s = HttpUtil.get(url); +// System.out.println(s); + + HttpResponse execute = get.setReadTimeout(10000).execute(); + String body = execute.body(); + System.out.println(body); + + +// init(); + + } + + + private static String init() { + + String url = "https://portal.sfygroup.com/reporthome/rest/reporthome/reporthomeUI?username=18166360906&password=02a962f8b9dfdbe85ee37b3f9b99fd8fcb48e73a65c9009e92ab81c508dcdca261af7efc1644002d0f371e5001c30a8f&menuType=loadingheader/loadingheader.jsp"; + HttpRequest get = HttpUtil.createGet(url); + HttpResponse execute = get.execute(); + String cookie = execute.getCookieStr(); + System.out.println(cookie); + return cookie; +// String body = execute.body(); +// System.out.println(body); + + + } + + +}