1、滤波结果跳变门限可配置,暂停自动停止推送功能
This commit is contained in:
parent
3b72967226
commit
00634964fe
@ -42,8 +42,14 @@ public class WarningCfg {
|
||||
public static final String TYPE_NAME_CONT_INVALID_RESULT = "长时间无有效解";
|
||||
public static final int TYPE_INCLINE = 0x400;
|
||||
public static final String TYPE_NAME_INCLINE = "异常倾斜";
|
||||
public static final int TYPE_JUMP = 0x800;
|
||||
public static final String TYPE_NAME_JUMP = "滤波结果跳变";
|
||||
public static final int TYPE_SIM_STATUS_ABNORMAL = 0x800;
|
||||
public static final String TYPE_NAME_SIM_STATUS_ABNORMAL = "流量卡状态异常";
|
||||
public static final int TYPE_SIM_LOW_TRAFFIC = 0x1000;
|
||||
public static final String TYPE_NAME_SIM_LOW_TRAFFIC = "流量卡流量不足";
|
||||
public static final int TYPE_XY_JUMP = 0x2000;
|
||||
public static final String TYPE_NAME_XY_JUMP = "滤波结果水平跳变";
|
||||
public static final int TYPE_Z_JUMP = 0x4000;
|
||||
public static final String TYPE_NAME_Z_JUMP = "滤波结果高程跳变";
|
||||
|
||||
// warning level definition
|
||||
public static final short LEVEL_0 = 0; //正常
|
||||
@ -70,6 +76,8 @@ public class WarningCfg {
|
||||
if((code & TYPE_NO_FIXED_RESULT) !=0) warningInfo.add(TYPE_NAME_NO_FIXED_RESULT);
|
||||
if((code & TYPE_CONT_INVALID_RESULT) !=0) warningInfo.add(TYPE_NAME_CONT_INVALID_RESULT);
|
||||
if((code & TYPE_INCLINE) !=0) warningInfo.add(TYPE_NAME_INCLINE);
|
||||
if((code & TYPE_SIM_STATUS_ABNORMAL) !=0) warningInfo.add(TYPE_NAME_SIM_STATUS_ABNORMAL);
|
||||
if((code & TYPE_SIM_LOW_TRAFFIC) !=0) warningInfo.add(TYPE_NAME_SIM_LOW_TRAFFIC);
|
||||
return warningInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.imdroid.sideslope.service;
|
||||
import com.imdroid.secapi.dto.GnssCalcData;
|
||||
import com.imdroid.secapi.dto.GnssStatus;
|
||||
import com.imdroid.secapi.dto.GnssStatusMsg;
|
||||
import com.imdroid.secapi.dto.GnssTrxMsg;
|
||||
import com.imdroid.sideslope.sal.Device;
|
||||
|
||||
public interface WarningService {
|
||||
|
||||
@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -259,7 +261,80 @@ public class WarningServiceImpl implements WarningService {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
// 检查SIM卡状态
|
||||
public void checkSimCardStatus(Device device, SimCard simCard) {
|
||||
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
|
||||
if (status == null) return;
|
||||
|
||||
boolean isUpdated = false;
|
||||
|
||||
// 检查SIM卡状态是否异常(停机、注销、失效)
|
||||
if (simCard.getStatus() == SimCard.STATUS_SUSPENDED ||
|
||||
simCard.getStatus() == SimCard.STATUS_CANCELLED ||
|
||||
simCard.getStatus() == SimCard.STATUS_INVALID) {
|
||||
|
||||
String statusDesc;
|
||||
switch(simCard.getStatus()) {
|
||||
case SimCard.STATUS_SUSPENDED:
|
||||
statusDesc = "停机";
|
||||
break;
|
||||
case SimCard.STATUS_CANCELLED:
|
||||
statusDesc = "注销";
|
||||
break;
|
||||
case SimCard.STATUS_INVALID:
|
||||
statusDesc = "失效";
|
||||
break;
|
||||
default:
|
||||
statusDesc = "未知状态";
|
||||
}
|
||||
|
||||
if (check(status, WarningCfg.TYPE_SIM_STATUS_ABNORMAL,
|
||||
WarningCfg.TYPE_NAME_SIM_STATUS_ABNORMAL, false,
|
||||
simCard.getStatus(), null,
|
||||
"SIM卡状态: " + statusDesc)) {
|
||||
isUpdated = true;
|
||||
}
|
||||
} else if (simCard.getStatus() == SimCard.STATUS_ACTIVATED) {
|
||||
// 状态正常(已激活),清除告警
|
||||
if ((status.getWarningcode() & WarningCfg.TYPE_SIM_STATUS_ABNORMAL) != 0) {
|
||||
clearWarning(status, WarningCfg.TYPE_SIM_STATUS_ABNORMAL);
|
||||
isUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isUpdated) {
|
||||
status.setWarning(getWarningLevel(status.getWarningcode()));
|
||||
gnssStatusMapper.updateById(status);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkSimCardTraffic(Device device, SimCard simCard) {
|
||||
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
|
||||
if (status == null) return;
|
||||
|
||||
boolean isUpdated = false;
|
||||
|
||||
BigDecimal usedPercentage = simCard.getUsed()
|
||||
.divide(simCard.getTotal(), 4, RoundingMode.HALF_UP)
|
||||
.multiply(BigDecimal.valueOf(100));
|
||||
|
||||
// 检查流量使用情况
|
||||
if (check(status, WarningCfg.TYPE_SIM_LOW_TRAFFIC,
|
||||
WarningCfg.TYPE_NAME_SIM_LOW_TRAFFIC,
|
||||
false, // 大于等于流量门限值,那么就报警
|
||||
usedPercentage.intValue(),
|
||||
null,
|
||||
String.format("流量已使用 %.2f%%", usedPercentage.doubleValue()))) {
|
||||
isUpdated = true;
|
||||
}
|
||||
|
||||
if (isUpdated) {
|
||||
status.setWarning(getWarningLevel(status.getWarningcode()));
|
||||
gnssStatusMapper.updateById(status);
|
||||
}
|
||||
}
|
||||
*/
|
||||
public void generate_warning_logs(String device_id,int warning_type,String warning_type_name){
|
||||
// 连续无固定解 和 掉电 警告
|
||||
if (warning_type == WarningCfg.TYPE_NO_FIXED_RESULT || warning_type == WarningCfg.TYPE_LOW_VOLTAGE) {
|
||||
@ -286,9 +361,22 @@ public class WarningServiceImpl implements WarningService {
|
||||
|
||||
@Override
|
||||
public void checkFilteredResultJump(double[] latestRpos, GnssCalcData locationRecord){
|
||||
if(Math.abs(locationRecord.getRpose()-latestRpos[0])>2 ||
|
||||
Math.abs(locationRecord.getRposn()-latestRpos[1])>2 ||
|
||||
Math.abs(locationRecord.getRposd()-latestRpos[2])>4){
|
||||
int[] warningValuesXY = cfgMap.get(WarningCfg.TYPE_XY_JUMP);
|
||||
int[] warningValuesZ = cfgMap.get(WarningCfg.TYPE_Z_JUMP);
|
||||
int warningCode = 0;
|
||||
if(warningValuesXY!=null){
|
||||
if(Math.abs(locationRecord.getRpose()-latestRpos[0])>warningValuesXY[1] ||
|
||||
Math.abs(locationRecord.getRposn()-latestRpos[1])>warningValuesXY[1]){
|
||||
warningCode = WarningCfg.TYPE_XY_JUMP;
|
||||
}
|
||||
}
|
||||
if(warningCode==0 && warningValuesZ!=null){
|
||||
if(Math.abs(locationRecord.getRposd()-latestRpos[2])>warningValuesZ[1]){
|
||||
warningCode = WarningCfg.TYPE_Z_JUMP;
|
||||
}
|
||||
}
|
||||
|
||||
if(warningCode!=0){
|
||||
// 停止推送
|
||||
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("deviceid",locationRecord.getDeviceid());
|
||||
@ -300,13 +388,13 @@ public class WarningServiceImpl implements WarningService {
|
||||
!unFwdGroupName.equals(device.getFwd_group_id())){
|
||||
device.setFwd_group_id(unFwdGroupName);
|
||||
device.setFwd_group_id2(unFwdGroupName);
|
||||
deviceMapper.updateById(device);
|
||||
//deviceMapper.updateById(device);
|
||||
// 产生告警
|
||||
WarningMsg warningMsg = new WarningMsg();
|
||||
warningMsg.setDeviceid(device.getDeviceid());
|
||||
warningMsg.setTenantid(device.getTenantid());
|
||||
warningMsg.setCreatetime(LocalDateTime.now());
|
||||
warningMsg.setCode(WarningCfg.TYPE_JUMP);
|
||||
warningMsg.setCode(warningCode);
|
||||
warningMsg.setLevel(WarningCfg.LEVEL_2);
|
||||
double deltaE = locationRecord.getRpose()-latestRpos[0];
|
||||
double deltaN = locationRecord.getRposn()-latestRpos[1];
|
||||
|
||||
@ -47,6 +47,10 @@ public class WarningController extends BasicController implements CommonExcelSer
|
||||
warningMap.put(WarningCfg.TYPE_LOW_RSSI, WarningCfg.TYPE_NAME_LOW_RSSI);
|
||||
warningMap.put(WarningCfg.TYPE_RX_MUCH_UNKNOWN, WarningCfg.TYPE_NAME_RX_MUCH_UNKNOWN);
|
||||
warningMap.put(WarningCfg.TYPE_INCLINE, WarningCfg.TYPE_NAME_INCLINE);
|
||||
warningMap.put(WarningCfg.TYPE_SIM_LOW_TRAFFIC, WarningCfg.TYPE_NAME_SIM_LOW_TRAFFIC);
|
||||
warningMap.put(WarningCfg.TYPE_SIM_STATUS_ABNORMAL, WarningCfg.TYPE_NAME_SIM_STATUS_ABNORMAL);
|
||||
warningMap.put(WarningCfg.TYPE_XY_JUMP, WarningCfg.TYPE_NAME_XY_JUMP);
|
||||
warningMap.put(WarningCfg.TYPE_Z_JUMP, WarningCfg.TYPE_NAME_Z_JUMP);
|
||||
}
|
||||
|
||||
/**** 推送页面 *****/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user