1、4小时内无固定解告警推送短信
This commit is contained in:
parent
053513c602
commit
f7b1b2cf56
@ -38,8 +38,8 @@ public class WarningCfg {
|
|||||||
public static final String TYPE_NAME_LESS_B562 = "固定解少";
|
public static final String TYPE_NAME_LESS_B562 = "固定解少";
|
||||||
public static final int TYPE_NO_FIXED_RESULT = 0x100;
|
public static final int TYPE_NO_FIXED_RESULT = 0x100;
|
||||||
public static final String TYPE_NAME_NO_FIXED_RESULT = "连续无固定解";
|
public static final String TYPE_NAME_NO_FIXED_RESULT = "连续无固定解";
|
||||||
public static final int TYPE_BS_NO_RESULT = 0x200;
|
//public static final int TYPE_BS_NO_RESULT = 0x200;
|
||||||
public static final String TYPE_NAME_BS_NO_RESULT = "基站下的测站均无解";
|
//public static final String TYPE_NAME_BS_NO_RESULT = "基站下的测站均无解";
|
||||||
public static final int TYPE_INCLINE = 0x400;
|
public static final int TYPE_INCLINE = 0x400;
|
||||||
public static final String TYPE_NAME_INCLINE = "异常倾斜";
|
public static final String TYPE_NAME_INCLINE = "异常倾斜";
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ public class WarningCfg {
|
|||||||
if((code & TYPE_LESS_D3XX) !=0) warningInfo.add(TYPE_NAME_LESS_D3XX);
|
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_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_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);
|
//if((code & TYPE_BS_NO_RESULT) !=0) warningInfo.add(TYPE_NAME_BS_NO_RESULT);
|
||||||
if((code & TYPE_INCLINE) !=0) warningInfo.add(TYPE_NAME_INCLINE);
|
if((code & TYPE_INCLINE) !=0) warningInfo.add(TYPE_NAME_INCLINE);
|
||||||
return warningInfo;
|
return warningInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,18 +61,12 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
numB562Stat[0],null,
|
numB562Stat[0],null,
|
||||||
"固定解:"+numB562Stat[0]+",浮点解:"+numB562Stat[1]+",全零:"+numB562Stat[2])) isUpdated=true;
|
"固定解:"+numB562Stat[0]+",浮点解:"+numB562Stat[1]+",全零:"+numB562Stat[2])) isUpdated=true;
|
||||||
|
|
||||||
//连续无b562
|
//清除连续无b562
|
||||||
if(0 == numB562Stat[0]){
|
if(0 != numB562Stat[0]){
|
||||||
// 记录连续无固定解的轮数
|
if ((status.getWarningcode() & WarningCfg.TYPE_NO_FIXED_RESULT) != 0) {
|
||||||
int count = status.getNoreslutcount()+1;
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
status.setNoreslutcount(count);
|
isUpdated = true;
|
||||||
if(check(status, WarningCfg.TYPE_NO_FIXED_RESULT,
|
}
|
||||||
WarningCfg.TYPE_NAME_NO_FIXED_RESULT, false,
|
|
||||||
count, null,null)) isUpdated=true;
|
|
||||||
}
|
|
||||||
else if(isUpdated){ //b562有告警标志
|
|
||||||
status.setNoreslutcount(0);
|
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isUpdated){
|
if(isUpdated){
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class WarningController extends BasicController implements CommonExcelSer
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public static void init() {
|
public static void init() {
|
||||||
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_BS_NO_RESULT, WarningCfg.TYPE_NAME_BS_NO_RESULT);
|
//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_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);
|
||||||
|
|||||||
@ -101,78 +101,71 @@ public class DeviceStatusChecker {
|
|||||||
|
|
||||||
@Scheduled(cron = "0 28 * * * ?") // 每小时执行一次
|
@Scheduled(cron = "0 28 * * * ?") // 每小时执行一次
|
||||||
void checkRoverStationCalcData() throws ExecutionException, InterruptedException {
|
void checkRoverStationCalcData() throws ExecutionException, InterruptedException {
|
||||||
//获取所有基站
|
// 获取无固定解告警配置
|
||||||
|
QueryWrapper<WarningCfg> warningCfgQueryWrapper = new QueryWrapper<>();
|
||||||
|
warningCfgQueryWrapper.eq("typename",WarningCfg.TYPE_NAME_NO_FIXED_RESULT);
|
||||||
|
warningCfgQueryWrapper.last("limit 1");
|
||||||
|
WarningCfg warningCfg = warningCfgMapper.selectOne(warningCfgQueryWrapper);
|
||||||
|
if(warningCfg == null) return;
|
||||||
|
|
||||||
|
// 获取所有n个小时内无固定解的测站
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime beginTime = now.minusHours(warningCfg.getValue());
|
||||||
|
QueryWrapper<GnssCalcData> calcDataQueryWrapper = new QueryWrapper<>();
|
||||||
|
calcDataQueryWrapper.ge("createtime",beginTime.format(formatter));
|
||||||
|
List<GnssCalcData> calcDataList = dataMapper.selectList(calcDataQueryWrapper);
|
||||||
|
|
||||||
|
MPJQueryWrapper<GnssStatus> queryWrapper =
|
||||||
|
new MPJQueryWrapper<GnssStatus>()
|
||||||
|
.selectAll(GnssStatus.class)
|
||||||
|
.leftJoin("gnssdevices d on t.deviceid = d.deviceid")
|
||||||
|
.eq("d.devicetype",GnssDevice.TYPE_REFERENCE_STATION)
|
||||||
|
.eq("d.opmode",GnssDevice.OP_MODE_USE)
|
||||||
|
.ne("t.state",GnssStatus.STATE_OFFLINE);
|
||||||
|
List<GnssStatus> statusList = gnssStatusMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
List<String> deviceIds = new ArrayList<>();
|
List<String> deviceIds = new ArrayList<>();
|
||||||
QueryWrapper<GnssDevice> deviceQueryWrapper = new QueryWrapper<>();
|
for(GnssStatus status: statusList){
|
||||||
deviceQueryWrapper.eq("devicetype", GnssDevice.TYPE_REFERENCE_STATION);
|
int warningCode = WarningCfg.TYPE_NO_FIXED_RESULT;
|
||||||
deviceQueryWrapper.ne("opmode", GnssDevice.OP_MODE_UNUSE);
|
for(GnssCalcData calcData:calcDataList){
|
||||||
List<GnssDevice> bsList = deviceMapper.selectList(deviceQueryWrapper);
|
if(status.getDeviceid().equals(calcData.getDeviceid())){
|
||||||
for(GnssDevice bs:bsList){
|
warningCode = 0;
|
||||||
GnssStatus status = gnssStatusMapper.getByDeviceId(bs.getDeviceid());
|
break;
|
||||||
if(status != null && status.getState()!=GnssStatus.STATE_OFFLINE) {
|
|
||||||
int warningCode = 0;
|
|
||||||
if(!isRoverStationNormal(bs.getDeviceid())){
|
|
||||||
warningCode = WarningCfg.TYPE_BS_NO_RESULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// warningCode changed
|
|
||||||
if(warningCode != (status.getWarningcode()&WarningCfg.TYPE_BS_NO_RESULT)){
|
|
||||||
//清除原来的告警
|
|
||||||
if(warningCode == 0) {
|
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_BS_NO_RESULT);
|
|
||||||
status.setWarning(WarningCfg.LEVEL_0);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
WarningMsg warningMsg = new WarningMsg();
|
|
||||||
warningMsg.setDeviceid(bs.getDeviceid());
|
|
||||||
warningMsg.setTenantid(bs.getTenantid());
|
|
||||||
warningMsg.setCreatetime(LocalDateTime.now());
|
|
||||||
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
|
||||||
warningMsg.setCode(WarningCfg.TYPE_BS_NO_RESULT);
|
|
||||||
warningMsg.setLevel(WarningCfg.LEVEL_2);
|
|
||||||
warningMsg.setInfo(WarningCfg.TYPE_NAME_BS_NO_RESULT);
|
|
||||||
warningMsgMapper.insert(warningMsg);
|
|
||||||
|
|
||||||
status.setWarningcode(status.getWarningcode() | WarningCfg.TYPE_BS_NO_RESULT);
|
|
||||||
status.setWarning(WarningCfg.LEVEL_2);
|
|
||||||
deviceIds.add(bs.getDeviceid()+"("+bs.getName()+")");
|
|
||||||
}
|
|
||||||
gnssStatusMapper.updateById(status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(warningCode != (status.getWarningcode()&WarningCfg.TYPE_NO_FIXED_RESULT)){
|
||||||
|
//清除原来的告警
|
||||||
|
if(warningCode == 0) {
|
||||||
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
|
status.setWarning(WarningCfg.LEVEL_0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
WarningMsg warningMsg = new WarningMsg();
|
||||||
|
warningMsg.setDeviceid(status.getDeviceid());
|
||||||
|
warningMsg.setTenantid(status.getTenantid());
|
||||||
|
warningMsg.setCreatetime(now);
|
||||||
|
warningMsg.setDevicetype(WarningCfg.TYPE_GNSS);
|
||||||
|
warningMsg.setCode(WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
|
warningMsg.setLevel(WarningCfg.LEVEL_2);
|
||||||
|
warningMsg.setInfo(WarningCfg.TYPE_NAME_NO_FIXED_RESULT);
|
||||||
|
warningMsgMapper.insert(warningMsg);
|
||||||
|
|
||||||
|
status.setWarningcode(status.getWarningcode() | WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
|
status.setWarning(WarningCfg.LEVEL_2);
|
||||||
|
deviceIds.add(status.getDeviceid());
|
||||||
|
}
|
||||||
|
gnssStatusMapper.updateById(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发短信通知
|
// 发短信通知
|
||||||
if(deviceIds.size()>0){
|
if(deviceIds.size()>0){
|
||||||
notificationService.onWarning(deviceIds.toString(),
|
notificationService.onWarning(deviceIds.toString(),
|
||||||
WarningCfg.TYPE_NAME_BS_NO_RESULT,
|
WarningCfg.TYPE_NAME_NO_FIXED_RESULT,
|
||||||
LocalDateTime.now().format(formatter),
|
LocalDateTime.now().format(formatter),
|
||||||
WarningCfg.LEVEL_2);
|
WarningCfg.LEVEL_2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* 检查基站下的测站最近一个小时是否全都无固定解
|
|
||||||
*/
|
|
||||||
boolean isRoverStationNormal(String parentId){
|
|
||||||
//是否有关联测站
|
|
||||||
QueryWrapper<GnssDevice> deviceQueryWrapper = new QueryWrapper<>();
|
|
||||||
deviceQueryWrapper.eq("parentid", parentId);
|
|
||||||
deviceQueryWrapper.eq("opmode",GnssDevice.OP_MODE_USE);
|
|
||||||
if(deviceMapper.selectCount(deviceQueryWrapper) == 0) return true;
|
|
||||||
|
|
||||||
//如果有关联的测站,检查解算结果
|
|
||||||
LocalDateTime endTime = LocalDateTime.now();
|
|
||||||
LocalDateTime beginTime = endTime.minusHours(1);
|
|
||||||
MPJQueryWrapper<GnssCalcData> queryWrapper =
|
|
||||||
new MPJQueryWrapper<GnssCalcData>()
|
|
||||||
.selectAll(GnssCalcData.class)
|
|
||||||
.leftJoin("gnssdevices d on t.deviceid = d.deviceid")
|
|
||||||
.eq("d.parentid",parentId)
|
|
||||||
.between("t.createtime",beginTime.format(formatter),endTime.format(formatter))
|
|
||||||
.eq("t.enabled",true);
|
|
||||||
List<GnssCalcData> dataList = dataMapper.selectList(queryWrapper);
|
|
||||||
return dataList.size()>0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user