1、增加告警消除时间
This commit is contained in:
parent
1ee8b2540f
commit
280e15c0fd
@ -26,6 +26,8 @@ public class WarningMsg {
|
||||
|
||||
@ExcelProperty("上报时间")
|
||||
LocalDateTime createtime;
|
||||
@ExcelProperty("消除时间")
|
||||
LocalDateTime cleartime;
|
||||
|
||||
@ExcelProperty("设备编号")
|
||||
String deviceid;
|
||||
|
||||
@ -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<WarningMsg> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -82,11 +82,12 @@
|
||||
toolbar: '#toolbarDemo', //开启头部工具栏
|
||||
defaultToolbar: ['filter'],
|
||||
cols: [[
|
||||
{field: 'createtime', title: '上报时间', width: '15%', templet: "<div>{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
|
||||
{field: 'deviceid', title: '设备号'},
|
||||
{field: 'createtime', title: '上报时间', width: '15%', templet: "<div>{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
|
||||
{field: 'cleartime', title: '消除时间', width: '15%', templet: "<div>{{d.cleartime==null?'':layui.util.toDateString(d.cleartime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
|
||||
{field: 'level', title: '告警级别',templet: "<div>{{d.level==2?'严重':'一般'}}</div>"},
|
||||
{field: 'code', title: '告警类型'},
|
||||
{field: 'info', title: '告警内容', width: '35%'}
|
||||
{field: 'info', title: '告警内容', width: '40%'}
|
||||
]],
|
||||
limits: [10, 20, 50, 100, 150],
|
||||
limit: 10,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user