diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt index 76d5dd1e6f8..36b7e2ec84c 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt @@ -157,6 +157,18 @@ class QualityIndicatorService @Autowired constructor( } ?: listOf() } + fun serviceListALL(indicatorIds: Collection): List { + val indicatorTMap = indicatorDao.listByIds(dslContext, indicatorIds)?.map { it.id to it }?.toMap() + return indicatorIds.map { id -> + val indicator = indicatorTMap?.get(id) ?: throw OperationException("indicator id $id is not exist") + val metadataIds = convertMetaIds(indicator.metadataIds) + val metadata = metadataService.serviceListMetadata(metadataIds).map { + QualityIndicator.Metadata(it.hashId, it.dataName, it.dataId) + } + convertRecord(indicator, metadata) + } + } + fun serviceList(elementType: String, enNameSet: Collection): List { return if (enNameSet.isNotEmpty()) { val indicatorTMap = indicatorDao.listByElementType( diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityRuleBuildHisService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityRuleBuildHisService.kt index 28465834521..f62bb5cdd74 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityRuleBuildHisService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityRuleBuildHisService.kt @@ -188,7 +188,7 @@ class QualityRuleBuildHisService constructor( val indicatorIdList = it.indicatorIds.split(",").map { id -> id.toLong() } val thresholdList = it.indicatorThresholds.split(",") val opList = it.indicatorOperations.split(",") - val qualityIndicatorList = qualityIndicatorService.serviceList(indicatorIdList).toMutableList() + val qualityIndicatorList = qualityIndicatorService.serviceListALL(indicatorIdList).toMutableList() logger.info("QUALITY|get qualityIndicator: ${qualityIndicatorList.size}") val rule = QualityRule(