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;