Browse Source

待办中心项目列表、导出代码优化整合

tags/24080901
CMM 1 year ago
parent
commit
fef16f5027
20 changed files with 285 additions and 555 deletions
  1. +8
    -0
      pmapi/.idea/.gitignore
  2. +14
    -0
      pmapi/.idea/checkstyle-idea.xml
  3. +13
    -0
      pmapi/.idea/compiler.xml
  4. +12
    -0
      pmapi/.idea/eclipseCodeFormatter.xml
  5. +8
    -0
      pmapi/.idea/encodings.xml
  6. +10
    -0
      pmapi/.idea/inspectionProfiles/Project_Default.xml
  7. +25
    -0
      pmapi/.idea/jarRepositories.xml
  8. +12
    -0
      pmapi/.idea/misc.xml
  9. +0
    -0
      pmapi/.idea/sonarlint/issuestore/index.pb
  10. +6
    -0
      pmapi/.idea/vcs.xml
  11. +26
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  12. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java
  13. +0
    -25
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/HisProInsEndActId.java
  14. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  15. +0
    -97
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/ProcessStatusEnum.java
  16. +0
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/extension/cmd/BackToHisApprovalNodeCmd.java
  17. +121
    -410
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  18. +0
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/vo/ResToBeProcessedVO.java
  19. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  20. +23
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java

+ 8
- 0
pmapi/.idea/.gitignore View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

+ 14
- 0
pmapi/.idea/checkstyle-idea.xml View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA" serialisationVersion="2">
<checkstyleVersion>10.5.0</checkstyleVersion>
<scanScope>JavaOnly</scanScope>
<copyLibs>true</copyLibs>
<option name="locations">
<list>
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
</list>
</option>
</component>
</project>

+ 13
- 0
pmapi/.idea/compiler.xml View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="pmapi" />
</profile>
</annotationProcessing>
</component>
</project>

+ 12
- 0
pmapi/.idea/eclipseCodeFormatter.xml View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EclipseCodeFormatterProjectSettings">
<option name="projectSpecificProfile">
<ProjectSpecificProfile>
<option name="formatter" value="ECLIPSE" />
<option name="pathToConfigFileJava" value="D:/soft/formatter/eclipse-codestyle.xml" />
<option name="selectedJavaProfile" value="P3C-CodeStyle" />
</ProjectSpecificProfile>
</option>
</component>
</project>

+ 8
- 0
pmapi/.idea/encodings.xml View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/lib" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

+ 10
- 0
pmapi/.idea/inspectionProfiles/Project_Default.xml View File

@@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="189" name="Java" />
</Languages>
</inspection_tool>
</profile>
</component>

+ 25
- 0
pmapi/.idea/jarRepositories.xml View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="aliyun" />
<option name="name" value="aliyun" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
</component>
</project>

+ 12
- 0
pmapi/.idea/misc.xml View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

+ 0
- 0
pmapi/.idea/sonarlint/issuestore/index.pb View File


+ 6
- 0
pmapi/.idea/vcs.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

+ 26
- 4
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -2,10 +2,7 @@ package com.ningdatech.pmapi.common.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
import java.util.function.BiConsumer;

import javax.servlet.http.HttpServletResponse;
@@ -13,8 +10,12 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.exception.BizException;
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.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.http.HttpStatus;

@@ -25,6 +26,7 @@ import com.ningdatech.basic.util.StrPool;
import cn.hutool.poi.excel.ExcelUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;

