Files
jijiaqi/src/main/java/com/example/sso/schedule/DeleteWeiFa.java
2025-09-23 16:59:06 +08:00

70 lines
2.3 KiB
Java

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);
}
}
}
}
}