Zimo пре 4 дана
родитељ
комит
c8fd6300de

+ 26 - 4
yudao-server/src/main/java/cn/iocoder/yudao/server/controller/admin/TodoController.java

@@ -52,7 +52,7 @@ public class TodoController {
 
 
     @GetMapping("/oa")
     @GetMapping("/oa")
     @PermitAll
     @PermitAll
-    public CommonResult<ImmutableMap> oaTodo(String workcode) throws Exception {
+    public CommonResult<ImmutableMap> oaTodo(String workcode, Integer pageNo, Integer pageSize) throws Exception {
         List<IotOaPersonDO> workcode1 = iotOaPersonMapper.selectList("workcode", workcode);
         List<IotOaPersonDO> workcode1 = iotOaPersonMapper.selectList("workcode", workcode);
         if (CollUtil.isEmpty(workcode1)) {
         if (CollUtil.isEmpty(workcode1)) {
             oaFlow.getPerson();
             oaFlow.getPerson();
@@ -61,7 +61,29 @@ public class TodoController {
                 throw new ServiceException(new ErrorCode(1,"不存在OA用户"));
                 throw new ServiceException(new ErrorCode(1,"不存在OA用户"));
             }
             }
         }
         }
-        ImmutableMap<String, Object> oaTodo = portalOaFlow.getOaTodo(workcode1.get(0).getOaId());
+        ImmutableMap<String, Object> oaTodo = portalOaFlow.getOaTodo(workcode1.get(0).getOaId(), pageNo, pageSize);
+        return CommonResult.success(oaTodo);
+
+//        List<IotOaPersonRespVO> iotOaPersonRespVOS = pmsMapper.selectOaPersonByCode(workcode);
+//        if (CollUtil.isEmpty(iotOaPersonRespVOS)) {
+//            throw new ServiceException(new ErrorCode(1,"不存在OA用户"));
+//        }
+//        ImmutableMap<String, Object> oaTodo = portalOaFlow.getOaTodo(iotOaPersonRespVOS.get(0).getOaId());
+//        return CommonResult.success(oaTodo);
+    }
+
+    @GetMapping("/oa/done")
+    @PermitAll
+    public CommonResult<ImmutableMap> oaDone(String workcode, Integer pageNo, Integer pageSize) throws Exception {
+        List<IotOaPersonDO> workcode1 = iotOaPersonMapper.selectList("workcode", workcode);
+        if (CollUtil.isEmpty(workcode1)) {
+            oaFlow.getPerson();
+            workcode1 = iotOaPersonMapper.selectList("workcode", workcode);
+            if (CollUtil.isEmpty(workcode1)) {
+                throw new ServiceException(new ErrorCode(1,"不存在OA用户"));
+            }
+        }
+        ImmutableMap<String, Object> oaTodo = portalOaFlow.getOaTodo(workcode1.get(0).getOaId(), pageNo, pageSize);
         return CommonResult.success(oaTodo);
         return CommonResult.success(oaTodo);
 
 
 //        List<IotOaPersonRespVO> iotOaPersonRespVOS = pmsMapper.selectOaPersonByCode(workcode);
 //        List<IotOaPersonRespVO> iotOaPersonRespVOS = pmsMapper.selectOaPersonByCode(workcode);
@@ -74,7 +96,7 @@ public class TodoController {
 
 
     @GetMapping("/crm")
     @GetMapping("/crm")
     @PermitAll
     @PermitAll
-    public CommonResult<ImmutableMap<String, Object>> crmTodo(String workcode) throws Exception {
+    public CommonResult<ImmutableMap<String, Object>> crmTodo(String workcode, String type, Integer pageNo, Integer pageSize) throws Exception {
         ImmutableMap<String, String> stringStringImmutableMap = crmRest.refreshToken("ec301168-d9d7-4f0c-a73c-03f50e952a3a");
         ImmutableMap<String, String> stringStringImmutableMap = crmRest.refreshToken("ec301168-d9d7-4f0c-a73c-03f50e952a3a");
         AdminUserRespDTO userByUsername = adminUserApi.getUserByUsername(workcode);
         AdminUserRespDTO userByUsername = adminUserApi.getUserByUsername(workcode);
         if (userByUsername == null) {throw new ServiceException(new ErrorCode(1,"门户系统中不存在该用户"));}
         if (userByUsername == null) {throw new ServiceException(new ErrorCode(1,"门户系统中不存在该用户"));}
@@ -84,7 +106,7 @@ public class TodoController {
         if (StringUtils.isBlank(crmUserId)) {
         if (StringUtils.isBlank(crmUserId)) {
             return CommonResult.success(ImmutableMap.of("todoCount",0,"todoList", new ArrayList<>()));
             return CommonResult.success(ImmutableMap.of("todoCount",0,"todoList", new ArrayList<>()));
         }
         }
-        ImmutableMap<String, Object> access = crmRest.getCrmTodoList(String.valueOf(stringStringImmutableMap.get("access")), crmUserId);
+        ImmutableMap<String, Object> access = crmRest.getCrmTodoList(String.valueOf(stringStringImmutableMap.get("access")), crmUserId, type, pageNo, pageSize);
         return CommonResult.success(access);
         return CommonResult.success(access);
     }
     }
 
 

+ 2 - 1
yudao-server/src/main/java/cn/iocoder/yudao/server/controller/admin/vo/crm/CrmPersonRespVO.java

@@ -1,10 +1,11 @@
 package cn.iocoder.yudao.server.controller.admin.vo.crm;
 package cn.iocoder.yudao.server.controller.admin.vo.crm;
 
 
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import lombok.*;
 
 
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
-import com.alibaba.excel.annotation.*;
 
 
 @Schema(description = "管理后台 - crm人员 Response VO")
 @Schema(description = "管理后台 - crm人员 Response VO")
 @Data
 @Data

+ 2 - 1
yudao-server/src/main/java/cn/iocoder/yudao/server/controller/admin/vo/crm/CrmPersonSaveReqVO.java

@@ -2,7 +2,8 @@ package cn.iocoder.yudao.server.controller.admin.vo.crm;
 
 
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import lombok.*;
-import jakarta.validation.constraints.*;
+
+import javax.validation.constraints.NotEmpty;
 
 
 @Schema(description = "管理后台 - crm人员新增/修改 Request VO")
 @Schema(description = "管理后台 - crm人员新增/修改 Request VO")
 @Data
 @Data

+ 1 - 0
yudao-server/src/main/java/cn/iocoder/yudao/server/controller/admin/vo/crm/CrmTodoVo.java

@@ -24,4 +24,5 @@ public class CrmTodoVo implements Serializable {
     private Long submitAt;
     private Long submitAt;
     private Long submitterId;
     private Long submitterId;
     private String usertaskInstId;
     private String usertaskInstId;
+    private String userName;
 }
 }

+ 6 - 4
yudao-server/src/main/java/cn/iocoder/yudao/server/rest/CrmRest.java

@@ -110,20 +110,22 @@ public class CrmRest {
         return userId.get();
         return userId.get();
     }
     }
 
 
-    public ImmutableMap<String, Object> getCrmTodoList(String token, String crmUserId) {
+    public ImmutableMap<String, Object> getCrmTodoList(String token, String crmUserId, String type, Integer pageSize, Integer pageNo) {
         HttpHeaders headers = new HttpHeaders();
         HttpHeaders headers = new HttpHeaders();
         headers.add("Authorization", token);
         headers.add("Authorization", token);
         HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
         HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
         RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
         RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
-        ResponseEntity<String> exchange = restTemplate.exchange("https://api-tencent.xiaoshouyi.com/rest/data/v2.0/creekflow/task/filter?status=approved&pageNo=1&pageSize=1000",
-                HttpMethod.GET, requestEntity, String.class);
+        ResponseEntity<String> exchange = restTemplate.exchange("https://api-tencent.xiaoshouyi.com/rest/data/v2.0/creekflow/task/filter?assigneeIds="+crmUserId+"&status="+type+"&pageNum="+pageNo+"&pageSize="+pageSize, HttpMethod.GET, requestEntity, String.class);
         String body = exchange.getBody();
         String body = exchange.getBody();
         String data = JSON.parseObject(body).getString("data");
         String data = JSON.parseObject(body).getString("data");
         String records = JSON.parseObject(data).getJSONArray("records").toJSONString();
         String records = JSON.parseObject(data).getJSONArray("records").toJSONString();
         List<CrmTodoVo> crmTodoVos = JSON.parseArray(records, CrmTodoVo.class);
         List<CrmTodoVo> crmTodoVos = JSON.parseArray(records, CrmTodoVo.class);
         Integer dataCount = JSON.parseObject(data).getInteger("dataCount");
         Integer dataCount = JSON.parseObject(data).getInteger("dataCount");
+        List<CrmPersonDO> crmPersonDOS = crmPersonMapper.selectList();
         crmTodoVos.forEach(e ->{
         crmTodoVos.forEach(e ->{
-
+            crmPersonDOS.stream().filter(f -> f.getCrmUserId().equals(String.valueOf(e.getId()))).findAny().ifPresent(f ->{
+                e.setUserName(f.getCrmUserName());
+            });
         });
         });
         return ImmutableMap.of("todoCount", dataCount,"todoList", crmTodoVos);
         return ImmutableMap.of("todoCount", dataCount,"todoList", crmTodoVos);
     }
     }

+ 19 - 6
yudao-server/src/main/java/cn/iocoder/yudao/server/service/PortalOaFlow.java

@@ -99,7 +99,7 @@ public class PortalOaFlow {
         ));
         ));
     }
     }
 
 
