From f3f5e89c2f0def928b53a5a7270f9f23819db994 Mon Sep 17 00:00:00 2001 From: lijiazhuo <13787924+lijiazhuosky@user.noreply.gitee.com> Date: Tue, 6 Jan 2026 09:56:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/sso/schedule/DeleteKeCheng.java | 69 ------------------ .../example/sso/schedule/DeleteNianJian.java | 68 ------------------ .../example/sso/schedule/DeleteQianFei.java | 71 ------------------- .../com/example/sso/schedule/DeleteWeiFa.java | 69 ------------------ .../java/com/example/sso/util/V5utils.java | 44 ++++++++++++ 5 files changed, 44 insertions(+), 277 deletions(-) delete mode 100644 src/main/java/com/example/sso/schedule/DeleteKeCheng.java delete mode 100644 src/main/java/com/example/sso/schedule/DeleteNianJian.java delete mode 100644 src/main/java/com/example/sso/schedule/DeleteQianFei.java delete mode 100644 src/main/java/com/example/sso/schedule/DeleteWeiFa.java diff --git a/src/main/java/com/example/sso/schedule/DeleteKeCheng.java b/src/main/java/com/example/sso/schedule/DeleteKeCheng.java deleted file mode 100644 index 7e08ae2..0000000 --- a/src/main/java/com/example/sso/schedule/DeleteKeCheng.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.example.sso.schedule; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.example.sso.util.V5utils; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -@Component -public class DeleteKeCheng { - @Scheduled(cron = "0 0 15 * * ?") - public void main1() { - Boolean b = true; - String ID = ""; - - - while (b) { - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject.put("entry_id","6667e754f718f1edcc1ba298"); - jsonObject.put("limit",10000); - - if (!ID.isEmpty()) { - jsonObject.put("data_id", ID); - } - - String jsonString = jsonObject.toJSONString(); - String list = V5utils.list(jsonString); - JSONObject jsonObject2 = JSON.parseObject(list); - JSONArray jsonArray1 = jsonObject2.getJSONArray("data"); - int size = jsonArray1.size(); - if (size < 10000) { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","6667e754f718f1edcc1ba298"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - V5utils.delete(jsonString1); - - - - } - b = false; - } else { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","6667e754f718f1edcc1ba298"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - - ID = id; - V5utils.delete(jsonString1); - - } - - - - } - } - } -} diff --git a/src/main/java/com/example/sso/schedule/DeleteNianJian.java b/src/main/java/com/example/sso/schedule/DeleteNianJian.java deleted file mode 100644 index ba82663..0000000 --- a/src/main/java/com/example/sso/schedule/DeleteNianJian.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.example.sso.schedule; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.example.sso.util.V5utils; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -@Component -public class DeleteNianJian { - @Scheduled(cron = "0 10 15 * * ?") - public void main2() { - Boolean b = true; - String ID = ""; - - - while (b) { - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject.put("entry_id","66696a25f718f1edcc29d436"); - jsonObject.put("limit",10000); - if (!ID.isEmpty()) { - jsonObject.put("data_id", ID); - } - - String jsonString = jsonObject.toJSONString(); - String list = V5utils.list(jsonString); - JSONObject jsonObject2 = JSON.parseObject(list); - JSONArray jsonArray1 = jsonObject2.getJSONArray("data"); - int size = jsonArray1.size(); - if (size < 10000) { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","66696a25f718f1edcc29d436"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - V5utils.delete(jsonString1); - - - - } - b = false; - } else { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","66696a25f718f1edcc29d436"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - - ID = id; - V5utils.delete(jsonString1); - - } - - - - } - } - } -} diff --git a/src/main/java/com/example/sso/schedule/DeleteQianFei.java b/src/main/java/com/example/sso/schedule/DeleteQianFei.java deleted file mode 100644 index 879284e..0000000 --- a/src/main/java/com/example/sso/schedule/DeleteQianFei.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.example.sso.schedule; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.example.sso.util.V5utils; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -@Component -public class DeleteQianFei { - - @Scheduled(cron = "0 20 15 * * ?") - public void main3() { - Boolean b = true; - String ID = ""; - - - while (b) { - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject.put("entry_id","66626e72f718f1edcc1063eb"); - jsonObject.put("limit",10000); - if (!ID.isEmpty()) { - jsonObject.put("data_id", ID); - } - - String jsonString = jsonObject.toJSONString(); - String list = V5utils.list(jsonString); - JSONObject jsonObject2 = JSON.parseObject(list); - JSONArray jsonArray1 = jsonObject2.getJSONArray("data"); - int size = jsonArray1.size(); - if (size < 10000) { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","66626e72f718f1edcc1063eb"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - V5utils.delete(jsonString1); - - - - } - b = false; - } else { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","66626e72f718f1edcc1063eb"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - - ID = id; - V5utils.delete(jsonString1); - - } - - - - } - } - } - - -} diff --git a/src/main/java/com/example/sso/schedule/DeleteWeiFa.java b/src/main/java/com/example/sso/schedule/DeleteWeiFa.java deleted file mode 100644 index cc185d7..0000000 --- a/src/main/java/com/example/sso/schedule/DeleteWeiFa.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.example.sso.schedule; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.example.sso.util.V5utils; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -@Component -public class DeleteWeiFa { - @Scheduled(cron = "0 30 15 * * ?") - public void main33() { - Boolean b = true; - String ID = ""; - - - while (b) { - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject.put("entry_id","6667dd8a09f3185646f17f81"); - jsonObject.put("limit",10000); - if (!ID.isEmpty()) { - jsonObject.put("data_id", ID); - } - - String jsonString = jsonObject.toJSONString(); - String list = V5utils.list(jsonString); - JSONObject jsonObject2 = JSON.parseObject(list); - JSONArray jsonArray1 = jsonObject2.getJSONArray("data"); - int size = jsonArray1.size(); - if (size < 10000) { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","6667dd8a09f3185646f17f81"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - - V5utils.delete(jsonString1); - - - - } - b = false; - } else { - for (Object o : jsonArray1) { - JSONObject test = (JSONObject) o; - String id = test.getString("_id"); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("app_id","665ea38ef718f1edccf7b20d"); - jsonObject1.put("entry_id","6667dd8a09f3185646f17f81"); - jsonObject1.put("data_id",id); - String jsonString1 = jsonObject1.toJSONString(); - - ID = id; - V5utils.delete(jsonString1); - - } - - - - } - } - } -} diff --git a/src/main/java/com/example/sso/util/V5utils.java b/src/main/java/com/example/sso/util/V5utils.java index eae1c8e..c6d6533 100644 --- a/src/main/java/com/example/sso/util/V5utils.java +++ b/src/main/java/com/example/sso/util/V5utils.java @@ -158,6 +158,50 @@ public class V5utils { httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex"); + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + + // 执行请求,获取响应对象 + CloseableHttpResponse response = httpClient.execute(httpPost); + + try { + // 从响应对象中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + + // 处理响应数据 + responseBody = EntityUtils.toString(responseEntity); + System.out.println(responseBody); + } finally { + // 关闭响应对象 + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + // 关闭 HttpClient + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return responseBody; + } + + + public static String deletes(String jsonBody){ + CloseableHttpClient httpClient = HttpClients.createDefault(); + + // 创建 POST 请求对象 + HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/batch_delete"); + + String responseBody = null; + try { + // 设置请求头 + httpPost.setHeader("Content-Type", "application/json"); + httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex"); + + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); httpPost.setEntity(entity);