diff --git a/src/main/java/neatlogic/module/deploy/util/DeployPipelineConfigManager.java b/src/main/java/neatlogic/module/deploy/util/DeployPipelineConfigManager.java index 6ea1b8caf35541ac2a018012433bd5e4766dbf84..7513bbdc5cf4f73603034a093cabec6cf1e4039b 100644 --- a/src/main/java/neatlogic/module/deploy/util/DeployPipelineConfigManager.java +++ b/src/main/java/neatlogic/module/deploy/util/DeployPipelineConfigManager.java @@ -221,18 +221,21 @@ public class DeployPipelineConfigManager { autoexecServiceCrossoverService.updateAutoexecCombopConfig(deployPipelineConfig.getAutoexecCombopConfigVo()); } if (isHasBuildOrDeployTypeTool) { - Set operationIdSet = getOperationIdSet(deployPipelineConfig);List buildTypeToolIdList = new ArrayList<>(); - List deployTypeToolIdList = new ArrayList<>(); - Long buildTypeId = autoexecTypeMapper.getTypeIdByName("BUILD"); - Long deployTypeId = autoexecTypeMapper.getTypeIdByName("DEPLOY"); - List operationIdList = new ArrayList<>(operationIdSet); - if (buildTypeId != null) { - buildTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, buildTypeId); - } - if (deployTypeId != null) { - deployTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, deployTypeId); + Set operationIdSet = getOperationIdSet(deployPipelineConfig); + if (CollectionUtils.isNotEmpty(operationIdSet)) { + List buildTypeToolIdList = new ArrayList<>(); + List deployTypeToolIdList = new ArrayList<>(); + Long buildTypeId = autoexecTypeMapper.getTypeIdByName("BUILD"); + Long deployTypeId = autoexecTypeMapper.getTypeIdByName("DEPLOY"); + List operationIdList = new ArrayList<>(operationIdSet); + if (buildTypeId != null) { + buildTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, buildTypeId); + } + if (deployTypeId != null) { + deployTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, deployTypeId); + } + setIsHasBuildOrDeployTypeTool(deployPipelineConfig, buildTypeToolIdList, deployTypeToolIdList); } - setIsHasBuildOrDeployTypeTool(deployPipelineConfig, buildTypeToolIdList, deployTypeToolIdList); } } return deployPipelineConfig; @@ -291,8 +294,23 @@ public class DeployPipelineConfigManager { resultList.add(deployAppConfig); } - List buildTypeToolIdList = new ArrayList<>(); - List deployTypeToolIdList = new ArrayList<>(); + if (isDeleteDisabledPhase) { + for (DeployAppConfigVo deployAppConfig : resultList) { + DeployPipelineConfigVo deployPipelineConfig = deployAppConfig.getConfig(); + if (deployPipelineConfig != null) { + deleteDisabledPhase(deployPipelineConfig); + } + } + } + if (isUpdateConfig) { + for (DeployAppConfigVo deployAppConfig : resultList) { + DeployPipelineConfigVo deployPipelineConfig = deployAppConfig.getConfig(); + if (deployPipelineConfig != null) { + IAutoexecServiceCrossoverService autoexecServiceCrossoverService = CrossoverServiceFactory.getApi(IAutoexecServiceCrossoverService.class); + autoexecServiceCrossoverService.updateAutoexecCombopConfig(deployPipelineConfig.getAutoexecCombopConfigVo()); + } + } + } if (isHasBuildOrDeployTypeTool) { Set operationIdSet = new HashSet<>(); for (DeployAppConfigVo deployAppConfig : resultList) { @@ -301,29 +319,23 @@ public class DeployPipelineConfigManager { operationIdSet.addAll(getOperationIdSet(deployPipelineConfig)); } } - Long buildTypeId = autoexecTypeMapper.getTypeIdByName("BUILD"); - Long deployTypeId = autoexecTypeMapper.getTypeIdByName("DEPLOY"); - List operationIdList = new ArrayList<>(operationIdSet); - if (buildTypeId != null) { - buildTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, buildTypeId); - } - if (deployTypeId != null) { - deployTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, deployTypeId); - } - } - - for (DeployAppConfigVo deployAppConfig : resultList) { - DeployPipelineConfigVo deployPipelineConfig = deployAppConfig.getConfig(); - if (deployPipelineConfig != null) { - if (isDeleteDisabledPhase) { - deleteDisabledPhase(deployPipelineConfig); + if (CollectionUtils.isNotEmpty(operationIdSet)) { + Long buildTypeId = autoexecTypeMapper.getTypeIdByName("BUILD"); + Long deployTypeId = autoexecTypeMapper.getTypeIdByName("DEPLOY"); + List buildTypeToolIdList = new ArrayList<>(); + List deployTypeToolIdList = new ArrayList<>(); + List operationIdList = new ArrayList<>(operationIdSet); + if (buildTypeId != null) { + buildTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, buildTypeId); } - if (isUpdateConfig) { - IAutoexecServiceCrossoverService autoexecServiceCrossoverService = CrossoverServiceFactory.getApi(IAutoexecServiceCrossoverService.class); - autoexecServiceCrossoverService.updateAutoexecCombopConfig(deployPipelineConfig.getAutoexecCombopConfigVo()); + if (deployTypeId != null) { + deployTypeToolIdList = autoexecToolMapper.getToolIdListByIdListAndTypeId(operationIdList, deployTypeId); } - if (isHasBuildOrDeployTypeTool) { - setIsHasBuildOrDeployTypeTool(deployPipelineConfig, buildTypeToolIdList, deployTypeToolIdList); + for (DeployAppConfigVo deployAppConfig : resultList) { + DeployPipelineConfigVo deployPipelineConfig = deployAppConfig.getConfig(); + if (deployPipelineConfig != null) { + setIsHasBuildOrDeployTypeTool(deployPipelineConfig, buildTypeToolIdList, deployTypeToolIdList); + } } } }