|
|
@@ -2,7 +2,7 @@ package com.ningdatech.pmapi.todocenter.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.codec.Base64; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.io.resource.ResourceUtil; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
@@ -62,10 +62,12 @@ import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
import com.sun.org.apache.bcel.internal.generic.NEW; |
|
|
|
import com.wflow.contants.HisProInsEndActId; |
|
|
|
import com.wflow.exception.BusinessException; |
|
|
|
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; |
|
|
|
import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; |
|
|
|
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; |
|
|
|
import com.wflow.workflow.bean.process.ProgressNode; |
|
|
|
import com.wflow.workflow.bean.process.enums.NodeTypeEnum; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessInstanceVo; |
|
|
@@ -82,6 +84,7 @@ import org.flowable.bpmn.model.*; |
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
import org.flowable.engine.history.HistoricProcessInstance; |
|
|
|
import org.flowable.engine.runtime.ActivityInstance; |
|
|
|
import org.flowable.task.api.Task; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.mock.web.MockMultipartFile; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
@@ -91,9 +94,10 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.net.URL; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.*; |
|
|
|
import static com.wflow.workflow.task.TriggerServiceTask.runtimeService; |
|
|
@@ -138,13 +142,39 @@ public class TodoCenterManage { |
|
|
|
public PageVo<ResToBeProcessedVO> todoProjectList(ToBeProcessedReq param) { |
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
//因为要解耦 不能把项目和工作流一起查 |
|
|
|
//1.先查出用户工作流 |
|
|
|
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(), String.valueOf(userId)); |
|
|
|
if (CollUtil.isEmpty(userTodoList)) { |
|
|
|
|
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 查出用户工作流 |
|
|
|
TodoCenterListReqDTO req = new TodoCenterListReqDTO(); |
|
|
|
req.setInstCodes(instCodes); |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
req.setProcessDefId(param.getProcessDefId()); |
|
|
|
req.setUserId(String.valueOf(userId)); |
|
|
|
BeanUtils.copyProperties(param,req); |
|
|
|
List<ProcessTaskVo> todoList = processTaskService.getUserTodoList(req); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(todoList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<String> instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ProcessTaskVo> userTodoList = todoList.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
Set<String> processSet = Sets.newHashSet(); |
|
|
|
Map<String, ProcessTaskVo> taskMap = userTodoList.stream() |
|
|
@@ -153,27 +183,21 @@ public class TodoCenterManage { |
|
|
|
.filter(v -> processSet.add(v.getInstanceId())) |
|
|
|
.collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); |
|
|
|
|
|
|
|
//2.再分页查询项目信息 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
PageVo<ProjectLibListItemVO> projectPage = projectLibManage.projectLibList(projectListReq); |
|
|
|
|
|
|
|
if (0L == projectPage.getTotal()) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<ResToBeProcessedVO> resVos = projectPage.getRecords().stream().map(d -> { |
|
|
|
List<ResToBeProcessedVO> resVos = userTodoList.stream().map(d -> { |
|
|
|
Project projectInfo = projectInfoMap.get(d.getInstanceId()); |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
ProcessTaskVo taskVo = taskMap.get(d.getInstCode()); |
|
|
|
BeanUtils.copyProperties(projectInfo, res); |
|
|
|
res.setProjectId(projectInfo.getId()); |
|
|
|
ProcessTaskVo taskVo = taskMap.get(d.getInstanceId()); |
|
|
|
res.setNodeId(taskVo.getTaskDefKey()); |
|
|
|
res.setProcessStatusName(taskVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
LocalDateTime launchTime = NdDateUtils.date2LocalDateTime(d.getCreateTime()); |
|
|
|
String timeStr = NdDateUtils.format(launchTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN); |
|
|
|
LocalDateTime processLaunchTime = LocalDateTime.parse(timeStr, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); |
|
|
|
res.setProcessLaunchTime(processLaunchTime); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(resVos, projectPage.getTotal()); |
|
|
|
return PageVo.of(resVos, todoList.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -188,19 +212,28 @@ public class TodoCenterManage { |
|
|
|
public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); |
|
|
|
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); |
|
|
|
|
|
|
|
//因为要解耦 不能把项目和工作流一起查 |
|
|
|
//1.先查出用户工作流 |
|
|
|
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(), String.valueOf(userId)); |
|
|
|
List<String> instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//2.再查询项目信息 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = CollUtil.isEmpty(userTodoList) ? Collections.emptyList() : projectLibManage.projectList(projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.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)); |
|
|
|
BeanUtils.copyProperties(param,req); |
|
|
|
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(req); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
String fileName = null; |
|
|
@@ -211,7 +244,7 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
excelExportWriter.setFileName(fileName); |
|
|
|
List<String> sheetsNames = Lists.newArrayList(fileName); |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects); |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getTaskExportDatas(param.getExportOptionList(), userTodoList, projectInfoMap); |
|
|
|
// sheet列表集合 |
|
|
|
List<List<List<String>>> sheets = Lists.newArrayList(); |
|
|
|
sheets.add(exportDatas); |
|
|
@@ -652,9 +685,6 @@ public class TodoCenterManage { |
|
|
|
List<ProgressNode> progressInfo = progressInstanceDetail.getProgressInfo(); |
|
|
|
buildUserUtils.buildUserByProcessInfo(progressInfo); |
|
|
|
|
|
|
|
//// 装配节点审核人员信息 |
|
|
|
//buildUser(progressInfo, userMap); |
|
|
|
|
|
|
|
ProcessProgressDetailVo res = new ProcessProgressDetailVo(); |
|
|
|
res.setProcessProgressVo(progressInstanceDetail); |
|
|
|
res.setStatus(progressInstanceDetail.getStatus()); |
|
|
@@ -671,44 +701,59 @@ public class TodoCenterManage { |
|
|
|
* @since 2023/02/03 |
|
|
|
*/ |
|
|
|
public PageVo<ResToBeProcessedVO> idoList(ToBeProcessedReq param) { |
|
|
|
|
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
// 查出用户已处理工作流 |
|
|
|
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), String.valueOf(userId)); |
|
|
|
if (CollUtil.isEmpty(userIdoList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<String> instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
Set<String> processSet = Sets.newHashSet(); |
|
|
|
Map<String, ProcessTaskVo> taskMap = userIdoList.stream() |
|
|
|
.sorted((t1,t2) -> t2.getTaskEndTime().compareTo(t1.getTaskEndTime())) |
|
|
|
.collect(Collectors.toList()).stream() |
|
|
|
.filter(v -> processSet.add(v.getInstanceId())) |
|
|
|
.collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); |
|
|
|
|
|
|
|
// 分页查询项目信息 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
|
|
|
|
PageVo<ProjectLibListItemVO> projectPage = projectLibManage.projectLibList(projectListReq); |
|
|
|
if (0L == projectPage.getTotal()) { |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 查出用户工作流 |
|
|
|
TodoCenterListReqDTO req = new TodoCenterListReqDTO(); |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
req.setProcessDefId(param.getProcessDefId()); |
|
|
|
req.setUserId(String.valueOf(userId)); |
|
|
|
req.setInstCodes(instCodes); |
|
|
|
List<ProcessTaskVo> iDoList = processTaskService.getUserIdoList(req); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(iDoList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<ResToBeProcessedVO> resVos = projectPage.getRecords().stream().map(d -> { |
|
|
|
|
|
|
|
List<ProcessTaskVo> userIdoList = iDoList.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ResToBeProcessedVO> resVos = userIdoList.stream().map(d -> { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
ProcessTaskVo taskVo = taskMap.get(d.getInstCode()); |
|
|
|
res.setProcessStatusName(taskVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
res.setProcessHandleTime(NdDateUtils.date2LocalDateTime(taskVo.getTaskEndTime())); |
|
|
|
Project projectInfo = projectInfoMap.get(d.getInstanceId()); |
|
|
|
BeanUtils.copyProperties(projectInfo, res); |
|
|
|
res.setProjectId(projectInfo.getId()); |
|
|
|
res.setProcessStatusName(d.getStatus()); |
|
|
|
LocalDateTime launchTime = NdDateUtils.date2LocalDateTime(d.getCreateTime()); |
|
|
|
String launchTimeStr = NdDateUtils.format(launchTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN); |
|
|
|
LocalDateTime processLaunchTime = LocalDateTime.parse(launchTimeStr, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); |
|
|
|
res.setProcessLaunchTime(processLaunchTime); |
|
|
|
LocalDateTime handleTime = NdDateUtils.date2LocalDateTime(d.getTaskEndTime()); |
|
|
|
String handleTimeStr = NdDateUtils.format(handleTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN); |
|
|
|
LocalDateTime processHandleTime = LocalDateTime.parse(handleTimeStr, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); |
|
|
|
res.setProcessHandleTime(processHandleTime); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(resVos, projectPage.getTotal()); |
|
|
|
return PageVo.of(resVos, iDoList.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -724,19 +769,27 @@ public class TodoCenterManage { |
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); |
|
|
|
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); |
|
|
|
|
|
|
|
// 查询用户已处理工作流 |
|
|
|
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), String.valueOf(userId)); |
|
|
|
List<String> instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 查询项目信息 |
|
|
|
//因为要解耦 不能把项目和工作流一起查 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = CollUtil.isEmpty(userIdoList) ? Collections.emptyList() : |
|
|
|
projectLibManage.projectList(projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> 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<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(req); |
|
|
|
|
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
@@ -751,7 +804,7 @@ public class TodoCenterManage { |
|
|
|
List<String> sheetsNames = new ArrayList<>(); |
|
|
|
sheetsNames.add(fileName); |
|
|
|
|
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects); |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getTaskExportDatas(param.getExportOptionList(), userIdoList, projectInfoMap); |
|
|
|
// sheet列表集合 |
|
|
|
List<List<List<String>>> sheets = new ArrayList<>(); |
|
|
|
sheets.add(exportDatas); |
|
|
@@ -775,36 +828,51 @@ public class TodoCenterManage { |
|
|
|
public PageVo<ResToBeProcessedVO> mySubmittedList(ToBeProcessedReq param) { |
|
|
|
|
|
|
|
// 获取登录用户ID |
|
|
|
Long startUserId = LoginUserUtil.getUserId(); |
|
|
|
// 查出登录用户已提交工作流 |
|
|
|
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(startUserId), param.getProcessDefId(), null); |
|
|
|
Map<String, ProcessInstanceVo> instanceVoMap = userSubmittedList.stream() |
|
|
|
.collect(Collectors.toMap(ProcessInstanceVo::getInstanceId, v -> v)); |
|
|
|
if (CollUtil.isEmpty(userSubmittedList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<String> instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
// 分页查询项目信息 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
|
|
|
|
PageVo<ProjectLibListItemVO> projectPage = projectLibManage.projectLibList(projectListReq); |
|
|
|
if (0L == projectPage.getTotal()) { |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 查出用户工作流 |
|
|
|
TodoCenterListReqDTO req = new TodoCenterListReqDTO(); |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
req.setProcessDefId(param.getProcessDefId()); |
|
|
|
req.setUserId(String.valueOf(userId)); |
|
|
|
req.setInstCodes(instCodes); |
|
|
|
List<ProcessInstanceVo> submittedList = processInstanceService.getUserSubmittedList(req); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(submittedList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<ResToBeProcessedVO> resVos = projectPage.getRecords().stream().map(d -> { |
|
|
|
List<ProcessInstanceVo> userSubmittedList = submittedList.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
List<ResToBeProcessedVO> resVos = userSubmittedList.stream().map(d -> { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
Project project = projectInfoMap.get(d.getInstanceId()); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
ProcessInstanceVo instanceVo = instanceVoMap.get(d.getInstCode()); |
|
|
|
res.setProcessStatusName(instanceVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
res.setBuildOrg(project.getBuildOrgName()); |
|
|
|
res.setProjectId(project.getId()); |
|
|
|
res.setProcessStatusName(d.getStatus()); |
|
|
|
res.setProcessLaunchTime(NdDateUtils.date2LocalDateTime(d.getStartTime())); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(resVos, projectPage.getTotal()); |
|
|
|
return PageVo.of(resVos,submittedList.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -821,19 +889,25 @@ public class TodoCenterManage { |
|
|
|
// 获取登录用户ID |
|
|
|
long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); |
|
|
|
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); |
|
|
|
// 查询用户已处理工作流 |
|
|
|
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(userId), param.getProcessDefId(), null); |
|
|
|
List<String> instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 查询项目信息 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = CollUtil.isEmpty(userSubmittedList) ? Collections.emptyList() : |
|
|
|
projectLibManage.projectList(projectListReq); |
|
|
|
projectLibManage.projectList(projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> 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<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(req); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
@@ -848,7 +922,7 @@ public class TodoCenterManage { |
|
|
|
List<String> sheetsNames = new ArrayList<>(); |
|
|
|
sheetsNames.add(fileName); |
|
|
|
// 表体行数据集合 |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects); |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getInstExportDatas(param.getExportOptionList(), userSubmittedList, projectInfoMap); |
|
|
|
// sheet列表集合 |
|
|
|
List<List<List<String>>> sheets = new ArrayList<>(); |
|
|
|
sheets.add(exportDatas); |
|
|
@@ -870,39 +944,54 @@ public class TodoCenterManage { |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
public PageVo<ResToBeProcessedVO> ccmeList(ToBeProcessedReq param) { |
|
|
|
// 获取当前登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
// 查询抄送登录用户的工作流 |
|
|
|
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); |
|
|
|
if (CollUtil.isEmpty(ccMeList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<String> instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
Map<String, ProcessInstanceVo> instanceVoMap = ccMeList.stream() |
|
|
|
.collect(Collectors.toMap(ProcessInstanceVo::getInstanceId, v -> v)); |
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
// 分页查询项目信息 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 查出用户工作流 |
|
|
|
TodoCenterListReqDTO req = new TodoCenterListReqDTO(); |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
req.setProcessDefId(param.getProcessDefId()); |
|
|
|
req.setUserId(String.valueOf(userId)); |
|
|
|
req.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param,req); |
|
|
|
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(req); |
|
|
|
|
|
|
|
PageVo<ProjectLibListItemVO> projectPage = projectLibManage.projectLibList(projectListReq); |
|
|
|
if (0L == projectPage.getTotal()) { |
|
|
|
if (CollUtil.isEmpty(ccMeList)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<ResToBeProcessedVO> resVos = projectPage.getRecords().stream().map(d -> { |
|
|
|
List<ProcessInstanceVo> ccMeInstList = ccMeList.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ResToBeProcessedVO> resVos = ccMeInstList.stream().map(d -> { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
Project project = projectInfoMap.get(d.getInstanceId()); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
ProcessInstanceVo instanceVo = instanceVoMap.get(d.getInstCode()); |
|
|
|
res.setNodeId(instanceVo.getNodeId()); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(instanceVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
res.setNodeId(d.getNodeId()); |
|
|
|
res.setProjectId(project.getId()); |
|
|
|
res.setBuildOrg(project.getBuildOrgName()); |
|
|
|
res.setProcessStatusName(d.getStatus()); |
|
|
|
res.setProcessLaunchTime(NdDateUtils.date2LocalDateTime(d.getStartTime())); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(resVos, projectPage.getTotal()); |
|
|
|
return PageVo.of(resVos, ccMeList.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -919,18 +1008,26 @@ public class TodoCenterManage { |
|
|
|
// 获取登录用户ID |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); |
|
|
|
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); |
|
|
|
|
|
|
|
// 查询抄送登录用户的工作流 |
|
|
|
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); |
|
|
|
List<String> instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 查询项目信息 |
|
|
|
// 查出项目库项目 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = CollUtil.isEmpty(ccMeList) ? Collections.emptyList() : projectLibManage.projectList(projectListReq); |
|
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); |
|
|
|
// 再查出项目关联的流程实例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)); |
|
|
|
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId()))); |
|
|
|
List<String> 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<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(req); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
@@ -945,7 +1042,7 @@ public class TodoCenterManage { |
|
|
|
List<String> sheetsNames = new ArrayList<>(); |
|
|
|
sheetsNames.add(fileName); |
|
|
|
// 表体行数据集合 |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects); |
|
|
|
List<List<String>> exportDatas = ExcelDownUtil.getInstExportDatas(param.getExportOptionList(), ccMeList, projectInfoMap); |
|
|
|
// sheet列表集合 |
|
|
|
List<List<List<String>>> sheets = new ArrayList<>(); |
|
|
|
sheets.add(exportDatas); |
|
|
|