/**
* <p>
@@ -134,4 +136,24 @@ public class ExcelDownUtil {
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls");
}

public static List<List<String>> getExportDatas(ToBeProcessedExportReq param, List<Project> projects) {

// 表体行数据集合
List<List<String>> rowList = Lists.newArrayList();
// 表体列数据集合
List<ExportOptionEnum> columnList = param.getExportOptionList();
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);
JSONObject jsonObject = JSON.parseObject(s);
String columnValue = String.valueOf(jsonObject.get(column.toString()));
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
return rowList;
}

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.projectlib.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -75,9 +76,11 @@ public class ProjectLibListItemVO {
}

@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime createOn;

@ApiModelProperty("修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime updateOn;

}

+ 0
- 25
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/HisProInsEndActId.java View File

@@ -1,25 +0,0 @@
package com.ningdatech.pmapi.todocenter.constant;
/**
* 历史流程实例终点活跃ID状态
* @author CMM
* @since 2023/01/31 15:13
*/
public interface HisProInsEndActId {
/**
* 流程被驳回
*/
public static final String REJECT = "refuse-end";
/**
* 流程被退回
*/
public static final String BACK = "back-end";
/**
* 流程被撤回
*/
public static final String WITHDRAW = "cancel-end";
/**
* 流程结束
*/
public static final String END = "process-end";

}

+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java View File

@@ -41,8 +41,7 @@ public class TodoCenterController {
public PageVo<ResToBeProcessedVO> todoList(@ModelAttribute ToBeProcessedReq param,
@PathVariable Integer isTemporaryAugment){
param.setIsTemporaryAugment(isTemporaryAugment);
PageVo<ResToBeProcessedVO> result = todoCenterManage.todoProjectList(param);
return result;
return todoCenterManage.todoProjectList(param);
}

/**
@@ -90,8 +89,7 @@ public class TodoCenterController {
public PageVo<ResToBeProcessedVO> idoList(@ModelAttribute ToBeProcessedReq param,
@PathVariable Integer isTemporaryAugment){
param.setIsTemporaryAugment(isTemporaryAugment);
PageVo<ResToBeProcessedVO> result = todoCenterManage.idoList(param);
return result;
return todoCenterManage.idoList(param);
}
/**
* 待办中心-我已处理项目列表导出


+ 0
- 97
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enumeration/ProcessStatusEnum.java View File

@@ -1,97 +0,0 @@
package com.ningdatech.pmapi.todocenter.enumeration;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* 待办中心-流程状态枚举
*
* @author CMM
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ProcessStatusEnum", description = "流程状态-枚举")
public enum ProcessStatusEnum {
/**
* 审核中
*/

UNDER_REVIEW(1, "审核中"),

/**
* 被退回
*/
BE_BACKED(2, "被退回"),

/**
* 被驳回
*/
BE_REJECTED(3, "被驳回"),

/**
* 审核通过
*/
APPROVED(4, "审核通过"),
/**
* 被撤回
*/
WITHDRAW(5, "被撤回");


private Integer code;
private String desc;

public String getDesc() {
return desc;
}

public void setDesc(String desc) {
this.desc = desc;
}

public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (ProcessStatusEnum t : ProcessStatusEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}

public static Integer getCodeByDesc(String desc) {
if (Objects.isNull(desc)) {
return null;
}
for (ProcessStatusEnum t : ProcessStatusEnum.values()) {
if (desc.equals(t.getDesc())) {
return t.code;
}
}
return null;
}

public static ProcessStatusEnum getEnumByValue(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (ProcessStatusEnum t : ProcessStatusEnum.values()) {
if (code.equals(t.getCode())) {
return t;
}
}
return null;
}

public boolean eq(String val) {
return this.name().equals(val);
}
}

+ 0
- 9
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/extension/cmd/BackToHisApprovalNodeCmd.java View File

@@ -4,14 +4,7 @@ import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.enumeration.ProcessStatusEnum;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.assertj.core.util.Sets;
import org.flowable.bpmn.model.BpmnModel;
@@ -22,9 +15,7 @@ import org.flowable.common.engine.api.FlowableException;
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.impl.delegate.ActivityBehavior;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.impl.persistence.entity.ExecutionEntityManager;


