1、优化告警处理
This commit is contained in:
parent
109f913eb1
commit
06fe707939
@ -11,4 +11,7 @@ public interface RtcmClient {
|
|||||||
|
|
||||||
@PostMapping("/device_param_changed")
|
@PostMapping("/device_param_changed")
|
||||||
HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId);
|
HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId);
|
||||||
|
|
||||||
|
@PostMapping("/warning_param_changed")
|
||||||
|
HttpResp warningParamChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GNSS收发统计消息,每个工作周期结束的时候统计一次
|
* GNSS收发统计消息,每个工作周期结束的时候统计一次
|
||||||
*
|
*
|
||||||
@ -50,4 +53,18 @@ public class WarningCfg {
|
|||||||
String typename;
|
String typename;
|
||||||
Integer value;
|
Integer value;
|
||||||
Short level;
|
Short level;
|
||||||
|
|
||||||
|
public static List<String> parseCode(int code){
|
||||||
|
List<String> warningInfo = new ArrayList<>();
|
||||||
|
if((code & TYPE_LOW_VOLTAGE) !=0) warningInfo.add(TYPE_NAME_LOW_VOLTAGE);
|
||||||
|
if((code & TYPE_LOW_RSSI) !=0) warningInfo.add(TYPE_NAME_LOW_RSSI);
|
||||||
|
if((code & TYPE_DEVICE_OFF_LINE) !=0) warningInfo.add(TYPE_NAME_DEVICE_OFF_LINE);
|
||||||
|
if((code & TYPE_RX_MUCH_UNKNOWN) !=0) warningInfo.add(TYPE_NAME_RX_MUCH_UNKNOWN);
|
||||||
|
if((code & TYPE_LESS_INUSE_SAT) !=0) warningInfo.add(TYPE_NAME_LESS_INUSE_SAT);
|
||||||
|
if((code & TYPE_LESS_D3XX) !=0) warningInfo.add(TYPE_NAME_LESS_D3XX);
|
||||||
|
if((code & TYPE_LESS_B562) !=0) warningInfo.add(TYPE_NAME_LESS_B562);
|
||||||
|
if((code & TYPE_NO_FIXED_RESULT) !=0) warningInfo.add(TYPE_NAME_NO_FIXED_RESULT);
|
||||||
|
if((code & TYPE_BS_NO_RESULT) !=0) warningInfo.add(TYPE_NAME_BS_NO_RESULT);
|
||||||
|
return warningInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,21 +6,19 @@ import com.imdroid.secapi.dto.GnssTrxMsg;
|
|||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
|
|
||||||
public interface WarningService {
|
public interface WarningService {
|
||||||
|
void refreshCfg();
|
||||||
/***
|
/***
|
||||||
* 检查一个周期内的b562数量是否足够
|
* 检查一个周期内的b562数量是否足够
|
||||||
* 返回告警级别和告警码
|
* 返回告警级别和告警码
|
||||||
* @param
|
|
||||||
*/
|
*/
|
||||||
void checkB562Num(String deviceId,Integer tenantId, int[] numB562Stat);
|
void checkB562Num(String deviceId,Integer tenantId, int[] numB562Stat);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 检查电压、RSSI等
|
* 检查电压、RSSI等
|
||||||
* @param msg
|
|
||||||
*/
|
*/
|
||||||
void checkDeviceStatus(GnssStatusMsg msg, GnssStatus curStatus);
|
void checkDeviceStatus(GnssStatusMsg msg, GnssStatus curStatus);
|
||||||
/***
|
/***
|
||||||
* 检查未知报文是否较多
|
* 检查未知报文是否较多
|
||||||
* @param msg
|
|
||||||
*/
|
*/
|
||||||
void checkTrx(GnssTrxMsg msg, GnssStatus curStatus);
|
void checkTrx(GnssTrxMsg msg, GnssStatus curStatus);
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.imdroid.sideslope.sal.Device;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -24,10 +25,13 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
Map<Integer, int[]> cfgMap = new HashMap<>();
|
Map<Integer, int[]> cfgMap = new HashMap<>();
|
||||||
int warningLevel2Code = 0;
|
int warningLevel2Code = 0;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
public void refreshCfg(){
|
public void refreshCfg(){
|
||||||
QueryWrapper<WarningCfg> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<WarningCfg> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("devicetype", WarningCfg.TYPE_GNSS);
|
queryWrapper.eq("devicetype", WarningCfg.TYPE_GNSS);
|
||||||
List<WarningCfg> cfgList = warningCfgMapper.selectList(null);
|
List<WarningCfg> cfgList = warningCfgMapper.selectList(null);
|
||||||
|
cfgMap.clear();
|
||||||
for(WarningCfg cfg: cfgList){
|
for(WarningCfg cfg: cfgList){
|
||||||
cfgMap.put(cfg.getType(),new int[]{cfg.getLevel(),cfg.getValue()});
|
cfgMap.put(cfg.getType(),new int[]{cfg.getLevel(),cfg.getValue()});
|
||||||
if(cfg.getLevel() == WarningCfg.LEVEL_2){
|
if(cfg.getLevel() == WarningCfg.LEVEL_2){
|
||||||
@ -37,7 +41,6 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
}
|
}
|
||||||
/***
|
/***
|
||||||
* 检查一个周期内的b562数量是否足够
|
* 检查一个周期内的b562数量是否足够
|
||||||
* @param
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkB562Num(String deviceId, Integer tenantId,
|
public void checkB562Num(String deviceId, Integer tenantId,
|
||||||
@ -45,7 +48,6 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
|
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
|
||||||
if(status == null) return;
|
if(status == null) return;
|
||||||
|
|
||||||
if(cfgMap.size() == 0) refreshCfg();
|
|
||||||
boolean isUpdated = false;
|
boolean isUpdated = false;
|
||||||
if ((status.getWarningcode() & (WarningCfg.TYPE_NO_FIXED_RESULT
|
if ((status.getWarningcode() & (WarningCfg.TYPE_NO_FIXED_RESULT
|
||||||
| WarningCfg.TYPE_LESS_B562
|
| WarningCfg.TYPE_LESS_B562
|
||||||
@ -78,7 +80,7 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
int count = status.getNoreslutcount()+1;
|
int count = status.getNoreslutcount()+1;
|
||||||
status.setNoreslutcount(count);
|
status.setNoreslutcount(count);
|
||||||
int[] threshold2 = cfgMap.get(WarningCfg.TYPE_NO_FIXED_RESULT);
|
int[] threshold2 = cfgMap.get(WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
if(count >= threshold2[1]){
|
if(threshold2!=null && count >= threshold2[1]){
|
||||||
// 连续6个周期无固定解则产生严重告警
|
// 连续6个周期无固定解则产生严重告警
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
warningMsg.setDeviceid(deviceId);
|
warningMsg.setDeviceid(deviceId);
|
||||||
@ -106,61 +108,65 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
}
|
}
|
||||||
/***
|
/***
|
||||||
* 检查电压、RSSI等
|
* 检查电压、RSSI等
|
||||||
* @param statusMsg
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkDeviceStatus(GnssStatusMsg statusMsg, GnssStatus curStatus){
|
public void checkDeviceStatus(GnssStatusMsg statusMsg, GnssStatus curStatus){
|
||||||
if(cfgMap.size() == 0) refreshCfg();
|
|
||||||
// 清除离线告警
|
// 清除离线告警
|
||||||
if(curStatus.getWarningcode() == null) curStatus.setWarningcode(0);
|
if(curStatus.getWarningcode() == null) curStatus.setWarningcode(0);
|
||||||
curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_DEVICE_OFF_LINE);
|
boolean isUpdated = false;
|
||||||
|
|
||||||
// 检测电压和RSSI
|
//清除原来的告警
|
||||||
|
if ((curStatus.getWarningcode() & (WarningCfg.TYPE_DEVICE_OFF_LINE
|
||||||
|
| WarningCfg.TYPE_LOW_VOLTAGE
|
||||||
|
| WarningCfg.TYPE_LOW_RSSI)) != 0) {
|
||||||
|
curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_DEVICE_OFF_LINE);
|
||||||
|
curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_LOW_VOLTAGE);
|
||||||
|
curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_LOW_RSSI);
|
||||||
|
isUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] lowVoltage = cfgMap.get(WarningCfg.TYPE_LOW_VOLTAGE);
|
||||||
|
if(lowVoltage!=null && statusMsg.getVoltage() <= lowVoltage[1]){
|
||||||
|
// 检测电压
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
warningMsg.setDeviceid(statusMsg.getDeviceid());
|
warningMsg.setDeviceid(statusMsg.getDeviceid());
|
||||||
warningMsg.setTenantid(statusMsg.getTenantid());
|
warningMsg.setTenantid(statusMsg.getTenantid());
|
||||||
warningMsg.setCreatetime(LocalDateTime.now());
|
warningMsg.setCreatetime(LocalDateTime.now());
|
||||||
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
||||||
|
|
||||||
int[] lowVoltage = cfgMap.get(WarningCfg.TYPE_LOW_VOLTAGE);
|
|
||||||
if(lowVoltage!=null){
|
|
||||||
if(statusMsg.getVoltage() <= lowVoltage[1]) {
|
|
||||||
warningMsg.setCode(WarningCfg.TYPE_LOW_VOLTAGE);
|
warningMsg.setCode(WarningCfg.TYPE_LOW_VOLTAGE);
|
||||||
warningMsg.setLevel((short) lowVoltage[0]);
|
warningMsg.setLevel((short) lowVoltage[0]);
|
||||||
warningMsg.setInfo("低电压:" + statusMsg.getVoltage() + "mV");
|
warningMsg.setInfo("低电压:" + statusMsg.getVoltage() + "mV");
|
||||||
warningMsgMapper.insert(warningMsg);
|
warningMsgMapper.insert(warningMsg);
|
||||||
//告警级别
|
//告警级别
|
||||||
curStatus.setWarningcode(curStatus.getWarningcode() | WarningCfg.TYPE_LOW_VOLTAGE);
|
curStatus.setWarningcode(curStatus.getWarningcode() | WarningCfg.TYPE_LOW_VOLTAGE);
|
||||||
}
|
isUpdated = true;
|
||||||
else{
|
|
||||||
//清除告警
|
|
||||||
curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_LOW_VOLTAGE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] lowRSSI = cfgMap.get(WarningCfg.TYPE_LOW_RSSI);
|
int[] lowRSSI = cfgMap.get(WarningCfg.TYPE_LOW_RSSI);
|
||||||
if(lowRSSI!=null){
|
if(lowRSSI!=null && statusMsg.getRssi() <= lowRSSI[1]){
|
||||||
if(statusMsg.getRssi() <= lowRSSI[1]) {
|
// 检测RSSI
|
||||||
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
|
warningMsg.setDeviceid(statusMsg.getDeviceid());
|
||||||
|
warningMsg.setTenantid(statusMsg.getTenantid());
|
||||||
|
warningMsg.setCreatetime(LocalDateTime.now());
|
||||||
|
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
||||||
warningMsg.setCode( WarningCfg.TYPE_LOW_RSSI);
|
warningMsg.setCode( WarningCfg.TYPE_LOW_RSSI);
|
||||||
warningMsg.setLevel((short) lowRSSI[0]);
|
warningMsg.setLevel((short) lowRSSI[0]);
|
||||||
warningMsg.setInfo("4G信号弱:" + statusMsg.getRssi());
|
warningMsg.setInfo("4G信号弱:" + statusMsg.getRssi());
|
||||||
warningMsgMapper.insert(warningMsg);
|
warningMsgMapper.insert(warningMsg);
|
||||||
//告警级别
|
//告警级别
|
||||||
curStatus.setWarningcode(curStatus.getWarningcode() | WarningCfg.TYPE_LOW_RSSI);
|
curStatus.setWarningcode(curStatus.getWarningcode() | WarningCfg.TYPE_LOW_RSSI);
|
||||||
}
|
isUpdated = true;
|
||||||
else{
|
|
||||||
//清除告警
|
|
||||||
curStatus.setWarningcode(curStatus.getWarningcode() & ~WarningCfg.TYPE_LOW_RSSI);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据告警码确定告警级别
|
// 根据告警码确定告警级别
|
||||||
|
if(isUpdated){
|
||||||
curStatus.setWarning(getWarningLevel(curStatus.getWarningcode()));
|
curStatus.setWarning(getWarningLevel(curStatus.getWarningcode()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/***
|
/***
|
||||||
* 检查未知报文是否较多
|
* 检查未知报文是否较多
|
||||||
* @param msg
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkTrx(GnssTrxMsg msg, GnssStatus curStatus){
|
public void checkTrx(GnssTrxMsg msg, GnssStatus curStatus){
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.imdroid.sideslope.sal.LocalDeviceServiceImpl;
|
|||||||
import com.imdroid.sideslope.server.DeviceChannel;
|
import com.imdroid.sideslope.server.DeviceChannel;
|
||||||
import com.imdroid.sideslope.server.OnlineChannels;
|
import com.imdroid.sideslope.server.OnlineChannels;
|
||||||
import com.imdroid.common.util.DataTypeUtil;
|
import com.imdroid.common.util.DataTypeUtil;
|
||||||
|
import com.imdroid.sideslope.service.WarningService;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -30,6 +31,9 @@ public class ApiController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
LocalDeviceServiceImpl localDeviceService;
|
LocalDeviceServiceImpl localDeviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
WarningService warningService;
|
||||||
|
|
||||||
@PostMapping(value = "/config")
|
@PostMapping(value = "/config")
|
||||||
public HttpResp config(String deviceId, String configuration) {
|
public HttpResp config(String deviceId, String configuration) {
|
||||||
Map<String, Object> status = new HashMap<>();
|
Map<String, Object> status = new HashMap<>();
|
||||||
@ -68,6 +72,14 @@ public class ApiController {
|
|||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/warning_param_changed")
|
||||||
|
public HttpResp warningParamChanged(){
|
||||||
|
warningService.refreshCfg();
|
||||||
|
HttpResp resp = new HttpResp();
|
||||||
|
resp.setResponseMessage("succeed");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
private static byte[] getBinaryData(ConfigDataTypeEnum dataTypeEnum, String text) {
|
private static byte[] getBinaryData(ConfigDataTypeEnum dataTypeEnum, String text) {
|
||||||
if (dataTypeEnum == ConfigDataTypeEnum.HEX) {
|
if (dataTypeEnum == ConfigDataTypeEnum.HEX) {
|
||||||
return DataTypeUtil.hexStringToBytes(text);
|
return DataTypeUtil.hexStringToBytes(text);
|
||||||
|
|||||||
@ -268,7 +268,10 @@ public class GnssDeviceController extends BasicController{
|
|||||||
int num = gnssDeviceMapper.delete(wrapper);
|
int num = gnssDeviceMapper.delete(wrapper);
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return HttpResult.failed();
|
return HttpResult.failed();
|
||||||
} else return HttpResult.ok();
|
} else{
|
||||||
|
rtcmClient.deviceParamChanged(del_id);
|
||||||
|
return HttpResult.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.imdroid.beidou.service.CommonExcelService;
|
|||||||
import com.imdroid.secapi.dto.GnssStatus;
|
import com.imdroid.secapi.dto.GnssStatus;
|
||||||
import com.imdroid.secapi.dto.GnssStatusJoin;
|
import com.imdroid.secapi.dto.GnssStatusJoin;
|
||||||
import com.imdroid.secapi.dto.GnssStatusMapper;
|
import com.imdroid.secapi.dto.GnssStatusMapper;
|
||||||
|
import com.imdroid.secapi.dto.WarningCfg;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@ -43,6 +44,14 @@ public class GnssStatusController extends BasicController implements CommonExcel
|
|||||||
return this.pageList(session, page, limit, searchParams);
|
return this.pageList(session, page, limit, searchParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/gnss/status/info")
|
||||||
|
@ResponseBody
|
||||||
|
public String info(@RequestParam Integer warningCode) {
|
||||||
|
List<String> warningInfo= WarningCfg.parseCode(warningCode);
|
||||||
|
if(warningInfo.size() == 0) return "无告警";
|
||||||
|
else return warningInfo.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
*
|
*
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.imdroid.beidou.common.HttpResult;
|
import com.imdroid.beidou.common.HttpResult;
|
||||||
import com.imdroid.beidou.service.CommonExcelService;
|
import com.imdroid.beidou.service.CommonExcelService;
|
||||||
|
import com.imdroid.secapi.client.RtcmClient;
|
||||||
import com.imdroid.secapi.dto.*;
|
import com.imdroid.secapi.dto.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -27,19 +28,22 @@ public class WarningController extends BasicController implements CommonExcelSer
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
WarningCfgMapper warningCfgMapper;
|
WarningCfgMapper warningCfgMapper;
|
||||||
|
@Autowired
|
||||||
|
RtcmClient rtcmClient;
|
||||||
|
|
||||||
public static final Map<Integer, String> warningMap = new HashMap<>();
|
public static final Map<Integer, String> warningMap = new HashMap<>();
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public static void init() {
|
public static void init() {
|
||||||
warningMap.put(WarningCfg.TYPE_LOW_VOLTAGE, WarningCfg.TYPE_NAME_LOW_VOLTAGE);
|
|
||||||
warningMap.put(WarningCfg.TYPE_LOW_RSSI, WarningCfg.TYPE_NAME_LOW_RSSI);
|
|
||||||
warningMap.put(WarningCfg.TYPE_DEVICE_OFF_LINE, WarningCfg.TYPE_NAME_DEVICE_OFF_LINE);
|
warningMap.put(WarningCfg.TYPE_DEVICE_OFF_LINE, WarningCfg.TYPE_NAME_DEVICE_OFF_LINE);
|
||||||
warningMap.put(WarningCfg.TYPE_RX_MUCH_UNKNOWN, WarningCfg.TYPE_NAME_RX_MUCH_UNKNOWN);
|
warningMap.put(WarningCfg.TYPE_BS_NO_RESULT, WarningCfg.TYPE_NAME_BS_NO_RESULT);
|
||||||
|
warningMap.put(WarningCfg.TYPE_NO_FIXED_RESULT, WarningCfg.TYPE_NAME_NO_FIXED_RESULT);
|
||||||
warningMap.put(WarningCfg.TYPE_LESS_INUSE_SAT, WarningCfg.TYPE_NAME_LESS_INUSE_SAT);
|
warningMap.put(WarningCfg.TYPE_LESS_INUSE_SAT, WarningCfg.TYPE_NAME_LESS_INUSE_SAT);
|
||||||
warningMap.put(WarningCfg.TYPE_LESS_D3XX, WarningCfg.TYPE_NAME_LESS_D3XX);
|
warningMap.put(WarningCfg.TYPE_LESS_D3XX, WarningCfg.TYPE_NAME_LESS_D3XX);
|
||||||
warningMap.put(WarningCfg.TYPE_LESS_B562, WarningCfg.TYPE_NAME_LESS_B562);
|
warningMap.put(WarningCfg.TYPE_LESS_B562, WarningCfg.TYPE_NAME_LESS_B562);
|
||||||
warningMap.put(WarningCfg.TYPE_NO_FIXED_RESULT, WarningCfg.TYPE_NAME_NO_FIXED_RESULT);
|
warningMap.put(WarningCfg.TYPE_LOW_VOLTAGE, WarningCfg.TYPE_NAME_LOW_VOLTAGE);
|
||||||
|
warningMap.put(WarningCfg.TYPE_LOW_RSSI, WarningCfg.TYPE_NAME_LOW_RSSI);
|
||||||
|
warningMap.put(WarningCfg.TYPE_RX_MUCH_UNKNOWN, WarningCfg.TYPE_NAME_RX_MUCH_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**** 推送页面 *****/
|
/**** 推送页面 *****/
|
||||||
@ -118,6 +122,7 @@ public class WarningController extends BasicController implements CommonExcelSer
|
|||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return HttpResult.failed();
|
return HttpResult.failed();
|
||||||
} else {
|
} else {
|
||||||
|
rtcmClient.warningParamChanged();
|
||||||
return HttpResult.ok();
|
return HttpResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +135,7 @@ public class WarningController extends BasicController implements CommonExcelSer
|
|||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return HttpResult.failed();
|
return HttpResult.failed();
|
||||||
} else {
|
} else {
|
||||||
|
rtcmClient.warningParamChanged();
|
||||||
return HttpResult.ok();
|
return HttpResult.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@ -64,7 +65,7 @@ public class DeviceStatusChecker {
|
|||||||
}
|
}
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
List<GnssStatusJoin> deviceStatuses = gnssStatusMapper.queryOnline();
|
List<GnssStatusJoin> deviceStatuses = gnssStatusMapper.queryOnline();
|
||||||
String deviceIds = null;
|
List<String> deviceIds = new ArrayList<>();
|
||||||
for(GnssStatusJoin status : deviceStatuses){
|
for(GnssStatusJoin status : deviceStatuses){
|
||||||
//如果上次上线到现在超过两个周期,则认为掉线了
|
//如果上次上线到现在超过两个周期,则认为掉线了
|
||||||
LocalDateTime expiredTime = status.getUpdatetime().plusMinutes(group_cycle_map.get(status.getGroup_id())*noDataCycles);
|
LocalDateTime expiredTime = status.getUpdatetime().plusMinutes(group_cycle_map.get(status.getGroup_id())*noDataCycles);
|
||||||
@ -85,12 +86,11 @@ public class DeviceStatusChecker {
|
|||||||
warningMsg.setCode(WarningCfg.TYPE_DEVICE_OFF_LINE);
|
warningMsg.setCode(WarningCfg.TYPE_DEVICE_OFF_LINE);
|
||||||
warningMsgMapper.insert(warningMsg);
|
warningMsgMapper.insert(warningMsg);
|
||||||
//短信推送
|
//短信推送
|
||||||
if(deviceIds==null) deviceIds = status.getDeviceid();
|
deviceIds.add(status.getDeviceid());
|
||||||
else deviceIds = deviceIds+", "+status.getDeviceid();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(deviceIds!=null) {
|
if(deviceIds.size()>0){
|
||||||
notificationService.onWarning(deviceIds,
|
notificationService.onWarning(deviceIds.toString(),
|
||||||
WarningCfg.TYPE_NAME_DEVICE_OFF_LINE,
|
WarningCfg.TYPE_NAME_DEVICE_OFF_LINE,
|
||||||
now.format(formatter), WarningCfg.LEVEL_2);
|
now.format(formatter), WarningCfg.LEVEL_2);
|
||||||
}
|
}
|
||||||
@ -99,16 +99,15 @@ public class DeviceStatusChecker {
|
|||||||
@Scheduled(cron = "0 28 * * * ?") // 每小时执行一次
|
@Scheduled(cron = "0 28 * * * ?") // 每小时执行一次
|
||||||
void checkRoverStationCalcData() throws ExecutionException, InterruptedException {
|
void checkRoverStationCalcData() throws ExecutionException, InterruptedException {
|
||||||
//获取所有基站
|
//获取所有基站
|
||||||
String deviceIds = null;
|
List<String> deviceIds = new ArrayList<>();
|
||||||
QueryWrapper<GnssDevice> deviceQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<GnssDevice> deviceQueryWrapper = new QueryWrapper<>();
|
||||||
deviceQueryWrapper.eq("devicetype", GnssDevice.TYPE_REFERENCE_STATION);
|
deviceQueryWrapper.eq("devicetype", GnssDevice.TYPE_REFERENCE_STATION);
|
||||||
deviceQueryWrapper.eq("opmode", GnssDevice.OP_MODE_USE);
|
deviceQueryWrapper.eq("opmode", GnssDevice.OP_MODE_USE);
|
||||||
List<GnssDevice> bsList = deviceMapper.selectList(deviceQueryWrapper);
|
List<GnssDevice> bsList = deviceMapper.selectList(deviceQueryWrapper);
|
||||||
for(GnssDevice bs:bsList){
|
for(GnssDevice bs:bsList){
|
||||||
GnssStatus status = gnssStatusMapper.getByDeviceId(bs.getDeviceid());
|
GnssStatus status = gnssStatusMapper.getByDeviceId(bs.getDeviceid());
|
||||||
if(status != null) {
|
if(status != null && status.getState()!=GnssStatus.STATE_OFFLINE) {
|
||||||
int oldWarningCode = status.getWarningcode() & WarningCfg.TYPE_BS_NO_RESULT;
|
int warningCode = 0;
|
||||||
int newWarningCode = oldWarningCode;
|
|
||||||
if(!isRoverStationNormal(bs.getDeviceid())){
|
if(!isRoverStationNormal(bs.getDeviceid())){
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
warningMsg.setDeviceid(bs.getDeviceid());
|
warningMsg.setDeviceid(bs.getDeviceid());
|
||||||
@ -119,21 +118,20 @@ public class DeviceStatusChecker {
|
|||||||
warningMsg.setLevel(WarningCfg.LEVEL_2);
|
warningMsg.setLevel(WarningCfg.LEVEL_2);
|
||||||
warningMsg.setInfo(WarningCfg.TYPE_NAME_BS_NO_RESULT);
|
warningMsg.setInfo(WarningCfg.TYPE_NAME_BS_NO_RESULT);
|
||||||
warningMsgMapper.insert(warningMsg);
|
warningMsgMapper.insert(warningMsg);
|
||||||
newWarningCode = WarningCfg.TYPE_BS_NO_RESULT;
|
warningCode = WarningCfg.TYPE_BS_NO_RESULT;
|
||||||
}
|
|
||||||
else{
|
|
||||||
newWarningCode = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldWarningCode!=newWarningCode){
|
// warningCode changed
|
||||||
|
if(warningCode != (status.getWarningcode()&WarningCfg.TYPE_BS_NO_RESULT)){
|
||||||
//清除原来的告警
|
//清除原来的告警
|
||||||
if(newWarningCode == 0) {
|
if(warningCode == 0) {
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_BS_NO_RESULT);
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_BS_NO_RESULT);
|
||||||
|
status.setWarning(WarningCfg.LEVEL_0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
status.setWarningcode(status.getWarningcode() | WarningCfg.TYPE_BS_NO_RESULT);
|
status.setWarningcode(status.getWarningcode() | WarningCfg.TYPE_BS_NO_RESULT);
|
||||||
if(deviceIds == null) deviceIds = bs.getDeviceid();
|
status.setWarning(WarningCfg.LEVEL_2);
|
||||||
else deviceIds = deviceIds+","+bs.getDeviceid();
|
deviceIds.add(bs.getDeviceid());
|
||||||
}
|
}
|
||||||
gnssStatusMapper.updateById(status);
|
gnssStatusMapper.updateById(status);
|
||||||
}
|
}
|
||||||
@ -142,8 +140,8 @@ public class DeviceStatusChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发短信通知
|
// 发短信通知
|
||||||
if(deviceIds != null){
|
if(deviceIds.size()>0){
|
||||||
notificationService.onWarning(deviceIds,
|
notificationService.onWarning(deviceIds.toString(),
|
||||||
WarningCfg.TYPE_NAME_BS_NO_RESULT,
|
WarningCfg.TYPE_NAME_BS_NO_RESULT,
|
||||||
LocalDateTime.now().format(formatter),
|
LocalDateTime.now().format(formatter),
|
||||||
WarningCfg.LEVEL_2);
|
WarningCfg.LEVEL_2);
|
||||||
|
|||||||
@ -157,17 +157,17 @@
|
|||||||
$(window).on("resize", function () {
|
$(window).on("resize", function () {
|
||||||
layer.full(index);
|
layer.full(index);
|
||||||
});
|
});
|
||||||
} else if (obj.event === 'delete') { // 监听删除操作
|
}
|
||||||
|
/*else if (obj.event === 'delete') { // 批量监听删除操作
|
||||||
var checkStatus = table.checkStatus('currentTableId')
|
var checkStatus = table.checkStatus('currentTableId')
|
||||||
, data = checkStatus.data;
|
, data = checkStatus.data;
|
||||||
layer.alert(JSON.stringify(data));
|
layer.alert(JSON.stringify(data));
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
|
|
||||||
table.on('tool(currentTableFilter)', function (obj) {
|
table.on('tool(currentTableFilter)', function (obj) {
|
||||||
var data = obj.data;
|
var data = obj.data;
|
||||||
if (obj.event === 'edit') {
|
if (obj.event === 'edit') {
|
||||||
|
|
||||||
var index = layer.open({
|
var index = layer.open({
|
||||||
title: '修改设备',
|
title: '修改设备',
|
||||||
type: 2,
|
type: 2,
|
||||||
|
|||||||
@ -73,7 +73,7 @@
|
|||||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||||
|
|
||||||
<script type="text/html" id="currentTableBar">
|
<script type="text/html" id="currentTableBar">
|
||||||
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="cmd">详细</a>
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="info">详细</a>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -140,6 +140,27 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* toolbar事件监听
|
||||||
|
*/
|
||||||
|
table.on('tool(currentTableFilter)', function (obj) {
|
||||||
|
if (obj.event === 'info') { // 监听添加操作
|
||||||
|
$.ajax({
|
||||||
|
type:"POST",
|
||||||
|
url:"/gnss/status/info",
|
||||||
|
data:{
|
||||||
|
'warningCode':obj.data.warningcode
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
layer.alert(data);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
console.log("ajax error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 监听导出操作
|
// 监听导出操作
|
||||||
form.on('submit(data-export-btn)', function (data) {
|
form.on('submit(data-export-btn)', function (data) {
|
||||||
var result = $('#searchFrm').serialize();
|
var result = $('#searchFrm').serialize();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user