Kaynağa Gözat

改为OA的接口调用方式

Zimo 3 gün önce
ebeveyn
işleme
cd2a4a52ec

+ 4 - 2
yudao-server/src/main/java/cn/iocoder/yudao/server/controller/admin/FlowGroupController.java

@@ -22,6 +22,7 @@ import cn.iocoder.yudao.server.service.FlowGroupService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -36,6 +37,7 @@ import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
@@ -142,9 +144,9 @@ public class FlowGroupController {
         List<AdminUserDO> userDOS = new ArrayList<>();
         iotOaPersonDOS.forEach(e ->{
             //如果系统用户里面没有包含oa里面的
-            if (!collect.contains(e.getWorkcode())) {
+            if (!collect.contains(e.getWorkcode())&& StringUtils.isNotBlank(e.getWorkcode())&&"1".equals(e.getStatus())) {
                 AdminUserDO adminUserDO = new AdminUserDO();
-                if (e.getMobile().length()<=11) {
+                if (Objects.nonNull(e.getMobile())&&e.getMobile().length()<=11) {
                     adminUserDO.setMobile(e.getMobile());
                 }
                 adminUserDO.setStatus(0);

+ 25 - 27
yudao-server/src/main/java/cn/iocoder/yudao/server/service/PortalOaFlow.java

@@ -169,10 +169,8 @@ public class PortalOaFlow {
     }
 
     public String testRestfulNoHeader(String address,String api,String jsonParams, String userid){
-        //ECOLOGY返回的token
-
         String data = HttpRequest
-                .post(address + api).disableCookie()
+                .post(address + api + "?user="+userid).disableCookie()
                 .body(jsonParams)
                 .execute().body();
         System.out.println("testRestful():"+data);
@@ -222,30 +220,30 @@ public class PortalOaFlow {
 //    }
 
     public ImmutableMap<String, Object> getOaTodo(String oaId, Integer pageNo ,Integer pageSize) throws Exception {
-        return ImmutableMap.of("todoCount", 0 , "todoList", new ArrayList<>(),"doneCount", 0,"doneList", new ArrayList<>());
-//        Map<String, Object> params = new HashMap<>();
-//        Map<String, Object> map = new HashMap<>();
-//        map.put("root", ImmutableMap.of("createrid", oaId));
-//        params.put("conditions", map);
-//
-//        String out = testRestful("https://yfoa.keruioil.com", "/api/workflow/paService/getDoingWorkflowRequestCount", JSON.toJSONString(params), oaId);
-//        String done = testRestful("https://yfoa.keruioil.com", "/api/workflow/paService/getHandledWorkflowRequestCount", JSON.toJSONString(params), oaId);
-//        map.put("root", ImmutableMap.of("craterid", oaId,"isdebug", "true"));
-//        params.put("conditions", map);
-//        System.out.println("-----------"+JSON.toJSONString(params));
-//
-//        String todoList = testRestful("https://yfoa.keruioil.com", "/api/workflow/paService/getDoingWorkflowRequestList?pageNo="+pageNo+"&pageSize="+pageSize, JSON.toJSONString(params), oaId);
-//        List<JSONObject> jsonObjects = new ArrayList<>();
-//        if (todoList != null && !todoList.contains("token不存在或者超时")) {
-//            jsonObjects = JSON.parseArray(todoList, JSONObject.class);
-//        }
-//        //已办明细
-//        String doneList = testRestful("https://yfoa.keruioil.com", "/api/workflow/paService/getHandledWorkflowRequestList?pageNo="+pageNo+"&pageSize="+pageSize, JSON.toJSONString(params), oaId);
-//        List<JSONObject> doneJsonObjects = new ArrayList<>();
-//        if (todoList != null && !todoList.contains("token不存在或者超时")) {
-//            doneJsonObjects = JSON.parseArray(doneList, JSONObject.class);
-//        }
-//        return ImmutableMap.of("todoCount", NumberUtil.isNumber(out)?out:0 , "todoList", jsonObjects,"doneCount", NumberUtil.isNumber(done)?done : 0,"doneList", doneJsonObjects);
+//        return ImmutableMap.of("todoCount", 0 , "todoList", new ArrayList<>(),"doneCount", 0,"doneList", new ArrayList<>());
+        Map<String, Object> params = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
+        map.put("root", ImmutableMap.of("createrid", oaId));
+        params.put("conditions", map);
+
+        String out = testRestfulNoHeader("https://yfoa.keruioil.com", "/api/workflow/paService/getDoingWorkflowRequestCountInside", JSON.toJSONString(params), oaId);
+        String done = testRestfulNoHeader("https://yfoa.keruioil.com", "/api/workflow/paService/getHandledWorkflowRequestCountInside", JSON.toJSONString(params), oaId);
+        map.put("root", ImmutableMap.of("craterid", oaId,"isdebug", "true"));
+        params.put("conditions", map);
+        System.out.println("-----------"+JSON.toJSONString(params));
+
+        String todoList = testRestfulNoHeader("https://yfoa.keruioil.com", "/api/workflow/paService/getDoingWorkflowRequestListInside?pageNo="+pageNo+"&pageSize="+pageSize, JSON.toJSONString(params), oaId);
+        List<JSONObject> jsonObjects = new ArrayList<>();
+        if (todoList != null && !todoList.contains("token不存在或者超时")) {
+            jsonObjects = JSON.parseArray(todoList, JSONObject.class);
+        }
+        //已办明细
+        String doneList = testRestfulNoHeader("https://yfoa.keruioil.com", "/api/workflow/paService/getHandledWorkflowRequestListInside?pageNo="+pageNo+"&pageSize="+pageSize, JSON.toJSONString(params), oaId);
+        List<JSONObject> doneJsonObjects = new ArrayList<>();
+        if (todoList != null && !todoList.contains("token不存在或者超时")) {
+            doneJsonObjects = JSON.parseArray(doneList, JSONObject.class);
+        }
+        return ImmutableMap.of("todoCount", NumberUtil.isNumber(out)?out:0 , "todoList", jsonObjects,"doneCount", NumberUtil.isNumber(done)?done : 0,"doneList", doneJsonObjects);
     }
 
     public List getOaNotice(String oaId, OaNoticeDO oaNoticeDO, String workcode) throws Exception {