+ 121
- 410
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -2,14 +2,13 @@ package com.ningdatech.pmapi.todocenter.manage;

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.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum;
import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
@@ -29,9 +28,7 @@ import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode;
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo;
import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo;
import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId;
import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum;
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;
@@ -45,6 +42,7 @@ import com.ningdatech.zwdd.client.ZwddClient;
import com.wflow.bean.entity.WflowCcTasks;
import com.wflow.bean.entity.WflowModelHistorys;
import com.wflow.bean.entity.WflowModels;
import com.wflow.contants.HisProInsEndActId;
import com.wflow.exception.BusinessException;
import com.wflow.mapper.WflowCcTasksMapper;
import com.wflow.mapper.WflowModelHistorysMapper;
@@ -59,9 +57,9 @@ 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.enums.ProcessStatusEnum;
import com.wflow.workflow.service.*;
import com.wflow.workflow.service.FormService;
import com.wflow.workflow.utils.Executor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;
@@ -70,15 +68,12 @@ import org.flowable.bpmn.model.*;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskInfo;
import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery;
import org.flowable.variable.api.history.HistoricVariableInstance;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
@@ -122,6 +117,8 @@ public class TodoCenterManage {
private final IDingEmployeeInfoService dingEmployeeInfoService;
private final IDingOrganizationService dingOrganizationService;

private final ProcessInstanceService processInstanceService;

/**
* 待办中心待我处理项目列表查询
*
@@ -172,6 +169,9 @@ public class TodoCenterManage {
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();
String userId = param.getUserId();
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);

//因为要解耦 不能把项目和工作流一起查
//1.先查出用户工作流
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),userId);
@@ -192,27 +192,12 @@ public class TodoCenterManage {
}
excelExportWriter.setFileName(fileName);
List<String> sheetsNames = Lists.newArrayList(fileName);

// 表体行数据集合
List<List<String>> rowList = Lists.newArrayList();
// 表体列数据集合
List<ExportOptionEnum> columnList = param.getExportOptionList();
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);
JSONObject jsonObject = JSON.parseObject(s);
String columnValue = String.valueOf(jsonObject.get(column.toString()));
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
// sheet列表集合
List<List<List<String>>> sheets = Lists.newArrayList();
sheets.add(rowList);
sheets.add(exportDatas);
excelExportWriter.setHeads(sheets);
excelExportWriter.setDatas(rowList);
excelExportWriter.setDatas(exportDatas);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);
@@ -840,21 +825,7 @@ public class TodoCenterManage {
.variableName(WflowGlobalVarDef.WFLOW_FORMS)
.singleResult();
List<HistoricVariableInstance> formDatas = null;
//if (nodeId.equals("undefined")) {
// List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list();
// formDatas = historyService
// .createHistoricVariableInstanceQuery()
// .executionIds(historicTaskInstances.stream()
// .map(HistoricTaskInstance::getExecutionId)
// .collect(Collectors.toSet()))
// .processInstanceId(instanceId)
// .list();
//} else {
// formDatas = historyService
// .createHistoricVariableInstanceQuery()
// .processInstanceId(instanceId)
// .list();
//}

List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(instanceId).list();
formDatas = historyService.createHistoricVariableInstanceQuery()
@@ -868,25 +839,11 @@ public class TodoCenterManage {
.processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_NODE_PROPS).singleResult();
Map<String, Object> nodePropsValue = (Map<String, Object>) nodeProps.getValue();

ProcessNode<?> currentNode = null;

//if (StrUtil.isNotBlank(nodeId)) {
// // 搜索当前版本流程的配置
// WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder()
// .processDefId(instance.getProcessDefinitionId())
// .version(instance.getProcessDefinitionVersion())
// .build()));
// currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId);
//}
// 搜索当前版本流程的配置



WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder()
.processDefId(instance.getProcessDefinitionId())
.version(instance.getProcessDefinitionVersion())
.build()));
currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get("undefined");
ProcessNode<?> currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get("undefined");

//UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId()));
//HashSet<String> userSet = new HashSet<>();
@@ -1046,99 +1003,31 @@ public class TodoCenterManage {
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();

Long userId = 381496L;
// Long userId = 6418616L;
// Long userId = 61769799L;

// 自定义sql查询所有已办的任务实例
String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n"
+ "LEFT JOIN ACT_HI_VARINST AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ AND ahv.NAME_ LIKE 'approve_%'\n"
+ "WHERE aht.ASSIGNEE_ = " + userId + " AND ahv.NAME_ IS NOT NULL \n" + "ORDER BY aht.END_TIME_ DESC";
NativeHistoricTaskInstanceQuery taskInstanceQuery =
historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql);
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list();

Set<String> taskProcessInsIds = taskInstances.stream()
.map(HistoricTaskInstance::getProcessInstanceId)
.collect(Collectors.toSet());
// List<Project> results = getHandledProjects(param, taskProcessInsIds);
List<Project> results = Lists.newArrayList();

// 总数
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));
String userId = param.getUserId();
// 查出用户已处理工作流
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), userId);
List<String> instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList());

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<ResToBeProcessedVO> resVos = records.stream().map(d -> {
// 分页查询项目信息
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 -> {
ResToBeProcessedVO res = new ResToBeProcessedVO();
BeanUtils.copyProperties(d, res);
res.setProjectId(d.getId());
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
LocalDateTime processLaunchTime = d.getCreateOn();
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);
LocalDateTime processHandleTime = d.getUpdateOn();
String handleTimeFormat = NdDateUtils.format(processHandleTime, "yyyy-MM-dd HH:mm");
LocalDateTime handleTime = LocalDateTime.parse(handleTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessHandleTime(handleTime);

// 从已处理任务实例列表中取出当前登录用户及项目实例对应的任务实例
HistoricTaskInstance task = taskInstanceMap.get(d.getInstCode());
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());

// 从缓存取
staterUsers.add(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());
res.setProcessHandleTime(d.getUpdateOn());
return res;
}).collect(Collectors.toList());
if (isEmpty(resVos)) {
return PageVo.empty();
}
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedVO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream().peek(v -> v.getProcessTaskInfo()
// .setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
return PageVo.of(resVos, total);
return PageVo.of(resVos,projectPage.getTotal());
}

/**
@@ -1151,27 +1040,22 @@ public class TodoCenterManage {
* @since 2023/02/06
*/
public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) {
param.setPageNumber(1);
param.setPageSize(10000);
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();
Long userId = 381496L;
// 自定义sql查询所有已办的任务实例
String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n"
+ "LEFT JOIN ACT_HI_VARINST AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ AND ahv.NAME_ LIKE 'approve_%'\n"
+ "WHERE aht.ASSIGNEE_ = " + userId + " AND ahv.NAME_ IS NOT NULL \n" + "ORDER BY aht.END_TIME_ DESC";
NativeHistoricTaskInstanceQuery taskInstanceQuery =
historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql);
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list();

