diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java index 27405d1..bdb8f3d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -155,9 +155,8 @@ public class DefaultDeclaredProjectManage { return Collections.emptyMap(); } - UserFullInfoDTO startUser = userInfoHelper.getUserFullInfo(userFullInfo.getUserId()); - String startOrgCode = startUser.getEmpPosUnitCode(); - String startOrgName = startUser.getEmpPosUnitName(); + String startOrgCode = userFullInfo.getEmpPosUnitCode(); + String startOrgName = userFullInfo.getEmpPosUnitName(); String startOrgParentCode; String startOrgParentName; // 如果申报时 上级主管单位,由该单位自己审核 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java index 8f96faf..4a5227b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java @@ -63,28 +63,23 @@ public class ProjectVersionUtil { } // 获取之前版本的项目 - int index = projectList.size() - 1; - ProcessProgressVo instanceDetail = null; - while (index > 0){ - index = index - 1; - Project preProject = projectList.get(index); + for (Project preProject : projectList) { // 从项目流程实例关联表中查出实例详情 - List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, preProject.getId()) - .eq(ProjectInst::getInstType,instTypeEnum.getCode())); + List projectInstList = projectInstService + .list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, preProject.getId()) + .eq(ProjectInst::getInstType, instTypeEnum.getCode())); if (CollUtil.isNotEmpty(projectInstList)) { List processProgressVoList = projectInstList.stream() - .map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode())) - .collect(Collectors.toList()); + .map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode())) + .collect(Collectors.toList()); // 筛选出上个版本该类型审核流程通过的流程详情 List instanceDetailList = processProgressVoList.stream() - .filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus())) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(instanceDetailList)){ - continue; + .filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus())) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(instanceDetailList)) { + // 获取最后一个流程详情 + return instanceDetailList.get(instanceDetailList.size() - 1); } - // 获取最后一个流程详情 - return instanceDetailList.get(instanceDetailList.size() - 1); } } return null; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 49c6e3e..5e95e1b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -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 currentEmployeeCodeList = Lists.newArrayList(); List newProgressInfo = newInstanceDetail.getProgressInfo(); ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); - String currentEmployeeCode; + // 说明当前节点是子流程节点 if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { List children = currentNode.getChildren(); // 获取子流程当前审核人节点 ProgressNode subCurrentNode = children.get(children.size() - 1); - currentEmployeeCode = subCurrentNode.getUserId(); + // 获取节点ID相同地审核节点 + List nodeList = children.stream() + .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) + .collect(Collectors.toList()); + List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); + currentEmployeeCodeList.addAll(userIdList); } else { - currentEmployeeCode = currentNode.getUserId(); + List nodeList = newProgressInfo.stream() + .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) + .collect(Collectors.toList()); + List 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); } }