|
@@ -4,6 +4,7 @@ import com.dingtalk.api.DefaultDingTalkClient;
|
|
|
import com.dingtalk.api.DingTalkClient;
|
|
|
import com.dingtalk.api.request.*;
|
|
|
import com.dingtalk.api.response.*;
|
|
|
+import com.mysql.cj.util.StringUtils;
|
|
|
import com.taobao.api.ApiException;
|
|
|
import net.chenlin.dp.common.openapi4j.util.PropUtil;
|
|
|
import net.chenlin.dp.common.utils.DateUtils;
|
|
@@ -64,7 +65,7 @@ public class DingdingOpenInterface {
|
|
|
* 钉钉接口仅支持120天内数据
|
|
|
*/
|
|
|
|
|
|
- public List<String> getOrderIdList(String processCode){
|
|
|
+ public static List<String> getOrderIdList(String processCode){
|
|
|
getToken();
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
@@ -76,18 +77,28 @@ public class DingdingOpenInterface {
|
|
|
|
|
|
req.setProcessCode(processCode);
|
|
|
Calendar nowTime = Calendar.getInstance();
|
|
|
- nowTime.add(Calendar.DAY_OF_YEAR, -1);
|
|
|
+ nowTime.add(Calendar.DAY_OF_YEAR, -30);
|
|
|
Date date = nowTime.getTime();
|
|
|
req.setStartTime(Long.valueOf(date.getTime()));
|
|
|
- OapiProcessinstanceListidsResponse rsp = client.execute(req, gettoken);
|
|
|
- map = JSONUtils.jsonToMap(rsp.getBody());
|
|
|
-
|
|
|
- if(map.get("errcode").equals(0)){
|
|
|
- Map<String,Object> mapList = (Map<String, Object>) map.get("result");
|
|
|
- list = (List<String>) mapList.get("list");
|
|
|
-
|
|
|
+ String next_cursor = "1";
|
|
|
+ req.setSize(20L);
|
|
|
+ while (!StringUtils.isNullOrEmpty(next_cursor)){
|
|
|
+
|
|
|
+ OapiProcessinstanceListidsResponse rsp = client.execute(req, gettoken);
|
|
|
+ map = JSONUtils.jsonToMap(rsp.getBody());
|
|
|
+ if(map.get("errcode").equals(0)){
|
|
|
+ Map<String,Object> mapList = (Map<String, Object>) map.get("result");
|
|
|
+ if(mapList.get("next_cursor") != null){
|
|
|
+ next_cursor = mapList.get("next_cursor").toString();
|
|
|
+ req.setCursor(Long.valueOf(next_cursor));
|
|
|
+ }else{
|
|
|
+ next_cursor = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ list.addAll((List<String>) mapList.get("list"));
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+ System.out.println(list);
|
|
|
} catch (ApiException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (Exception e) {
|
|
@@ -143,15 +154,16 @@ public class DingdingOpenInterface {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
+ getOrderIdList("PROC-A561B73E-8282-4780-BB05-DCBA8125C45C");
|
|
|
|
|
|
|
|
|
|
|
|
- Calendar nowTime = Calendar.getInstance();
|
|
|
-
|
|
|
- nowTime.add(Calendar.DAY_OF_YEAR, -1);
|
|
|
- Date date = nowTime.getTime();
|
|
|
- System.out.println(date.getTime());
|
|
|
- System.out.println(nowTime.getTime());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static Map toMap(String jsonString) throws JSONException {
|