// 把已办任务流程实例一次性取出来,减少查询次数
Set<String> taskProcessInsIds = taskInstances.stream()
.map(HistoricTaskInstance::getProcessInstanceId)
.collect(Collectors.toSet());
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq();
BeanUtils.copyProperties(param, toBeProcessedReq);
// List<Project> records = getHandledProjects(toBeProcessedReq, taskProcessInsIds);
List<Project> records = Lists.newArrayList();

String userId = param.getUserId();
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);

// 查询用户已处理工作流
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), 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 = projectLibManage.projectList(projectListReq);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -1186,26 +1070,12 @@ public class TodoCenterManage {
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);

// 表体行数据集合
List<List<String>> rowList = new ArrayList<>();
// 表体列数据集合
List<ExportOptionEnum> columnList = param.getExportOptionList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = new ArrayList<>();
columnValues.add(column.getDesc());
records.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()));
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(rowList);
sheets.add(exportDatas);
excelExportWriter.setHeads(sheets);
excelExportWriter.setDatas(rowList);
excelExportWriter.setDatas(exportDatas);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);
@@ -1223,128 +1093,32 @@ public class TodoCenterManage {
*/
public PageVo<ResToBeProcessedVO> mySubmittedList(ToBeProcessedReq param) {

// 获取登录用户ID
// Long startUserId = LoginUserUtil.getUserId();
Long startUserId = 381496L;
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
Executor.builder().ifNotBlankNext(String.valueOf(startUserId), instanceQuery::startedBy);
List<HistoricProcessInstance> historicProcessInstances = instanceQuery.orderByProcessInstanceStartTime()
.desc().orderByProcessInstanceEndTime().desc().list();
Set<String> historicProcessInstanceIds = historicProcessInstances.stream()
.map(HistoricProcessInstance::getId).collect(Collectors.toSet());

// List<Project> results = getMySubmittedProjects(param, historicProcessInstanceIds);
List<Project> results = Lists.newArrayList();

// 总数
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());
String userId = param.getUserId();
// 查出登录用户已提交工作流
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(userId, param.getProcessDefId(), null);
List<String> instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList());

