From 44fffc6483e85865aaaab0af95bb54bfcf5b36cd Mon Sep 17 00:00:00 2001 From: WendyYang Date: Sat, 2 Mar 2024 10:50:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectlib/manage/DeclaredRecordManage.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java index 6a7aa57..3494c4d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java @@ -12,6 +12,7 @@ import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; @@ -104,26 +105,29 @@ public class DeclaredRecordManage { public PageVo pageDeclaredProject(DeclaredProjectListReq req) { LambdaQueryWrapper query = buildQuery(req); + // 查询审核中、失败、待立项备案的项目信息 + LambdaQueryWrapper pQuery = Wrappers.lambdaQuery(Project.class) + .in(Project::getStatus, ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.getCode(), + ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode(), + ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode()) + .select(Project::getId, Project::getProjectCode, Project::getStage, Project::getStatus, Project::getCreateOn); + List projects = projectService.list(pQuery); + Map projectMap = BizUtils.groupFirstMap(projects, Project::getProjectCode, + Comparator.comparing(Project::getCreateOn).reversed()); + query.and(q1 -> q1.isNull(MhProject::getProjectCode) + .or(!projects.isEmpty(), q2 -> q2.in(MhProject::getProjectCode, projectMap.keySet()))); Page page = mhProjectService.page(req.page(), query); if (page.getTotal() == 0) { return PageVo.empty(); } List records = page.getRecords(); - List projectCodes = CollUtils.fieldList(records, MhProject::getProjectCode); - Map projectMap; - if (!projectCodes.isEmpty()) { - List projects = projectService.listNewestByProjectCodes(projectCodes); - projectMap = CollUtils.listToMap(projects, Project::getProjectCode); - } else { - projectMap = Collections.emptyMap(); - } List data = records.stream().map(w -> { DeclaredProjectListVO item = new DeclaredProjectListVO(); item.setMhProjectId(w.getId()); Project project = projectMap.get(w.getProjectCode()); if (project == null) { item.setStatus(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode()); - item.setStage(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + item.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); } else { item.setStatus(project.getStatus()); item.setStage(project.getStage());