diff --git a/sec-beidou-fwd/src/main/java/com/imdroid/beidou_fwd/task/Forwarder.java b/sec-beidou-fwd/src/main/java/com/imdroid/beidou_fwd/task/Forwarder.java index 45288edf..0d79000b 100644 --- a/sec-beidou-fwd/src/main/java/com/imdroid/beidou_fwd/task/Forwarder.java +++ b/sec-beidou-fwd/src/main/java/com/imdroid/beidou_fwd/task/Forwarder.java @@ -271,7 +271,7 @@ public class Forwarder { } void insertData(GnssStatus offDevice,GnssStatus refDevice){ - logger.info("insertData"); + logger.info("insertData based on {}",refDevice.getDeviceid()); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("deviceid",refDevice.getDeviceid()); queryWrapper.eq("enabled",true); diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/GNSSCalcFilterService.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/GNSSCalcFilterService.java index 8e7d95dc..c012dedb 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/GNSSCalcFilterService.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/GNSSCalcFilterService.java @@ -26,6 +26,8 @@ public class GNSSCalcFilterService { private GnssGroupCalcMapper groupCalcMapper; @Autowired private GnssCalcDataMapper repository; + @Autowired + private GnssMsgMapper msgMapper; public static final int FILTER_MIN_CYCLE_HOUR = 2; public static final int FILTER_DEFAULT_CYCLE_HOUR = 8; @@ -107,10 +109,10 @@ public class GNSSCalcFilterService { query.orderByDesc("createtime"); List gnssDeviceLocationRecords = repository.selectList(query); - logger.info(deviceId + " select records from "+filterAfterTime.format(dateFormatter)+ +/* logger.debug(deviceId + " select records from "+filterAfterTime.format(dateFormatter)+ " to "+newRecordTime.format(dateFormatter)+ ", record num:"+gnssDeviceLocationRecords.size()); - +*/ if(gnssDeviceLocationRecords.size() == 0){ //第一个点无参考,当作坏点处理 newRecord.setEnabled(false); @@ -162,7 +164,7 @@ public class GNSSCalcFilterService { } } } - logger.info(deviceId + " filter records num: " + count+", min cycle num: "+minCount); + logger.debug("{} filter records num: {}",deviceId,count); if (count >= FILTER_MIN_RECORD_NUM) { newRecord.setRpose(NumberUtils.scaleTwo(sumE / count)); newRecord.setRposn(NumberUtils.scaleTwo(sumN / count)); @@ -198,7 +200,8 @@ public class GNSSCalcFilterService { varyCycle.startTime = now; varyCycle.filterCycleHour = groupCalc.getFilter_min_hour(); autoCycleDevices.put(deviceId, varyCycle); - logger.info(deviceId + ": filter cycle change to " + varyCycle.filterCycleHour); + saveMsg(deviceId, curCalcData.getTenantid(), + "filter cycle changed to"+varyCycle.filterCycleHour,now); } else { VaryFilterCycle varyCycle = autoCycleDevices.get(deviceId); @@ -211,7 +214,8 @@ public class GNSSCalcFilterService { if (now.isAfter(varyCycle.startTime.plusHours(1))) { varyCycle.filterCycleHour++; varyCycle.startTime = now; - logger.info(deviceId + ": refresh filter cycle "+varyCycle.filterCycleHour); + saveMsg(deviceId, curCalcData.getTenantid(), + "filter cycle changed to"+varyCycle.filterCycleHour,now); } } } @@ -242,8 +246,25 @@ public class GNSSCalcFilterService { groupCalc.getXy_threshold(), groupCalc.getZ_threshold(), groupCalc.getAdv_filter()); repository.updateById(calcData); lastTime = calcData.getCreatetime(); - logger.info(deviceId + " update rpos"); + //logger.info(deviceId + " update rpos"); } return lastTime; } + + void saveMsg(String deviceId, Integer tenantId, String content, LocalDateTime time){ + GnssMsg gnssMsg = new GnssMsg(); + gnssMsg.setTenantid(tenantId); + gnssMsg.setCreatetime(time); + gnssMsg.setDeviceid(deviceId); + gnssMsg.setMsgtype(0); + gnssMsg.setMsglen(content.length()); + gnssMsg.setTx(false); + if(content.length()<=128) { + gnssMsg.setContent(content); + } + else{ + gnssMsg.setContent(content.substring(0,120)+"..."); + } + msgMapper.insert(gnssMsg); + } } diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/MultiLineGNSSCalcService.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/MultiLineGNSSCalcService.java index b7d825af..fbdff4d1 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/MultiLineGNSSCalcService.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/calc/MultiLineGNSSCalcService.java @@ -64,7 +64,12 @@ public class MultiLineGNSSCalcService { lastD342Time = new D342Time(); deviceMap.put(deviceId, lastD342Time); // 产生断点补传通知 - beidouClient.onGnssUpload(deviceId, d342Message.getTenantId(), msgTime, "session begin"); + try { + beidouClient.onGnssUpload(deviceId, d342Message.getTenantId(), msgTime, "session begin"); + } + catch (Exception e){ + + } GnssStatus gnssStatus = dataPersistService.getDeviceState(deviceId); if (gnssStatus != null) { gnssStatus.setUpdatetime(LocalDateTime.now()); @@ -93,7 +98,12 @@ public class MultiLineGNSSCalcService { void d342SessionDone(String deviceId, Integer tenantId, LocalDateTime lastDate){ //补传结束指示 logger.info(deviceId + " d342 session done! "+lastDate); - beidouClient.onGnssUploadComplete(deviceId,tenantId, lastDate); + try { + beidouClient.onGnssUploadComplete(deviceId, tenantId, lastDate); + } + catch (Exception e){ + + } // 计算上轮结果 calcService.calSingleDone(deviceId, tenantId, lastDate); // 重算最近的 diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D31xConfigAckMessageExecutor.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D31xConfigAckMessageExecutor.java index 89ab97b9..cd151f61 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D31xConfigAckMessageExecutor.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D31xConfigAckMessageExecutor.java @@ -28,7 +28,13 @@ public class D31xConfigAckMessageExecutor implements Executor { GnssStatus lastGnssStatus = dataPersistService.getDeviceState(message.getId()); - if(lastGnssStatus!=null && lastGnssStatus.getState() == GnssStatus.STATE_OFFLINE){ - beidouClient.onLine(lastGnssStatus.getDeviceid(), lastGnssStatus.getTenantid(), lastGnssStatus.getUpdatetime()); + try { + if (lastGnssStatus != null && lastGnssStatus.getState() == GnssStatus.STATE_OFFLINE) { + beidouClient.onLine(lastGnssStatus.getDeviceid(), + lastGnssStatus.getTenantid(), lastGnssStatus.getUpdatetime()); + } else { + // 通知beidou服务设备上线 + beidouClient.onDeviceActive(message.getId(), device.getTenantId()); + } } - else{ - // 通知beidou服务设备上线 - beidouClient.onDeviceActive(message.getId(), device.getTenantId()); + catch (Exception e){ + } dataPersistService.saveDeviceState(message); }); diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F2StopIndicationMessageExecutor.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F2StopIndicationMessageExecutor.java index 6053fd7c..21f9db67 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F2StopIndicationMessageExecutor.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D3F2StopIndicationMessageExecutor.java @@ -60,12 +60,17 @@ public class D3F2StopIndicationMessageExecutor implements Executor