fix: 修复GeoidSeparation数值

This commit is contained in:
yarnom 2025-11-13 01:10:11 +08:00
parent cde4c06e52
commit 27535fc82e
5 changed files with 29 additions and 3 deletions

View File

@ -16,4 +16,7 @@ public interface RtkrcvClient {
@GetMapping("/rtk/log_exists")
Boolean logExists(@RequestParam("device_id") String deviceId);
@GetMapping("/rtk/gngga")
java.util.Map<String,Object> gngga(@RequestParam("device_id") String deviceId);
}

View File

@ -26,4 +26,17 @@ public class RtkrcvController {
java.nio.file.Path p = java.nio.file.Paths.get("/opt/rtk/"+deviceId+"/rtkrcv.log");
return java.nio.file.Files.exists(p);
}
@GetMapping("/gngga")
public java.util.Map<String,Object> gngga(@RequestParam("device_id") String deviceId){
java.util.Map<String,Object> r = new java.util.HashMap<>();
com.imdroid.sideslope.service.Device d = manager.deviceService.findByDeviceId(deviceId);
if(d!=null){
r.put("lat", d.getLatitude());
r.put("lon", d.getLongitude());
r.put("alt", d.getAltitude());
r.put("geo", d.getGeoidSeparation());
}
return r;
}
}

View File

@ -6,6 +6,7 @@ import com.imdroid.secapi.dto.RtkGroup;
import com.imdroid.secapi.dto.RtkGroupMapper;
import com.imdroid.secapi.dto.RtkProfile;
import com.imdroid.secapi.dto.RtkProfileMapper;
import com.imdroid.sideslope.service.Device;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
@ -45,7 +46,7 @@ public class RtkrcvManager {
ensureDefaults(profile, deviceId);
String retHint = "ok";
try{
com.imdroid.sideslope.service.Device dev = deviceService.findByDeviceId(deviceId);
Device dev = deviceService.findByDeviceId(deviceId);
if(dev!=null){
Double lat = dev.getLatitude()==null?0.0:dev.getLatitude();
Double lon = dev.getLongitude()==null?0.0:dev.getLongitude();

View File

@ -41,4 +41,10 @@ public class RtkrcvProxyController {
Boolean exists = rtkrcvClient.logExists(deviceId);
return exists != null && exists;
}
@GetMapping("/rtk/gngga")
@ResponseBody
public java.util.Map<String,Object> gngga(@RequestParam("device_id") String deviceId){
return rtkrcvClient.gngga(deviceId);
}
}

View File

@ -346,6 +346,7 @@ layui.use(['form','table','element','layer','transfer'], function(){
var rtkWs = null;
var rtkSelectedDevice = '';
var rtkRunning = false;
var rtkGnggaTimer = null;
function connectRtkWs(){
if(rtkWs && rtkWs.readyState === WebSocket.OPEN) return;
var curPath = window.document.location.href;
@ -408,6 +409,8 @@ layui.use(['form','table','element','layer','transfer'], function(){
};
}
function closeRtkWs(){ if(rtkWs){ try{ rtkWs.close(); }catch(e){} rtkWs=null; } }
function startGnggaTimer(){ if(rtkGnggaTimer) clearInterval(rtkGnggaTimer); rtkGnggaTimer = setInterval(function(){ if(!rtkSelectedDevice) return; $.get('/rtk/gngga',{device_id: rtkSelectedDevice}, function(res){ if(res){ var gtxt = 'lat='+(res.lat!=null?res.lat:0)+', lon='+(res.lon!=null?res.lon:0)+', alt='+(res.alt!=null?res.alt:0)+', geo='+(res.geo!=null?res.geo:0); $('#rtk-gngga').text('GNGGA: '+gtxt); } }); }, 5000); }
function stopGnggaTimer(){ if(rtkGnggaTimer){ clearInterval(rtkGnggaTimer); rtkGnggaTimer=null; } }
function loadRtkGroups(){
$.get('/rtk/group/list', {page:1,limit:1000}, function(res){
@ -458,7 +461,7 @@ layui.use(['form','table','element','layer','transfer'], function(){
$.post('/rtk/start', {device_id: rtkSelectedDevice, clear_log: clear}, function(res){
if(res && res.code === 0){
if(res.data === 'ok' || res.data === 'all_zero'){
connectRtkWs(); rtkRunning = true; updateToggleBtn();
connectRtkWs(); startGnggaTimer(); rtkRunning = true; updateToggleBtn();
if(res.data === 'all_zero'){ layer.msg('GNGGA全零使用默认配置启动'); }
} else {
layer.msg(res.data||'已处理');
@ -479,7 +482,7 @@ layui.use(['form','table','element','layer','transfer'], function(){
} else {
$.post('/rtk/stop', {device_id: rtkSelectedDevice}, function(){
rtkRunning = false; updateToggleBtn();
closeRtkWs();
closeRtkWs(); stopGnggaTimer();
});
}
});