|
|
@@ -276,12 +276,38 @@ public sealed class AdoSmartOpsKpiDimensionConfigService : ITransient
|
|
|
cap.CapabilityStatus = "PENDING_DIMENSION_SQL";
|
|
|
return cap;
|
|
|
}
|
|
|
+ // 维度绑定的汇总版本(兼容旧字段 + 明确的 Bound* 字段)
|
|
|
cap.SummaryConfigVersion = active.SummaryConfigVersion;
|
|
|
+ cap.BoundSummaryConfigId = active.SummaryConfigId;
|
|
|
+ cap.BoundSummaryConfigVersion = active.SummaryConfigVersion;
|
|
|
cap.DimensionConfigVersion = active.DimensionConfigVersion;
|
|
|
cap.AggregationType = active.AggregationType;
|
|
|
cap.SupportedDimensions = ParseDimensions(active.SupportedDimensionsJson);
|
|
|
- cap.Supported = active.AggregationType != "SUMMARY_ONLY";
|
|
|
- cap.CapabilityStatus = active.AggregationType == "SUMMARY_ONLY" ? "SUMMARY_ONLY" : "CONFIGURED";
|
|
|
+
|
|
|
+ // 当前生效的汇总版本(可能已推进超过维度绑定);一致性同时比对 Id 与 Version
|
|
|
+ var currentSummary = await _summaryConfig.GetActiveAsync(tenantId, metricCode);
|
|
|
+ cap.CurrentSummaryConfigId = currentSummary?.Id;
|
|
|
+ cap.CurrentSummaryConfigVersion = currentSummary?.VersionNo;
|
|
|
+ cap.IsSummaryBindingConsistent = currentSummary != null
|
|
|
+ && currentSummary.Id == active.SummaryConfigId
|
|
|
+ && currentSummary.VersionNo == active.SummaryConfigVersion;
|
|
|
+
|
|
|
+ if (active.AggregationType == "SUMMARY_ONLY")
|
|
|
+ {
|
|
|
+ cap.Supported = false;
|
|
|
+ cap.CapabilityStatus = "SUMMARY_ONLY";
|
|
|
+ }
|
|
|
+ else if (!cap.IsSummaryBindingConsistent)
|
|
|
+ {
|
|
|
+ // 汇总已推进 / 当前汇总缺失:旧绑定维度不可直接投用,避免误判可用
|
|
|
+ cap.Supported = false;
|
|
|
+ cap.CapabilityStatus = "VERSION_MISMATCH";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cap.Supported = true;
|
|
|
+ cap.CapabilityStatus = "CONFIGURED";
|
|
|
+ }
|
|
|
|
|
|
var lastRun = await _db.Queryable<AdoSmartOpsKpiDimensionRunLog>().ClearFilter<ITenantIdFilter>()
|
|
|
.Where(x => x.MetricCode == metricCode && x.TenantId == tenantId)
|