Browse Source

流程处理通过修改

master
CMM 1 year ago
parent
commit
846ef107b4
1 changed files with 25 additions and 13 deletions
  1. +25
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java

+ 25
- 13
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java View File

@@ -3,13 +3,12 @@ package com.ningdatech.pmapi.todocenter.manage;
import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;

import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
@@ -89,17 +88,28 @@ public class HandlerManage {
// 获取流程通过后当前流程详情
ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId());
// 获取流程通过后当前审核人信息,向其发送工作通知
// 会签/或签会有多个审核人
List<String> currentEmployeeCodeList = Lists.newArrayList();
List<ProgressNode> newProgressInfo = newInstanceDetail.getProgressInfo();
ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1);
String currentEmployeeCode;
// 说明当前节点是子流程节点
if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) {
List<ProgressNode> children = currentNode.getChildren();
// 获取子流程当前审核人节点
ProgressNode subCurrentNode = children.get(children.size() - 1);
currentEmployeeCode = subCurrentNode.getUserId();
// 获取节点ID相同地审核节点
List<ProgressNode> nodeList = children.stream()
.filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId()))
.collect(Collectors.toList());
List<String> userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList());
currentEmployeeCodeList.addAll(userIdList);
} else {
currentEmployeeCode = currentNode.getUserId();
List<ProgressNode> nodeList = newProgressInfo.stream()
.filter(c -> currentNode.getNodeId().equals(c.getNodeId()))
.collect(Collectors.toList());
List<String> userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList());
currentEmployeeCodeList.addAll(userIdList);
}

// 流程通过后,判断当前登录用户是不是最后一个审核人
@@ -131,15 +141,17 @@ public class HandlerManage {
noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(),
PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS);
} else {
// 若有下一个审核人(当前节点的用户),
// 若有下一个审核人(当前节点的用户),会签/或签会有多个
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。
// 获取发送浙政钉工作通知必要信息
if (Objects.isNull(currentEmployeeCode)) {
throw new BizException("审核人信息不存在!");
for (String currentEmployeeCode : currentEmployeeCodeList) {
if (Objects.isNull(currentEmployeeCode)) {
throw new BizException("审核人信息不存在!");
}
//发送消息
noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(),
PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW);
}
//发送消息
noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(),
PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW);
}
}



Loading…
Cancel
Save