fix: 告警清除自定义的AlarmCode

This commit is contained in:
TsMask
2025-05-09 11:54:56 +08:00
parent ad6626e67b
commit 4989f45a03
4 changed files with 23 additions and 4 deletions

View File

@@ -77,7 +77,7 @@ func (r Alarm) AlarmClearByIds(ids []int64, clearUser string) (int64, error) {
var rows int64 = 0
for _, v := range arr {
// 状态检查AlarmCode变更告警ID
if v.AlarmCode == constants.ALARM_STATE_CHECK {
if v.AlarmCode == constants.ALARM_STATE_CHECK || v.AlarmCode == constants.ALARM_CMD_CHECK || v.AlarmCode == constants.ALARM_LICENSE_CHECK {
v.AlarmId = fmt.Sprintf("%d%d", v.AlarmCode, v.EventTime)
}
v.AlarmStatus = "0"
@@ -120,6 +120,15 @@ func (r Alarm) AlarmAckByIds(ids []int64, ackUser string, ackState bool) (int64,
return 0, fmt.Errorf("ack fail")
}
// InsertAndForword 新增信息并转发通知
func (s Alarm) InsertAndForword(param model.Alarm) int64 {
rows := s.alarmRepository.Insert(param)
if rows > 0 {
// 转发通知 TODO
}
return rows
}
// ExportXlsx 导出数据到 xlsx 文件
func (r Alarm) ExportXlsx(rows []model.Alarm, fileName, language, alarmStatus string) (string, error) {
// 第一行表头标题