From 548bb0f08754c91fa43a3e78830ea009afba6adf Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 24 Apr 2024 20:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectlib/model/vo/ProjectLibListItemVO.java | 1 + .../workbench/controller/WorkbenchController.java | 9 ++ .../pm/api/workbench/manage/WorkbenchManage.java | 97 ++++++++++++++++++++++ .../workbench/model/WorkbenchProjectLibReq.java | 37 +++++++++ 4 files changed, 144 insertions(+) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java index 4d234a5..08054cd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java @@ -33,6 +33,7 @@ public class ProjectLibListItemVO { @Tolerate public ProjectLibListItemVO() { + // 无参构造 } @ApiModelProperty("来源 1申报项目 2项目归集") 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 dc39149..b9bc706 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 @@ -1,10 +1,13 @@ package com.hz.pm.api.workbench.controller; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.workbench.manage.WorkbenchManage; +import com.hz.pm.api.workbench.model.WorkbenchProjectLibReq; import com.hz.pm.api.workbench.model.WorkbenchReq; import com.hz.pm.api.workbench.model.vo.ProjectProcessStageStatisticsVO; import com.hz.pm.api.workbench.model.vo.ProjectTotalViewVO; import com.hz.pm.api.workbench.model.vo.WorkbenchVO; +import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -61,4 +64,10 @@ public class WorkbenchController { return workbenchManage.projectProcessStageStatistics(req); } + @GetMapping("/pageProjectLib") + @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 75ebcf8..0c50072 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 @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.entity.KeyValDTO; @@ -38,6 +39,7 @@ import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; import com.hz.pm.api.workbench.converter.WorkbenchConverter; +import com.hz.pm.api.workbench.model.WorkbenchProjectLibReq; import com.hz.pm.api.workbench.model.WorkbenchReq; import com.hz.pm.api.workbench.model.vo.ProjectProcessStageStatisticsVO; import com.hz.pm.api.workbench.model.vo.ProjectTotalViewVO; @@ -303,4 +305,99 @@ public class WorkbenchManage { return retData; } + public PageVo pageProjectLib(WorkbenchProjectLibReq req) { + Assert.notNull(req.getProcessNode(), "节点不能为空"); + Long unitId; + if (req.getUnitId() != null) { + unitId = req.getUnitId(); + } else { + unitId = LoginUserUtil.loginUserDetail().getMhUnitId(); + } + List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(unitId); + LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) + .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) + .like(StrUtil.isNotBlank(req.getBuildOrg()), Project::getBuildOrgName, req.getBuildOrg()) + .like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) + .in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)) + .eq(Project::getNewest, Boolean.TRUE) + .orderByDesc(Project::getUpdateOn); + switch (req.getProcessNode()) { + case PROJECT_DECLARED: + projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); + break; + case PROJECT_REVIEW: + projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); + break; + case APPROVAL_AMOUNT: + query.isNotNull(Project::getApprovalAmount).gt(Project::getApprovalAmount, BigDecimal.ZERO); + break; + case PROJECT_APPROVAL: + projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.DECLARED_RECORD_PASS); + break; + case PROJECT_PURCHASE: + projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_NOTICE); + break; + case PROJECT_ADAPTION: + projectQueryByPurchaseStatusChange(query, AdaptStateChangeEvent.ADAPT_INFO_PASSED); + break; + case SYSTEM_SELF_TEST: + projectQueryByPurchaseStatusChange(query, SelfTestStateChangeEvent.SELF_TEST_PASSED); + break; + case SYSTEM_TEST_VALID: + projectQueryByPurchaseStatusChange(query, TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); + break; + case FIRST_INSPECTED: + case PILOT_RUNNING: + projectQueryByPurchaseStatusChange(query, TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); + break; + case XCFHX_REVIEW: + projectQueryByPurchaseStatusChange(query, XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); + break; + case FINAL_INSPECTED: + projectQueryByPurchaseStatusChange(query, TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); + break; + default: + return PageVo.empty(); + } + Page page = projectService.page(req.page(), query); + 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.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.setPrePlanProjectId(w.getPrePlanProjectId()); + return item; + }); + return PageVo.of(records, page.getTotal()); + } + + private static void projectQueryByProjectStatusChange(LambdaQueryWrapper query, AbstractStateChangeEvent event) { + query.exists("select 1 from nd_project_status_change npsc" + + " where nd_project.project_code = npsc.project_code" + + " and npsc.event = {0}", event); + } + + private static void projectQueryByPurchaseStatusChange(LambdaQueryWrapper query, AbstractStateChangeEvent event) { + query.exists("select 1 from nd_purchase_status_change npsc" + + " where nd_project.project_code = npsc.project_code" + + " 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 new file mode 100644 index 0000000..f64175f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/WorkbenchProjectLibReq.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.workbench.model; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import static com.hz.pm.api.projectlib.handle.AbstractProcessHandle.ProcessNode; + +/** + *

+ * WorkbenchProjectLibReq + *

+ * + * @author WendyYang + * @since 18:27 2024/4/10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class WorkbenchProjectLibReq extends PagePo { + + @ApiModelProperty("单位ID") + private Long unitId; + + @ApiModelProperty("项目年度") + private Integer projectYear; + + @ApiModelProperty("项目阶段") + private ProcessNode processNode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位名称") + private String buildOrg; + +}