// 把已办任务流程实例一次性取出来,减少查询次数
Map<String, HistoricProcessInstance> instanceMap = isNotEmpty(historicProcessInstances) ? historyService
.createHistoricProcessInstanceQuery()
.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<ResToBeProcessedVO> resVos =
records.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 launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);
HistoricProcessInstance ist = instanceMap.get(d.getInstCode());
staterUsers.add(ist.getStartUserId());

ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
return res;
}).collect(Collectors.toList());
// 分页查询项目信息
ProjectListReq projectListReq = new ProjectListReq();
projectListReq.setInstCodes(instCodes);
BeanUtils.copyProperties(param,projectListReq);

if (isEmpty(resVos)) {
PageVo<ProjectLibListItemVO> projectPage = projectLibManage.projectLibList(projectListReq);
if (0L == projectPage.getTotal()) {
return PageVo.empty();
}
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedVO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessInstanceInfo().setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
return PageVo.of(resVos, total);
}

/**
* 获取流程实例信息
*
* @param ist 流程实例
* @return java.util.List<com.wflow.workflow.bean.vo.ProcessInstanceVo>
* @author CMM
* @since 2023/02/06
*/
private ProcessInstanceVo getProcessInstanceVos(HistoricProcessInstance ist) {
Map<String, String> instanceNodeMap = new HashMap<>();
ProcessInstanceVo instanceVo = ProcessInstanceVo
.builder()
.processDefId(ist.getProcessDefinitionId())
.instanceId(ist.getId())
.nodeId(instanceNodeMap.get(ist.getId()))
.formId(ist.getProcessDefinitionKey())
.staterUserId(ist.getStartUserId())
.startTime(ist.getStartTime())
.finishTime(ist.getEndTime())
.processDefName(ist.getProcessDefinitionName())
.result(ist.getEndActivityId())
.version(ist.getProcessDefinitionVersion())
.build();

if (Objects.isNull(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.UNDER_REVIEW.name());
} else if (HisProInsEndActId.BACK.equals(ist.getEndActivityId())) {
// 被流程发起人退回的审核节点状态,此时项目回到上一个状态,当前流程结束
// (由前一个审核人撤回的流程,未结束,仍在审核中)
instanceVo.setStatus(ProcessStatusEnum.BE_BACKED.name());
} else if (HisProInsEndActId.REJECT.equals(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.BE_REJECTED.name());
} else if (HisProInsEndActId.END.equals(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.APPROVED.name());
}

if (ObjectUtil.isNull(ist.getEndActivityId())) {
// 没有结束,还在走流程,获取任务
List<Task> list = taskService.createTaskQuery().processInstanceId(ist.getId()).includeIdentityLinks().active().list();
instanceVo.setNodeId(Optional.ofNullable(instanceVo.getNodeId()).orElseGet(() -> {
if (isNotEmpty(list)) {
return list.get(0).getTaskDefinitionKey();
}
return null;
}));
instanceVo.setTaskName(StrUtil.join("、", list.stream().map(TaskInfo::getName).collect(Collectors.toSet())));
} else {
if (HisProInsEndActId.WITHDRAW.equals(ist.getEndActivityId())) {
instanceVo.setTaskName(ProcessStatusEnum.WITHDRAW.getDesc());
} else if (HisProInsEndActId.REJECT.equals(ist.getEndActivityId())) {
instanceVo.setTaskName(ProcessStatusEnum.BE_REJECTED.getDesc());
} else {
instanceVo.setTaskName(ProcessStatusEnum.APPROVED.getDesc());
}
}
return instanceVo;
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()));
res.setProcessLaunchTime(d.getCreateOn());
return res;
}).collect(Collectors.toList());
return PageVo.of(resVos,projectPage.getTotal());
}

