From d00309428ba67646b03a7134a06eff7ab2e5abc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Mon, 19 May 2025 10:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=89=E7=BA=A4=E6=8A=A5=E8=AD=A6=E5=AD=98?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/controller/DcEventController.java | 15 ++++++++++++++- .../resources/mapper/business/DcWarningMapper.xml | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java index 1f4bb6e3..cab1f026 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java @@ -7,14 +7,17 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.zc.business.domain.DcEvent; +import com.zc.business.domain.DcNoStakeWarningTable; import com.zc.business.enums.UniversalEnum; import com.zc.business.service.IDcEventService; +import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl; import com.zc.common.core.websocket.WebSocketService; import com.zc.common.core.websocket.constant.WebSocketEvent; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -39,7 +42,8 @@ public class DcEventController extends BaseController { @Autowired private IDcEventService dcEventService; - + @Resource + private DcNoStakeWarningTableServiceImpl dcNoStakeWarningTableService; /** * 查询事件信息列表 */ @@ -285,6 +289,15 @@ if (eventState==UniversalEnum.ZERO.getNumber()){ contentMap.put("contentType", title); contentMap.put("message", message); contentMap.put("warningTime", new Date()); + + DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable(); + dcNoStakeWarningTable.setWarningDescription(message); + dcNoStakeWarningTable.setWarningType(UniversalEnum.FOUR.getValue()); + dcNoStakeWarningTable.setOtherConfig(payload.toString()); + dcNoStakeWarningTable.setWarningTime(new Date()); +//存入记录 + dcNoStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable); + WebSocketService.broadcast("opticalFiberAlarm", contentMap); return AjaxResult.success(); } diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 0062a0be..427f70c8 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -460,6 +460,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE warning_type = 1 AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 14 DAY) UNION ALL + SELECT 'OpticalFiber' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config + FROM dc_no_stake_warning_table + WHERE warning_type = 4 + AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY) + UNION ALL SELECT 'Weather Warning' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config FROM dc_no_stake_warning_table WHERE warning_type = 2 AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY) @@ -469,6 +474,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE warning_type = 3 AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 2 DAY) + ORDER BY warning_time DESC