From 6d677014b7db037fb6cc59bd3c0fe9e557cc125c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 23 Aug 2024 15:08:45 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E5=90=84=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/projectlib/helper/ProjectManageUtil.java | 26 ++++++--- .../com/hz/pm/api/user/util/LoginUserUtil.java | 4 ++ .../workbench/controller/WorkbenchController.java | 2 +- .../pm/api/workbench/manage/WorkbenchManage.java | 64 +++++++--------------- .../workbench/model/WorkbenchProjectLibReq.java | 2 - 5 files changed, 44 insertions(+), 54 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java index 66d5df5..b01b2bf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java @@ -1,20 +1,20 @@ package com.hz.pm.api.projectlib.helper; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; -import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; -import com.hz.pm.api.user.helper.MhUnitCache; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; - import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hz.pm.api.common.model.constant.ExistsSqlConst; +import com.hz.pm.api.common.statemachine.event.AbstractStateChangeEvent; +import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; - -import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.user.helper.MhUnitCache; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import java.util.List; import java.util.Map; @@ -106,6 +106,18 @@ public class ProjectManageUtil { return query; } + public static void projectQueryByProjectStatusChange(LambdaQueryWrapper query, + AbstractStateChangeEvent event) { + query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + + " and npsc.event = {0}", event); + } + + public static void projectQueryByPurchaseStatusChange(LambdaQueryWrapper query, + AbstractStateChangeEvent event) { + query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE_STATUS_CHANGE + + " and npsc.event ={0}", event.name()); + } + /** * 转换VO * diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java index 023dcb4..80be75f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java @@ -34,4 +34,8 @@ public class LoginUserUtil extends AbstractLoginUserUtil { return detail.getUserRoleList().stream().anyMatch(w -> RoleEnum.EXPERT.eq(w.getCode())); } + public static Long getMhUnitId() { + return loginUserDetail().getMhUnitId(); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java index 704bd27..c29662c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java @@ -65,7 +65,7 @@ public class WorkbenchController { } @GetMapping("/pageProjectLib") - @ApiOperation("项目库列表") + @ApiOperation("各阶段项目列表") public PageVo pageProjectLib(WorkbenchProjectLibReq req) { return workbenchManage.pageProjectLib(req); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index d389c9c..ee25158 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -71,6 +71,7 @@ import java.util.function.BiFunction; import java.util.function.Predicate; import java.util.stream.Collectors; +import static com.hz.pm.api.projectlib.helper.ProjectManageUtil.projectQueryByProjectStatusChange; import static com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO.TenderAdaptFinishStatVO; /** @@ -514,12 +515,7 @@ public class WorkbenchManage { public PageVo pageProjectLib(WorkbenchProjectLibReq req) { Assert.notNull(req.getProcessNode(), "节点不能为空"); - Long unitId; - if (req.getUnitId() != null) { - unitId = req.getUnitId(); - } else { - unitId = LoginUserUtil.loginUserDetail().getMhUnitId(); - } + Long unitId = Optional.ofNullable(req.getUnitId()).orElseGet(LoginUserUtil::getMhUnitId); List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(unitId); LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) @@ -533,7 +529,7 @@ public class WorkbenchManage { .ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin()) .ge(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax()) .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) - .eq(Project::getStage, ProjectStatus.STOPPED.getCode()) + .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) .eq(Project::getNewest, Boolean.TRUE) .orderByDesc(Project::getUpdateOn); projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); @@ -568,44 +564,24 @@ public class WorkbenchManage { if (page.getTotal() == 0) { return PageVo.empty(); } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = new ProjectLibListItemVO(); - item.setId(w.getId()); - item.setProjectName(w.getProjectName()); - // 项目申报 - item.setFromType("1"); - item.setProjectCode(w.getProjectCode()); - item.setArea(w.getArea()); - item.setAreaCode(w.getAreaCode()); - item.setCreateOn(w.getCreateOn()); - item.setDeclaredAmount(w.getDeclareAmount()); - item.setStage(w.getStage()); - item.setStatus(w.getStatus()); - item.setProjectType(w.getProjectType()); - item.setProjectYear(w.getProjectYear()); - item.setBuildOrg(w.getBuildOrgName()); - item.setBizDomain(w.getBizDomain()); - item.setProcessStatus(w.getProcessStatus()); - item.setInstCode(w.getInstCode()); - item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApprovedAmount(w.getApprovalAmount()); - item.setReviewAmount(w.getReviewAmount()); - item.setPrePlanProjectId(w.getPrePlanProjectId()); - return item; - }); + List records = CollUtils.convert(page.getRecords(), + w -> ProjectLibListItemVO.builder() + .id(w.getId()) + .projectName(w.getProjectName()) + .projectCode(w.getProjectCode()) + .projectType(w.getProjectType()) + .projectYear(w.getProjectYear()) + .buildOrg(w.getBuildOrgName()) + .buildOrgCode(w.getBuildOrgCode()) + .bizDomain(w.getBizDomain()) + .approvedAmount(w.getApprovalAmount()) + .reviewAmount(w.getReviewAmount()) + .declaredAmount(w.getDeclareAmount()) + .createOn(w.getCreateOn()) + .stage(w.getStage()) + .status(w.getStatus()) + .build()); return PageVo.of(records, page.getTotal()); } - private static void projectQueryByProjectStatusChange - (LambdaQueryWrapper query, AbstractStateChangeEvent event) { - query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + - " and npsc.event = {0}", event); - } - - private static void projectQueryByPurchaseStatusChange - (LambdaQueryWrapper query, AbstractStateChangeEvent event) { - query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE_STATUS_CHANGE + - " and npsc.event ={0}", event.name()); - } - } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java index b078bc0..889bf8f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java @@ -7,8 +7,6 @@ import lombok.EqualsAndHashCode; import java.math.BigDecimal; -import static com.hz.pm.api.projectlib.handle.AbstractProcessHandle.ProcessNode; - /** *

* WorkbenchProjectLibReq