diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 7f7e337..317b89d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.todocenter.manage; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; @@ -120,6 +121,9 @@ public class TodoCenterManage { //因为要解耦 不能把项目和工作流一起查 //1.先查出用户工作流 List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); + if(CollUtil.isEmpty(userTodoList)){ + return PageVo.empty(); + } List instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); //2.再分页查询项目信息 @@ -167,7 +171,7 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); BeanUtils.copyProperties(param,projectListReq); - List projects = projectLibManage.projectList(projectListReq); + List projects = CollUtil.isEmpty(userTodoList) ? Collections.emptyList() : projectLibManage.projectList(projectListReq); PageVo projectLibList = projectLibManage.projectLibList(projectListReq); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -829,10 +833,13 @@ public class TodoCenterManage { */ public PageVo idoList(ToBeProcessedReq param) { // 获取登录用户ID - long userId = LoginUserUtil.getUserId(); + Long userId = LoginUserUtil.getUserId(); // 查出用户已处理工作流 List userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(),String.valueOf(userId)); + if(CollUtil.isEmpty(userIdoList)){ + return PageVo.empty(); + } List instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); @@ -882,7 +889,8 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); + List projects = CollUtil.isEmpty(userIdoList) ? Collections.emptyList() : + projectLibManage.projectList(projectListReq); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -924,6 +932,9 @@ public class TodoCenterManage { Long startUserId = LoginUserUtil.getUserId(); // 查出登录用户已提交工作流 List userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(startUserId), param.getProcessDefId(), null); + if(CollUtil.isEmpty(userSubmittedList)){ + return PageVo.empty(); + } List instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); // 分页查询项目信息 @@ -971,7 +982,8 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); + List projects = CollUtil.isEmpty(userSubmittedList) ? Collections.emptyList() : + projectLibManage.projectList(projectListReq);projectLibManage.projectList(projectListReq); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -1013,6 +1025,9 @@ public class TodoCenterManage { // 查询抄送登录用户的工作流 List ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); + if(CollUtil.isEmpty(ccMeList)){ + return PageVo.empty(); + } List instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); // 分页查询项目信息 @@ -1061,7 +1076,7 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); BeanUtils.copyProperties(param, projectListReq); - List projects = projectLibManage.projectList(projectListReq); + List projects = CollUtil.isEmpty(ccMeList) ? Collections.emptyList() : projectLibManage.projectList(projectListReq); ExcelExportWriter excelExportWriter = new ExcelExportWriter();