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