修改d331告警清除
This commit is contained in:
parent
05e79800c7
commit
877c107625
@ -42,10 +42,23 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
@Override
|
@Override
|
||||||
public void checkB562Num(String deviceId, Integer tenantId,
|
public void checkB562Num(String deviceId, Integer tenantId,
|
||||||
int[] numB562Stat){
|
int[] numB562Stat){
|
||||||
|
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
|
||||||
|
if(status == null) return;
|
||||||
|
|
||||||
if(cfgMap.size() == 0) refreshCfg();
|
if(cfgMap.size() == 0) refreshCfg();
|
||||||
|
boolean isUpdated = false;
|
||||||
|
if ((status.getWarningcode() & (WarningCfg.TYPE_NO_FIXED_RESULT
|
||||||
|
| WarningCfg.TYPE_LESS_B562
|
||||||
|
| WarningCfg.TYPE_LESS_D3XX)) != 0) {
|
||||||
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_B562);
|
||||||
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_D3XX);
|
||||||
|
isUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// b562少
|
||||||
int[] threshold = cfgMap.get(WarningCfg.TYPE_LESS_B562);
|
int[] threshold = cfgMap.get(WarningCfg.TYPE_LESS_B562);
|
||||||
if(threshold != null && (numB562Stat[0] < threshold[1])) {
|
if(threshold != null && (numB562Stat[0] < threshold[1])) {
|
||||||
// 检测电压和RSSI
|
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
warningMsg.setDeviceid(deviceId);
|
warningMsg.setDeviceid(deviceId);
|
||||||
warningMsg.setTenantid(tenantId);
|
warningMsg.setTenantid(tenantId);
|
||||||
@ -55,43 +68,40 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
warningMsg.setLevel((short) threshold[0]);
|
warningMsg.setLevel((short) threshold[0]);
|
||||||
warningMsg.setInfo(WarningCfg.TYPE_NAME_LESS_B562+",固定解:" + numB562Stat[0] + ",非固定解:"+numB562Stat[1]+",无B562:"+numB562Stat[2]);
|
warningMsg.setInfo(WarningCfg.TYPE_NAME_LESS_B562+",固定解:" + numB562Stat[0] + ",非固定解:"+numB562Stat[1]+",无B562:"+numB562Stat[2]);
|
||||||
warningMsgMapper.insert(warningMsg);
|
warningMsgMapper.insert(warningMsg);
|
||||||
|
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_LESS_B562);
|
||||||
|
isUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
|
//连续无b562
|
||||||
// 清除d331告警
|
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_D3XX);
|
|
||||||
|
|
||||||
if(0 == numB562Stat[0]){
|
if(0 == numB562Stat[0]){
|
||||||
// 记录连续无固定解的轮数
|
// 记录连续无固定解的轮数
|
||||||
if(status != null){
|
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(count >= threshold2[1]){
|
// 连续6个周期无固定解则产生严重告警
|
||||||
// 连续6个周期无固定解则产生严重告警
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
warningMsg.setDeviceid(deviceId);
|
||||||
warningMsg.setDeviceid(deviceId);
|
warningMsg.setTenantid(tenantId);
|
||||||
warningMsg.setTenantid(tenantId);
|
warningMsg.setCreatetime(LocalDateTime.now());
|
||||||
warningMsg.setCreatetime(LocalDateTime.now());
|
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
||||||
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
warningMsg.setCode(WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
warningMsg.setCode(WarningCfg.TYPE_NO_FIXED_RESULT);
|
warningMsg.setLevel((short) threshold2[0]);
|
||||||
warningMsg.setLevel((short) threshold2[0]);
|
warningMsg.setInfo("连续" + count+"周期无固定解");
|
||||||
warningMsg.setInfo("连续" + count+"周期无固定解");
|
warningMsgMapper.insert(warningMsg);
|
||||||
warningMsgMapper.insert(warningMsg);
|
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_NO_FIXED_RESULT);
|
|
||||||
// 根据告警码确定告警级别
|
|
||||||
status.setWarning(getWarningLevel(status.getWarningcode()));
|
|
||||||
}
|
|
||||||
gnssStatusMapper.updateById(status);
|
|
||||||
}
|
}
|
||||||
|
isUpdated = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else if(isUpdated){ //b562有告警标志
|
||||||
if((status.getWarningcode()&WarningCfg.TYPE_NO_FIXED_RESULT) != 0){
|
status.setNoreslutcount(0);
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
}
|
||||||
status.setWarning(getWarningLevel(status.getWarningcode()));
|
|
||||||
status.setNoreslutcount(0);
|
if(isUpdated){
|
||||||
gnssStatusMapper.updateById(status);
|
// 根据告警码确定告警级别
|
||||||
}
|
status.setWarning(getWarningLevel(status.getWarningcode()));
|
||||||
|
gnssStatusMapper.updateById(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/***
|
/***
|
||||||
@ -165,28 +175,36 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkD3xxNum(Device device){
|
public void checkD3xxNum(Device device){
|
||||||
if(device.getD3xxCount() > 0) {
|
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
|
||||||
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
|
if(status != null) {
|
||||||
if(status != null) {
|
boolean isUpdated = false;
|
||||||
// 清除b562告警
|
// 清除b562告警
|
||||||
|
if((status.getWarningcode() & (WarningCfg.TYPE_NO_FIXED_RESULT
|
||||||
|
|WarningCfg.TYPE_LESS_B562
|
||||||
|
|WarningCfg.TYPE_LESS_D3XX)) !=0 ) {
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_B562);
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_B562);
|
||||||
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_D3XX);
|
||||||
|
isUpdated = true;
|
||||||
|
}
|
||||||
|
// 检查d331告警
|
||||||
|
if(cfgMap.size() == 0) refreshCfg();
|
||||||
|
int[] threshold = cfgMap.get(WarningCfg.TYPE_LESS_D3XX);
|
||||||
|
if(threshold != null && (device.getD3xxCount() < threshold[1])) {
|
||||||
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
|
warningMsg.setDeviceid(device.getDeviceId());
|
||||||
|
warningMsg.setTenantid(device.getTenantId());
|
||||||
|
warningMsg.setCreatetime(LocalDateTime.now());
|
||||||
|
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
||||||
|
warningMsg.setCode(WarningCfg.TYPE_LESS_D3XX);
|
||||||
|
warningMsg.setLevel((short) threshold[0]);
|
||||||
|
warningMsg.setInfo(WarningCfg.TYPE_NAME_LESS_D3XX+"," + device.getD3xxCount());
|
||||||
|
warningMsgMapper.insert(warningMsg);
|
||||||
|
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_LESS_D3XX);
|
||||||
|
isUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
// 检查d331告警
|
if(isUpdated) {
|
||||||
if(cfgMap.size() == 0) refreshCfg();
|
|
||||||
int[] threshold = cfgMap.get(WarningCfg.TYPE_LESS_D3XX);
|
|
||||||
if(threshold != null && (device.getD3xxCount() < threshold[1])) {
|
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
|
||||||
warningMsg.setDeviceid(device.getDeviceId());
|
|
||||||
warningMsg.setTenantid(device.getTenantId());
|
|
||||||
warningMsg.setCreatetime(LocalDateTime.now());
|
|
||||||
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
|
||||||
warningMsg.setCode(WarningCfg.TYPE_LESS_D3XX);
|
|
||||||
warningMsg.setLevel((short) threshold[0]);
|
|
||||||
warningMsg.setInfo(WarningCfg.TYPE_NAME_LESS_D3XX+"," + device.getD3xxCount());
|
|
||||||
warningMsgMapper.insert(warningMsg);
|
|
||||||
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_LESS_D3XX);
|
|
||||||
}
|
|
||||||
status.setWarning(getWarningLevel(status.getWarningcode()));
|
status.setWarning(getWarningLevel(status.getWarningcode()));
|
||||||
gnssStatusMapper.updateById(status);
|
gnssStatusMapper.updateById(status);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user