Browse Source

modify:

1. 增加阶段跳转改造情况列表;
tags/24082601^0
WendyYang 4 months ago
parent
commit
08e2d0278a
4 changed files with 157 additions and 23 deletions
  1. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/GovSystemReplaceInfoDTO.java
  2. +18
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java
  3. +7
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java
  4. +126
    -19
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/GovSystemReplaceInfoDTO.java View File

@@ -21,6 +21,12 @@ public class GovSystemReplaceInfoDTO implements Serializable {

private static final long serialVersionUID = -1054216204216816787L;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报单位")
private String buildOrgName;

@ApiModelProperty("替代前系统名称")
private List<String> sourceSystemNames;



+ 18
- 4
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java View File

@@ -2,6 +2,7 @@ package com.hz.pm.api.user.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -94,11 +95,24 @@ public class MhUnitManage {
List<MhUnitTreeDTO> nodes = allUnits.stream()
.filter(w -> MhUnitTypeEnum.SASAC.equals(w.getType()) ||
((MhUnitTypeEnum.REGION.equals(w.getType()) || MhUnitTypeEnum.NODE.equals(w.getType()))
&& (w.getName().endsWith("信创办") || "市级部门".equals(w.getName()) || "杭州市".equals(w.getName()))))
.map(w -> BeanUtil.copyProperties(w, MhUnitTreeDTO.class))
.collect(Collectors.toList());
&& (w.getName().endsWith("信创办")
|| "市级部门".equals(w.getName())
|| "杭州市".equals(w.getName())
|| "区县部门".equals(w.getName()))))
.map(w -> {
MhUnitTreeDTO unit = BeanUtil.copyProperties(w, MhUnitTreeDTO.class);
if ("区县部门".equals(w.getName())) {
UnitDTO parent = mhUnitCache.getById(unit.getParentId());
if (parent != null) {
String parentName = StrUtil.blankToDefault(parent.getShortName(), parent.getName());
String unitName = StrUtil.blankToDefault(unit.getShortName(), unit.getName());
unit.setShortName(parentName + unitName);
}
}
return unit;
}).collect(Collectors.toList());
Function<MhUnitTreeDTO, Integer> function = w -> w.getType().getStrip().getCode();
nodes.sort(Comparator.comparing(MhUnitTreeDTO::getName)
nodes.sort(Comparator.comparing(MhUnitTreeDTO::getShortName)
.thenComparing(function, Comparator.reverseOrder()));
return nodes;
}


+ 7
- 0
hz-pm-api/src/main/java/com/hz/pm/api/workbench/controller/WorkbenchController.java View File

@@ -1,6 +1,7 @@
package com.hz.pm.api.workbench.controller;

import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.SystemReplaceInfoVO;
import com.hz.pm.api.workbench.manage.WorkbenchManage;
import com.hz.pm.api.workbench.model.WorkbenchProjectLibReq;
import com.hz.pm.api.workbench.model.WorkbenchReq;
@@ -70,4 +71,10 @@ public class WorkbenchController {
return workbenchManage.pageProjectLib(req);
}

@GetMapping("/systemReplaceInfos")
@ApiOperation("获取项目替代情况")
public SystemReplaceInfoVO systemReplaceInfos(WorkbenchProjectLibReq req ) {
return workbenchManage.listSystemReplaceInfos(req);
}

}

+ 126
- 19
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -23,12 +23,15 @@ import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.manage.ProjectLibManage;
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
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.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.SystemReplaceInfoVO;
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO;
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO.ProjectGovSystemReplaceVO;
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
@@ -68,6 +71,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -188,7 +192,7 @@ public class WorkbenchManage {
initWorkbenchDefaultParam(req);
LambdaQueryWrapper<Project> projectQuery = Wrappers.lambdaQuery(Project.class)
.select(Project::getReviewAmount, Project::getApprovalAmount, Project::getId,
Project::getApprovalGovOwnFinanceAmount,Project::getApprovalGovSuperiorFinanceAmount)
Project::getApprovalGovOwnFinanceAmount, Project::getApprovalGovSuperiorFinanceAmount)
.eq(Project::getProjectYear, req.getProjectYear())
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
.eq(Project::getNewest, Boolean.TRUE);
@@ -520,23 +524,7 @@ public class WorkbenchManage {
}

public PageVo<ProjectLibListItemVO> pageProjectLib(WorkbenchProjectLibReq req) {
Assert.notNull(req.getProcessNode(), "节点不能为空");
Long unitId = Optional.ofNullable(req.getUnitId()).orElseGet(LoginUserUtil::getMhUnitId);
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(unitId);
LambdaQueryWrapper<Project> 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))
// 评审金额
.ge(req.getReviewAmountMin() != null, Project::getReviewAmount, req.getReviewAmountMin())
.le(req.getReviewAmountMax() != null, Project::getReviewAmount, req.getReviewAmountMax())
// 下达金额
.ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin())
.le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax())
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
.eq(Project::getNewest, Boolean.TRUE)
.orderByDesc(Project::getUpdateOn);
LambdaQueryWrapper<Project> query = workbenchProjectLibQuery(req);
ProjectManageUtil.projectBaseQuery(query);
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT);
switch (req.getProcessNode()) {
@@ -590,4 +578,123 @@ public class WorkbenchManage {
return PageVo.of(records, page.getTotal());
}

public SystemReplaceInfoVO listSystemReplaceInfos(WorkbenchProjectLibReq req) {
LambdaQueryWrapper<Project> query = workbenchProjectLibQuery(req)
.select(Project::getProjectCode, Project::getProjectName,
Project::getBuildOrgCode, Project::getBuildOrgName);
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT);
switch (req.getProcessNode()) {
case PROJECT_DECLARED:
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_SUBMIT);
break;
case PROJECT_PURCHASE:
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD);
break;
case FIRST_INSPECTED:
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES);
break;
case PROJECT_ADAPTION:
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM);
break;
case FINAL_INSPECTED:
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS);
break;
default:
return null;
}
List<Project> projects = projectService.list(query);
return buildSystemReplaceInfos(projects);
}

