修改d331告警清除

This commit is contained in:
weidong 2024-02-04 15:09:33 +08:00
parent 05e79800c7
commit 877c107625

View File

@ -42,10 +42,23 @@ public class WarningServiceImpl implements WarningService {
@Override
public void checkB562Num(String deviceId, Integer tenantId,
int[] numB562Stat){
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
if(status == null) return;
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);
if(threshold != null && (numB562Stat[0] < threshold[1])) {
// 检测电压和RSSI
WarningMsg warningMsg = new WarningMsg();
warningMsg.setDeviceid(deviceId);
warningMsg.setTenantid(tenantId);
@ -55,15 +68,13 @@ public class WarningServiceImpl implements WarningService {
warningMsg.setLevel((short) threshold[0]);
warningMsg.setInfo(WarningCfg.TYPE_NAME_LESS_B562+",固定解:" + numB562Stat[0] + ",非固定解:"+numB562Stat[1]+"无B562:"+numB562Stat[2]);
warningMsgMapper.insert(warningMsg);
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_LESS_B562);
isUpdated = true;
}
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
// 清除d331告警
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_D3XX);
//连续无b562
if(0 == numB562Stat[0]){
// 记录连续无固定解的轮数
if(status != null){
int count = status.getNoreslutcount()+1;
status.setNoreslutcount(count);
int[] threshold2 = cfgMap.get(WarningCfg.TYPE_NO_FIXED_RESULT);
@ -79,21 +90,20 @@ public class WarningServiceImpl implements WarningService {
warningMsg.setInfo("连续" + count+"周期无固定解");
warningMsgMapper.insert(warningMsg);
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_NO_FIXED_RESULT);
}
isUpdated = true;
}
else if(isUpdated){ //b562有告警标志
status.setNoreslutcount(0);
}
if(isUpdated){
// 根据告警码确定告警级别
status.setWarning(getWarningLevel(status.getWarningcode()));
}
gnssStatusMapper.updateById(status);
}
}
else{
if((status.getWarningcode()&WarningCfg.TYPE_NO_FIXED_RESULT) != 0){
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
status.setWarning(getWarningLevel(status.getWarningcode()));
status.setNoreslutcount(0);
gnssStatusMapper.updateById(status);
}
}
}
/***
* 检查电压RSSI等
* @param statusMsg
@ -165,13 +175,18 @@ public class WarningServiceImpl implements WarningService {
@Override
public void checkD3xxNum(Device device){
if(device.getD3xxCount() > 0) {
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
if(status != null) {
boolean isUpdated = false;
// 清除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_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);
@ -186,7 +201,10 @@ public class WarningServiceImpl implements WarningService {
warningMsg.setInfo(WarningCfg.TYPE_NAME_LESS_D3XX+"" + device.getD3xxCount());
warningMsgMapper.insert(warningMsg);
status.setWarningcode(status.getWarningcode()|WarningCfg.TYPE_LESS_D3XX);
isUpdated = true;
}
if(isUpdated) {
status.setWarning(getWarningLevel(status.getWarningcode()));
gnssStatusMapper.updateById(status);
}