|
|
@@ -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<Project> 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<Project> 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<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery(); |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|