瀏覽代碼

修改系统替代情况返回值

tags/24080901
WendyYang 7 月之前
父節點
當前提交
c735a12b3c
共有 4 個檔案被更改,包括 39 行新增23 行删除
  1. +2
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectGovSystemReplaceInfoController.java
  2. +13
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectGovSystemReplaceInfoManage.java
  3. +24
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/SystemReplaceInfoVO.java
  4. +0
    -19
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 2
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectGovSystemReplaceInfoController.java 查看文件

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

import com.hz.pm.api.projectlib.manage.ProjectGovSystemReplaceInfoManage;
import com.hz.pm.api.projectlib.model.vo.SystemReplaceInfoVO;
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
@@ -26,7 +27,7 @@ public class ProjectGovSystemReplaceInfoController {
private final ProjectGovSystemReplaceInfoManage systemReplaceInfoManage;

@GetMapping("/all")
public List<UnitProjectGovSystemReplaceVO> all(@RequestParam(required = false) String targetSystem) {
public SystemReplaceInfoVO all(@RequestParam(required = false) String targetSystem) {
return systemReplaceInfoManage.systemReplaceInfos(targetSystem);
}



+ 13
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectGovSystemReplaceInfoManage.java 查看文件

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos;
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.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;
@@ -18,6 +19,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

/**
@@ -37,7 +39,8 @@ public class ProjectGovSystemReplaceInfoManage {
private final MhUnitCache mhUnitCache;


public List<UnitProjectGovSystemReplaceVO> systemReplaceInfos(String targetSystem) {
public SystemReplaceInfoVO systemReplaceInfos(String targetSystem) {
SystemReplaceInfoVO retDetail = new SystemReplaceInfoVO();
LambdaQueryWrapper<ProjectGovSystemReplaceInfos> pgsriQuery;
if (StrUtil.isNotBlank(targetSystem)) {
pgsriQuery = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
@@ -47,7 +50,7 @@ public class ProjectGovSystemReplaceInfoManage {
}
List<ProjectGovSystemReplaceInfos> systemReplaceInfos = systemReplaceInfosService.list(pgsriQuery);
if (systemReplaceInfos.isEmpty()) {
return Collections.emptyList();
return retDetail;
}
Map<Long, List<ProjectGovSystemReplaceInfos>> projectSystemMap = CollUtils.group(systemReplaceInfos,
ProjectGovSystemReplaceInfos::getProjectId);
@@ -56,6 +59,8 @@ public class ProjectGovSystemReplaceInfoManage {
.filter(w -> NumberUtil.isNumber(w.getBuildOrgCode()))
.collect(Collectors.groupingBy(w -> Long.parseLong(w.getBuildOrgCode())));
List<UnitProjectGovSystemReplaceVO> retList = new ArrayList<>();
AtomicInteger before = new AtomicInteger(0);
AtomicInteger after = new AtomicInteger(0);
unitProjectMap.forEach((unitId, tmpProjects) -> {
UnitDTO unit = mhUnitCache.getById(unitId);
UnitProjectGovSystemReplaceVO item = new UnitProjectGovSystemReplaceVO();
@@ -72,6 +77,8 @@ public class ProjectGovSystemReplaceInfoManage {
item.getProjectSystemReplaces().add(projectSystem);
Map<Integer, List<ProjectGovSystemReplaceInfos>> replaceInfoGroup = CollUtils.group(replaceInfos,
ProjectGovSystemReplaceInfos::getBatchNo);
before.addAndGet(CollUtils.sum(replaceInfoGroup.entrySet(), w -> w.getValue().size()));
after.addAndGet(replaceInfoGroup.size());
List<GovSystemReplaceInfoDTO> replaceInfoList = replaceInfoGroup.entrySet().stream()
.sorted(Comparator.comparingInt(Map.Entry::getKey))
.map(w -> {
@@ -89,7 +96,10 @@ public class ProjectGovSystemReplaceInfoManage {

}
});
return retList;
retDetail.setBeforeReplace(before.get());
retDetail.setAfterReplace(after.get());
retDetail.setReplaceDetail(retList);
return retDetail;
}

}

+ 24
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/SystemReplaceInfoVO.java 查看文件

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

import lombok.Data;

import java.util.List;

/**
* <p>
* SystemReplaceInfoVO
* </p>
*
* @author WendyYang
* @since 16:06 2024/3/22
*/
@Data
public class SystemReplaceInfoVO {

private Integer beforeReplace;

private Integer afterReplace;

private List<UnitProjectGovSystemReplaceVO> replaceDetail;

}

+ 0
- 19
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java 查看文件

@@ -28,7 +28,6 @@ import com.hz.pm.api.sys.manage.EarlyWarningManage;
import com.hz.pm.api.sys.manage.NoticeManage;
import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning;
import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords;
import com.hz.pm.api.sys.model.req.NoticeListReq;
import com.hz.pm.api.sys.model.vo.ProjectEarlyWarningVO;
import com.hz.pm.api.sys.service.IEarlyWarningRecordsService;
import com.hz.pm.api.sys.service.IProjectEarlyWarningService;
@@ -129,24 +128,6 @@ public class WorkbenchManage {
CompletableFuture.runAsync(() -> {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//3.所有公告按类型分
NoticeListReq noticeListReq = new NoticeListReq();
noticeListReq.page(1, 20);
res.setNoticeList(noticeManage.listToMapByManager(noticeListReq, user));
stopWatch.stop();
log.info("公告 耗时,{} s", stopWatch.getTotalTimeSeconds());
}, ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> {
StopWatch stopWatch = new StopWatch();
stopWatch.start();

//4.项目预警记录
res.setProjectEarlyWarning(getProjectEarlyWarning(user));
log.info("项目预警记录 耗时,{} s", stopWatch.getTotalTimeSeconds());
}, ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// 项目列表
ProjectListReq projectListReq = new ProjectListReq();
projectListReq.page(1, 20);


Loading…
取消
儲存