From 24e68627498fbc8c97318ca6f613cc3b1a184914 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 18 Apr 2024 11:38:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/AbstractStateChangeEvent.java | 4 ++ .../projectlib/handle/AbstractProcessHandle.java | 17 +++++ .../api/projectlib/handle/HandleParamContext.java | 12 +++- .../handle/stage/ProjectApprovalHandle.java | 74 ++++++++-------------- .../handle/stage/ProjectDeclareHandle.java | 63 +++++++++++++++--- .../handle/stage/ProjectPurchaseHandle.java | 16 ++--- .../handle/stage/ProjectReviewHandle.java | 56 +++++++++++++--- .../projectlib/service/IProjectInstService.java | 2 +- .../service/IProjectStatusChangeService.java | 3 +- 9 files changed, 165 insertions(+), 82 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java index 96efdf7..8fd5448 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java @@ -56,4 +56,8 @@ public interface AbstractStateChangeEvent { throw BizException.wrap("该状态下没有对应的撤回操作!"); } + default boolean eq(String name){ + return name().equals(name); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java index c38665f..3728249 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java @@ -1,8 +1,12 @@ package com.hz.pm.api.projectlib.handle; import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.bean.vo.ProcessInfoVO; +import com.wflow.workflow.bean.vo.ProcessInstanceVo; +import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.enums.StepStatusEnum; import lombok.AllArgsConstructor; @@ -95,4 +99,17 @@ public abstract class AbstractProcessHandle implements Ordered, ProcessHandle { } } + public void buildStepStatus(ProcessDetailVO detail, ProcessProgressVo progress, ProjectStatusChange event) { + detail.setProcessProgressVo(progress); + if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(progress.getStatus())) { + detail.setStepStatus(StepStatusEnum.REJECTED); + detail.setFinishTime(event.getCreateOn()); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(progress.getStatus())) { + detail.setStepStatus(StepStatusEnum.COMPLETED); + detail.setFinishTime(event.getCreateOn()); + } else { + detail.setStepStatus(StepStatusEnum.ON_GOING); + } + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/HandleParamContext.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/HandleParamContext.java index eaa809b..532ec28 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/HandleParamContext.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/HandleParamContext.java @@ -1,14 +1,18 @@ package com.hz.pm.api.projectlib.handle; +import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.enums.StepStatusEnum; import lombok.Data; import java.util.List; +import java.util.Map; /** *

@@ -29,8 +33,14 @@ public final class HandleParamContext { private List purchaseInstList; - private List projectStatusChanges; + private Map projectStatusChanges; + + private Map projectInstMap; private StepStatusEnum preStepStatus; + public ProjectStatusChange getProjectStateChange(ProjectStateChangeEvent event) { + return projectStatusChanges.get(event); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java index 04489e9..f0c72da 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectApprovalHandle.java @@ -1,18 +1,11 @@ package com.hz.pm.api.projectlib.handle.stage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; import com.hz.pm.api.projectlib.handle.AbstractProcessHandle; import com.hz.pm.api.projectlib.handle.HandleParamContext; -import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; -import com.hz.pm.api.projectlib.service.IProjectInstService; -import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.ProcessStatusEnum; @@ -21,9 +14,11 @@ import com.wflow.workflow.service.ProcessInstanceService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; +import java.util.Comparator; +import java.util.Map; +import java.util.Optional; + +import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.*; /** * 立项批复处理 @@ -35,9 +30,6 @@ import java.util.Objects; @RequiredArgsConstructor public class ProjectApprovalHandle extends AbstractProcessHandle { - private final IProjectStatusChangeService projectStatusChangeService; - private final IProjectService projectService; - private final IProjectInstService projectInstService; private final ProcessInstanceService processInstanceService; @Override @@ -50,46 +42,30 @@ public class ProjectApprovalHandle extends AbstractProcessHandle { ProcessDetailVO detail = new ProcessDetailVO(); detail.setProcessName(getProcessNode().getName()); ctx.getProcessDetails().add(detail); - Project project = ctx.getProject(); - Integer status = project.getStatus(); + if (!StepStatusEnum.COMPLETED.equals(ctx.getPreStepStatus())) { + detail.setStepStatus(StepStatusEnum.NOT_START); + return; + } // 项目状态为待立项批复之前的状态 - if (status == null || (status < ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode())) { + Map eventMap = ctx.getProjectStatusChanges(); + if (!eventMap.containsKey(DECLARED_RECORD_SUBMIT)) { detail.setStepStatus(StepStatusEnum.NOT_START); } else { - List projectIds = projectService.allVersionProjectIds(project.getProjectCode()); - // 当前项目状态为待立项批复 - if (ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.eq(status) - || ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.eq(status)) { - // 根据建设方案评审通过的时间获取 - final List events = Arrays.asList( - ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT, - ProjectStateChangeEvent.DECLARED_RECORD_RESUBMIT); - ProjectStatusChange projectStatusChange = projectStatusChangeService.getLastOne(projectIds, events); - if (projectStatusChange != null) { - detail.setFinishTime(projectStatusChange.getCreateOn()); - } - detail.setStepStatus(StepStatusEnum.ON_GOING); + ProjectInst inst = ctx.getProjectInstMap().get(InstTypeEnum.DECLARED_RECORD); + if (inst == null) { + detail.setStepStatus(StepStatusEnum.NOT_START); } else { - // 取 状态机 改变状态时间 - final List events = Arrays.asList( - ProjectStateChangeEvent.DECLARED_RECORD_FAILED, - ProjectStateChangeEvent.DECLARED_RECORD_PASS); - ProjectStatusChange projectStatusChange = projectStatusChangeService.getLastOne(projectIds, events); - if (Objects.nonNull(projectStatusChange)) { - detail.setFinishTime(projectStatusChange.getCreateOn()); - detail.setStepStatus(StepStatusEnum.COMPLETED); - ProjectInst inst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .in(ProjectInst::getProjectId, projectIds) - .eq(ProjectInst::getInstType, InstTypeEnum.DECLARED_RECORD.getCode()) - .orderByDesc(ProjectInst::getCreateOn) - .last(BizConst.LIMIT_1)); - if (inst != null) { - ProcessProgressVo instDetail = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); - detail.setProcessProgressVo(instDetail); - if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(instDetail.getStatus())) { - detail.setStepStatus(StepStatusEnum.REJECTED); - } - } + Optional event = eventMap.values().stream() + .filter(w -> DECLARED_RECORD_SUBMIT.eq(w.getEvent()) + || DECLARED_RECORD_PASS.eq(w.getEvent()) + || DECLARED_RECORD_RESUBMIT.eq(w.getEvent()) + || DECLARED_RECORD_FAILED.eq(w.getEvent()) + ).max(Comparator.comparing(ProjectStatusChange::getCreateOn)); + if (event.isPresent()) { + ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); + buildStepStatus(detail, progress, event.get()); + } else { + detail.setStepStatus(StepStatusEnum.NOT_START); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java index 72cfc86..b9467a3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java @@ -1,14 +1,29 @@ package com.hz.pm.api.projectlib.handle.stage; +import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; import com.hz.pm.api.projectlib.handle.AbstractProcessHandle; import com.hz.pm.api.projectlib.handle.HandleParamContext; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.StepStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.time.LocalDateTime; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.*; /** * 项目申报处理 @@ -20,6 +35,10 @@ import java.time.LocalDateTime; @RequiredArgsConstructor public class ProjectDeclareHandle extends AbstractProcessHandle { + private final IProjectStatusChangeService projectStatusChangeService; + private final IProjectInstService projectInstService; + private final ProcessInstanceService processInstanceService; + @Override public ProcessNode getProcessNode() { return ProcessNode.PROJECT_DECLARED; @@ -27,15 +46,41 @@ public class ProjectDeclareHandle extends AbstractProcessHandle { @Override public void handle(HandleParamContext ctx) { - // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - // 项目库中查出申报完成时间 + ProcessDetailVO detail = new ProcessDetailVO(); + detail.setProcessName(getProcessNode().getName()); + ctx.getProcessDetails().add(detail); Project project = ctx.getProject(); - LocalDateTime createOn = project.getCreateOn(); - processDetailVO.setFinishTime(createOn); - processDetailVO.setProcessName(getProcessNode().getName()); - ctx.getProcessDetails().add(processDetailVO); + // 项目状态为待立项批复之前的状态 + Map eventMap = projectStatusChangeService.listLastEventMap(project.getProjectCode()); + ctx.setProjectStatusChanges(eventMap); + if (!eventMap.containsKey(PROJECT_APPLICATION_SUBMIT)) { + detail.setStepStatus(StepStatusEnum.NOT_START); + } else { + List projectIds = ProjectIdCodeCacheUtil.get(project.getProjectCode()); + List projectInstList = projectInstService.listByProjectIds(projectIds); + Map instMap = BizUtils.groupFirstMap(projectInstList, + w -> InstTypeEnum.getNoNull(w.getInstType()), + Comparator.comparing(ProjectInst::getCreateOn).reversed()); + ctx.setProjectInstMap(instMap); + ProjectInst inst = instMap.get(InstTypeEnum.COMPLIANCE_REVIEW); + if (inst == null) { + detail.setStepStatus(StepStatusEnum.NOT_START); + } else { + Optional event = eventMap.values().stream() + .filter(w -> PROJECT_APPLICATION_SUBMIT.eq(w.getEvent()) + || COMPLIANCE_REVIEW_FAILED.eq(w.getEvent()) + || COMPLIANCE_REVIEW_RESUBMIT.eq(w.getEvent()) + || COMPLIANCE_REVIEW_PASS.eq(w.getEvent()) + ).max(Comparator.comparing(ProjectStatusChange::getCreateOn)); + if (event.isPresent()) { + ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); + buildStepStatus(detail, progress, event.get()); + } else { + detail.setStepStatus(StepStatusEnum.NOT_START); + } + } + } + ctx.setPreStepStatus(detail.getStepStatus()); } @Override diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java index bf36ebe..2253b27 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectPurchaseHandle.java @@ -1,7 +1,5 @@ package com.hz.pm.api.projectlib.handle.stage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; @@ -19,6 +17,7 @@ import org.springframework.stereotype.Component; import java.util.List; +import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.SUBMIT_OPERATION_PLAN; import static com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus.ON_PURCHASING; import static com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus.TO_BE_PURCHASED; @@ -51,8 +50,10 @@ public class ProjectPurchaseHandle extends AbstractProcessHandle { ProcessDetailVO detail = new ProcessDetailVO(); detail.setProcessName(getProcessNode().getName()); ctx.getProcessDetails().add(detail); - // 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 - // 进行了立项批复且项目状态是待采购 + if (!StepStatusEnum.COMPLETED.equals(ctx.getPreStepStatus())) { + detail.setStepStatus(StepStatusEnum.NOT_START); + return; + } Project project = ctx.getProject(); if (TO_BE_PURCHASED.eq(project.getStatus())) { detail.setStepStatus(StepStatusEnum.NOT_START); @@ -60,11 +61,7 @@ public class ProjectPurchaseHandle extends AbstractProcessHandle { detail.setStepStatus(StepStatusEnum.ON_GOING); } else { // 根据采购备案的时间获取 - ProjectStatusChange change = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .eq(ProjectStatusChange::getProjectCode, project.getProjectCode()) - .eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.SUBMIT_OPERATION_PLAN) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1)); + ProjectStatusChange change = ctx.getProjectStateChange(SUBMIT_OPERATION_PLAN); if (change == null) { detail.setStepStatus(StepStatusEnum.NOT_START); } else { @@ -77,7 +74,6 @@ public class ProjectPurchaseHandle extends AbstractProcessHandle { } } ctx.setPreStepStatus(detail.getStepStatus()); - detail.setProcessName(getProcessNode().getName()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java index 63ada5a..4d247cb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java @@ -1,12 +1,23 @@ package com.hz.pm.api.projectlib.handle.stage; +import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; import com.hz.pm.api.projectlib.handle.AbstractProcessHandle; import com.hz.pm.api.projectlib.handle.HandleParamContext; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.StepStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.time.LocalDateTime; +import java.util.Comparator; +import java.util.Map; +import java.util.Optional; + +import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.*; /** * 项目申报处理 @@ -14,10 +25,12 @@ import java.time.LocalDateTime; * @author CMM * @since 2023/02/24 14:35 */ - @Component +@RequiredArgsConstructor public class ProjectReviewHandle extends AbstractProcessHandle { + private final ProcessInstanceService processInstanceService; + @Override public ProcessNode getProcessNode() { return ProcessNode.PROJECT_REVIEW; @@ -30,14 +43,37 @@ public class ProjectReviewHandle extends AbstractProcessHandle { @Override public void handle(HandleParamContext ctx) { - // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 - ProcessDetailVO processDetailVO = new ProcessDetailVO(); - processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); - // 项目库中查出申报完成时间 - LocalDateTime createOn = ctx.getProject().getCreateOn(); - processDetailVO.setFinishTime(createOn); - processDetailVO.setProcessName(getProcessNode().getName()); - ctx.getProcessDetails().add(processDetailVO); + ProcessDetailVO detail = new ProcessDetailVO(); + detail.setProcessName(getProcessNode().getName()); + ctx.getProcessDetails().add(detail); + if (!StepStatusEnum.COMPLETED.equals(ctx.getPreStepStatus())) { + detail.setStepStatus(StepStatusEnum.NOT_START); + return; + } + // 项目状态为待立项批复之前的状态 + Map eventMap = ctx.getProjectStatusChanges(); + if (!eventMap.containsKey(PROJECT_REVIEW_SUBMIT)) { + detail.setStepStatus(StepStatusEnum.NOT_START); + } else { + ProjectInst inst = ctx.getProjectInstMap().get(InstTypeEnum.PROJECT_REVIEW); + if (inst == null) { + detail.setStepStatus(StepStatusEnum.NOT_START); + } else { + Optional event = eventMap.values().stream() + .filter(w -> PROJECT_REVIEW_PASS.eq(w.getEvent()) + || PROJECT_REVIEW_RESUBMIT.eq(w.getEvent()) + || PROJECT_REVIEW_FAILED.eq(w.getEvent()) + || PROJECT_REVIEW_SUBMIT.eq(w.getEvent()) + ).max(Comparator.comparing(ProjectStatusChange::getCreateOn)); + if (event.isPresent()) { + ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); + buildStepStatus(detail, progress, event.get()); + } else { + detail.setStepStatus(StepStatusEnum.NOT_START); + } + } + } + ctx.setPreStepStatus(detail.getStepStatus()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java index 74eda61..6cd627c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java @@ -28,7 +28,7 @@ public interface IProjectInstService extends IService { default List listByProjectIds(Collection projectIds) { LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIds) - .orderByDesc(ProjectInst::getProjectId); + .orderByDesc(ProjectInst::getCreateOn); return list(query); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java index a329200..89d867c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java @@ -62,8 +62,7 @@ public interface IProjectStatusChangeService extends IService listLastEventMap(String projectCode) { Wrapper query = Wrappers.lambdaQuery(ProjectStatusChange.class) .eq(ProjectStatusChange::getProjectCode, projectCode) - .orderByDesc(ProjectStatusChange::getCreateOn) - .last(BizConst.LIMIT_1); + .orderByDesc(ProjectStatusChange::getCreateOn); return BizUtils.groupFirstMap(list(query), w -> ProjectStateChangeEvent.valueOf(w.getEvent()), Comparator.comparing(ProjectStatusChange::getCreateOn).reversed());