1、修改基站修改后同步不到rtcm缓存的问题

This commit is contained in:
weidong 2024-07-30 17:49:49 +08:00
parent 6cfc24eeb5
commit 4e9c411365
5 changed files with 11 additions and 7 deletions

View File

@ -10,7 +10,7 @@ public interface RtcmClient {
HttpResp config(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "configuration") String configData);
@PostMapping("/device_param_changed")
HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId);
HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId,@RequestParam(name = "oldParentId") String oldParentId);
@PostMapping("/group_param_changed")
HttpResp groupParamChanged();

View File

@ -48,7 +48,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
byte[] forwardBytes = message.getSrcData();
// 要求快速转发因此用缓存不要每次都查数据库
List<Device> deviceList = deviceService.findByParentId(id);
logger.debug("base station {} has {} rovers: ", message.getId(),deviceList.size());
//logger.debug("base station {} has {} rovers: ", message.getId(),deviceList.size());
for (Device device : deviceList) {
if (device.getOpMode() != GnssDevice.OP_MODE_USE) continue;
String deviceId = device.getDeviceId();

View File

@ -57,11 +57,14 @@ public class LocalDeviceServiceImpl implements DeviceService {
return device;
}
public void refresh(String deviceId){
public void refresh(String deviceId, String oldParentId){
Device device = deviceCache.getIfPresent(deviceId);
if (device != null) {
if(device.getParentId()!=null) {
subDeviceCache.invalidate(device.getParentId());
if(oldParentId!=null && !oldParentId.equals(device.getParentId())){
subDeviceCache.invalidate(oldParentId);
}
}
deviceCache.invalidate(deviceId);
}

View File

@ -71,9 +71,9 @@ public class ApiController {
}
@PostMapping("/device_param_changed")
public HttpResp deviceParamChanged(String deviceId) {
public HttpResp deviceParamChanged(String deviceId, String oldParentId) {
// 更新设备缓存
localDeviceService.refresh(deviceId);
localDeviceService.refresh(deviceId, oldParentId);
calcService.refreshDeviceCalc(deviceId);
HttpResp resp = new HttpResp();

View File

@ -200,7 +200,8 @@ public class GnssDeviceController extends BasicController{
} else {
// 更新组参数的关联个数
updateBasicGroupAssociatedNum(device,old_device);
rtcmClient.deviceParamChanged(device.getDeviceid());
rtcmClient.deviceParamChanged(device.getDeviceid(),
old_device==null?null:old_device.getParentid());
return HttpResult.ok();
}
}
@ -293,7 +294,7 @@ public class GnssDeviceController extends BasicController{
if (num == 0) {
return HttpResult.failed();
} else{
rtcmClient.deviceParamChanged(del_id);
rtcmClient.deviceParamChanged(del_id, null);
return HttpResult.ok();
}
}