From a6b4f05c8564b5f61c31f497d2a50cf0ddd0e820 Mon Sep 17 00:00:00 2001 From: "review512jwy@163.com" <“review512jwy@163.com”> Date: Tue, 30 Jun 2026 17:31:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=81=A2=E5=A4=8D=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E5=A4=84=E7=90=86=E5=8E=86=E5=8F=B2=E3=80=81=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E6=8C=81=E7=BB=AD=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sender/dao/DashboardAlertDao.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/techsor/datacenter/sender/dao/DashboardAlertDao.java b/src/main/java/com/techsor/datacenter/sender/dao/DashboardAlertDao.java index 49e8e48..364fa87 100644 --- a/src/main/java/com/techsor/datacenter/sender/dao/DashboardAlertDao.java +++ b/src/main/java/com/techsor/datacenter/sender/dao/DashboardAlertDao.java @@ -258,13 +258,26 @@ public class DashboardAlertDao { Long alertHistoryId = alertHistoryDTO.getId(); + // 20260630需求,自动恢复的要插入一条到处理历史 + long now = System.currentTimeMillis(); + String insertHandleSql = "INSERT INTO alert_handle_history (" + + "alert_history_id, device_id, alert_status, status, handle_at, detail_title, detail_content" + + ") VALUES (?, ?, 1, 4, ?, ?, ?)"; + jdbcTemplate.update(insertHandleSql, + alertHistoryId, + entity.getDeviceId(), + now, + "自動復旧", + "自動復旧" + ); + // 更新 alert_history - String updateAlertHistorySql = "UPDATE alert_history SET handle_status = 4, alert_status = 1 WHERE id = ? and handle_status != 3 "; - jdbcTemplate.update(updateAlertHistorySql, alertHistoryId); + String updateAlertHistorySql = "UPDATE alert_history SET handle_status = 4, alert_status = 1, alarm_duration = ? - receive_ts WHERE id = ? and handle_status != 3 "; + jdbcTemplate.update(updateAlertHistorySql, now, alertHistoryId); // 更新 alert_handle_history // status值不能是完成status != 3 - String updateHandleHistorySql = "UPDATE alert_handle_history SET status = 4, alert_status = 1 WHERE alert_history_id = ? and status != 3"; - jdbcTemplate.update(updateHandleHistorySql, alertHistoryId); +// String updateHandleHistorySql = "UPDATE alert_handle_history SET status = 4, alert_status = 1 WHERE alert_history_id = ? and status != 3"; +// jdbcTemplate.update(updateHandleHistorySql, alertHistoryId); } }