/**
@@ -1358,23 +1132,21 @@ public class TodoCenterManage {
*/
public void exportMySubmittedList(HttpServletResponse response, ToBeProcessedExportReq param) {

param.setPageNumber(1);
param.setPageSize(10000);
// Long startUserId = LoginUserUtil.getUserId();
Long startUserId = 381496L;
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
Executor.builder().ifNotBlankNext(String.valueOf(startUserId), instanceQuery::startedBy);
List<HistoricProcessInstance> historicProcessInstances = instanceQuery
.orderByProcessInstanceStartTime().desc()
.orderByProcessInstanceEndTime().desc()
.list();
Set<String> historicProcessInstanceIds = historicProcessInstances.stream()
.map(h -> h.getId())
.collect(Collectors.toSet());
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq();
BeanUtils.copyProperties(param, toBeProcessedReq);
// List<Project> records = getMySubmittedProjects(toBeProcessedReq, historicProcessInstanceIds);
List<Project> records = Lists.newArrayList();
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();

String userId = param.getUserId();
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);
// 查询用户已处理工作流
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(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 = projectLibManage.projectList(projectListReq);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -1388,27 +1160,13 @@ public class TodoCenterManage {

List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);

// 表体行数据集合
List<List<String>> rowList = new ArrayList<>();
// 表体列数据集合
List<ExportOptionEnum> columnList = param.getExportOptionList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = new ArrayList<>();
columnValues.add(column.getDesc());
records.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()));
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(rowList);
sheets.add(exportDatas);
excelExportWriter.setHeads(sheets);
excelExportWriter.setDatas(rowList);
excelExportWriter.setDatas(exportDatas);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);
@@ -1427,64 +1185,31 @@ public class TodoCenterManage {
public PageVo<ResToBeProcessedVO> ccmeList(ToBeProcessedReq param) {
// 获取当前登录用户ID
// Long userId = LoginUserUtil.getUserId();
String userId = param.getUserId();

Long userId = 381496L;
List<WflowCcTasks> ccTasks = ccTasksMapper.selectList(Wrappers.lambdaQuery(WflowCcTasks.class)
.eq(WflowCcTasks::getUserId, String.valueOf(userId)).orderByDesc(WflowCcTasks::getCreateTime));
List<String> processInsIds = ccTasks.stream()
.map(WflowCcTasks::getInstanceId)
.collect(Collectors.toList());
// 查询抄送登录用户的工作流
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), userId);
List<String> instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList());

// List<Project> results = getCcMeProjects(param, processInsIds);
List<Project> results = Lists.newArrayList();

// 总数
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());
// 分页查询项目信息
ProjectListReq projectListReq = new ProjectListReq();
projectListReq.setInstCodes(instCodes);
BeanUtils.copyProperties(param,projectListReq);

