Compare commits

..

No commits in common. "15b14a94f6f25a29591f32d9bd8b50415abbc7f4" and "9f5fa31bb142bde944e72cd645ac3cce5a0bbb8f" have entirely different histories.

View File

@ -38,8 +38,6 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private static final Map<String ,Boolean> deviceBackupStatus = new ConcurrentHashMap<>();
@Autowired
private DeviceService deviceService;
@Autowired
@ -91,26 +89,8 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
Device primaryBase = deviceService.findByDeviceId(primaryBaseId);
// 如果主基站仍然在线则跳过备选基站的数据
if (primaryBase != null && isBaseStationOnline(primaryBase)) {
if(deviceBackupStatus.remove(deviceId) != null){
logger.info("设备 {} 从备用基站 {} 切换回主基站 {}",
deviceId, id, primaryBaseId);
}
continue;
}
else{
String hexPrimaryBase = String.format("%06x",Integer.parseInt(primaryBaseId));
if(deviceBackupStatus.putIfAbsent(deviceId,true) == null){
logger.info("设备 {} 从主基站 {} 切换到备用基站 {}",
deviceId, primaryBaseId, id);
}
byte[] modifyData = forwardBytes.clone();
modifyData[5] = (byte) Integer.parseInt(hexPrimaryBase.substring(0,2),16);
modifyData[6] = (byte) Integer.parseInt(hexPrimaryBase.substring(2,4),16);
modifyData[7] = (byte) Integer.parseInt(hexPrimaryBase.substring(4,6),16);
forwardBytes = modifyData;
}
}
// 获取设备通道并发送数据