Explorar el Código

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang hace 1 año
padre
commit
7bdeb0ede4
Se han modificado 5 ficheros con 299 adiciones y 153 borrados
  1. +55
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  4. +3
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  5. +239
    -139
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 55
- 7
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java Ver fichero

@@ -16,7 +16,8 @@ import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum;
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.wflow.workflow.enums.ProcessStatusEnum;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.http.HttpStatus;

@@ -137,23 +138,24 @@ public class ExcelDownUtil {
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls");
}

public static List<List<String>> getExportDatas(List<ExportOptionEnum> columnList, List<Project> projects) {
public static List<List<String>> getTaskExportDatas(List<ExportOptionEnum> columnList,List<ProcessTaskVo> taskVoList, Map<String, Project> projectInfoMap) {

// 表体行数据集合
List<List<String>> rowList = Lists.newArrayList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = Lists.newArrayList();
columnValues.add(column.getDesc());
projects.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> {
String s = JSON.toJSONString(record);
taskVoList.stream().forEach(taskVo -> {
Project project = projectInfoMap.get(taskVo.getInstanceId());
String s = JSON.toJSONString(project);
JSONObject jsonObject = JSON.parseObject(s);
String columnValue = null;
if (column.name().equals(ExportOptionEnum.processStatusName.name())){
columnValue = ProcessStatusEnum.getDescByCode(record.getProcessStatus());
columnValue = taskVo.getStatus();
}else if (column.name().equals(ExportOptionEnum.processLaunchTime.name())){
columnValue = NdDateUtils.format(record.getCreateOn(), "yyyy-MM-dd HH:mm");
columnValue = NdDateUtils.format(taskVo.getCreateTime(), "yyyy-MM-dd HH:mm");
}else if (column.name().equals(ExportOptionEnum.processHandleTime.name())){
columnValue = NdDateUtils.format(record.getUpdateOn(), "yyyy-MM-dd HH:mm");
columnValue = NdDateUtils.format(taskVo.getTaskEndTime(), "yyyy-MM-dd HH:mm");
}else {
columnValue = String.valueOf(jsonObject.get(column.toString()));
}
@@ -164,4 +166,50 @@ public class ExcelDownUtil {
return rowList;
}


public static List<List<String>> getInstExportDatas(List<ExportOptionEnum> columnList,List<ProcessInstanceVo> instanceVoList, Map<String, Project> projectInfoMap) {

// 表体行数据集合
List<List<String>> rowList = Lists.newArrayList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = Lists.newArrayList();
columnValues.add(column.getDesc());
instanceVoList.stream().forEach(instanceVo -> {
Project project = projectInfoMap.get(instanceVo.getInstanceId());
String s = JSON.toJSONString(project);
JSONObject jsonObject = JSON.parseObject(s);
String columnValue = null;
if (column.name().equals(ExportOptionEnum.processStatusName.name())){
columnValue = instanceVo.getStatus();
}else if (column.name().equals(ExportOptionEnum.processLaunchTime.name())){
columnValue = NdDateUtils.format(instanceVo.getStartTime(), "yyyy-MM-dd HH:mm");
}else {
columnValue = String.valueOf(jsonObject.get(column.toString()));
}
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
return rowList;
}


public static List<List<String>> getProjectExportDatas(List<ExportOptionEnum> columnList,List<Project> projects) {

// 表体行数据集合
List<List<String>> rowList = Lists.newArrayList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = Lists.newArrayList();
columnValues.add(column.getDesc());
projects.stream().forEach(project -> {
String s = JSON.toJSONString(project);
JSONObject jsonObject = JSON.parseObject(s);
String columnValue = String.valueOf(jsonObject.get(column.toString()));
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
return rowList;
}

}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Ver fichero

@@ -248,7 +248,7 @@ public class AnnualPlanLibManage {
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);
// 表体行数据集合
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
List<List<String>> exportDatas = ExcelDownUtil.getProjectExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Ver fichero

@@ -148,7 +148,7 @@ public class ProjectLibManage {
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);
// 表体行数据集合
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
List<List<String>> exportDatas = ExcelDownUtil.getProjectExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);


+ 3
- 5
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java Ver fichero

@@ -44,7 +44,7 @@ public class TodoCenterController {
* @return
*/
@GetMapping("/todo-list/{isTemporaryAugment}")
public PageVo<ResToBeProcessedVO> todoList(@ModelAttribute ToBeProcessedReq param,
public PageVo<ResToBeProcessedVO> todoList(@Valid @ModelAttribute ToBeProcessedReq param,
@PathVariable Integer isTemporaryAugment){
param.setIsTemporaryAugment(isTemporaryAugment);
return todoCenterManage.todoProjectList(param);
@@ -119,8 +119,7 @@ public class TodoCenterController {
public PageVo<ResToBeProcessedVO> mySubmittedList(@ModelAttribute ToBeProcessedReq param,
@PathVariable Integer isTemporaryAugment){
param.setIsTemporaryAugment(isTemporaryAugment);
PageVo<ResToBeProcessedVO> result = todoCenterManage.mySubmittedList(param);
return result;
return todoCenterManage.mySubmittedList(param);
}

/**
@@ -146,8 +145,7 @@ public class TodoCenterController {
public PageVo<ResToBeProcessedVO> ccmeList(@Valid @ModelAttribute ToBeProcessedReq param,
@PathVariable Integer isTemporaryAugment){
param.setIsTemporaryAugment(isTemporaryAugment);
PageVo<ResToBeProcessedVO> result = todoCenterManage.ccmeList(param);
return result;
return todoCenterManage.ccmeList(param);
}

/**


+ 239
- 139
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Ver fichero

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.todocenter.manage;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -65,10 +66,13 @@ 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.dto.TodoCenterListReqDTO;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
@@ -85,6 +89,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;
@@ -95,7 +100,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
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;
@@ -142,13 +149,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()
@@ -157,27 +190,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());
}

/**
@@ -192,19 +219,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;
@@ -215,7 +251,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);
@@ -656,9 +692,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());
@@ -675,44 +708,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());
}

/**
@@ -728,19 +776,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();

@@ -755,7 +811,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);
@@ -779,36 +835,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());
}

/**
@@ -825,19 +896,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();

@@ -852,7 +929,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);
@@ -874,39 +951,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());
}

/**
@@ -923,18 +1015,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();

@@ -949,7 +1049,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);


Cargando…
Cancelar
Guardar