From ef8f25f9a2db6b17985cd716bb3085f34518020f Mon Sep 17 00:00:00 2001 From: lucas Date: Mon, 1 Sep 2025 11:16:20 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=B0=83=E6=95=B4=20his=20=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consumers/consumerAxySkAlarm.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/consumers/consumerAxySkAlarm.go b/consumers/consumerAxySkAlarm.go index 1bba256..ca61814 100644 --- a/consumers/consumerAxySkAlarm.go +++ b/consumers/consumerAxySkAlarm.go @@ -241,10 +241,12 @@ func (the *consumerAxySkAlarm) judgeSK() string { } func (the *consumerAxySkAlarm) isHistoryAlarm(sourceId string, level int, alarmTime time.Time) (bool, string) { + isHis := false //特别注意 告警进程:产生一级后,后续触发二级 也会算到一级头上,所有双控产生二级 如果二级不存在 要往上高等级判断 rawK := fmt.Sprintf("%s_%s", sourceId, fmt.Sprintf("3077000%d", level)) + hisK := rawK for i := level; i >= 1; i-- { - hisK := fmt.Sprintf("%s_%s", sourceId, fmt.Sprintf("3077000%d", i)) + hisK = fmt.Sprintf("%s_%s", sourceId, fmt.Sprintf("3077000%d", i)) if hv, ok := the.historyStationAlarmMap[hisK]; ok { if !alarmTime.After(hv.Time) { log.Printf("测点[%s]本次触发时刻[%s]%s(实际es=%s) 对比历史有效时刻[%s] 非新", @@ -254,18 +256,19 @@ func (the *consumerAxySkAlarm) isHistoryAlarm(sourceId string, level int, alarmT hisK, hv.Time.Format("2006-01-02 15:04:05.000"), ) + isHis = true continue } if hv.AlarmLevel < level { //低等级告警过滤 log.Printf("测点[%s]本次触发 %s(实际es=%s) 低于 历史有效等级%d,历史时刻%s,不再重复触发", sourceId, rawK, hisK, hv.AlarmLevel, hv.Time.Format("2006-01-02 15:04:05.000")) + isHis = true continue } - return false, hisK } } - return true, rawK + return isHis, hisK } func (the *consumerAxySkAlarm) skAlarmInfo(alarmInfoTemplate *models.EsAlarm, level int, detail string, alarmTime time.Time, triggerTypeCodes []string) []byte {