From fffb5ab1ba0412bd20a70f6031609c0da5604730 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 2 Sep 2024 14:31:32 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E9=A1=B9=E7=9B=AE=E7=94=B3?= =?UTF-8?q?=E6=8A=A5=E5=88=97=E8=A1=A8=E3=80=81=E8=AF=84=E5=AE=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=8C=89=E7=85=A7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/DeclaredProjectManage.java | 24 +++++++++++- .../manage/ProjectReviewManage.java | 44 ++++++++++++++++------ .../pm/api/projectlib/manage/ProjectLibManage.java | 5 ++- .../model/enumeration/status/ProjectStatus.java | 2 + .../pm/api/workbench/manage/QxWorkbenchManage.java | 2 +- 5 files changed, 61 insertions(+), 16 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 27c5c65..87ad223 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -16,6 +16,7 @@ import com.hz.pm.api.common.enumeration.BoolDisplayEnum; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessType; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.ExistsSqlConst; import com.hz.pm.api.common.model.constant.MhUnitConst; import com.hz.pm.api.common.model.constant.TypeReferenceConst; import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; @@ -353,19 +354,38 @@ public class DeclaredProjectManage { * @return */ public PageVo projectLibList(ProjectListReq req) { + Integer status = req.getStatus(); + req.setStatus(null); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); LambdaQueryWrapper query = ProjectManageUtil.projectQuery(req); // 当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 if (!projectQueryPermission(query, user, req.getDeclaredUnitId())) { return PageVo.empty(); } + if (status != null) { + if (ProjectStatus.COMPLIANCE_REVIEW_PASSED.eq(status)) { + query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + + " and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); + } else { + query.eq(Project::getStatus, status); + } + } + query.ne(Project::getStage, ProjectStatus.STOPPED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); if (page.getTotal() == 0) { return PageVo.empty(); } - List records = CollUtils.convert(page.getRecords(), - w -> BeanUtil.copyProperties(w, ProjectLibListItemVO.class)); + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = BeanUtil.copyProperties(w, ProjectLibListItemVO.class); + if (!ProjectStatus.TO_BE_DECLARED.eq(w.getStatus()) + && ProjectStatus.COMPLIANCE_REVIEW_FAILED.eq(w.getStatus()) + && ProjectStatus.ON_COMPLIANCE_REVIEW.eq(w.getStatus()) + && !ProjectStatus.CHANGE.eq(w.getStage())) { + item.setStatus(ProjectStatus.COMPLIANCE_REVIEW_PASSED.getCode()); + } + return item; + }); return PageVo.of(records, page.getTotal()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java index 550dbde..abd668f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.enumeration.ProjectProcessType; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.common.model.constant.ExistsSqlConst; +import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.utils.DataScopeUtil; @@ -121,8 +123,8 @@ public class ProjectReviewManage { /** * 项目列表 * - * @param req - * @return + * @param req \ + * @return \ */ public PageVo pageReviewProject(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); @@ -130,20 +132,38 @@ public class ProjectReviewManage { if (!projectQueryPermission(query, user, req.getDeclaredUnitId())) { return PageVo.empty(); } + Integer status = req.getStatus(); + if (status != null) { + req.setStatus(null); + if (ProjectStatus.PROJECT_REVIEW_PASSED.eq(status)) { + query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + + " and npsc.event = {0}", ProjectStateChangeEvent.PROJECT_REVIEW_PASS); + } else { + query.eq(Project::getStatus, status); + } + } else { + query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + + " and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); + } ProjectManageUtil.projectQuery(query, req); - query.in(Project::getStatus, - ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode(), - ProjectStatus.ON_PROJECT_REVIEW.getCode(), - ProjectStatus.PROJECT_REVIEW_FAILED.getCode()) - .eq(Project::getNewest, Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE) + .ne(Project::getStage, ProjectStatus.STOPPED.getCode()); Page page = projectService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { + if (page.getTotal() == 0) { return PageVo.empty(); } - List records = CollUtils.convert(page.getRecords(), - w -> BeanUtil.copyProperties(w, ProjectLibListItemVO.class)); - return PageVo.of(records, total); + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = BeanUtil.copyProperties(w, ProjectLibListItemVO.class); + if (!ProjectStatus.PROJECT_REVIEW_FAILED.eq(w.getStatus()) + && !ProjectStatus.COMPLIANCE_REVIEW_PASSED.eq(w.getStatus()) + && !ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(w.getStatus()) + && !ProjectStatus.ON_PROJECT_REVIEW.eq(w.getStatus()) + && !ProjectStatus.CHANGE.eq(w.getStage())) { + item.setStatus(ProjectStatus.PROJECT_REVIEW_PASSED.getCode()); + } + return item; + }); + return PageVo.of(records, page.getTotal()); } private boolean projectQueryPermission(LambdaQueryWrapper query, diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 6148645..fbc8cb0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; @@ -962,7 +963,9 @@ public class ProjectLibManage { replaceInfo.setSourceSystem(curr.getSourceSystemNames().get(i1)); replaceInfo.setTargetSystem(curr.getTargetSystemName()); replaceInfo.setBatchNo(i + 1); - replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1)); + if (ArrayUtil.isNotEmpty(curr.getSourceSystemIds())) { + replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1)); + } replaceInfos.add(replaceInfo); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java index c9f46f0..94f9dc6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java @@ -31,6 +31,7 @@ public enum ProjectStatus implements IStatus { */ ON_COMPLIANCE_REVIEW(10030, "合规性审查中", 10000), COMPLIANCE_REVIEW_FAILED(10031, "合规性审查不通过", 10000), + COMPLIANCE_REVIEW_PASSED(10032, "合规性审查通过", 10000), /** * 项目评审 @@ -38,6 +39,7 @@ public enum ProjectStatus implements IStatus { WITHOUT_PROJECT_REVIEW(10040, "待项目评审", 10000), ON_PROJECT_REVIEW(10041, "项目评审中", 10000), PROJECT_REVIEW_FAILED(10042, "项目评审不通过", 10000), + PROJECT_REVIEW_PASSED(10043, "项目评审通过", 10000), ON_ANNUAL_PLAN(10010, "年度计划中", 10000), diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/QxWorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/QxWorkbenchManage.java index 769a9ec..029e514 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/QxWorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/QxWorkbenchManage.java @@ -68,7 +68,7 @@ public class QxWorkbenchManage { stat.setTotalBudget(DecimalUtil.sum(purchases, QxPurchase::getPurchaseBudget)); stat.setTotalContractAmount(DecimalUtil.sum(purchases, QxPurchase::getContractAmount)); QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.select("count(distinct project_id) adaptCount"); + wrapper.select("count(distinct project_id) \"adaptCount\""); wrapper.in("project_id", projectIds); wrapper.isNotNull("has_security_eval"); Map map = qxProjectSystemReplaceInfosService.getMap(wrapper);