代码说明
This commit is contained in:
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -158,6 +158,50 @@ public class V5utils {
|
|||||||
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
|
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);
|
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
|
||||||
httpPost.setEntity(entity);
|
httpPost.setEntity(entity);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user