From 438a156dce09cee7403bcb1627659e038e717978 Mon Sep 17 00:00:00 2001 From: lucas Date: Tue, 8 Jul 2025 16:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=80=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E3=80=80=E4=B8=80=E7=A7=8D=E7=9B=91=E6=B5=8B=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E3=80=80=E7=AE=97=E4=B8=80=E4=B8=AA=E6=9C=89=E6=95=88=E5=91=8A?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...¥ç‰©äº‘es告警组åˆèšé›†to触å‘爆闪.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/adaptors/知物云es告警组åˆèšé›†to触å‘爆闪.go b/adaptors/知物云es告警组åˆèšé›†to触å‘爆闪.go index 3c45462..ce86d3a 100644 --- a/adaptors/知物云es告警组åˆèšé›†to触å‘爆闪.go +++ b/adaptors/知物云es告警组åˆèšé›†to触å‘爆闪.go @@ -37,10 +37,10 @@ func (the Adaptor_ZWY_AlarmCombin) Transform(config AlarmCombination.Combination esAggPointsCount := len(esAggData.Aggregations.GroupBySensor.Buckets) detailMsg := "" - itemAlarmCounts := 0 // >=2有效 - for _, esBucket := range esAggData.Aggregations.GroupBySensor.Buckets { - stationId, _ := strconv.Atoi(esBucket.Key) - for _, item := range config.ConfigItems { + factorItemAlarmCounts := 0 // >=2有效 + for _, item := range config.ConfigItems { + for _, esBucket := range esAggData.Aggregations.GroupBySensor.Buckets { + stationId, _ := strconv.Atoi(esBucket.Key) found := slices.Contains(item.StationIds, stationId) if found { @@ -48,10 +48,11 @@ func (the Adaptor_ZWY_AlarmCombin) Transform(config AlarmCombination.Combination detailMsg += "," } if stationName, ok := the.Info[stationId]; ok { - if itemAlarmCounts < 2 { + if factorItemAlarmCounts < 2 { detailMsg += stationName } - itemAlarmCounts += 1 + factorItemAlarmCounts += 1 + break //一ç§ç±»åž‹æœ‰ä¸€ä¸ªç‚¹å°±è·³å‡º } else { log.Printf("测点[%d]无匹é…çš„åç§°", stationId) } @@ -60,11 +61,11 @@ func (the Adaptor_ZWY_AlarmCombin) Transform(config AlarmCombination.Combination } - if itemAlarmCounts < 2 { + if factorItemAlarmCounts < 2 { log.Printf("es èšé›†æŸ¥è¯¢å‘Šè­¦ç»„æ•°=%d < 2", esAggPointsCount) return nil } - msg := fmt.Sprintf("组åˆå‘Šè­¦[%s]产生,æœ‰æ•ˆè§¦å‘æµ‹ç‚¹:%s ç­‰,å…±%d个", config.Name, detailMsg, itemAlarmCounts) + msg := fmt.Sprintf("组åˆå‘Šè­¦[%s]产生,æœ‰æ•ˆè§¦å‘æµ‹ç‚¹:%s ç­‰,å…±%d个", config.Name, detailMsg, factorItemAlarmCounts) log.Printf(msg) prefix := "zh-"