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 7e8623d..f8822d8 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 @@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; @@ -164,13 +165,17 @@ public class TodoCenterManage { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + if(CollUtil.isEmpty(projectIdList)){ + return PageVo.empty(); + } List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - - + if(CollUtil.isEmpty(instCodes)){ + return PageVo.empty(); + } // 查出用户工作流 TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setInstCodes(instCodes); @@ -238,14 +243,16 @@ public class TodoCenterManage { Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setInstCodes(instCodes); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - BeanUtils.copyProperties(param,req); - List userTodoList = processTaskService.getUserTodoList(req); + List userTodoList = Lists.newArrayList(); + if (CollUtil.isNotEmpty(instCodes)) { + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setInstCodes(instCodes); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + BeanUtils.copyProperties(param,req); + userTodoList = processTaskService.getUserTodoList(req); + } ExcelExportWriter excelExportWriter = new ExcelExportWriter(); String fileName = null; @@ -724,6 +731,9 @@ public class TodoCenterManage { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + if (CollUtil.isEmpty(projectIdList)) { + return PageVo.empty(); + } List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); @@ -780,22 +790,26 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); List projects = projectLibManage.projectList(projectListReq); - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); - List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setInstCodes(instCodes); - List userIdoList = processTaskService.getUserIdoList(req); - + List userIdoList = Lists.newArrayList(); + Map projectInfoMap = Maps.newHashMap(); + if (CollUtil.isEmpty(projects)) { + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::getProjectId)); + projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); + List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setInstCodes(instCodes); + userIdoList = processTaskService.getUserIdoList(req); + } ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -843,6 +857,11 @@ public class TodoCenterManage { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + + if (CollUtil.isEmpty(projectIdList)) { + return PageVo.empty(); + } + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); @@ -900,21 +919,26 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); List projects = projectLibManage.projectList(projectListReq); - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); - List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - // 查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setInstCodes(instCodes); - List userSubmittedList = processInstanceService.getUserSubmittedList(req); + List userSubmittedList = Lists.newArrayList(); + Map projectInfoMap = Maps.newHashMap(); + if (CollUtil.isEmpty(projects)) { + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::getProjectId)); + projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); + List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); + + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setInstCodes(instCodes); + userSubmittedList = processInstanceService.getUserSubmittedList(req); + } ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -959,6 +983,11 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); List projects = projectLibManage.projectList(projectListReq); + + if (CollUtil.isEmpty(projects)) { + return PageVo.empty(); + } + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); @@ -1020,22 +1049,29 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); List projects = projectLibManage.projectList(projectListReq); - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); - // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIdList) - .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); - List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); - // 分页查出用户工作流 - TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setInstCodes(instCodes); - BeanUtils.copyProperties(param,req); - List ccMeList = processInstanceService.getCcMeList(req); + List ccMeList = Lists.newArrayList(); + Map projectInfoMap = Maps.newHashMap(); + if (CollUtil.isEmpty(projects)) { + Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + // 再查出项目关联的流程实例ID + List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) + .in(ProjectInst::getProjectId, projectIdList) + .orderByDesc(ProjectInst::getProjectId)); + projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); + List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); + + // 分页查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(String.valueOf(userId)); + req.setInstCodes(instCodes); + BeanUtils.copyProperties(param,req); + ccMeList = processInstanceService.getCcMeList(req); + } + + ExcelExportWriter excelExportWriter = new ExcelExportWriter();