Set<String> staterUsers = new HashSet<>();
// 将抄送我的流程实例一次性取出来,减少查询次数
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<ResToBeProcessedVO> resVos =
records.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 launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);
HistoricProcessInstance ist = instanceMap.get(d.getInstCode());
staterUsers.add(ist.getStartUserId());

ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
return res;
}).collect(Collectors.toList());
if (isEmpty(resVos)) {
PageVo<ProjectLibListItemVO> projectPage = projectLibManage.projectLibList(projectListReq);
if (0L == projectPage.getTotal()) {
return PageVo.empty();
}
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedVO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessInstanceInfo().setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
return PageVo.of(resVos, total);

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()));
res.setProcessLaunchTime(d.getCreateOn());
return res;
}).collect(Collectors.toList());
return PageVo.of(resVos,projectPage.getTotal());
}

/**
@@ -1498,22 +1223,22 @@ public class TodoCenterManage {
*/
public void exportCcMeProjectList(HttpServletResponse response, ToBeProcessedExportReq param) {

param.setPageNumber(1);
param.setPageSize(10000);
// 获取当前登录用户ID
// Long userId = LoginUserUtil.getUserId();
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();

Long userId = 381496L;
List<WflowCcTasks> ccTasks = ccTasksMapper.selectList(Wrappers.lambdaQuery(WflowCcTasks.class)
.eq(WflowCcTasks::getUserId, String.valueOf(userId)).orderByDesc(WflowCcTasks::getCreateTime));
List<String> processInsIds = ccTasks.stream()
.map(WflowCcTasks::getInstanceId)
.collect(Collectors.toList());
String userId = param.getUserId();
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);

ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq();
BeanUtils.copyProperties(param, toBeProcessedReq);
// List<Project> records = getCcMeProjects(toBeProcessedReq, processInsIds);
List<Project> records = Lists.newArrayList();
// 查询抄送登录用户的工作流
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), 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 = projectLibManage.projectList(projectListReq);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -1527,27 +1252,13 @@ public class TodoCenterManage {

List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);

// 表体行数据集合
List<List<String>> rowList = new ArrayList<>();
// 表体列数据集合
List<ExportOptionEnum> columnList = param.getExportOptionList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = new ArrayList<>();
columnValues.add(column.getDesc());
records.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()));
columnValues.add(columnValue);
});
rowList.add(columnValues);
}
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(rowList);
sheets.add(exportDatas);
excelExportWriter.setHeads(sheets);
excelExportWriter.setDatas(rowList);
excelExportWriter.setDatas(exportDatas);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);


+ 0
- 6
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/vo/ResToBeProcessedVO.java View File

@@ -60,10 +60,4 @@ public class ResToBeProcessedVO implements Serializable {
@ApiModelProperty("流程处理时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime processHandleTime;

@ApiModelProperty("流程任务信息")
private ProcessTaskVo processTaskInfo;

@ApiModelProperty("流程实例信息")
private ProcessInstanceVo processInstanceInfo;
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java View File

@@ -17,4 +17,6 @@ import java.util.Set;
*/
public interface IUserInfoService extends IService<UserInfo> {
Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers);

ProcessInstanceUserDto getUserInfo(String userId);
}

+ 23
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java View File

@@ -61,4 +61,27 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
}).collect(Collectors.toList());
return resVos.stream().collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v));
}

@Override
public ProcessInstanceUserDto getUserInfo(String userId) {
UserInfo userInfo = userInfoMapper.selectById(Long.valueOf(userId));
ProcessInstanceUserDto processInstanceUserDto = new ProcessInstanceUserDto();
processInstanceUserDto.setUserId(String.valueOf(userInfo.getId()));
processInstanceUserDto.setUserName(userInfo.getRealName());
Long accountId = userInfo.getAccountId();
if (Objects.isNull(accountId)){
throw new BizException("该用户没有录入浙政钉用户信息!");
}
// 根据浙政钉用户ID获取部门code
DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getId, accountId));
String organizationCode = employeeInfo.getOrganizationCode();
// 根据部门code获取部门名称
DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, organizationCode));
String organizationName = dingOrganization.getOrganizationName();
processInstanceUserDto.setOrgCode(organizationCode);
processInstanceUserDto.setOrgName(organizationName);
return processInstanceUserDto;
}
}

Loading…
Cancel
Save