diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java
index 4b10aa5..1875d92 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java
@@ -4,6 +4,7 @@ import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.hz.pm.api.projectlib.manage.DeclaredRecordManage;
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq;
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO;
+import com.hz.pm.api.projectlib.model.vo.DeclaredRecordProgressStatVO;
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
@@ -39,6 +40,13 @@ public class MhProjectController {
return declaredRecordManage.pageDeclaredProject(req);
}
+ @ApiOperation("立项备案列表数量统计")
+ @GetMapping("/declaredRecordProgressStatistics")
+ @WebLog("立项备案列表")
+ public DeclaredRecordProgressStatVO declaredRecordProgressStatistics(DeclaredProjectListReq req) {
+ return declaredRecordManage.declaredRecordProgressStatistics(req);
+ }
+
@ApiOperation("信产项目基本信息")
@GetMapping("/baseInfo/{mhProjectId}")
@WebLog("信产项目基本信息")
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 9a2ee34..14c3322 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
@@ -98,7 +98,7 @@ public class ProjectManageUtil {
query.select(Project::getId, Project::getStage, Project::getStatus, Project::getProjectCode,
Project::getBuildOrgCode, Project::getBuildOrgName, Project::getApprovalAmount,
Project::getCreateOn, Project::getProjectName, Project::getProjectYear,
- Project::getDeclareAmount, Project::getReviewAmount);
+ Project::getDeclareAmount, Project::getReviewAmount, Project::getUnitStrip);
}
/**
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
index 58af2ac..3e8b1de 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
@@ -13,7 +13,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.TypeReferenceConst;
+import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
+import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.datascope.model.DataScopeDTO;
import com.hz.pm.api.datascope.utils.DataScopeUtil;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
@@ -26,6 +29,7 @@ import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO;
import com.hz.pm.api.projectdeclared.service.IProjectDraftService;
import com.hz.pm.api.projectdeclared.utils.ProjectCodeGenUtil;
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos;
+import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.model.dto.ImportProjectFinanceInfosDTO;
import com.hz.pm.api.projectlib.model.dto.ImportReplaceSystemInfosDTO;
import com.hz.pm.api.projectlib.model.dto.ProjectDTO;
@@ -36,11 +40,9 @@ import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq;
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO;
+import com.hz.pm.api.projectlib.model.vo.DeclaredRecordProgressStatVO;
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO;
-import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService;
-import com.hz.pm.api.projectlib.service.IMhProjectService;
-import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService;
-import com.hz.pm.api.projectlib.service.IProjectService;
+import com.hz.pm.api.projectlib.service.*;
import com.hz.pm.api.staging.enums.MsgTypeEnum;
import com.hz.pm.api.sys.manage.NoticeManage;
import com.hz.pm.api.sys.manage.ProcessModelManage;
@@ -74,6 +76,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
+import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.DECLARED_RECORD_PASS;
+
/**
*
* MhProjectManage
@@ -103,20 +107,6 @@ public class DeclaredRecordManage {
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService;
private final MHTodoClient mhTodoClient;
- private LambdaQueryWrapper buildQuery(DeclaredProjectListReq req) {
- LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class)
- .like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName())
- .like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit())
- .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip());
- if (req.getCreateDateMin() != null) {
- query.ge(Project::getCreateOn, req.getCreateDateMin());
- }
- if (req.getCreateDateMax() != null) {
- query.lt(Project::getCreateOn, req.getCreateDateMax().minusDays(1));
- }
- return query;
- }
-
private boolean buildProjectLibPermission(LambdaQueryWrapper query, UserFullInfoDTO user, Long declaredUnitId) {
boolean queryState = true;
Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user);
@@ -162,18 +152,79 @@ public class DeclaredRecordManage {
return queryState;
}
- public PageVo pageDeclaredProject(DeclaredProjectListReq req) {
- LambdaQueryWrapper query = buildQuery(req);
+
+ public DeclaredRecordProgressStatVO declaredRecordProgressStatistics(DeclaredProjectListReq req) {
+ req.setStatus(null);
+ LambdaQueryWrapper query = buildDeclaredRecordQuery(req);
+ if (query == null) {
+ return null;
+ }
+ query.select(Project::getStatus, Project::getProjectCode);
+ List projects = projectService.list(query);
+ Map countMap = CollUtils.groupCount(projects,
+ w -> getDeclaredRecordStatus(w.getStatus()));
+ DeclaredRecordProgressStatVO stat = new DeclaredRecordProgressStatVO();
+ stat.setTodoCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD, 0L));
+ stat.setAuditingCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING, 0L));
+ stat.setPassedCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_RECORD_PASSED, 0L));
+ stat.setFailedCount(countMap.getOrDefault(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED, 0L));
+ stat.setTotalCount((long) projects.size());
+ return stat;
+ }
+
+ private ProjectStatus getDeclaredRecordStatus(Integer statusCode) {
+ ProjectStatus status = ProjectStatus.getNoNull(statusCode);
+ switch (status) {
+ case DECLARED_APPROVED_TO_BE_RECORD:
+ case DECLARED_APPROVED_RECORD_AUDITING:
+ case DECLARED_APPROVED_RECORD_FAILED:
+ return status;
+ default:
+ return ProjectStatus.DECLARED_APPROVED_RECORD_PASSED;
+ }
+ }
+
+ private LambdaQueryWrapper buildDeclaredRecordQuery(DeclaredProjectListReq req) {
+ LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class)
+ .like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName())
+ .like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit())
+ .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
+ .ge(req.getCreateDateMin() != null, Project::getCreateOn, req.getCreateDateMin())
+ .eq(Project::getNewest, Boolean.TRUE)
+ .orderByDesc(Project::getUpdateOn);
+ BizUtils.notNull(req.getCreateDateMax(), w -> query.lt(Project::getCreateOn, w.plusDays(1)));
+ if (req.getStatus() == null) {
+ query.and(q1 -> q1.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(),
+ ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(),
+ ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode())
+ .or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE
+ + " and npsc.event = {0}", DECLARED_RECORD_PASS)));
+ } else if (ProjectStatus.DECLARED_APPROVED_RECORD_PASSED.eq(req.getStatus())) {
+ query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE
+ + " and npsc.event = {0}", DECLARED_RECORD_PASS);
+ } else if (ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.eq(req.getStatus())) {
+ query.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode());
+ } else if (ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.eq(req.getStatus())) {
+ query.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode());
+ } else if (ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.eq(req.getStatus())) {
+ query.eq(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode());
+ } else {
+ return null;
+ }
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
// 查询审核中、失败、待立项备案的项目信息
if (!buildProjectLibPermission(query, user, req.getDeclaredUnitId())) {
+ return null;
+ }
+ return query;
+ }
+
+ public PageVo pageDeclaredProject(DeclaredProjectListReq req) {
+ LambdaQueryWrapper query = buildDeclaredRecordQuery(req);
+ if (query == null) {
return PageVo.empty();
}
- query.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(),
- ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(),
- ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode())
- .eq(Project::getNewest, Boolean.TRUE)
- .orderByDesc(Project::getUpdateOn);
+ ProjectManageUtil.projectBaseQuery(query);
Page page = projectService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
@@ -187,8 +238,6 @@ public class DeclaredRecordManage {
if (mhProj != null) {
item.setMhProjectId(mhProj.getId());
}
- item.setStatus(w.getStatus());
- item.setStage(w.getStage());
item.setProjectId(w.getId());
item.setUnitStrip(w.getUnitStrip());
item.setUnitStripName(MhUnitStripEnum.getVal(w.getUnitStrip()));
@@ -199,6 +248,9 @@ public class DeclaredRecordManage {
item.setReviewAmount(w.getReviewAmount());
item.setApprovedAmount(w.getApprovalAmount());
item.setCreateTime(w.getCreateOn());
+ ProjectStatus projectStatus = getDeclaredRecordStatus(w.getStatus());
+ item.setStatus(projectStatus.getCode());
+ item.setStage(projectStatus.getStageCode());
return item;
}).collect(Collectors.toList());
return PageVo.of(data, page.getTotal());
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 9f4381d..0b178dc 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
@@ -47,6 +47,7 @@ public enum ProjectStatus implements IStatus {
DECLARED_APPROVED_TO_BE_RECORD(10022, "待立项备案"),
DECLARED_APPROVED_RECORD_AUDITING(10023, "立项备案审核中"),
DECLARED_APPROVED_RECORD_FAILED(10024, "立项备案审核不通过"),
+ DECLARED_APPROVED_RECORD_PASSED(10025, "立项备案审核通过"),
/**
* 项目阶段:已立项
@@ -96,6 +97,10 @@ public enum ProjectStatus implements IStatus {
return getNoNull(stageCode);
}
+ public Integer getStageCode() {
+ return getStage().getCode();
+ }
+
public static String getDesc(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java
index 46d4a59..affe124 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java
@@ -37,4 +37,7 @@ public class DeclaredProjectListReq extends PagePo {
@ApiModelProperty("申报单位ID")
private Long declaredUnitId;
+ @ApiModelProperty("项目状态")
+ private Integer status;
+
}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredRecordProgressStatVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredRecordProgressStatVO.java
new file mode 100644
index 0000000..574a112
--- /dev/null
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredRecordProgressStatVO.java
@@ -0,0 +1,32 @@
+package com.hz.pm.api.projectlib.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *
+ * DeclaredRecordProgressStatVO
+ *
+ *
+ * @author WendyYang
+ * @since 17:14 2024/8/26
+ */
+@Data
+public class DeclaredRecordProgressStatVO {
+
+ @ApiModelProperty("总记录数")
+ private Long totalCount;
+
+ @ApiModelProperty("待立项备案数")
+ private Long todoCount;
+
+ @ApiModelProperty("立项备案通过数")
+ private Long passedCount;
+
+ @ApiModelProperty("立项备案不通过数")
+ private Long failedCount;
+
+ @ApiModelProperty("立项备案审核中数")
+ private Long auditingCount;
+
+}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java
index 89d867c..a2b7dc2 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java
@@ -8,9 +8,11 @@ import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
+import com.ningdatech.basic.util.CollUtils;
import java.util.Collection;
import java.util.Comparator;
+import java.util.List;
import java.util.Map;
/**
@@ -50,6 +52,14 @@ public interface IProjectStatusChangeService extends IService projectCodesExistsEvent(Collection projectCodes, ProjectStateChangeEvent event) {
+ Wrapper pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
+ .select(ProjectStatusChange::getProjectCode, ProjectStatusChange::getId)
+ .in(ProjectStatusChange::getProjectCode, projectCodes)
+ .eq(ProjectStatusChange::getEvent, event);
+ return CollUtils.fieldList(list(pscQuery), ProjectStatusChange::getProjectCode);
+ }
+
default ProjectStatusChange getLastOne(String projectCode, Collection events) {
LambdaQueryWrapper pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getProjectCode, projectCode)