|
|
@@ -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<Task> taskList = taskQuery.list(); |
|
|
|
List<Project> results = getToBeProcessedProjects(param, taskList); |
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
|
// 获取传入的分页参数 |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
List<Project> records = results.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
Map<String, Task> taskMap = taskList.stream() |
|
|
|
.collect(Collectors.toMap(Task::getProcessInstanceId, t -> t)); |
|
|
@@ -154,13 +167,13 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
// 将申报项目待登录用户处理的流程实例一次性取出来,减少查询次数 |
|
|
|
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(taskList) |
|
|
|
Map<String, HistoricProcessInstance> instanceMap = isNotEmpty(taskList) |
|
|
|
? historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceIds(processInsIds).list().stream() |
|
|
|
.collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) |
|
|
|
: new HashMap<>(); |
|
|
|
|
|
|
|
List<ResToBeProcessedDTO> resVos = results.stream().map(d -> { |
|
|
|
List<ResToBeProcessedDTO> 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<ResToBeProcessedDTO> result = null; |
|
|
|
if (CollectionUtil.isNotEmpty(staterUsers)) { |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
result = resVos.stream() |
|
|
|
resVos.stream() |
|
|
|
.peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// Map<Long,UserInfo> 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<Task> taskList = taskQuery.list(); |
|
|
|
List<Project> records = getToBeProcessedProjects(param, taskList); |
|
|
|
|
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param,reqToBeProcessedDTO); |
|
|
|
List<Project> records = getToBeProcessedProjects(reqToBeProcessedDTO, taskList); |
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
|
String fileName = null; |
|
|
@@ -270,7 +286,6 @@ public class TodoCenterManage { |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
private List<Project> getToBeProcessedProjects(ReqToBeProcessedDTO param, List<Task> taskList) { |
|
|
|
Page<Project> page = param.page(); |
|
|
|
LambdaQueryWrapper<Project> 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<Project> results = projectService.list(wrapper); |
|
|
|
|
|
|
|
List<String> 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<String, OrgUser> 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<String, OrgUser> 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<Project> results = getHandledProjects(param, taskProcessInsIds); |
|
|
|
|
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
|
// 获取传入的分页参数 |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
List<Project> records = results.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 把已办任务实例一次性取出来,减少查询次数 |
|
|
|
Map<String, HistoricTaskInstance> taskInstanceMap = taskInstances.stream() |
|
|
|
.collect(Collectors.toMap(HistoricTaskInstance::getProcessInstanceId, v -> v)); |
|
|
|
|
|
|
|
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(taskInstances) |
|
|
|
Map<String, HistoricProcessInstance> instanceMap = isNotEmpty(taskInstances) |
|
|
|
? historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceIds(taskProcessInsIds) |
|
|
|
.list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) |
|
|
|
: new HashMap<>(); |
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
|
|
|
|
List<ResToBeProcessedDTO> resVos = results.stream().map(d -> { |
|
|
|
List<ResToBeProcessedDTO> 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<ResToBeProcessedDTO> result = null; |
|
|
|
if (CollectionUtil.isNotEmpty(staterUsers)) { |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
result = resVos.stream() |
|
|
|
resVos.stream() |
|
|
|
.peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// Map<Long,UserInfo> 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<Project> getHandledProjects(ReqToBeProcessedDTO param, Set<String> taskProcessInsIds) { |
|
|
|
// 获取入参分页信息 |
|
|
|
Page<Project> page = param.page(); |
|
|
|
LambdaQueryWrapper<Project> 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<Project> 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<String> taskProcessInsIds = taskInstances.stream() |
|
|
|
.map(HistoricTaskInstance::getProcessInstanceId) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
List<Project> records = getHandledProjects(param, taskProcessInsIds); |
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param,reqToBeProcessedDTO); |
|
|
|
List<Project> records = getHandledProjects(reqToBeProcessedDTO, taskProcessInsIds); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
@@ -1203,20 +1244,30 @@ public class TodoCenterManage { |
|
|
|
List<HistoricProcessInstance> historicProcessInstances = |
|
|
|
instanceQuery.orderByProcessInstanceStartTime().desc().orderByProcessInstanceEndTime().desc().list(); |
|
|
|
Set<String> historicProcessInstanceIds = |
|
|
|
historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet()); |
|
|
|
historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Project> results = getMySubmittedProjects(param, historicProcessInstanceIds); |
|
|
|
|
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
|
// 获取传入的分页参数 |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
List<Project> records = results.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 把已办任务流程实例一次性取出来,减少查询次数 |
|
|
|
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(historicProcessInstances) ? historyService |
|
|
|
Map<String, HistoricProcessInstance> 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<String> staterUsers = new HashSet<>(); |
|
|
|
|
|
|
|
List<ResToBeProcessedDTO> 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<String, OrgUser> 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<Project> getMySubmittedProjects(ReqToBeProcessedDTO param, Set<String> historicProcessInstanceIds) { |
|
|
|
Page<Project> page = param.page(); |
|
|
|
LambdaQueryWrapper<Project> 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<Project> results = projectService.list(wrapper); |
|
|
|
|
|
|
|
// 筛选出申报项目中我发起的项目 |
|
|
|
List<Project> 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<Task> 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<String> historicProcessInstanceIds = historicProcessInstances.stream() |
|
|
|
.map(h -> h.getId()) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
List<Project> records = getMySubmittedProjects(param, historicProcessInstanceIds); |
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param,reqToBeProcessedDTO); |
|
|
|
List<Project> records = getMySubmittedProjects(reqToBeProcessedDTO, historicProcessInstanceIds); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
@@ -1415,15 +1466,25 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
List<Project> results = getCcMeProjects(param, processInsIds); |
|
|
|
|
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
|
// 获取传入的分页参数 |
|
|
|
Integer pageNumber = param.getPageNumber(); |
|
|
|
Integer pageSize = param.getPageSize(); |
|
|
|
List<Project> records = results.stream() |
|
|
|
.skip((long) (pageNumber - 1) * pageSize) |
|
|
|
.limit(pageSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
// 将抄送我的流程实例一次性取出来,减少查询次数 |
|
|
|
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(ccTasks) |
|
|
|
Map<String, HistoricProcessInstance> 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<ResToBeProcessedDTO> 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<String, OrgUser> 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<Project> getCcMeProjects(ReqToBeProcessedDTO param, List<String> processInsIds) { |
|
|
|
Page<Project> page = param.page(); |
|
|
|
LambdaQueryWrapper<Project> 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<Project> 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<Project> records = getCcMeProjects(param, processInsIds); |
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param,reqToBeProcessedDTO); |
|
|
|
List<Project> records = getCcMeProjects(reqToBeProcessedDTO, processInsIds); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
|