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

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