From 707b7d383629569defbead8c0dfdedd65eda9cc9 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 18 Jul 2025 19:21:26 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=9B=86=E6=88=90?= =?UTF-8?q?=E5=8F=91=E5=B8=83-=E6=9F=A5=E8=AF=A2=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E9=85=8D=E7=BD=AE=E7=9A=84=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=A8=A1=E5=9D=97=E7=8E=AF=E5=A2=83=E6=A0=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1466730218487808]集成发布-查询发布应用配置的应用系统模块环境树优化 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1466730218487808 --- ...ployAppConfigAppSystemAppModuleEnvApi.java | 94 +++++++++++-------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/src/main/java/neatlogic/module/deploy/api/appconfig/system/TreeDeployAppConfigAppSystemAppModuleEnvApi.java b/src/main/java/neatlogic/module/deploy/api/appconfig/system/TreeDeployAppConfigAppSystemAppModuleEnvApi.java index 37801216..6cdd655b 100644 --- a/src/main/java/neatlogic/module/deploy/api/appconfig/system/TreeDeployAppConfigAppSystemAppModuleEnvApi.java +++ b/src/main/java/neatlogic/module/deploy/api/appconfig/system/TreeDeployAppConfigAppSystemAppModuleEnvApi.java @@ -15,6 +15,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; @Service @AuthAction(action = DEPLOY_BASE.class) @@ -77,17 +78,18 @@ public class TreeDeployAppConfigAppSystemAppModuleEnvApi extends PrivateApiCompo deployAppModuleVo.setEnvList(envList); } List deployAppConfigList = deployAppConfigMapper.getAppConfigListByAppSystemId(appSystemId); - for (DeployAppModuleVo deployAppModuleVo : deployAppModuleList) { - DeployPipelineConfigVo pipelineConfigVo = getDeployPipelineConfigVo(deployAppConfigList, appSystemId, deployAppModuleVo.getId(), 0L); - if (pipelineConfigVo != null) { - JSONObject resultObj = parsePipeline(pipelineConfigVo); - deployAppModuleVo.setIsActive(resultObj.getInteger("isActive")); - deployAppModuleVo.setOverride(resultObj.getInteger("override")); - } - for (DeployAppEnvironmentVo env : deployAppModuleVo.getEnvList()) { - pipelineConfigVo = getDeployPipelineConfigVo(deployAppConfigList, appSystemId, deployAppModuleVo.getId(), env.getId()); - if (pipelineConfigVo != null) { - JSONObject resultObj = parsePipeline(pipelineConfigVo); + DeployPipelineConfigVo appPipelineConfigVo = getDeployPipelineConfigVo(deployAppConfigList, appSystemId, 0L, 0L); + if (appPipelineConfigVo != null) { + for (DeployAppModuleVo deployAppModuleVo : deployAppModuleList) { + { + DeployPipelineConfigVo pipelineConfigVo = getDeployPipelineConfigVo(deployAppConfigList, appSystemId, deployAppModuleVo.getId(), 0L); + JSONObject resultObj = parsePipeline(appPipelineConfigVo, pipelineConfigVo); + deployAppModuleVo.setIsActive(resultObj.getInteger("isActive")); + deployAppModuleVo.setOverride(resultObj.getInteger("override")); + } + for (DeployAppEnvironmentVo env : deployAppModuleVo.getEnvList()) { + DeployPipelineConfigVo pipelineConfigVo = getDeployPipelineConfigVo(deployAppConfigList, appSystemId, deployAppModuleVo.getId(), env.getId()); + JSONObject resultObj = parsePipeline(appPipelineConfigVo, pipelineConfigVo); env.setIsActive(resultObj.getInteger("isActive")); env.setOverride(resultObj.getInteger("override")); } @@ -131,22 +133,38 @@ public class TreeDeployAppConfigAppSystemAppModuleEnvApi extends PrivateApiCompo // return resultObj; // } - private JSONObject parsePipeline(DeployPipelineConfigVo deployPipelineConfigVo) { + private JSONObject parsePipeline(DeployPipelineConfigVo appPipelineConfigVo, DeployPipelineConfigVo deployPipelineConfigVo) { JSONObject resultObj = new JSONObject(); - Integer override = 0; - Integer isActive = 1; - List combopPhaseList = deployPipelineConfigVo.getCombopPhaseList(); - if (CollectionUtils.isNotEmpty(combopPhaseList)) { - for (DeployPipelinePhaseVo deployPipelinePhaseVo : combopPhaseList) { - if (Objects.equals(deployPipelinePhaseVo.getOverride(), 1)) { - override = 1; - break; + int override = 0; + int isActive = 1; + Set appCombopPhaseIdSet = new HashSet<>(); + List appCombopPhaseList = appPipelineConfigVo.getCombopPhaseList(); + if (CollectionUtils.isNotEmpty(appCombopPhaseList)) { + appCombopPhaseIdSet = appCombopPhaseList.stream().map(DeployPipelinePhaseVo::getId).collect(Collectors.toSet()); + } + if (deployPipelineConfigVo != null) { + List combopPhaseList = deployPipelineConfigVo.getCombopPhaseList(); + if (CollectionUtils.isNotEmpty(combopPhaseList)) { + for (DeployPipelinePhaseVo deployPipelinePhaseVo : combopPhaseList) { + if (appCombopPhaseIdSet.contains(deployPipelinePhaseVo.getId()) && Objects.equals(deployPipelinePhaseVo.getOverride(), 1)) { + override = 1; + break; + } } +// for (DeployPipelinePhaseVo deployPipelinePhaseVo : combopPhaseList) { +// if (appCombopPhaseUuidSet.contains(deployPipelinePhaseVo.getUuid()) && !Objects.equals(deployPipelinePhaseVo.getIsActive(), 1)) { +// isActive = 0; +// break; +// } +// } } - for (DeployPipelinePhaseVo deployPipelinePhaseVo : combopPhaseList) { - if (!Objects.equals(deployPipelinePhaseVo.getIsActive(), 1)) { - isActive = 0; - break; + List disabledPhaseIdList = deployPipelineConfigVo.getDisabledPhaseIdList(); + if (CollectionUtils.isNotEmpty(disabledPhaseIdList)) { + for (Long disabledPhaseId : disabledPhaseIdList) { + if (appCombopPhaseIdSet.contains(disabledPhaseId)) { + isActive = 0; + break; + } } } } @@ -163,20 +181,20 @@ public class TreeDeployAppConfigAppSystemAppModuleEnvApi extends PrivateApiCompo return deployAppConfigVo.getConfig(); } } - for (DeployAppConfigVo deployAppConfigVo : deployAppConfigList) { - if (Objects.equals(deployAppConfigVo.getAppSystemId(), appSystemId) - && Objects.equals(deployAppConfigVo.getAppModuleId(), appModuleId) - && Objects.equals(deployAppConfigVo.getEnvId(), 0L)) { - return deployAppConfigVo.getConfig(); - } - } - for (DeployAppConfigVo deployAppConfigVo : deployAppConfigList) { - if (Objects.equals(deployAppConfigVo.getAppSystemId(), appSystemId) - && Objects.equals(deployAppConfigVo.getAppModuleId(), 0L) - && Objects.equals(deployAppConfigVo.getEnvId(), 0L)) { - return deployAppConfigVo.getConfig(); - } - } +// for (DeployAppConfigVo deployAppConfigVo : deployAppConfigList) { +// if (Objects.equals(deployAppConfigVo.getAppSystemId(), appSystemId) +// && Objects.equals(deployAppConfigVo.getAppModuleId(), appModuleId) +// && Objects.equals(deployAppConfigVo.getEnvId(), 0L)) { +// return deployAppConfigVo.getConfig(); +// } +// } +// for (DeployAppConfigVo deployAppConfigVo : deployAppConfigList) { +// if (Objects.equals(deployAppConfigVo.getAppSystemId(), appSystemId) +// && Objects.equals(deployAppConfigVo.getAppModuleId(), 0L) +// && Objects.equals(deployAppConfigVo.getEnvId(), 0L)) { +// return deployAppConfigVo.getConfig(); +// } +// } return null; } } -- Gitee