소스 검색

修改流程实例用户信息实体类

tags/24080901
CMM 1 년 전
부모
커밋
8986be7160
8개의 변경된 파일61개의 추가작업 그리고 60개의 파일을 삭제
  1. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProgressNode.java
  2. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java
  3. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProgressNodeAuditInfoVo.java
  4. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  5. +41
    -36
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  6. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java
  7. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  8. +10
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java

+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProgressNode.java 파일 보기

@@ -1,10 +1,9 @@
package com.ningdatech.pmapi.todocenter.bean.entity;

import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,7 +11,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
* 流程节点实体
@@ -48,7 +46,7 @@ public class ProgressNode {
/**
* 节点相关人员
*/
private UserInfoVO user;
private ProcessInstanceUserDto user;
/**
* 该节点动作操作类型
*/


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java 파일 보기

@@ -2,8 +2,8 @@ package com.ningdatech.pmapi.todocenter.bean.vo;


import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.vo.UserInfoVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -60,7 +60,7 @@ public class ProcessProgressDetailVo {
/**
* 发起人
*/
private UserInfoVO startUser;
private ProcessInstanceUserDto startUser;
/**
* 发起时间
*/


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProgressNodeAuditInfoVo.java 파일 보기

@@ -1,7 +1,7 @@
package com.ningdatech.pmapi.todocenter.bean.vo;

import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -34,7 +34,7 @@ public class ProgressNodeAuditInfoVo extends ProcessComment {
private String commentType;

@ApiModelProperty("评论用户信息")
private UserInfoVO user;
private ProcessInstanceUserDto user;

@ApiModelProperty("评论时间")
private Date createTime;


+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java 파일 보기

@@ -61,7 +61,6 @@ public class TodoCenterController {
/**
* 查询流程表单数据及审批的进度步骤
* @param instanceId 流程实例ID
* @param nodeId 当前获取流程人员关联的流程节点ID
* @return 流程进度及表单详情
*/
@GetMapping("/progress/{instanceId}/{projectId}")


+ 41
- 36
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java 파일 보기

@@ -48,7 +48,7 @@ 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.process.OrgUser;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.ProcessNode;
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
@@ -56,7 +56,6 @@ import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.process.props.ApprovalProps;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.config.WflowGlobalVarDef;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import com.wflow.workflow.service.FormService;
@@ -177,12 +176,14 @@ public class TodoCenterManage {
// 从待办任务列表中取出当前登录用户及项目实例对应的任务
Task task = taskMap.get(d.getInstCode());
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());

//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(instance.getStartUserId()));
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get((instance.getStartUserId())));

ProcessInstanceUserDto owner = new ProcessInstanceUserDto();
owner.setUserId(instance.getStartUserId());
res.setOwner(owner);
// 从缓存取
staterUsers.add(String.valueOf(userId));
@@ -210,7 +211,7 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(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());
@@ -910,7 +911,6 @@ public class TodoCenterManage {

/**
* 查询流程表单数据及审批的进度步骤
* @param nodeId 当前获取流程人员关联的流程节点ID
* @param instanceId 流程实例ID
* @return 流程进度及表单详情
*/
@@ -953,6 +953,7 @@ public class TodoCenterManage {
Map<String, Object> nodePropsValue = (Map<String, Object>) nodeProps.getValue();

ProcessNode<?> currentNode = null;

//if (StrUtil.isNotBlank(nodeId)) {
// // 搜索当前版本流程的配置
// WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder()
@@ -962,16 +963,20 @@ public class TodoCenterManage {
// 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");

//UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId()));
//HashSet<String> userSet = new HashSet<>();
//userSet.add(String.valueOf(userInfo.getId()));
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//UserInfoVO userInfoVO = userMap.get(userInfo.getId());
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
//ProcessInstanceUserDto startUser = userMap.get(String.valueOf(userInfo.getId()));
List<ProgressNode> taskRecords = getHisTaskRecords(instanceId, nodePropsValue);
// 获取添加抄送任务
taskRecords.addAll(getCcTaskRecords(instanceId));
@@ -1004,7 +1009,7 @@ public class TodoCenterManage {
.startTime(instance.getStartTime())
.progress(taskRecords)
.build();
//res.setStartUser(userInfoVO);
//res.setStartUser(startUser);
Project project = projectService.getById(projectId);
res.setStatus(ProcessStatusEnum.getDescByCode(project.getProcessStatus()));
return res;
@@ -1025,13 +1030,13 @@ public class TodoCenterManage {
ccUsers.add(task.getUserId());
return ProgressNode.builder().nodeId(task.getNodeId()).nodeType(NodeTypeEnum.CC)
.name(task.getNodeName())
.user(UserInfoVO.builder().userId(Long.valueOf(task.getUserId())).build())
.user(ProcessInstanceUserDto.builder().userId(task.getUserId()).build())
.startTime(task.getCreateTime())
.finishTime(task.getCreateTime())
.build();
}).collect(Collectors.toList());
if (isNotEmpty(ccUsers)) {
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(ccUsers);
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(ccUsers);
ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList());
}
return ccList;
@@ -1066,7 +1071,7 @@ public class TodoCenterManage {
.commentType(comment.getType())
.type("COMMENT")
.createTime(comment.getTime())
.user(UserInfoVO.builder().userId(Long.valueOf(comment.getUserId())).build())
.user(ProcessInstanceUserDto.builder().userId(comment.getUserId()).build())
.build();
ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class);
progressNodeAuditInfoVo.setText(processComment.getText());
@@ -1094,7 +1099,7 @@ public class TodoCenterManage {
.nodeId(his.getActivityId())
.name(his.getActivityName())
.nodeType(NodeTypeEnum.APPROVAL)
.user(UserInfoVO.builder().userId(Long.valueOf(his.getAssignee())).build())
.user(ProcessInstanceUserDto.builder().userId(his.getAssignee()).build())
.startTime(his.getStartTime())
.finishTime(his.getEndTime())
.taskId(his.getTaskId())
@@ -1103,7 +1108,7 @@ public class TodoCenterManage {
.result(varMap.get("approve_" + his.getTaskId())).build();
}).collect(Collectors.toList());
if (isNotEmpty(userSet)) {
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
progressNodes.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList());
}
return progressNodes;
@@ -1187,10 +1192,10 @@ public class TodoCenterManage {
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(instance.getStartUserId()));
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(instance.getStartUserId()));
ProcessInstanceUserDto owner = new ProcessInstanceUserDto();
owner.setUserId(instance.getStartUserId());
res.setOwner(owner);
// 从缓存取
staterUsers.add(instance.getStartUserId());
@@ -1210,9 +1215,9 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream().peek(v -> v.getProcessTaskInfo()
// .setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
@@ -1369,11 +1374,11 @@ public class TodoCenterManage {
HistoricProcessInstance ist = instanceMap.get(d.getInstCode());
staterUsers.add(ist.getStartUserId());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(ist.getStartUserId()));
//userSet.add(ist.getStartUserId()) ;
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(ist.getStartUserId()));
ProcessInstanceUserDto owner = new ProcessInstanceUserDto();
owner.setUserId(ist.getStartUserId());
res.setOwner(owner);
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
@@ -1386,9 +1391,9 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
@@ -1592,11 +1597,11 @@ public class TodoCenterManage {
HistoricProcessInstance ist = instanceMap.get(d.getInstCode());
staterUsers.add(ist.getStartUserId());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(ist.getStartUserId()));
//userSet.add(ist.getStartUserId()) ;
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(ist.getStartUserId()));
ProcessInstanceUserDto owner = new ProcessInstanceUserDto();
owner.setUserId(ist.getStartUserId());
res.setOwner(owner);
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
@@ -1608,9 +1613,9 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java 파일 보기

@@ -2,9 +2,9 @@ package com.ningdatech.pmapi.todocenter.model.dto.res;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.bean.vo.UserInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -69,5 +69,5 @@ public class ResToBeProcessedDTO implements Serializable {
private ProcessInstanceVo processInstanceInfo;

@ApiModelProperty("流程发起人信息")
private UserInfoVO owner;
private ProcessInstanceUserDto owner;
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java 파일 보기

@@ -2,7 +2,7 @@ package com.ningdatech.pmapi.user.service;

import com.ningdatech.pmapi.user.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;

import java.util.Map;
import java.util.Set;
@@ -16,5 +16,5 @@ import java.util.Set;
* @since 2023-02-01
*/
public interface IUserInfoService extends IService<UserInfo> {
Map<Long, UserInfoVO> getUserMapByIds(Set<String> staterUsers);
Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers);
}

+ 10
- 11
pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java 파일 보기

@@ -10,7 +10,7 @@ import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
@@ -33,13 +33,12 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>

private final IDingOrganizationService dingOrganizationService;
@Override
public Map<Long, UserInfoVO> getUserMapByIds(Set<String> staterUsers) {
public Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers) {
List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers);
List<UserInfoVO> resVos = userInfos.stream().map(u -> {
UserInfoVO userInfoVO = new UserInfoVO();
userInfoVO.setUserId(u.getId());
userInfoVO.setRealName(u.getRealName());
userInfoVO.setAccountId(u.getAccountId());
List<ProcessInstanceUserDto> resVos = userInfos.stream().map(u -> {
ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto();
userInfo.setUserId(String.valueOf(u.getId()));
userInfo.setUserName(u.getRealName());
Long accountId = u.getAccountId();
if (Objects.isNull(accountId)){
throw new BizException("该用户没有录入浙政钉用户信息!");
@@ -52,10 +51,10 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, organizationCode));
String organizationName = dingOrganization.getOrganizationName();
userInfoVO.setOrganizationCode(organizationCode);
userInfoVO.setOrganizationName(organizationName);
return userInfoVO;
userInfo.setOrgCode(organizationCode);
userInfo.setOrgName(organizationName);
return userInfo;
}).collect(Collectors.toList());
return resVos.stream().collect(Collectors.toMap(UserInfoVO::getUserId, v -> v));
return resVos.stream().collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v));
}
}

불러오는 중...
취소
저장