-    public ImmutableMap<String, Object> getOaTodo(String oaId) throws Exception {
+    public ImmutableMap<String, Object> getOaTodo(String oaId, Integer pageNo ,Integer pageSize) throws Exception {
         String token = getToken();
         String token = getToken();
 
 
         HttpHeaders headersOut = new HttpHeaders();
         HttpHeaders headersOut = new HttpHeaders();
@@ -114,8 +114,6 @@ public class PortalOaFlow {
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         map.put("root", ImmutableMap.of("createrid", oaId));
         map.put("root", ImmutableMap.of("createrid", oaId));
         params.put("conditions", map);
         params.put("conditions", map);
-        params.put("pageSize", 20);
-        params.put("pageNo", 1);
 
 
         HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
         HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
 
 
@@ -128,18 +126,33 @@ public class PortalOaFlow {
                 requestEntityOut, String.class
                 requestEntityOut, String.class
         );
         );
 
 
-        // 待办明细
+        //已办数量
+        String done = noCookieRestTemplate.postForObject("https://yfoa.keruioil.com/api/workflow/paService/getHandledWorkflowRequestCount", requestEntityOut, String.class);
+
         map.put("root", ImmutableMap.of("craterid", oaId));
         map.put("root", ImmutableMap.of("craterid", oaId));
         params.put("conditions", map);
         params.put("conditions", map);
+        params.put("pageSize", pageSize);
+        params.put("pageNo", pageNo);
+        System.out.println("-----------"+JSON.toJSONString(params));
         HttpEntity<Map<String, Object>> requestEntityOut1 = new HttpEntity<>(params, headersOut);
         HttpEntity<Map<String, Object>> requestEntityOut1 = new HttpEntity<>(params, headersOut);
-
+        // 待办明细
         String todoList = noCookieRestTemplate.postForObject(
         String todoList = noCookieRestTemplate.postForObject(
                 "https://yfoa.keruioil.com/api/workflow/paService/getDoingWorkflowRequestList",
                 "https://yfoa.keruioil.com/api/workflow/paService/getDoingWorkflowRequestList",
                 requestEntityOut1, String.class
                 requestEntityOut1, String.class
         );
         );
 
 
         List<JSONObject> jsonObjects = JSON.parseArray(todoList, JSONObject.class);
         List<JSONObject> jsonObjects = JSON.parseArray(todoList, JSONObject.class);
-        return ImmutableMap.of("todoCount", out, "todoList", jsonObjects);
+
+        // 待办明细
+//        map.put("root", ImmutableMap.of("craterid", oaId));
+//        params.put("conditions", map);
+//        HttpEntity<Map<String, Object>> requestEntityOut1 = new HttpEntity<>(params, headersOut);
+        //已办明细
+        String doneList = noCookieRestTemplate.postForObject("https://yfoa.keruioil.com/api/workflow/paService/getHandledWorkflowRequestList", requestEntityOut1, String.class);
+
+        List<JSONObject> doneJsonObjects = JSON.parseArray(doneList, JSONObject.class);
+        return ImmutableMap.of("todoCount", out, "todoList", jsonObjects,"doneCount", done,"doneList", doneJsonObjects);
     }
     }
 
 
+
 }
 }