64 lines
1.9 KiB
Java
64 lines
1.9 KiB
Java
package com.example.sso.dao;
|
|
|
|
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 org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Slf4j
|
|
@Component
|
|
public class Test {
|
|
// @Scheduled(cron = "0 48 13 * * ?")
|
|
public void main() {
|
|
Boolean b = true;
|
|
String ID = "";
|
|
JSONArray jsonArray12 = new JSONArray();
|
|
while (b) {
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("app_id", "628eeaace7f28c00089a60cc");
|
|
jsonObject.put("entry_id", "5c9d82c72ceed93a0d9ebca4");
|
|
jsonObject.put("limit", 10000);
|
|
if (!ID.isEmpty()) {
|
|
jsonObject.put("data_id", ID);
|
|
}
|
|
String jsonString = jsonObject.toJSONString();
|
|
String list = V5utils.list(jsonString);
|
|
JSONObject jsonObject1 = JSON.parseObject(list);
|
|
System.out.println(jsonObject1);
|
|
JSONArray jsonArray = jsonObject1.getJSONArray("data");
|
|
int size = jsonArray.size();
|
|
if (size < 10000) {
|
|
for (Object o : jsonArray) {
|
|
JSONObject test = (JSONObject) o;
|
|
String id = test.getString("_id");
|
|
jsonArray12.add(id);
|
|
|
|
|
|
}
|
|
b = false;
|
|
} else {
|
|
for (Object o : jsonArray) {
|
|
JSONObject test = (JSONObject) o;
|
|
String id = test.getString("_id");
|
|
|
|
ID = id;
|
|
jsonArray12.add(id);
|
|
|
|
}
|
|
jsonObject.put("data_id", ID);
|
|
|
|
|
|
}
|
|
}
|
|
int size = jsonArray12.size();
|
|
String s = String.valueOf(size);
|
|
System.out.println("我是数组总数:"+ s );
|
|
|
|
|
|
}
|
|
}
|