From 92a16704d29bdff6143b4e4d7ab69807c92718fb Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Tue, 14 Feb 2023 15:18:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=A4=84=E7=90=86-=E6=92=A4?= =?UTF-8?q?=E5=9B=9E=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TodoCenterController.java | 9 +- .../pmapi/todocenter/manage/TodoCenterManage.java | 176 ++++++++++++++------- .../model/dto/req/ReqToBeProcessedDTO.java | 7 +- .../model/dto/req/ReqToBeProcessedExportDTO.java | 52 ++++++ 4 files changed, 177 insertions(+), 67 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedExportDTO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index 8405823..60685fc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -7,6 +7,7 @@ import javax.validation.Valid; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; +import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedExportDTO; import org.springframework.web.bind.annotation.*; import com.ningdatech.basic.model.ApiResponse; @@ -53,7 +54,7 @@ public class TodoCenterController { * @return void */ @PostMapping("/exportPending") - public void exportPendingProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + public void exportPendingProjectList(@Valid @RequestBody ReqToBeProcessedExportDTO param, HttpServletResponse response){ todoCenterManage.exportPendingProjectList(response,param); } @@ -98,7 +99,7 @@ public class TodoCenterController { * @return void */ @PostMapping("/exportHandled") - public void exportHandledProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + public void exportHandledProjectList(@Valid @RequestBody ReqToBeProcessedExportDTO param, HttpServletResponse response){ todoCenterManage.exportHandledProjectList(response,param); } @@ -121,7 +122,7 @@ public class TodoCenterController { * @return void */ @PostMapping("/exportMySubmitted") - public void exportMySubmittedProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + public void exportMySubmittedProjectList(@Valid @RequestBody ReqToBeProcessedExportDTO param, HttpServletResponse response){ todoCenterManage.exportMySubmittedProjectList(response,param); } @@ -144,7 +145,7 @@ public class TodoCenterController { * @return void */ @PostMapping("/exportCcMe") - public void exportCcMeProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + public void exportCcMeProjectList(@Valid @RequestBody ReqToBeProcessedExportDTO param, HttpServletResponse response){ todoCenterManage.exportCcMeProjectList(response,param); } } 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 6dc30f9..6b3a65e 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.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -38,6 +39,7 @@ import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd; import com.ningdatech.pmapi.todocenter.extension.cmd.SaveCommentCmd; import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO; +import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedExportDTO; import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO; import com.ningdatech.pmapi.todocenter.zwdd.model.MessageContent; import com.ningdatech.pmapi.todocenter.zwdd.model.MessageText; @@ -96,6 +98,8 @@ import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; +import static cn.hutool.core.collection.CollUtil.isEmpty; +import static cn.hutool.core.collection.CollUtil.isNotEmpty; import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPLATE; import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPLATE2; @@ -138,13 +142,22 @@ public class TodoCenterManage { // 获取登录用户ID // long userId = LoginUserUtil.getUserId(); - Long userId = 381496L; - // Long userId = 6418616L; + // Long userId = 381496L; + Long userId = 6418616L; // Long userId = 61769799L; TaskQuery taskQuery = taskService.createTaskQuery(); taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc(); List taskList = taskQuery.list(); List results = getToBeProcessedProjects(param, taskList); + // 总数 + int total = results.size(); + // 获取传入的分页参数 + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + List records = results.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); Map taskMap = taskList.stream() .collect(Collectors.toMap(Task::getProcessInstanceId, t -> t)); @@ -154,13 +167,13 @@ public class TodoCenterManage { Set staterUsers = new HashSet<>(); // 将申报项目待登录用户处理的流程实例一次性取出来,减少查询次数 - Map instanceMap = CollectionUtil.isNotEmpty(taskList) + Map instanceMap = isNotEmpty(taskList) ? historyService.createHistoricProcessInstanceQuery() .processInstanceIds(processInsIds).list().stream() .collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); - List resVos = results.stream().map(d -> { + List resVos = records.stream().map(d -> { ResToBeProcessedDTO res = new ResToBeProcessedDTO(); BeanUtils.copyProperties(d, res); res.setProjectId(d.getId()); @@ -186,17 +199,19 @@ public class TodoCenterManage { return res; }).collect(Collectors.toList()); // 取用户信息,减少数据库查询,一次构建 - List result = null; - if (CollectionUtil.isNotEmpty(staterUsers)) { + if (isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); - result = resVos.stream() + resVos.stream() .peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) .collect(Collectors.toList()); // Map userMap = userInfoService.getUserMapByIds(staterUsers); // result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) // .collect(Collectors.toList()); } - return PageVo.of(result, result.size()); + if (isEmpty(resVos)){ + return PageVo.empty(); + } + return PageVo.of(resVos, total); } /** @@ -208,7 +223,7 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/01 */ - public void exportPendingProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { + public void exportPendingProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { param.setPageNumber(1); param.setPageSize(10000); // 获取登录用户ID @@ -219,8 +234,9 @@ public class TodoCenterManage { TaskQuery taskQuery = taskService.createTaskQuery(); taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc(); List taskList = taskQuery.list(); - List records = getToBeProcessedProjects(param, taskList); - + ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); + BeanUtils.copyProperties(param,reqToBeProcessedDTO); + List records = getToBeProcessedProjects(reqToBeProcessedDTO, taskList); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); String fileName = null; @@ -270,7 +286,6 @@ public class TodoCenterManage { * @since 2023/02/11 */ private List getToBeProcessedProjects(ReqToBeProcessedDTO param, List taskList) { - Page page = param.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) @@ -279,12 +294,13 @@ public class TodoCenterManage { .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, param.getProcessLaunchStartTime()) .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); - projectService.page(page, wrapper); + List results = projectService.list(wrapper); List taskProcessInsIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toList()); + // 过滤申报项目中待登录用户审核的项目 - return page.getRecords().stream().filter(w -> taskProcessInsIds.contains(w.getInstCode())) + return results.stream().filter(w -> taskProcessInsIds.contains(w.getInstCode())) .collect(Collectors.toList()); } @@ -302,9 +318,9 @@ public class TodoCenterManage { // Long userId = LoginUserUtil.getUserId(); - Long userId = 381496L; + // Long userId = 381496L; - // Long userId = 6418616L; + Long userId = 6418616L; // 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作) if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)){ @@ -642,7 +658,7 @@ public class TodoCenterManage { */ private boolean hasComment(ProcessComment comment) { return Objects.nonNull(comment) - && (StrUtil.isNotBlank(comment.getText()) || CollectionUtil.isNotEmpty(comment.getAttachments())); + && (StrUtil.isNotBlank(comment.getText()) || isNotEmpty(comment.getAttachments())); } /** @@ -744,7 +760,20 @@ public class TodoCenterManage { .collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) .changeState(); } else { - // TODO 获取前一个审核节点审核人信息 + // 获取当前流程待审核节点 + FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); + SequenceFlow sequenceFlow = currentNode.getIncomingFlows().get(0); + // 获取上一个节点的activityId + String sourceRef = sequenceFlow.getSourceRef(); + + HistoricActivityInstance lastInstance = historyService.createHistoricActivityInstanceQuery() + .processInstanceId(task.getProcessInstanceId()) + .activityId(sourceRef) + .activityType("userTask") + .finished() + .singleResult(); + // 获取前一个审核节点审核人信息 + String beforeUserId = lastInstance.getAssignee(); // TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 Boolean orgFlag = true; @@ -929,7 +958,7 @@ public class TodoCenterManage { .name(task.getNodeName()).user(OrgUser.builder().id(task.getUserId()).build()) .startTime(task.getCreateTime()).finishTime(task.getCreateTime()).build(); }).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(ccUsers)) { + if (isNotEmpty(ccUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(ccUsers); ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getId()))).collect(Collectors.toList()); } @@ -990,7 +1019,7 @@ public class TodoCenterManage { .approvalMode(approvalMode).auditInfo(commentsMap.get(his.getTaskId())) .result(varMap.get("approve_" + his.getTaskId())).build(); }).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(userSet)) { + if (isNotEmpty(userSet)) { Map map = userDeptOrLeaderService.getUserMapByIds(userSet); progressNodes.forEach(n -> n.setUser(map.get(n.getUser().getId()))); } @@ -1014,8 +1043,8 @@ public class TodoCenterManage { // 获取登录用户ID // long userId = LoginUserUtil.getUserId(); - // Long userId = 381496L; - Long userId = 6418616L; + Long userId = 381496L; + // Long userId = 6418616L; // Long userId = 61769799L; // 自定义sql查询所有已办的任务实例 @@ -1031,18 +1060,29 @@ public class TodoCenterManage { .collect(Collectors.toSet()); List results = getHandledProjects(param, taskProcessInsIds); + // 总数 + int total = results.size(); + // 获取传入的分页参数 + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + List records = results.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + // 把已办任务实例一次性取出来,减少查询次数 Map taskInstanceMap = taskInstances.stream() .collect(Collectors.toMap(HistoricTaskInstance::getProcessInstanceId, v -> v)); - Map instanceMap = CollectionUtil.isNotEmpty(taskInstances) + Map instanceMap = isNotEmpty(taskInstances) ? historyService.createHistoricProcessInstanceQuery() .processInstanceIds(taskProcessInsIds) .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); Set staterUsers = new HashSet<>(); - List resVos = results.stream().map(d -> { + List resVos = records.stream().map(d -> { ResToBeProcessedDTO res = new ResToBeProcessedDTO(); BeanUtils.copyProperties(d, res); @@ -1075,18 +1115,19 @@ public class TodoCenterManage { return res; }).collect(Collectors.toList()); // 取用户信息,减少数据库查询,一次构建 - List result = null; - if (CollectionUtil.isNotEmpty(staterUsers)) { + if (isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); - result = resVos.stream() + resVos.stream() .peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) .collect(Collectors.toList()); // Map userMap = userInfoService.getUserMapByIds(staterUsers); // result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) // .collect(Collectors.toList()); - } - return PageVo.of(result, result.size()); + if (isEmpty(resVos)){ + return PageVo.empty(); + } + return PageVo.of(resVos,total); } /** @@ -1099,8 +1140,6 @@ public class TodoCenterManage { * @since 2023/02/11 */ private List getHandledProjects(ReqToBeProcessedDTO param, Set taskProcessInsIds) { - // 获取入参分页信息 - Page page = param.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) @@ -1109,10 +1148,10 @@ public class TodoCenterManage { .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, param.getProcessLaunchStartTime()) .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); - projectService.page(page, wrapper); + List results = projectService.list(wrapper); // 过滤申报项目中登录用户已审核的项目 - return page.getRecords().stream() + return results.stream() .filter(w -> taskProcessInsIds.contains(w.getInstCode())) .collect(Collectors.toList()); } @@ -1126,7 +1165,7 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/06 */ - public void exportHandledProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { + public void exportHandledProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { param.setPageNumber(1); param.setPageSize(10000); // 获取登录用户ID @@ -1144,7 +1183,9 @@ public class TodoCenterManage { Set taskProcessInsIds = taskInstances.stream() .map(HistoricTaskInstance::getProcessInstanceId) .collect(Collectors.toSet()); - List records = getHandledProjects(param, taskProcessInsIds); + ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); + BeanUtils.copyProperties(param,reqToBeProcessedDTO); + List records = getHandledProjects(reqToBeProcessedDTO, taskProcessInsIds); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -1203,20 +1244,30 @@ public class TodoCenterManage { List historicProcessInstances = instanceQuery.orderByProcessInstanceStartTime().desc().orderByProcessInstanceEndTime().desc().list(); Set historicProcessInstanceIds = - historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet()); + historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toSet()); List results = getMySubmittedProjects(param, historicProcessInstanceIds); + // 总数 + int total = results.size(); + // 获取传入的分页参数 + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + List records = results.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + // 把已办任务流程实例一次性取出来,减少查询次数 - Map instanceMap = CollectionUtil.isNotEmpty(historicProcessInstances) ? historyService + Map instanceMap = isNotEmpty(historicProcessInstances) ? historyService .createHistoricProcessInstanceQuery() - .processInstanceIds(historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet())) + .processInstanceIds(historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toSet())) .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); Set staterUsers = new HashSet<>(); List resVos = - results.stream().map(d -> { + records.stream().map(d -> { ResToBeProcessedDTO res = new ResToBeProcessedDTO(); BeanUtils.copyProperties(d, res); res.setProjectId(d.getId()); @@ -1233,7 +1284,7 @@ public class TodoCenterManage { return res; }).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(staterUsers)) { + if (isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); resVos.stream().map(v -> { v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); @@ -1246,7 +1297,7 @@ public class TodoCenterManage { // resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) // .collect(Collectors.toList()); // } - return PageVo.of(resVos, resVos.size()); + return PageVo.of(resVos, total); } /** @@ -1259,7 +1310,6 @@ public class TodoCenterManage { * @since 2023/02/11 */ private List getMySubmittedProjects(ReqToBeProcessedDTO param, Set historicProcessInstanceIds) { - Page page = param.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) @@ -1268,13 +1318,12 @@ public class TodoCenterManage { .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, param.getProcessLaunchStartTime()) .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); - projectService.page(page, wrapper); + List results = projectService.list(wrapper); // 筛选出申报项目中我发起的项目 - List results = page.getRecords().stream() + return results.stream() .filter(d -> historicProcessInstanceIds.contains(d.getInstCode())) .collect(Collectors.toList()); - return results; } /** @@ -1309,7 +1358,7 @@ public class TodoCenterManage { List list = taskService.createTaskQuery().processInstanceId(ist.getId()).includeIdentityLinks().active().list(); instanceVo.setNodeId(Optional.ofNullable(instanceVo.getNodeId()).orElseGet(() -> { - if (CollectionUtil.isNotEmpty(list)) { + if (isNotEmpty(list)) { return list.get(0).getTaskDefinitionKey(); } return null; @@ -1337,7 +1386,7 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/11 */ - public void exportMySubmittedProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { + public void exportMySubmittedProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { param.setPageNumber(1); param.setPageSize(10000); @@ -1352,7 +1401,9 @@ public class TodoCenterManage { Set historicProcessInstanceIds = historicProcessInstances.stream() .map(h -> h.getId()) .collect(Collectors.toSet()); - List records = getMySubmittedProjects(param, historicProcessInstanceIds); + ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); + BeanUtils.copyProperties(param,reqToBeProcessedDTO); + List records = getMySubmittedProjects(reqToBeProcessedDTO, historicProcessInstanceIds); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -1415,15 +1466,25 @@ public class TodoCenterManage { List results = getCcMeProjects(param, processInsIds); + // 总数 + int total = results.size(); + // 获取传入的分页参数 + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + List records = results.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + Set staterUsers = new HashSet<>(); // 将抄送我的流程实例一次性取出来,减少查询次数 - Map instanceMap = CollectionUtil.isNotEmpty(ccTasks) + Map instanceMap = isNotEmpty(ccTasks) ? historyService.createHistoricProcessInstanceQuery() .processInstanceIds(ccTasks.stream().map(WflowCcTasks::getInstanceId).collect(Collectors.toSet())) .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); List resVos = - results.stream().map(d -> { + records.stream().map(d -> { ResToBeProcessedDTO res = new ResToBeProcessedDTO(); BeanUtils.copyProperties(d, res); res.setProjectId(d.getId()); @@ -1440,7 +1501,7 @@ public class TodoCenterManage { return res; }).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(staterUsers)) { + if (isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); resVos.stream().map(v -> { v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); @@ -1453,7 +1514,7 @@ public class TodoCenterManage { // resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) // .collect(Collectors.toList()); // } - return PageVo.of(resVos, resVos.size()); + return PageVo.of(resVos, total); } /** @@ -1466,7 +1527,6 @@ public class TodoCenterManage { * @since 2023/02/11 */ private List getCcMeProjects(ReqToBeProcessedDTO param, List processInsIds) { - Page page = param.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) @@ -1475,9 +1535,9 @@ public class TodoCenterManage { .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, param.getProcessLaunchStartTime()) .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); - projectService.page(page, wrapper); + List results = projectService.list(wrapper); - return page.getRecords().stream() + return results.stream() .filter(d -> processInsIds.contains(d.getInstCode())) .collect(Collectors.toList()); } @@ -1491,7 +1551,7 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/11 */ - public void exportCcMeProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { + public void exportCcMeProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { param.setPageNumber(1); param.setPageSize(10000); @@ -1505,7 +1565,9 @@ public class TodoCenterManage { .map(WflowCcTasks::getInstanceId) .collect(Collectors.toList()); - List records = getCcMeProjects(param, processInsIds); + ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); + BeanUtils.copyProperties(param,reqToBeProcessedDTO); + List records = getCcMeProjects(reqToBeProcessedDTO, processInsIds); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java index aed7a1a..fd28e27 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java @@ -15,7 +15,7 @@ import lombok.NoArgsConstructor; import javax.validation.constraints.NotNull; /** - * 待办中心-待我处理查询实体信息 + * 待办中心-列表查询实体信息 * * @author CMM * @since 2023/01/12 16:01 @@ -44,9 +44,4 @@ public class ReqToBeProcessedDTO extends PagePo implements Serializable { @ApiModelProperty(value = "是否增补项目",allowableValues = "非增补项目 0,增补项目 1") @NotNull(message = "是否增补字段不能为空!") private Integer isSupplement; - - @ApiModelProperty("导出选项") - @NotNull(message = "导出选项不能为空") - private List exportOptionList; - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedExportDTO.java new file mode 100644 index 0000000..5ac6c6b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedExportDTO.java @@ -0,0 +1,52 @@ +package com.ningdatech.pmapi.todocenter.model.dto.req; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import javax.validation.constraints.NotNull; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 待办中心-导出查询实体信息 + * + * @author CMM + * @since 2023/01/12 16:01 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ReqToBeProcessedExportDTO extends PagePo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位名称") + private String buildUnitName; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("流程发起开始时间") + private LocalDateTime processLaunchStartTime; + + @ApiModelProperty("流程发起结束时间") + private LocalDateTime processLaunchEndTime; + + @ApiModelProperty(value = "是否增补项目",allowableValues = "非增补项目 0,增补项目 1") + @NotNull(message = "是否增补字段不能为空!") + private Integer isSupplement; + + @ApiModelProperty("导出选项") + @NotNull(message = "导出选项不能为空") + private List exportOptionList; + +}