From 328e97101f1304f1cb5f41f563d2c6b4f1e9407f Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Fri, 21 Apr 2023 14:17: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/utils/ProjectVersionUtil.java | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) 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;