1、优化DEBUG的时机
2、优化device.clear的时机
This commit is contained in:
parent
2076b8bca0
commit
579a15e1bd
@ -203,8 +203,6 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
|||||||
future = ThreadManager.getScheduledThreadPool().schedule(() -> {
|
future = ThreadManager.getScheduledThreadPool().schedule(() -> {
|
||||||
try {
|
try {
|
||||||
calCycleResult(device, groupCalc,date);
|
calCycleResult(device, groupCalc,date);
|
||||||
// 清除统计
|
|
||||||
device.clearStat();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.toString());
|
logger.error(e.toString());
|
||||||
}
|
}
|
||||||
@ -283,6 +281,13 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新有效解时间
|
||||||
|
if(locationRecord.getEnabled()){
|
||||||
|
if(device.getLastValidCalcDataTime().isBefore(resultTime)){
|
||||||
|
device.setLastValidCalcDataTime(resultTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 记录本次位置,作为下次的参考
|
// 记录本次位置,作为下次的参考
|
||||||
if(focusCalculator.getVer()==6) {
|
if(focusCalculator.getVer()==6) {
|
||||||
if(locationRecord.getRpose()!=null) {
|
if(locationRecord.getRpose()!=null) {
|
||||||
|
|||||||
@ -40,18 +40,11 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
public Void execute(D331RtcmMessage message) {
|
public Void execute(D331RtcmMessage message) {
|
||||||
String id = message.getId();
|
String id = message.getId();
|
||||||
// 补齐tenantId
|
// 补齐tenantId
|
||||||
Device device1 = deviceService.findByDeviceId(id);
|
Device deviceBs = deviceService.findByDeviceId(id);
|
||||||
if(device1 == null || device1.getOpMode() == GnssDevice.OP_MODE_UNUSE) return null;
|
if(deviceBs == null || deviceBs.getOpMode() == GnssDevice.OP_MODE_UNUSE) return null;
|
||||||
|
|
||||||
// 原始码流输出到日志文件 -- INFO 级别
|
|
||||||
// 只有测站开了日志记录,或者消息来自基站,才将原码记录到日志文件
|
|
||||||
if(device1.getLoggingmode() == GnssDevice.LOGGING_MODE_FULL || device1.getDeviceType() == GnssDevice.TYPE_REFERENCE_STATION){
|
|
||||||
logger.info("receive {} d331 message: {}", message.getId(), DataTypeUtil.getHexString(message.getSrcData()));
|
|
||||||
logger.info("receive d331 rtcm message of device: {}, seq:{}, len:{}", message.getId(), message.getSeq(), message.getLen());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 推送基站数据
|
// 推送基站数据
|
||||||
if(device1.getOpMode() == GnssDevice.OP_MODE_USE) {
|
if(deviceBs.getOpMode() == GnssDevice.OP_MODE_USE) {
|
||||||
byte[] forwardBytes = message.getSrcData();
|
byte[] forwardBytes = message.getSrcData();
|
||||||
// 要求快速转发,因此用缓存,不要每次都查数据库
|
// 要求快速转发,因此用缓存,不要每次都查数据库
|
||||||
List<Device> deviceList = deviceService.findByParentId(id);
|
List<Device> deviceList = deviceService.findByParentId(id);
|
||||||
@ -74,26 +67,26 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 如果30分钟内收到不到d3f0和d3f2,则根据UDP最后一个报文触发状态更新和统计
|
// 如果30分钟内收到不到d3f0和d3f2,则根据UDP最后一个报文触发状态更新和统计
|
||||||
LocalDateTime now = LocalDateTime.now();
|
if(deviceBs.getD3xxbytes()>0){
|
||||||
if(device1.getLastRxTime()!=null &&
|
LocalDateTime now = LocalDateTime.now();
|
||||||
device1.getLastRxTime().isBefore(now.minusMinutes(1))){
|
if(deviceBs.getLastRxTime().isBefore(now.minusMinutes(1)) &&
|
||||||
if(device1.getLastD3f0f2Time() == null ||
|
(deviceBs.getLastD3f0f2Time() == null ||
|
||||||
device1.getLastD3f0f2Time().isBefore(now.minusMinutes(30))) {
|
deviceBs.getLastD3f0f2Time().isBefore(now.minusMinutes(30)))) {
|
||||||
// new cycle
|
// new cycle
|
||||||
logger.info("device {} rx {} d331 in a cycle while not d3f0f2",device1.getDeviceId(),device1.getD3xxCount());
|
logger.info("device {} rx {} d331 in a cycle while not d3f0f2",deviceBs.getDeviceId(),deviceBs.getD3xxCount());
|
||||||
|
|
||||||
Device lastCycleDevice = new Device();
|
Device lastCycleDevice = new Device();
|
||||||
lastCycleDevice.setDeviceId(device1.getDeviceId());
|
lastCycleDevice.setDeviceId(deviceBs.getDeviceId());
|
||||||
lastCycleDevice.setTenantId(device1.getTenantId());
|
lastCycleDevice.setTenantId(deviceBs.getTenantId());
|
||||||
lastCycleDevice.setD3xxbytes(device1.getD3xxbytes());
|
lastCycleDevice.setD3xxbytes(deviceBs.getD3xxbytes());
|
||||||
lastCycleDevice.setD3xxCount(device1.getD3xxCount());
|
lastCycleDevice.setD3xxCount(deviceBs.getD3xxCount());
|
||||||
lastCycleDevice.setLastRxTime(device1.getLastRxTime());
|
lastCycleDevice.setLastRxTime(deviceBs.getLastRxTime());
|
||||||
lastCycleDevice.setSatelitesInUse(device1.getSatelitesInUse());
|
lastCycleDevice.setSatelitesInUse(deviceBs.getSatelitesInUse());
|
||||||
device1.clearStat();
|
deviceBs.clearStat();
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
// 通知上线
|
// 通知上线
|
||||||
try {
|
try {
|
||||||
beidouClient.onDeviceActive(device1.getDeviceId(), device1.getTenantId());
|
beidouClient.onDeviceActive(deviceBs.getDeviceId(), deviceBs.getTenantId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.toString());
|
logger.error(e.toString());
|
||||||
}
|
}
|
||||||
@ -103,18 +96,26 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update trx
|
// update trx
|
||||||
device1.updateRx(message.getHeader(),message.getLen(),message.getPacketNum());
|
deviceBs.updateRx(message.getHeader(),message.getLen(),message.getPacketNum());
|
||||||
// update gga
|
// update gga
|
||||||
Gga gga = message.getGga();
|
Gga gga = message.getGga();
|
||||||
if(gga != null) {
|
if(gga != null) {
|
||||||
device1.updateSatelitesNum(gga.getSatellitesInUsed());
|
deviceBs.updateSatelitesNum(gga.getSatellitesInUsed());
|
||||||
//if(gga.isFixed()) { //基站的quality不会是4
|
//if(gga.isFixed()) { //基站的quality不会是4
|
||||||
device1.setLatitude(gga.getLatitude());
|
deviceBs.setLatitude(gga.getLatitude());
|
||||||
device1.setLongitude(gga.getLongitude());
|
deviceBs.setLongitude(gga.getLongitude());
|
||||||
device1.setAltitude(gga.getAltitude());
|
deviceBs.setAltitude(gga.getAltitude());
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
|
// 原始码流输出到日志文件 -- INFO 级别
|
||||||
|
// 只有测站开了日志记录,或者消息来自基站,才将原码记录到日志文件
|
||||||
|
if(deviceBs.getLoggingmode() == GnssDevice.LOGGING_MODE_FULL){
|
||||||
|
logger.info("receive {} d331 message: {}", message.getId(), DataTypeUtil.getHexString(message.getSrcData()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,23 +37,16 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
private DataPersistService dataPersistService;
|
private DataPersistService dataPersistService;
|
||||||
@Override
|
@Override
|
||||||
public Void execute(D341LocationMessage message) {
|
public Void execute(D341LocationMessage message) {
|
||||||
// 补齐tenantId,要求快速处理,因此用缓存,不要每次都查数据库
|
// 更新device对象统计
|
||||||
Device device = deviceService.findByDeviceId(message.getId());
|
Device device = deviceService.findByDeviceId(message.getId());
|
||||||
if(device == null) return null;
|
if(device == null) return null;
|
||||||
message.setTenantId(device.getTenantId());
|
|
||||||
|
|
||||||
// 原始码流输出到日志文件 -- INFO 级别
|
// 如果没有收到d3f2,这里判断是否是一个新的周期:上一次收到D341的时间大于两分钟且上次收到d3f2的时间大于30分钟
|
||||||
if(device.getLoggingmode() == GnssDevice.LOGGING_MODE_FULL){
|
if(device.getD341Count()>0) {
|
||||||
logger.info("receive "+message.getId()+" d341 message: "+ DataTypeUtil.getHexString(message.getSrcData()));
|
LocalDateTime now = LocalDateTime.now();
|
||||||
logger.info("receive d341 message of device: "+message.getId()+", seq:"+message.getSeq()+", len:"+message.getLen());
|
if (device.getLastRxTime().isBefore(now.minusMinutes(2)) &&
|
||||||
}
|
(device.getLastD3f0f2Time() == null ||
|
||||||
|
device.getLastD3f0f2Time().isBefore(now.minusMinutes(30)))) {
|
||||||
// trx cycle stat
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
if(device.getLastRxTime()!=null &&
|
|
||||||
device.getLastRxTime().isBefore(now.minusMinutes(2))){
|
|
||||||
if(device.getLastD3f0f2Time() == null ||
|
|
||||||
device.getLastD3f0f2Time().isBefore(now.minusMinutes(30))) {
|
|
||||||
// new cycle
|
// new cycle
|
||||||
Device lastCycleDevice = new Device();
|
Device lastCycleDevice = new Device();
|
||||||
lastCycleDevice.setDeviceId(device.getDeviceId());
|
lastCycleDevice.setDeviceId(device.getDeviceId());
|
||||||
@ -78,6 +71,7 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update trx
|
// update trx
|
||||||
|
message.setTenantId(device.getTenantId());
|
||||||
device.updateRx(message.getHeader(), message.getLen(), 1);
|
device.updateRx(message.getHeader(), message.getLen(), 1);
|
||||||
if(device.isB562AsCalc()) {
|
if(device.isB562AsCalc()) {
|
||||||
double[] pos = message.getB562_loc();
|
double[] pos = message.getB562_loc();
|
||||||
@ -91,13 +85,6 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
device.setLatitude(gga.getLatitude());
|
device.setLatitude(gga.getLatitude());
|
||||||
device.setLongitude(gga.getLongitude());
|
device.setLongitude(gga.getLongitude());
|
||||||
device.setAltitude(gga.getAltitude());
|
device.setAltitude(gga.getAltitude());
|
||||||
}else{
|
|
||||||
// 若不是固定解,则打印原始码流到日志里
|
|
||||||
if(device.getLoggingmode() == GnssDevice.LOGGING_MODE_SIMPLE){
|
|
||||||
logger.info("receive {} d341 message: {}", message.getId(), DataTypeUtil.getHexString(message.getSrcData()));
|
|
||||||
logger.info("receive d341 message of device: {}, seq:{}, len:{}", message.getId(), message.getSeq(), message.getLen());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!device.isB562AsCalc()){
|
if(!device.isB562AsCalc()){
|
||||||
device.updateCalcQuality(gga.getQuality());
|
device.updateCalcQuality(gga.getQuality());
|
||||||
@ -106,6 +93,17 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
|
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
gnssCalcService.calcSingle(message,true);
|
gnssCalcService.calcSingle(message,true);
|
||||||
|
// 原始码流输出到日志文件 -- INFO 级别
|
||||||
|
if(device.getLoggingmode() == GnssDevice.LOGGING_MODE_FULL){
|
||||||
|
logger.info("receive {} d341 message: {}", message.getId(), DataTypeUtil.getHexString(message.getSrcData()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Gga gga1 = message.getGga();
|
||||||
|
if (gga1 != null && !gga1.isFixed()) {
|
||||||
|
// 若不是固定解,则打印原始码流到日志里
|
||||||
|
logger.info("receive {} d341 message: {}", message.getId(), DataTypeUtil.getHexString(message.getSrcData()));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -115,4 +113,8 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
public Class<?> getMessageType() {
|
public Class<?> getMessageType() {
|
||||||
return D341LocationMessage.class;
|
return D341LocationMessage.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void executeInThread(D341LocationMessage message){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,8 +67,20 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
|||||||
|
|
||||||
// 储设备收发字节数统计信息
|
// 储设备收发字节数统计信息
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
|
// 开始周期解算
|
||||||
LocalDateTime uploadTime = multiLineGNSSCalcService.checkUploadTime(
|
LocalDateTime uploadTime = multiLineGNSSCalcService.checkUploadTime(
|
||||||
device.getDeviceId(), device.getTenantId());
|
device.getDeviceId(), device.getTenantId());
|
||||||
|
gnssCalcService.calSingleDone(device, null, message.getCreateTime());
|
||||||
|
|
||||||
|
// 检查告警
|
||||||
|
if(device.getDeviceType() == Device.DEVICE_BASE_STATION) {
|
||||||
|
warningService.checkD3xxNum(device);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
warningService.checkB562Num(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存统计
|
||||||
dataPersistService.saveDeviceTrxStat(message, (uploadTime!=null), device);
|
dataPersistService.saveDeviceTrxStat(message, (uploadTime!=null), device);
|
||||||
|
|
||||||
// 保存缓存中的 GNSS 单次解析结果
|
// 保存缓存中的 GNSS 单次解析结果
|
||||||
@ -87,15 +99,8 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
|||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
|
|
||||||
}
|
}
|
||||||
// 检查告警
|
// 清除统计
|
||||||
if(device.getDeviceType() == Device.DEVICE_BASE_STATION) {
|
device.clearStat();
|
||||||
warningService.checkD3xxNum(device);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
warningService.checkB562Num(device);
|
|
||||||
}
|
|
||||||
// 开始周期解算
|
|
||||||
gnssCalcService.calSingleDone(device, null, message.getCreateTime());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -73,6 +73,7 @@ public class Device {
|
|||||||
|
|
||||||
int fixedNum = 0;
|
int fixedNum = 0;
|
||||||
int floatNum = 0;
|
int floatNum = 0;
|
||||||
|
LocalDateTime lastValidCalcDataTime; //最近一次有效解
|
||||||
|
|
||||||
public void updateRx(int head, int bytes,int count){
|
public void updateRx(int head, int bytes,int count){
|
||||||
lastRxHead = head;
|
lastRxHead = head;
|
||||||
|
|||||||
@ -104,7 +104,7 @@ public class DeviceStatusChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 28 * * * ?") // 每小时执行一次
|
@Scheduled(cron = "0 27 * * * ?") // 每小时执行一次
|
||||||
void checkRoverStationCalcData() throws ExecutionException, InterruptedException {
|
void checkRoverStationCalcData() throws ExecutionException, InterruptedException {
|
||||||
// 获取无固定解告警配置
|
// 获取无固定解告警配置
|
||||||
QueryWrapper<WarningCfg> warningCfgQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<WarningCfg> warningCfgQueryWrapper = new QueryWrapper<>();
|
||||||
@ -113,7 +113,7 @@ public class DeviceStatusChecker {
|
|||||||
WarningCfg warningCfg = warningCfgMapper.selectOne(warningCfgQueryWrapper);
|
WarningCfg warningCfg = warningCfgMapper.selectOne(warningCfgQueryWrapper);
|
||||||
if(warningCfg == null) return;
|
if(warningCfg == null) return;
|
||||||
|
|
||||||
// 获取所有n个小时内无固定解的测站
|
// 获取所有warningCfg.getValue()个小时内无固定解的测站
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
LocalDateTime beginTime = now.minusHours(warningCfg.getValue());
|
LocalDateTime beginTime = now.minusHours(warningCfg.getValue());
|
||||||
QueryWrapper<GnssCalcData> calcDataQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<GnssCalcData> calcDataQueryWrapper = new QueryWrapper<>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user