|
|
@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; |
|
|
|
import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; |
|
|
|
import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO; |
|
|
|
import com.wflow.workflow.enums.ProcessHandlerEnum; |
|
|
|
import org.apache.commons.io.FileUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@@ -218,7 +219,7 @@ public class TodoCenterManage { |
|
|
|
res.setProcessDefName(d.getProcessDefName()); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(resVos, todoList.size()); |
|
|
|
return PageVo.of(resVos, list.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -1105,4 +1106,72 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
return statisticsVO; |
|
|
|
} |
|
|
|
|
|
|
|
public TodoNumVO getTodoNums(ToBeProcessedReq param) { |
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
// 获取登录用户全量信息 |
|
|
|
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); |
|
|
|
// 获取员工浙政钉code |
|
|
|
String employeeCode = userFullInfo.getEmployeeCode(); |
|
|
|
TodoNumVO todoNumVo = new TodoNumVO(); |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
if(CollUtil.isEmpty(projects)){ |
|
|
|
return todoNumVo; |
|
|
|
} |
|
|
|
// 再查出项目关联的流程实例ID |
|
|
|
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) |
|
|
|
.in(ProjectInst::getProjectId, projectIdList) |
|
|
|
.orderByDesc(ProjectInst::getProjectId)); |
|
|
|
List<String> 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)); |
|
|
|
req.setEmployeeCode(employeeCode); |
|
|
|
//有待办节点的(不包含退回) |
|
|
|
List<ProcessTaskVo> todoList = processTaskService.getUserTodoList(req); |
|
|
|
//有退回待办的 |
|
|
|
List<ProcessTaskVo> backList = processTaskService.getBackTodoList(req); |
|
|
|
//合并 并且排序 |
|
|
|
List<ProcessTaskVo> list = Stream.concat(todoList.stream(),backList.stream()) |
|
|
|
.filter(Objects::nonNull) |
|
|
|
.sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime) |
|
|
|
.reversed()) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (CollUtil.isEmpty(list)){ |
|
|
|
return todoNumVo; |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream() |
|
|
|
.collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
// 关联项目信息 |
|
|
|
List<Project> projectList = list.stream() |
|
|
|
.map(d -> projectInfoMap.get(d.getInstanceId())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (CollUtil.isNotEmpty(projectList)) { |
|
|
|
todoNumVo.setTotalNum(projectList.size()); |
|
|
|
} |
|
|
|
// 筛选出增补项目和非增补项目 |
|
|
|
List<Project> appendProjects = projectList.stream() |
|
|
|
.filter(p -> IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (CollUtil.isNotEmpty(appendProjects)){ |
|
|
|
todoNumVo.setAppendNum(appendProjects.size()); |
|
|
|
} |
|
|
|
List<Project> notAppendProjects = projectList.stream() |
|
|
|
.filter(p -> IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (CollUtil.isNotEmpty(notAppendProjects)){ |
|
|
|
todoNumVo.setNotAppendNum(notAppendProjects.size()); |
|
|
|
} |
|
|
|
return todoNumVo; |
|
|
|
} |
|
|
|
} |