diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java index 091638f..6df3aff 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AnnualPlanController.java @@ -7,6 +7,7 @@ import com.hz.pm.api.projectlib.model.req.ProjectIdReq; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq; import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; +import com.hz.pm.api.projectlib.model.vo.AnnualPlanProgressStatisticsVO; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; @@ -39,6 +40,12 @@ public class AnnualPlanController { return annualPlanLibManage.annulPlanLibList(req); } + @GetMapping("/progressStatistics") + @ApiOperation("年度计划库列表进度统计") + public AnnualPlanProgressStatisticsVO progressStatistics(ProjectListReq req) { + return annualPlanLibManage.annualProgressStatistics(req); + } + @PostMapping("/startProjectDeclared") @ApiOperation("开启项目申报") @WebLog("开启项目申报") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index ca30888..3bc5d3f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -1,6 +1,7 @@ package com.hz.pm.api.projectlib.manage; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.enumeration.CommonEnum; @@ -23,6 +24,7 @@ import com.hz.pm.api.projectlib.model.req.ProjectIdReq; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq; import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; +import com.hz.pm.api.projectlib.model.vo.AnnualPlanProgressStatisticsVO; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.todocenter.constant.TodoCenterConst; @@ -65,6 +67,28 @@ public class AnnualPlanLibManage { private final ProjectStateMachineUtil stateMachine; private final UserInfoHelper userInfoHelper; + + public AnnualPlanProgressStatisticsVO annualProgressStatistics(ProjectListReq req) { + req.setIsStartDeclaredProject(null); + LambdaQueryWrapper query = ProjectManageUtil.initQuery(); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + if (!projectQueryPermission(query, user)) { + return null; + } + ProjectManageUtil.projectQuery(query, req); + query.select(Project::getId, Project::getAnnualPlanOpened) + .eq(Project::getNewest, Boolean.TRUE) + .and(q1 -> q1.in(Project::getStatus, ON_ANNUAL_PLAN.getCode()) + .or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and event = {0}", + ProjectStateChangeEvent.ANNUAL_PLAN_PASS))); + List projects = projectService.list(query); + AnnualPlanProgressStatisticsVO stat = new AnnualPlanProgressStatisticsVO(); + stat.setTotalCount(projects.size()); + stat.setOpenAnnualPlanCount(CollUtil.count(projects, w -> Boolean.TRUE.equals(w.getAnnualPlanOpened()))); + stat.setNotOpenAnnualPlanCount(stat.getTotalCount() - stat.getOpenAnnualPlanCount()); + return stat; + } + public PageVo annulPlanLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectManageUtil.initQuery(); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualPlanProgressStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualPlanProgressStatisticsVO.java new file mode 100644 index 0000000..19ad536 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AnnualPlanProgressStatisticsVO.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * AnnualPlanProgressStatisticsVO + *

+ * + * @author WendyYang + * @since 16:41 2024/9/4 + */ +@Data +public class AnnualPlanProgressStatisticsVO { + + @ApiModelProperty("总数量") + private Integer totalCount; + + @ApiModelProperty("已纳入总数量") + private Integer openAnnualPlanCount; + + @ApiModelProperty("未纳入总数量") + private Integer notOpenAnnualPlanCount; + +}