|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.hz.pm.api.open.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
@@ -7,12 +8,13 @@ import com.hz.pm.api.common.model.constant.ExistsSqlConst; |
|
|
|
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; |
|
|
|
import com.hz.pm.api.common.util.BizDateUtil; |
|
|
|
import com.hz.pm.api.open.model.po.MhSyncProjectListPO; |
|
|
|
import com.hz.pm.api.open.model.vo.ReferSystemReplaceInfoToMhVO; |
|
|
|
import com.hz.pm.api.open.model.vo.DeclaredProjectInfoToMhVO; |
|
|
|
import com.hz.pm.api.open.model.vo.ReferSystemReplaceInfoToMhVO; |
|
|
|
import com.hz.pm.api.open.util.OpenApiCheckSignUtil; |
|
|
|
import com.hz.pm.api.projectlib.entity.MhSystemReplaceInfo; |
|
|
|
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.Project; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; |
|
|
|
import com.hz.pm.api.projectlib.service.IMhSystemReplaceInfoService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectService; |
|
|
@@ -23,6 +25,7 @@ import org.springframework.stereotype.Component; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -69,9 +72,10 @@ public class OpenApiProjectLibManage { |
|
|
|
} |
|
|
|
List<String> projectCodes = CollUtils.fieldList(projects, Project::getProjectCode); |
|
|
|
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.listByProjectCodes(projectCodes); |
|
|
|
replaceInfos.removeIf(w -> StrUtil.isBlank(w.getSourceSystemId())); |
|
|
|
Map<String, List<ProjectGovSystemReplaceInfos>> originReplaceInfoMap; |
|
|
|
Map<String, List<MhSystemReplaceInfo>> replaceInfoMap; |
|
|
|
if (!replaceInfos.isEmpty()) { |
|
|
|
originReplaceInfoMap = CollUtils.group(replaceInfos, ProjectGovSystemReplaceInfos::getProjectCode); |
|
|
|
List<String> sourceSystemIds = CollUtils.fieldList(replaceInfos, ProjectGovSystemReplaceInfos::getSourceSystemId); |
|
|
|
List<MhSystemReplaceInfo> mhSystemReplaceInfos = mhSystemReplaceInfoService.listByIds(sourceSystemIds); |
|
|
|
Map<String, MhSystemReplaceInfo> mhReplaceInfoMap = CollUtils.listToMap(mhSystemReplaceInfos, MhSystemReplaceInfo::getId); |
|
|
@@ -80,6 +84,7 @@ public class OpenApiProjectLibManage { |
|
|
|
.collect(Collectors.groupingBy(ProjectGovSystemReplaceInfos::getProjectCode, |
|
|
|
Collectors.mapping(w -> mhReplaceInfoMap.get(w.getSourceSystemId()), Collectors.toList()))); |
|
|
|
} else { |
|
|
|
originReplaceInfoMap = Collections.emptyMap(); |
|
|
|
replaceInfoMap = Collections.emptyMap(); |
|
|
|
} |
|
|
|
|
|
|
@@ -95,9 +100,9 @@ public class OpenApiProjectLibManage { |
|
|
|
item.setBuildOrgName(w.getBuildOrgName()); |
|
|
|
item.setDeclareAmount(w.getDeclareAmount()); |
|
|
|
item.setReviewAmount(w.getReviewAmount()); |
|
|
|
List<MhSystemReplaceInfo> replaceInfoList = replaceInfoMap.get(w.getProjectCode()); |
|
|
|
if (replaceInfoList != null) { |
|
|
|
List<ReferSystemReplaceInfoToMhVO> referSystemList = CollUtils.convert(replaceInfoList, |
|
|
|
if (replaceInfoMap.containsKey(w.getProjectCode())) { |
|
|
|
List<MhSystemReplaceInfo> currReplaceInfos = replaceInfoMap.get(w.getProjectCode()); |
|
|
|
List<ReferSystemReplaceInfoToMhVO> referSystemList = CollUtils.convert(currReplaceInfos, |
|
|
|
t -> ReferSystemReplaceInfoToMhVO.builder() |
|
|
|
.id(t.getId()) |
|
|
|
.buildOrgCode(t.getBuildOrgCode()) |
|
|
@@ -107,6 +112,18 @@ public class OpenApiProjectLibManage { |
|
|
|
.alternativeType(t.getReplaceType()) |
|
|
|
.build()); |
|
|
|
item.setReferSystemList(referSystemList); |
|
|
|
} else if (originReplaceInfoMap.containsKey(w.getProjectCode())) { |
|
|
|
List<ProjectGovSystemReplaceInfos> currReplaceInfos = originReplaceInfoMap.get(w.getProjectCode()); |
|
|
|
List<ReferSystemReplaceInfoToMhVO> referSystemList = CollUtils.convert(currReplaceInfos, |
|
|
|
t -> ReferSystemReplaceInfoToMhVO.builder() |
|
|
|
.id(t.getSourceSystemId()) |
|
|
|
.buildOrgCode(Integer.valueOf(w.getBuildOrgCode())) |
|
|
|
.buildOrgName(w.getBuildOrgName()) |
|
|
|
.systemName(t.getSourceSystem()) |
|
|
|
.alternativeName(t.getTargetSystem()) |
|
|
|
.alternativeType(getReplaceType(t)) |
|
|
|
.build()); |
|
|
|
item.setReferSystemList(referSystemList); |
|
|
|
} else { |
|
|
|
item.setReferSystemList(Collections.emptyList()); |
|
|
|
} |
|
|
@@ -114,4 +131,18 @@ public class OpenApiProjectLibManage { |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
private static String getReplaceType(ProjectGovSystemReplaceInfos t) { |
|
|
|
String replaceType = StrUtil.EMPTY; |
|
|
|
if (NumberUtil.isNumber(t.getReplaceType())) { |
|
|
|
Optional<GovSystemReplaceTypeEnum> optReplaceType = GovSystemReplaceTypeEnum.get(Integer.valueOf(t.getReplaceType())); |
|
|
|
if (optReplaceType.isPresent()) { |
|
|
|
GovSystemReplaceTypeEnum replaceTypeEnum = optReplaceType.get(); |
|
|
|
replaceType = Optional.ofNullable(replaceTypeEnum.getMhReplaceType()) |
|
|
|
.flatMap(mhReplaceType -> Optional.of(mhReplaceType.getCode())) |
|
|
|
.orElse(replaceTypeEnum.getVal()); |
|
|
|
} |
|
|
|
} |
|
|
|
return replaceType; |
|
|
|
} |
|
|
|
|
|
|
|
} |