增加d331告警
This commit is contained in:
parent
83cccb924c
commit
115bc5301b
@ -8,6 +8,7 @@ import com.imdroid.sideslope.sal.Device;
|
||||
import com.imdroid.sideslope.sal.DeviceService;
|
||||
import com.imdroid.sideslope.service.DataPersistService;
|
||||
import com.imdroid.common.util.ThreadManager;
|
||||
import com.imdroid.sideslope.service.WarningService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -34,6 +35,8 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
||||
private BeidouClient beidouClient;
|
||||
@Autowired
|
||||
MultiLineGNSSCalcService multiLineGNSSCalcService;
|
||||
@Autowired
|
||||
WarningService warningService;
|
||||
|
||||
@Override
|
||||
public Void execute(D3F2StopIndicationMessage message) {
|
||||
@ -47,19 +50,20 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
||||
message.setTenantId(device.getTenantId());
|
||||
GnssTrxMsg gnssTrxMsg = message.getTrxMsg();
|
||||
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
|
||||
gnssTrxMsg.setB562bytes(device.getB562bytes());
|
||||
|
||||
LocalDateTime uploadTime = multiLineGNSSCalcService.checkUploadTime(
|
||||
device.getDeviceId(), device.getTenantId());
|
||||
gnssTrxMsg.setB562bytes(device.getD341bytes());
|
||||
|
||||
// 储设备收发字节数统计信息
|
||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||
LocalDateTime uploadTime = multiLineGNSSCalcService.checkUploadTime(
|
||||
device.getDeviceId(), device.getTenantId());
|
||||
dataPersistService.saveDeviceTrxStat(message, (uploadTime!=null));
|
||||
// 通知beidou服务设备休眠
|
||||
beidouClient.onDeviceStop(deviceId,device.getTenantId());
|
||||
if(uploadTime!=null){
|
||||
beidouClient.onGnssUpload(deviceId,device.getTenantId(),uploadTime);
|
||||
}
|
||||
// 检查告警
|
||||
warningService.checkD3xxNum(device);
|
||||
});
|
||||
|
||||
return null;
|
||||
|
||||
@ -35,20 +35,26 @@ public class Device {
|
||||
private Integer calcGroupId;
|
||||
private Short opMode;
|
||||
|
||||
int d3xxCount = 0;
|
||||
int d3xxbytes = 0;
|
||||
int b562bytes = 0;
|
||||
int d341Count = 0;
|
||||
int d341bytes = 0;
|
||||
|
||||
public void updateD331Bytes(int bytes){
|
||||
d3xxCount++;
|
||||
d3xxbytes += bytes;
|
||||
}
|
||||
|
||||
public void updateD341Bytes(int bytes){
|
||||
b562bytes += bytes;
|
||||
d341Count++;
|
||||
d341bytes += bytes;
|
||||
}
|
||||
|
||||
public void clearStat(){
|
||||
d3xxCount = 0;
|
||||
d3xxbytes = 0;
|
||||
b562bytes = 0;
|
||||
d341Count = 0;
|
||||
d341bytes = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.imdroid.sideslope.service;
|
||||
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 {
|
||||
/***
|
||||
@ -22,4 +23,6 @@ public interface WarningService {
|
||||
* @param msg
|
||||
*/
|
||||
void checkTrx(GnssTrxMsg msg, GnssStatus curStatus);
|
||||
|
||||
void checkD3xxNum(Device device);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.imdroid.sideslope.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.imdroid.secapi.dto.*;
|
||||
import com.imdroid.sideslope.sal.Device;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -158,4 +159,34 @@ public class WarningServiceImpl implements WarningService {
|
||||
else if((warningCode & warningLevel2Code) !=0 ) return WarningCfg.LEVEL_2;
|
||||
else return WarningCfg.LEVEL_1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkD3xxNum(Device device){
|
||||
if(device.getD3xxCount() > 0) {
|
||||
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
|
||||
if(status != null) {
|
||||
// 清除b562告警
|
||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_LESS_B562);
|
||||
|
||||
// 检查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);
|
||||
}
|
||||
status.setWarning(getWarningLevel(status.getWarningcode()));
|
||||
gnssStatusMapper.updateById(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user