Browse Source

modify:

1. 立项备案统计修改;
tags/24082801
WendyYang 4 months ago
parent
commit
f02f30d768
7 changed files with 138 additions and 28 deletions
  1. +8
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java
  2. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java
  3. +79
    -27
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  4. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
  5. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java
  6. +32
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredRecordProgressStatVO.java
  7. +10
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java

+ 8
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java View File

@@ -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("信产项目基本信息")


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java View File

@@ -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);
}

/**


+ 79
- 27
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java View File

@@ -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;

/**
* <p>
* MhProjectManage
@@ -103,20 +107,6 @@ public class DeclaredRecordManage {
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService;
private final MHTodoClient mhTodoClient;

private LambdaQueryWrapper<Project> buildQuery(DeclaredProjectListReq req) {
LambdaQueryWrapper<Project> 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<Project> query, UserFullInfoDTO user, Long declaredUnitId) {
boolean queryState = true;
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user);
@@ -162,18 +152,79 @@ public class DeclaredRecordManage {
return queryState;
}

public PageVo<DeclaredProjectListVO> pageDeclaredProject(DeclaredProjectListReq req) {
LambdaQueryWrapper<Project> query = buildQuery(req);

public DeclaredRecordProgressStatVO declaredRecordProgressStatistics(DeclaredProjectListReq req) {
req.setStatus(null);
LambdaQueryWrapper<Project> query = buildDeclaredRecordQuery(req);
if (query == null) {
return null;
}
query.select(Project::getStatus, Project::getProjectCode);
List<Project> projects = projectService.list(query);
Map<ProjectStatus, Long> 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<Project> buildDeclaredRecordQuery(DeclaredProjectListReq req) {
LambdaQueryWrapper<Project> 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<DeclaredProjectListVO> pageDeclaredProject(DeclaredProjectListReq req) {
LambdaQueryWrapper<Project> 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<Project> 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());


+ 5
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java View File

@@ -47,6 +47,7 @@ public enum ProjectStatus implements IStatus<Integer, String> {
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<Integer, String> {
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);
}


+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java View File

@@ -37,4 +37,7 @@ public class DeclaredProjectListReq extends PagePo {
@ApiModelProperty("申报单位ID")
private Long declaredUnitId;

@ApiModelProperty("项目状态")
private Integer status;

}

+ 32
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredRecordProgressStatVO.java View File

@@ -0,0 +1,32 @@
package com.hz.pm.api.projectlib.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* DeclaredRecordProgressStatVO
* </p>
*
* @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;

}

+ 10
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java View File

@@ -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<ProjectStatusChang
return getOne(pscQuery);
}

default List<String> projectCodesExistsEvent(Collection<String> projectCodes, ProjectStateChangeEvent event) {
Wrapper<ProjectStatusChange> 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<ProjectStateChangeEvent> events) {
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getProjectCode, projectCode)


Loading…
Cancel
Save