From 280e15c0fd7aa487cd44a8e12c0d5ef3a1c6b1b6 Mon Sep 17 00:00:00 2001 From: weidong Date: Thu, 12 Dec 2024 09:39:07 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=B6=88=E9=99=A4=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/imdroid/secapi/dto/WarningMsg.java | 2 ++ .../sideslope/service/WarningServiceImpl.java | 28 +++++++++++++------ sec-beidou/src/main/resources/db/schema.sql | 1 + .../resources/templates/page/warning.html | 5 ++-- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/sec-api/src/main/java/com/imdroid/secapi/dto/WarningMsg.java b/sec-api/src/main/java/com/imdroid/secapi/dto/WarningMsg.java index 3d9c20eb..20e01876 100644 --- a/sec-api/src/main/java/com/imdroid/secapi/dto/WarningMsg.java +++ b/sec-api/src/main/java/com/imdroid/secapi/dto/WarningMsg.java @@ -26,6 +26,8 @@ public class WarningMsg { @ExcelProperty("上报时间") LocalDateTime createtime; + @ExcelProperty("消除时间") + LocalDateTime cleartime; @ExcelProperty("设备编号") String deviceid; diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/service/WarningServiceImpl.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/service/WarningServiceImpl.java index 2f6f4559..d46387d6 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/service/WarningServiceImpl.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/service/WarningServiceImpl.java @@ -56,7 +56,7 @@ public class WarningServiceImpl implements WarningService { boolean isUpdated = false; if ((status.getWarningcode() & WarningCfg.TYPE_LESS_D3XX) != 0) { - status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_D3XX); + clearWarning(status, WarningCfg.TYPE_LESS_D3XX); isUpdated = true; } @@ -71,7 +71,7 @@ public class WarningServiceImpl implements WarningService { //连续无固定解 if ((status.getWarningcode() & WarningCfg.TYPE_NO_FIXED_RESULT) != 0) { if(0 != device.getFixedNum()) { - status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT); + clearWarning(status, WarningCfg.TYPE_NO_FIXED_RESULT); isUpdated = true; } } @@ -89,7 +89,7 @@ public class WarningServiceImpl implements WarningService { int[] warningValues = cfgMap.get(WarningCfg.TYPE_CONT_INVALID_RESULT); if(warningValues!=null && device.getLastValidCalcDataTime()!=null){ if(LocalDateTime.now().isBefore(device.getLastValidCalcDataTime().plusHours(warningValues[1]))){ - status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_CONT_INVALID_RESULT); + clearWarning(status, WarningCfg.TYPE_CONT_INVALID_RESULT); isUpdated = true; } } @@ -121,7 +121,7 @@ public class WarningServiceImpl implements WarningService { boolean isUpdated = false; if ((curStatus.getWarningcode() & WarningCfg.TYPE_DEVICE_OFF_LINE) != 0) { - curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_DEVICE_OFF_LINE); + clearWarning(curStatus, WarningCfg.TYPE_DEVICE_OFF_LINE); isUpdated = true; } @@ -190,7 +190,7 @@ public class WarningServiceImpl implements WarningService { int oldWarningCode = curStatus.getWarningcode() & warningType; if(newWarningCode != oldWarningCode){ if(newWarningCode == 0){ - curStatus.setWarningcode(curStatus.getWarningcode() & ~warningType); + clearWarning(curStatus, warningType); } else { WarningMsg warningMsg = new WarningMsg(); @@ -239,15 +239,15 @@ public class WarningServiceImpl implements WarningService { boolean isUpdated = false; // 清除b562告警 if((status.getWarningcode() & WarningCfg.TYPE_CONT_INVALID_RESULT) !=0 ) { - status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_CONT_INVALID_RESULT); + clearWarning(status, WarningCfg.TYPE_CONT_INVALID_RESULT); isUpdated = true; } if((status.getWarningcode() & WarningCfg.TYPE_NO_FIXED_RESULT) !=0 ) { - status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT); + clearWarning(status, WarningCfg.TYPE_NO_FIXED_RESULT); isUpdated = true; } if((status.getWarningcode() & WarningCfg.TYPE_LESS_B562) !=0 ) { - status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_B562); + clearWarning(status, WarningCfg.TYPE_LESS_B562); isUpdated = true; } // 检查d331告警 @@ -270,4 +270,16 @@ public class WarningServiceImpl implements WarningService { } } + + void clearWarning(GnssStatus status, int warningCode){ + status.setWarningcode(status.getWarningcode()&~warningCode); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("deviceid",status.getDeviceid()); + queryWrapper.eq("code",warningCode); + WarningMsg warningMsg = warningMsgMapper.selectOne(queryWrapper); + if(warningMsg!=null){ + warningMsg.setCleartime(LocalDateTime.now()); + warningMsgMapper.updateById(warningMsg); + } + } } diff --git a/sec-beidou/src/main/resources/db/schema.sql b/sec-beidou/src/main/resources/db/schema.sql index a6348ba2..6d8de6e7 100644 --- a/sec-beidou/src/main/resources/db/schema.sql +++ b/sec-beidou/src/main/resources/db/schema.sql @@ -223,6 +223,7 @@ CREATE TABLE IF NOT EXISTS `warninginfo` ( `id` bigint AUTO_INCREMENT, `tenantid` int NOT NULL, `createtime` datetime DEFAULT NULL, + `cleartime` datetime DEFAULT NULL, `deviceid` varchar(20) NOT NULL, `devicetype` smallint DEFAULT NULL, `level` smallint DEFAULT NULL, diff --git a/sec-beidou/src/main/resources/templates/page/warning.html b/sec-beidou/src/main/resources/templates/page/warning.html index 3c5e6134..5927b850 100644 --- a/sec-beidou/src/main/resources/templates/page/warning.html +++ b/sec-beidou/src/main/resources/templates/page/warning.html @@ -82,11 +82,12 @@ toolbar: '#toolbarDemo', //开启头部工具栏 defaultToolbar: ['filter'], cols: [[ - {field: 'createtime', title: '上报时间', width: '15%', templet: "
{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}
"}, {field: 'deviceid', title: '设备号'}, + {field: 'createtime', title: '上报时间', width: '15%', templet: "
{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}
"}, + {field: 'cleartime', title: '消除时间', width: '15%', templet: "
{{d.cleartime==null?'':layui.util.toDateString(d.cleartime, 'yyyy-MM-dd HH:mm:ss')}}
"}, {field: 'level', title: '告警级别',templet: "
{{d.level==2?'严重':'一般'}}
"}, {field: 'code', title: '告警类型'}, - {field: 'info', title: '告警内容', width: '35%'} + {field: 'info', title: '告警内容', width: '40%'} ]], limits: [10, 20, 50, 100, 150], limit: 10,