|
|
@@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
@@ -20,7 +19,10 @@ import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; |
|
|
@@ -33,9 +35,9 @@ import com.ningdatech.pmapi.todocenter.enumeration.ProcessStatusEnum; |
|
|
|
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.model.dto.req.ToBeProcessedReq; |
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; |
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; |
|
|
|
|
|
|
|
import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
@@ -46,7 +48,6 @@ import com.wflow.bean.entity.WflowModels; |
|
|
|
import com.wflow.exception.BusinessException; |
|
|
|
import com.wflow.mapper.WflowCcTasksMapper; |
|
|
|
import com.wflow.mapper.WflowModelHistorysMapper; |
|
|
|
import com.wflow.service.OrgRepositoryService; |
|
|
|
import com.wflow.utils.CodeUtil; |
|
|
|
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; |
|
|
|
import com.wflow.workflow.bean.process.ProcessNode; |
|
|
@@ -58,13 +59,12 @@ import com.wflow.workflow.bean.vo.ProcessInstanceVo; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessTaskVo; |
|
|
|
import com.wflow.workflow.config.WflowGlobalVarDef; |
|
|
|
import com.wflow.workflow.enums.ProcessHandlerEnum; |
|
|
|
import com.wflow.workflow.service.*; |
|
|
|
import com.wflow.workflow.service.FormService; |
|
|
|
import com.wflow.workflow.service.ProcessModelService; |
|
|
|
import com.wflow.workflow.service.ProcessNodeCatchService; |
|
|
|
import com.wflow.workflow.service.UserDeptOrLeaderService; |
|
|
|
import com.wflow.workflow.utils.Executor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.assertj.core.util.Lists; |
|
|
|
import org.assertj.core.util.Maps; |
|
|
|
import org.flowable.bpmn.model.*; |
|
|
|
import org.flowable.engine.*; |
|
|
@@ -93,8 +93,8 @@ import static cn.hutool.core.collection.CollUtil.isNotEmpty; |
|
|
|
import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author CMM |
|
|
|
* @since 2023/01/12 16:09 |
|
|
|
* @author ZPF |
|
|
|
* @since 2023/02/19 16:09 |
|
|
|
*/ |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
@@ -102,19 +102,21 @@ import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.*; |
|
|
|
public class TodoCenterManage { |
|
|
|
|
|
|
|
private final TaskService taskService; |
|
|
|
|
|
|
|
private final ProcessTaskService processTaskService; |
|
|
|
private final RepositoryService repositoryService; |
|
|
|
private final RuntimeService runtimeService; |
|
|
|
private final UserDeptOrLeaderService userDeptOrLeaderService; |
|
|
|
private final FormService formService; |
|
|
|
private final ManagementService managementService; |
|
|
|
private final HistoryService historyService; |
|
|
|
private final WflowModelHistorysMapper modelHistorysMapper; |
|
|
|
private final ProcessNodeCatchService nodeCatchService; |
|
|
|
private final OrgRepositoryService orgRepositoryService; |
|
|
|
private final WflowCcTasksMapper ccTasksMapper; |
|
|
|
private final ProcessModelService processModelService; |
|
|
|
private final IUserInfoService userInfoService; |
|
|
|
private final IProjectService projectService; |
|
|
|
|
|
|
|
private final ProjectLibManage projectLibManage; |
|
|
|
private final StateMachineUtils stateMachineUtils; |
|
|
|
private final ZwddClient zwddClient; |
|
|
|
private final IDingEmployeeInfoService dingEmployeeInfoService; |
|
|
@@ -124,92 +126,37 @@ public class TodoCenterManage { |
|
|
|
* 待办中心待我处理项目列表查询 |
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @return com.ningdatech.basic.model.PageVo<com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO> |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/01 |
|
|
|
* @author zpf |
|
|
|
* @since 2023/02/18 |
|
|
|
*/ |
|
|
|
public PageVo<ResToBeProcessedDTO> queryPendingProjectList(ReqToBeProcessedDTO param) { |
|
|
|
public PageVo<ResToBeProcessedVO> todoProjectList(ToBeProcessedReq param) { |
|
|
|
// 获取登录用户ID |
|
|
|
// long userId = LoginUserUtil.getUserId(); |
|
|
|
String userId = param.getUserId(); |
|
|
|
//因为要解耦 不能把项目和工作流一起查 |
|
|
|
//1.先查出用户工作流 |
|
|
|
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),userId); |
|
|
|
List<String> instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//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(); |
|
|
|
} |
|
|
|
|
|
|
|
// 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)); |
|
|
|
Set<String> processInsIds = results.stream() |
|
|
|
.map(Project::getInstCode) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
// 将申报项目待登录用户处理的流程实例一次性取出来,减少查询次数 |
|
|
|
Map<String, HistoricProcessInstance> instanceMap = isNotEmpty(taskList) |
|
|
|
? historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceIds(processInsIds).list().stream() |
|
|
|
.collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) |
|
|
|
: new HashMap<>(); |
|
|
|
|
|
|
|
List<ResToBeProcessedDTO> resVos = records.stream().map(d -> { |
|
|
|
ResToBeProcessedDTO res = new ResToBeProcessedDTO(); |
|
|
|
List<ResToBeProcessedVO> resVos = projectPage.getRecords().stream().map(d -> { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
|
LocalDateTime processLaunchTime = d.getCreateOn(); |
|
|
|
String format = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); |
|
|
|
LocalDateTime launchTime = LocalDateTime.parse(format, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); |
|
|
|
res.setProcessLaunchTime(launchTime); |
|
|
|
|
|
|
|
// 从待办任务列表中取出当前登录用户及项目实例对应的任务 |
|
|
|
Task task = taskMap.get(d.getInstCode()); |
|
|
|
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); |
|
|
|
|
|
|
|
// 从缓存取 |
|
|
|
staterUsers.add(String.valueOf(instance.getStartUserId())); |
|
|
|
ProcessTaskVo processTaskVo = ProcessTaskVo.builder() |
|
|
|
.taskId(task.getId()) |
|
|
|
.taskName(task.getName()) |
|
|
|
.taskDefKey(task.getTaskDefinitionKey()) |
|
|
|
.processDefId(task.getProcessDefinitionId()) |
|
|
|
.executionId(task.getExecutionId()) |
|
|
|
.nodeId(task.getTaskDefinitionKey()) |
|
|
|
.deployId(instance.getDeploymentId()) |
|
|
|
.processDefName(instance.getProcessDefinitionName()) |
|
|
|
.version(instance.getProcessDefinitionVersion()) |
|
|
|
.instanceId(task.getProcessInstanceId()) |
|
|
|
.ownerId(instance.getStartUserId()) |
|
|
|
.createTime(instance.getStartTime()) |
|
|
|
.taskCreateTime(task.getCreateTime()) |
|
|
|
.build(); |
|
|
|
res.setProcessTaskInfo(processTaskVo); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if (isEmpty(resVos)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream() |
|
|
|
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
// return PageVo.of(result, total); |
|
|
|
return PageVo.of(resVos, total); |
|
|
|
return PageVo.of(resVos, projectPage.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -221,41 +168,39 @@ public class TodoCenterManage { |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/01 |
|
|
|
*/ |
|
|
|
public void exportPendingProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { |
|
|
|
param.setPageNumber(1); |
|
|
|
param.setPageSize(10000); |
|
|
|
public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
|
// 获取登录用户ID |
|
|
|
// long userId = LoginUserUtil.getUserId(); |
|
|
|
String userId = param.getUserId(); |
|
|
|
//因为要解耦 不能把项目和工作流一起查 |
|
|
|
//1.先查出用户工作流 |
|
|
|
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),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 = projectLibManage.projectList(projectListReq); |
|
|
|
|
|
|
|
Long userId = 381496L; |
|
|
|
// Long userId = 6418616L; |
|
|
|
TaskQuery taskQuery = taskService.createTaskQuery(); |
|
|
|
taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc(); |
|
|
|
List<Task> taskList = taskQuery.list(); |
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param, reqToBeProcessedDTO); |
|
|
|
List<Project> records = getToBeProcessedProjects(reqToBeProcessedDTO, taskList); |
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
|
String fileName = null; |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_待我处理_增补项目列表"; |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_待我处理_非增补项目列表"; |
|
|
|
} |
|
|
|
excelExportWriter.setFileName(fileName); |
|
|
|
|
|
|
|
List<String> sheetsNames = new ArrayList<>(); |
|
|
|
sheetsNames.add(fileName); |
|
|
|
List<String> sheetsNames = Lists.newArrayList(fileName); |
|
|
|
|
|
|
|
// 表体行数据集合 |
|
|
|
List<List<String>> rowList = new ArrayList<>(); |
|
|
|
List<List<String>> rowList = Lists.newArrayList(); |
|
|
|
// 表体列数据集合 |
|
|
|
List<ExportOptionEnum> columnList = param.getExportOptionList(); |
|
|
|
for (ExportOptionEnum column : columnList) { |
|
|
|
List<String> columnValues = new ArrayList<>(); |
|
|
|
List<String> columnValues = Lists.newArrayList(); |
|
|
|
columnValues.add(column.getDesc()); |
|
|
|
records.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> { |
|
|
|
projects.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> { |
|
|
|
String s = JSON.toJSONString(record); |
|
|
|
JSONObject jsonObject = JSON.parseObject(s); |
|
|
|
String columnValue = String.valueOf(jsonObject.get(column.toString())); |
|
|
@@ -264,7 +209,7 @@ public class TodoCenterManage { |
|
|
|
rowList.add(columnValues); |
|
|
|
} |
|
|
|
// sheet列表集合 |
|
|
|
List<List<List<String>>> sheets = new ArrayList<>(); |
|
|
|
List<List<List<String>>> sheets = Lists.newArrayList(); |
|
|
|
sheets.add(rowList); |
|
|
|
excelExportWriter.setHeads(sheets); |
|
|
|
excelExportWriter.setDatas(rowList); |
|
|
@@ -275,34 +220,6 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取申报项目列表中待登录用户处理的项目列表 |
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @param taskList |
|
|
|
* @return java.util.List<com.ningdatech.pmapi.projectlib.model.entity.Project> |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
private List<Project> getToBeProcessedProjects(ReqToBeProcessedDTO param, List<Task> taskList) { |
|
|
|
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()) |
|
|
|
.eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) |
|
|
|
.eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) |
|
|
|
.ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, |
|
|
|
param.getProcessLaunchStartTime()) |
|
|
|
.le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); |
|
|
|
List<Project> results = projectService.list(wrapper); |
|
|
|
|
|
|
|
List<String> taskProcessInsIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 过滤申报项目中待登录用户审核的项目 |
|
|
|
return results.stream().filter(w -> taskProcessInsIds.contains(w.getInstCode())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 流程处理相关操作 |
|
|
|
* |
|
|
|
* @param param |
|
|
@@ -411,9 +328,9 @@ public class TodoCenterManage { |
|
|
|
*/ |
|
|
|
private void updateRejectProjectStatus(Long userId, Project declaredProject) { |
|
|
|
// 获取当前流程项目状态 |
|
|
|
Integer projectStatusSecond = declaredProject.getStatus(); |
|
|
|
Integer status = declaredProject.getStatus(); |
|
|
|
// 根据当前状态获取对应的通过事件 |
|
|
|
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusRejectEvent(projectStatusSecond); |
|
|
|
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusRejectEvent(status); |
|
|
|
try { |
|
|
|
stateMachineUtils.execute(declaredProject, event); |
|
|
|
declaredProject.setUpdateOn(LocalDateTime.now()); |
|
|
@@ -1122,11 +1039,10 @@ public class TodoCenterManage { |
|
|
|
* 待办中心我已处理项目列表查询 |
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @return com.ningdatech.basic.model.PageVo<com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO> |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/03 |
|
|
|
*/ |
|
|
|
public PageVo<ResToBeProcessedDTO> queryHandledProjectList(ReqToBeProcessedDTO param) { |
|
|
|
public PageVo<ResToBeProcessedVO> idoList(ToBeProcessedReq param) { |
|
|
|
// 获取登录用户ID |
|
|
|
// long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
@@ -1145,7 +1061,8 @@ public class TodoCenterManage { |
|
|
|
Set<String> taskProcessInsIds = taskInstances.stream() |
|
|
|
.map(HistoricTaskInstance::getProcessInstanceId) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
List<Project> results = getHandledProjects(param, taskProcessInsIds); |
|
|
|
// List<Project> results = getHandledProjects(param, taskProcessInsIds); |
|
|
|
List<Project> results = Lists.newArrayList(); |
|
|
|
|
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
@@ -1169,9 +1086,9 @@ public class TodoCenterManage { |
|
|
|
: new HashMap<>(); |
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
|
|
|
|
List<ResToBeProcessedDTO> resVos = records.stream().map(d -> { |
|
|
|
List<ResToBeProcessedVO> resVos = records.stream().map(d -> { |
|
|
|
|
|
|
|
ResToBeProcessedDTO res = new ResToBeProcessedDTO(); |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
@@ -1213,7 +1130,7 @@ public class TodoCenterManage { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
List<ResToBeProcessedVO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream().peek(v -> v.getProcessTaskInfo() |
|
|
@@ -1225,32 +1142,6 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取申报项目列表中登录用户已处理项目列表 |
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @param taskProcessInsIds |
|
|
|
* @return java.util.List<com.ningdatech.pmapi.projectlib.model.entity.Project> |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
private List<Project> getHandledProjects(ReqToBeProcessedDTO param, Set<String> taskProcessInsIds) { |
|
|
|
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()) |
|
|
|
.eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) |
|
|
|
.eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) |
|
|
|
.ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, |
|
|
|
param.getProcessLaunchStartTime()) |
|
|
|
.le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); |
|
|
|
List<Project> results = projectService.list(wrapper); |
|
|
|
|
|
|
|
// 过滤申报项目中登录用户已审核的项目 |
|
|
|
return results.stream() |
|
|
|
.filter(w -> taskProcessInsIds.contains(w.getInstCode())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出我已处理项目列表 |
|
|
|
* |
|
|
|
* @param response 返回数据流 |
|
|
@@ -1259,7 +1150,7 @@ public class TodoCenterManage { |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/06 |
|
|
|
*/ |
|
|
|
public void exportHandledProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { |
|
|
|
public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
|
param.setPageNumber(1); |
|
|
|
param.setPageSize(10000); |
|
|
|
// 获取登录用户ID |
|
|
@@ -1277,16 +1168,17 @@ public class TodoCenterManage { |
|
|
|
Set<String> taskProcessInsIds = taskInstances.stream() |
|
|
|
.map(HistoricTaskInstance::getProcessInstanceId) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param, reqToBeProcessedDTO); |
|
|
|
List<Project> records = getHandledProjects(reqToBeProcessedDTO, taskProcessInsIds); |
|
|
|
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); |
|
|
|
BeanUtils.copyProperties(param, toBeProcessedReq); |
|
|
|
// List<Project> records = getHandledProjects(toBeProcessedReq, taskProcessInsIds); |
|
|
|
List<Project> records = Lists.newArrayList(); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
|
String fileName = null; |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_我已处理_增补项目列表"; |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_我已处理_非增补项目列表"; |
|
|
|
} |
|
|
|
excelExportWriter.setFileName(fileName); |
|
|
@@ -1329,7 +1221,7 @@ public class TodoCenterManage { |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/06 |
|
|
|
*/ |
|
|
|
public PageVo<ResToBeProcessedDTO> queryMySubmittedProjectList(ReqToBeProcessedDTO param) { |
|
|
|
public PageVo<ResToBeProcessedVO> mySubmittedList(ToBeProcessedReq param) { |
|
|
|
|
|
|
|
// Long startUserId = LoginUserUtil.getUserId(); |
|
|
|
Long startUserId = 381496L; |
|
|
@@ -1340,7 +1232,8 @@ public class TodoCenterManage { |
|
|
|
Set<String> historicProcessInstanceIds = historicProcessInstances.stream() |
|
|
|
.map(HistoricProcessInstance::getId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<Project> results = getMySubmittedProjects(param, historicProcessInstanceIds); |
|
|
|
// List<Project> results = getMySubmittedProjects(param, historicProcessInstanceIds); |
|
|
|
List<Project> results = Lists.newArrayList(); |
|
|
|
|
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
@@ -1363,9 +1256,9 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
|
|
|
|
List<ResToBeProcessedDTO> resVos = |
|
|
|
List<ResToBeProcessedVO> resVos = |
|
|
|
records.stream().map(d -> { |
|
|
|
ResToBeProcessedDTO res = new ResToBeProcessedDTO(); |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
@@ -1385,7 +1278,7 @@ public class TodoCenterManage { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
List<ResToBeProcessedVO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream() |
|
|
@@ -1397,32 +1290,6 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取申报项目列表中当前登录用户发起的项目列表 |
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @param historicProcessInstanceIds |
|
|
|
* @return java.util.List<com.ningdatech.pmapi.projectlib.model.entity.Project> |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
private List<Project> getMySubmittedProjects(ReqToBeProcessedDTO param, Set<String> historicProcessInstanceIds) { |
|
|
|
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()) |
|
|
|
.eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) |
|
|
|
.eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) |
|
|
|
.ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, |
|
|
|
param.getProcessLaunchStartTime()) |
|
|
|
.le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); |
|
|
|
List<Project> results = projectService.list(wrapper); |
|
|
|
|
|
|
|
// 筛选出申报项目中我发起的项目 |
|
|
|
return results.stream() |
|
|
|
.filter(d -> historicProcessInstanceIds.contains(d.getInstCode())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取流程实例信息 |
|
|
|
* |
|
|
|
* @param ist 流程实例 |
|
|
@@ -1489,7 +1356,7 @@ public class TodoCenterManage { |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
public void exportMySubmittedProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { |
|
|
|
public void exportMySubmittedList(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
|
|
|
|
|
param.setPageNumber(1); |
|
|
|
param.setPageSize(10000); |
|
|
@@ -1504,16 +1371,17 @@ public class TodoCenterManage { |
|
|
|
Set<String> historicProcessInstanceIds = historicProcessInstances.stream() |
|
|
|
.map(h -> h.getId()) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param, reqToBeProcessedDTO); |
|
|
|
List<Project> records = getMySubmittedProjects(reqToBeProcessedDTO, historicProcessInstanceIds); |
|
|
|
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); |
|
|
|
BeanUtils.copyProperties(param, toBeProcessedReq); |
|
|
|
// List<Project> records = getMySubmittedProjects(toBeProcessedReq, historicProcessInstanceIds); |
|
|
|
List<Project> records = Lists.newArrayList(); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
|
String fileName = null; |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_我发起的_增补项目列表"; |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_我发起的_非增补项目列表"; |
|
|
|
} |
|
|
|
excelExportWriter.setFileName(fileName); |
|
|
@@ -1556,7 +1424,7 @@ public class TodoCenterManage { |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
public PageVo<ResToBeProcessedDTO> queryCcMeProjectList(ReqToBeProcessedDTO param) { |
|
|
|
public PageVo<ResToBeProcessedVO> ccmeList(ToBeProcessedReq param) { |
|
|
|
// 获取当前登录用户ID |
|
|
|
// Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
@@ -1567,7 +1435,8 @@ public class TodoCenterManage { |
|
|
|
.map(WflowCcTasks::getInstanceId) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<Project> results = getCcMeProjects(param, processInsIds); |
|
|
|
// List<Project> results = getCcMeProjects(param, processInsIds); |
|
|
|
List<Project> results = Lists.newArrayList(); |
|
|
|
|
|
|
|
// 总数 |
|
|
|
int total = results.size(); |
|
|
@@ -1586,9 +1455,9 @@ public class TodoCenterManage { |
|
|
|
.processInstanceIds(ccTasks.stream().map(WflowCcTasks::getInstanceId).collect(Collectors.toSet())) |
|
|
|
.list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) |
|
|
|
: new HashMap<>(); |
|
|
|
List<ResToBeProcessedDTO> resVos = |
|
|
|
List<ResToBeProcessedVO> resVos = |
|
|
|
records.stream().map(d -> { |
|
|
|
ResToBeProcessedDTO res = new ResToBeProcessedDTO(); |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
@@ -1607,7 +1476,7 @@ public class TodoCenterManage { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
List<ResToBeProcessedVO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream() |
|
|
@@ -1619,31 +1488,6 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取申报项目表中抄送当前登录用户的项目列表 |
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @param processInsIds |
|
|
|
* @return java.util.List<com.ningdatech.pmapi.projectlib.model.entity.Project> |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
private List<Project> getCcMeProjects(ReqToBeProcessedDTO param, List<String> processInsIds) { |
|
|
|
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()) |
|
|
|
.eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) |
|
|
|
.eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) |
|
|
|
.ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, |
|
|
|
param.getProcessLaunchStartTime()) |
|
|
|
.le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); |
|
|
|
List<Project> results = projectService.list(wrapper); |
|
|
|
|
|
|
|
return results.stream() |
|
|
|
.filter(d -> processInsIds.contains(d.getInstCode())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 待办中心-抄送我的项目列表导出 |
|
|
|
* |
|
|
|
* @param response |
|
|
@@ -1652,7 +1496,7 @@ public class TodoCenterManage { |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/11 |
|
|
|
*/ |
|
|
|
public void exportCcMeProjectList(HttpServletResponse response, ReqToBeProcessedExportDTO param) { |
|
|
|
public void exportCcMeProjectList(HttpServletResponse response, ToBeProcessedExportReq param) { |
|
|
|
|
|
|
|
param.setPageNumber(1); |
|
|
|
param.setPageSize(10000); |
|
|
@@ -1666,16 +1510,17 @@ public class TodoCenterManage { |
|
|
|
.map(WflowCcTasks::getInstanceId) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO(); |
|
|
|
BeanUtils.copyProperties(param, reqToBeProcessedDTO); |
|
|
|
List<Project> records = getCcMeProjects(reqToBeProcessedDTO, processInsIds); |
|
|
|
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); |
|
|
|
BeanUtils.copyProperties(param, toBeProcessedReq); |
|
|
|
// List<Project> records = getCcMeProjects(toBeProcessedReq, processInsIds); |
|
|
|
List<Project> records = Lists.newArrayList(); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
|
|
|
|
String fileName = null; |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_抄送我的_增补项目列表"; |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { |
|
|
|
} else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsTemporaryAugment())) { |
|
|
|
fileName = "待办中心_抄送我的_非增补项目列表"; |
|
|
|
} |
|
|
|
excelExportWriter.setFileName(fileName); |
|
|
|