|
@@ -10,6 +10,7 @@ import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.*; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.*; |
|
@@ -257,43 +258,45 @@ public class TodoCenterManage { |
|
|
* @since 2023/02/01 |
|
|
* @since 2023/02/01 |
|
|
*/ |
|
|
*/ |
|
|
public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
String employeeCode = param.getEmployeeCode(); |
|
|
|
|
|
if (StringUtils.isBlank(employeeCode)) { |
|
|
|
|
|
// 获取登录用户ID |
|
|
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
// 获取用户全量用户信息 |
|
|
|
|
|
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); |
|
|
|
|
|
// 获取登录用户浙政钉code |
|
|
|
|
|
employeeCode = userFullInfo.getEmployeeCode(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取登录用户ID |
|
|
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
// 获取用户全量用户信息 |
|
|
|
|
|
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); |
|
|
|
|
|
// 获取登录用户浙政钉code |
|
|
|
|
|
String employeeCode = userFullInfo.getEmployeeCode(); |
|
|
|
|
|
|
|
|
|
|
|
List<ProcessTaskVo> userTodoList = Lists.newArrayList(); |
|
|
|
|
|
Map<String, Project> projectInfoMap = MapUtil.newHashMap(); |
|
|
// 查出项目库项目 |
|
|
// 查出项目库项目 |
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
List<Project> projects = projectLibManage.projectList(projectListReq); |
|
|
|
|
|
if (CollUtil.isNotEmpty(projects)) { |
|
|
|
|
|
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)); |
|
|
|
|
|
projectInfoMap = projectInstList.stream() |
|
|
|
|
|
.collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); |
|
|
|
|
|
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
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.setEmployeeCode(employeeCode); |
|
|
|
|
|
|
|
|
// 查出用户工作流 |
|
|
|
|
|
TodoCenterListReqDTO req = new TodoCenterListReqDTO(); |
|
|
|
|
|
req.setInstCodes(instCodes); |
|
|
|
|
|
req.setProcessDefId(param.getProcessDefId()); |
|
|
|
|
|
req.setEmployeeCode(employeeCode); |
|
|
|
|
|
|
|
|
// 有待办节点的(不包含退回) |
|
|
|
|
|
List<ProcessTaskVo> todoList = processTaskService.getUserTodoList(req); |
|
|
|
|
|
// 有退回待办的 |
|
|
|
|
|
List<ProcessTaskVo> backList = processTaskService.getBackTodoList(req); |
|
|
|
|
|
// 合并 并且排序 |
|
|
|
|
|
List<ProcessTaskVo> userTodoList = Stream.concat(todoList.stream(), backList.stream()).filter(Objects::nonNull) |
|
|
|
|
|
.sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime).reversed()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
// 有待办节点的(不包含退回) |
|
|
|
|
|
List<ProcessTaskVo> todoList = processTaskService.getUserTodoList(req); |
|
|
|
|
|
// 有退回待办的 |
|
|
|
|
|
List<ProcessTaskVo> backList = processTaskService.getBackTodoList(req); |
|
|
|
|
|
// 合并 并且排序 |
|
|
|
|
|
userTodoList = Stream.concat(todoList.stream(), backList.stream()).filter(Objects::nonNull) |
|
|
|
|
|
.sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime).reversed()).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
String fileName = null; |
|
|
String fileName = null; |
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|