From fe31b770cef181ab49a3725187fb65a0fd023a78 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 20 Apr 2023 16:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/handle/UnitInnerAuditHandle.java | 2 +- .../pmapi/projectlib/utils/ProjectVersionUtil.java | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java index 1057e4a..8b00ace 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java @@ -79,7 +79,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); } if (Objects.isNull(instanceDetail)){ - throw new BizException("未获取到历史版本的流程详情!"); + throw new BizException("未获取到单位内部审核流程详情!"); } String status = instanceDetail.getStatus(); if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ 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 faa55cb..947e116 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 @@ -11,6 +11,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessHandlerEnum; import com.wflow.workflow.service.ProcessInstanceService; import liquibase.pro.packaged.I; import lombok.RequiredArgsConstructor; @@ -70,13 +71,18 @@ public class ProjectVersionUtil { .eq(ProjectInst::getProjectId, preProject.getId()) .eq(ProjectInst::getInstType,instTypeEnum.getCode())); if (CollUtil.isNotEmpty(projectInstList)) { - // 获取最新一个对应审核类型的项目关联实例 - ProjectInst projectInst = projectInstList.get(projectInstList.size() - 1); - // 获取流程详情 - instanceDetail = processInstanceService.getProgressInstanceDetail(null, projectInst.getInstCode()); - if (Objects.nonNull(instanceDetail)){ - return instanceDetail; + List processProgressVoList = projectInstList.stream() + .map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode())) + .collect(Collectors.toList()); + // 筛选出上个版本该类型审核流程通过的流程详情 + List instanceDetailList = processProgressVoList.stream() + .filter(p -> ProcessHandlerEnum.PASS.name().equals(p.getResult())) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(instanceDetailList)){ + return null; } + // 获取最后一个流程详情 + return instanceDetailList.get(instanceDetailList.size() - 1); } } return null;