This commit is contained in:
2026-02-16 14:46:27 +08:00
parent 8806473080
commit 49ed5f218a
3 changed files with 47 additions and 0 deletions

View File

@ -77,6 +77,15 @@ public interface IEmsAlarmRecordsService
* @return
*/
public String createTicketNo(Long id, Long userId);
/**
* 关闭告警并设置为已处理
*
* @param id 告警ID
* @param userId 用户ID
* @return 处理结果
*/
public String closeAlarm(Long id, Long userId);
// 订阅失败-增加告警
public void addSubFailedAlarmRecord(String topic);
// 订阅成功-处理告警

View File

@ -174,6 +174,27 @@ public class EmsAlarmRecordsServiceImpl implements IEmsAlarmRecordsService
return ticketNo;
}
@Override
public String closeAlarm(Long id, Long userId) {
EmsAlarmRecords emsAlarmRecords = emsAlarmRecordsMapper.selectEmsAlarmRecordsById(id);
if (emsAlarmRecords == null) {
return "告警记录不存在";
}
if (AlarmStatus.DONE.getCode().equals(emsAlarmRecords.getStatus())) {
return "告警已关闭";
}
emsAlarmRecords.setStatus(AlarmStatus.DONE.getCode());
emsAlarmRecords.setAlarmEndTime(DateUtils.getNowDate());
emsAlarmRecords.setUpdateTime(DateUtils.getNowDate());
if (userId == null) {
userId = 1L;
}
SysUser user = sysUserMapper.selectUserById(userId);
emsAlarmRecords.setUpdateBy(user != null ? user.getUserName() : "system");
emsAlarmRecordsMapper.updateEmsAlarmRecords(emsAlarmRecords);
return "success";
}
// 订阅失败-增加告警
@Override
public void addSubFailedAlarmRecord(String topic) {