diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java index dbb9b74..19a8557 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiProjectLibManage.java @@ -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 projectCodes = CollUtils.fieldList(projects, Project::getProjectCode); List replaceInfos = systemReplaceInfosService.listByProjectCodes(projectCodes); - replaceInfos.removeIf(w -> StrUtil.isBlank(w.getSourceSystemId())); + Map> originReplaceInfoMap; Map> replaceInfoMap; if (!replaceInfos.isEmpty()) { + originReplaceInfoMap = CollUtils.group(replaceInfos, ProjectGovSystemReplaceInfos::getProjectCode); List sourceSystemIds = CollUtils.fieldList(replaceInfos, ProjectGovSystemReplaceInfos::getSourceSystemId); List mhSystemReplaceInfos = mhSystemReplaceInfoService.listByIds(sourceSystemIds); Map 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 replaceInfoList = replaceInfoMap.get(w.getProjectCode()); - if (replaceInfoList != null) { - List referSystemList = CollUtils.convert(replaceInfoList, + if (replaceInfoMap.containsKey(w.getProjectCode())) { + List currReplaceInfos = replaceInfoMap.get(w.getProjectCode()); + List 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 currReplaceInfos = originReplaceInfoMap.get(w.getProjectCode()); + List 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 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; + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java index 31cbce2..1b62b8e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java @@ -96,7 +96,7 @@ public class ProjectReviewManage { throw BizException.wrap("该项目不允许申请项目评审"); } - UserInfoDetails user = LoginUserUtil.userDetail(); + UserInfoDetails user = LoginUserUtil.userDetailNotNull(); WflowModels model = processModelManage.getWflowModelsNoNull(ProjectProcessType.PROJECT_REVIEW, user.getMhUnitId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java index 3628acc..2118cf9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java @@ -9,7 +9,6 @@ import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotNull; -import java.io.Serializable; import java.util.Map; /** @@ -28,13 +27,13 @@ public class DefaultDeclaredDTO { private ProjectDTO projectInfo; @ApiModelProperty("表单信息 新增模块") - private Map formData; + private Map formData; @ApiModelProperty("是否是重新提交 默认false") private Boolean restart = Boolean.FALSE; - public Map getFormData(){ - if(CollUtil.isEmpty(this.formData)){ + public Map getFormData() { + if (CollUtil.isEmpty(this.formData)) { this.formData = Maps.newHashMap(); return this.formData; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 5d1240e..e787c7a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -5,13 +5,13 @@ import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.github.xiaoymin.knife4j.core.util.StrUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.hz.pm.api.common.compare.CompareUtils; @@ -703,8 +703,14 @@ public class ProjectLibManage { GovSystemReplaceInfoDTO replaceInfo = new GovSystemReplaceInfoDTO(); replaceInfo.setReplaceType(firstReplaceInfo.getReplaceType()); replaceInfo.setTargetSystemName(firstReplaceInfo.getTargetSystem()); - List sourceSystemNames = CollUtils.fieldList(currBatchValues, ProjectGovSystemReplaceInfos::getSourceSystem); + List sourceSystemNames = new ArrayList<>(); + List sourceSystemIds = new ArrayList<>(); + for (ProjectGovSystemReplaceInfos replaceInfos : currBatchValues) { + sourceSystemIds.add(StrUtil.nullToEmpty(replaceInfos.getSourceSystemId())); + sourceSystemNames.add(replaceInfos.getSourceSystem()); + } replaceInfo.setSourceSystemNames(sourceSystemNames); + replaceInfo.setSourceSystemIds(sourceSystemIds); Optional.ofNullable(upgradeContentMap.get(w.getKey())).ifPresent(uc -> { replaceInfo.setIterativeUpgradeContent(uc.getIterativeUpgradeContent()); replaceInfo.setIsAddIterativeUpgradeContent(uc.getIsAddIterativeUpgradeContent());