|
@@ -0,0 +1,52 @@
|
|
|
+package com.malk.kabeiyi.controller;
|
|
|
+
|
|
|
+import com.malk.server.common.McR;
|
|
|
+import com.malk.service.dingtalk.DDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient_Workflow;
|
|
|
+import com.malk.utils.UtilDateTime;
|
|
|
+import com.malk.utils.UtilMap;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/dd/")
|
|
|
+public class KabeiyiController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DDClient ddClient;
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Workflow ddClient_workflow;
|
|
|
+
|
|
|
+ @GetMapping("getList")
|
|
|
+ public McR getList(String pid,String procCode,String nextToken){
|
|
|
+ LocalDateTime now=LocalDateTime.now();
|
|
|
+ Map data=new HashMap();
|
|
|
+ data.put("maxResults",10);
|
|
|
+ data.put("nextToken",nextToken);
|
|
|
+ data.put("statuses", Arrays.asList("COMPLETED"));
|
|
|
+// data.put("userIds","");
|
|
|
+ Map rsp=ddClient_workflow.getInstanceIds(ddClient.getAccessToken(),procCode,
|
|
|
+ UtilDateTime.getLocalDateTimeTimeStamp(now.minusDays(120)),UtilDateTime.getLocalDateTimeTimeStamp(now),data);
|
|
|
+ List<String> list=(List)rsp.get("list");
|
|
|
+ List result=new ArrayList();
|
|
|
+ for(String id:list){
|
|
|
+ Map detail=ddClient_workflow.getProcessInstanceId(ddClient.getAccessToken(),id);
|
|
|
+ if("agree".equals(String.valueOf(detail.get("result")))){
|
|
|
+ Map dd=new HashMap();
|
|
|
+ dd.put("url","https://aflow.dingtalk.com/dingtalk/web/query/pchomepage.htm?from=oflow&op=true&corpid=dingc3a744cb591a7346f2c783f7214b6d69#/plainapproval?procInstId="+id);
|
|
|
+ dd.put("title",detail.get("title"));
|
|
|
+ dd.put("businessId",detail.get("businessId"));
|
|
|
+ result.add(dd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return McR.success(UtilMap.map("data, nextToken",result,rsp.get("nextToken")));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|