private LambdaQueryWrapper<Project> workbenchProjectLibQuery(WorkbenchProjectLibReq req) {
Assert.notNull(req.getProcessNode(), "节点不能为空");
Long unitId = Optional.ofNullable(req.getUnitId()).orElseGet(LoginUserUtil::getMhUnitId);
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(unitId);
return 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))
.ge(req.getReviewAmountMin() != null, Project::getReviewAmount, req.getReviewAmountMin())
.le(req.getReviewAmountMax() != null, Project::getReviewAmount, req.getReviewAmountMax())
.ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin())
.le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax())
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
.eq(Project::getNewest, Boolean.TRUE)
.orderByDesc(Project::getUpdateOn);
}

private SystemReplaceInfoVO buildSystemReplaceInfos(List<Project> projects) {
if (projects.isEmpty()) {
return null;
}
List<String> projectCodes = CollUtils.fieldList(projects, Project::getProjectCode);
Wrapper<ProjectGovSystemReplaceInfos> query = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
.in(ProjectGovSystemReplaceInfos::getProjectCode, projectCodes);
List<ProjectGovSystemReplaceInfos> systemReplaceInfos = systemReplaceInfosService.list(query);
if (systemReplaceInfos.isEmpty()) {
return null;
}
SystemReplaceInfoVO retDetail = new SystemReplaceInfoVO();
Map<String, List<ProjectGovSystemReplaceInfos>> projectSystemMap = CollUtils.group(systemReplaceInfos,
ProjectGovSystemReplaceInfos::getProjectCode);
Map<String, List<Project>> unitProjectMap = CollUtils.group(projects, Project::getBuildOrgCode);
List<UnitProjectGovSystemReplaceVO> retList = new ArrayList<>();
AtomicInteger sourceCount = new AtomicInteger(0);
AtomicInteger targetCount = new AtomicInteger(0);
for (Map.Entry<String, List<Project>> entry : unitProjectMap.entrySet()) {
List<Project> tmpProjects = entry.getValue();
List<ProjectGovSystemReplaceVO> currOrgReplaceInfos = new ArrayList<>();
for (Project proj : tmpProjects) {
List<ProjectGovSystemReplaceInfos> replaceInfos = projectSystemMap.get(proj.getProjectCode());
if (replaceInfos != null) {
ProjectGovSystemReplaceVO projectSystem = new ProjectGovSystemReplaceVO();
projectSystem.setProjectName(proj.getProjectName());
currOrgReplaceInfos.add(projectSystem);
Map<Integer, List<ProjectGovSystemReplaceInfos>> replaceInfoGroup = CollUtils.group(replaceInfos,
ProjectGovSystemReplaceInfos::getBatchNo);
List<GovSystemReplaceInfoDTO> replaceInfoList = replaceInfoGroup.entrySet().stream()
.sorted(Comparator.comparingInt(Map.Entry::getKey))
.map(w -> {
List<ProjectGovSystemReplaceInfos> currBatchValues = w.getValue();
ProjectGovSystemReplaceInfos firstReplaceInfo = currBatchValues.get(0);
GovSystemReplaceInfoDTO replaceInfo = new GovSystemReplaceInfoDTO();
replaceInfo.setReplaceType(firstReplaceInfo.getReplaceType());
replaceInfo.setTargetSystemName(firstReplaceInfo.getTargetSystem());
List<String> sourceSystemNames = CollUtils.fieldList(currBatchValues, val -> {
String sourceSystem = val.getSourceSystem();
if (isValidSystem.test(sourceSystem)) {
sourceCount.incrementAndGet();
}
return sourceSystem;
});
replaceInfo.setSourceSystemNames(sourceSystemNames);
if (isValidSystem.test(replaceInfo.getTargetSystemName())) {
targetCount.incrementAndGet();
}
return replaceInfo;
}).collect(Collectors.toList());
projectSystem.setReplaceSystems(replaceInfoList);
}
}
if (!currOrgReplaceInfos.isEmpty()) {
UnitProjectGovSystemReplaceVO item = new UnitProjectGovSystemReplaceVO();
item.setUnitName(tmpProjects.get(0).getBuildOrgName());
item.setProjectSystemReplaces(currOrgReplaceInfos);
retList.add(item);
}
}
retDetail.setBeforeReplace(sourceCount.get());
retDetail.setAfterReplace(targetCount.get());
retDetail.setReplaceDetail(retList);
return retDetail;
}
}

Loading…
Cancel
Save