代码说明
This commit is contained in:
105
src/main/java/com/example/sso/newdao/DeleteZhiKong6.java
Normal file
105
src/main/java/com/example/sso/newdao/DeleteZhiKong6.java
Normal file
@ -0,0 +1,105 @@
|
||||
package com.example.sso.newdao;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.sso.util.V5utils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@Slf4j
|
||||
public class DeleteZhiKong6 {
|
||||
public static void main7() {
|
||||
|
||||
Boolean flag = true;
|
||||
String id = "";
|
||||
List<String> lists = new ArrayList<>();
|
||||
while (flag){
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("app_id","665ea38ef718f1edccf7b20d");
|
||||
jsonObject.put("entry_id","66696a25f718f1edcc29d436");
|
||||
jsonObject.put("limit",10000);
|
||||
JSONArray fields = new JSONArray();
|
||||
fields.add("createTime");
|
||||
jsonObject.put("fields",fields);
|
||||
if (!id.equals("")){
|
||||
jsonObject.put("data_id",id);
|
||||
}
|
||||
|
||||
String jsonString = jsonObject.toJSONString();
|
||||
String list = V5utils.list(jsonString);
|
||||
JSONObject jsonObject1 = JSON.parseObject(list);
|
||||
JSONArray data = jsonObject1.getJSONArray("data");
|
||||
|
||||
|
||||
|
||||
int size = data.size();
|
||||
log.info("我是长度 " + size);
|
||||
|
||||
|
||||
if (size < 10000 ) {
|
||||
for (Object o : data) {
|
||||
JSONObject test = (JSONObject) o;
|
||||
String string = test.getString("_id");
|
||||
lists.add(string);
|
||||
if (lists.size() == 100) {
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("app_id", "665ea38ef718f1edccf7b20d");
|
||||
jsonObject2.put("entry_id", "694e2e9f4997401c0bc48444");
|
||||
jsonObject2.put("data_ids", lists);
|
||||
String jsonString1 = jsonObject2.toJSONString();
|
||||
log.info("我是删除参数 " + jsonString1);
|
||||
V5utils.deletes(jsonString1);
|
||||
lists.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
flag = false;
|
||||
|
||||
}else {
|
||||
for (Object o : data) {
|
||||
JSONObject test = (JSONObject) o;
|
||||
String string = test.getString("_id");
|
||||
lists.add(string);
|
||||
id = string;
|
||||
if (lists.size() == 100) {
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("app_id", "665ea38ef718f1edccf7b20d");
|
||||
jsonObject2.put("entry_id", "694e2e9f4997401c0bc48444");
|
||||
jsonObject2.put("data_ids", lists);
|
||||
String jsonString1 = jsonObject2.toJSONString();
|
||||
log.info("我是删除参数 " + jsonString1);
|
||||
V5utils.deletes(jsonString1);
|
||||
lists.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("app_id", "665ea38ef718f1edccf7b20d");
|
||||
jsonObject2.put("entry_id", "694e2e9f4997401c0bc48444");
|
||||
jsonObject2.put("data_ids", lists);
|
||||
String jsonString1 = jsonObject2.toJSONString();
|
||||
log.info("我是删除参数 " + jsonString1);
|
||||
V5utils.deletes(jsonString1);
|
||||
lists.clear();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user