From 54a9696bbfc9c518491e06e15255894686443597 Mon Sep 17 00:00:00 2001 From: yarnom Date: Wed, 29 Oct 2025 18:02:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E9=80=9A=E9=81=932?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/imdroid/secapi/dto/RtkrcvGroup.java | 4 ++++ .../com/imdroid/secapi/dto/RtkrcvProfile.java | 2 ++ .../rtkcluster/RtkClusterService.java | 17 ++++++++++++++++- .../rtkcluster/RtkrcvConfigService.java | 19 +++++++++++++++---- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvGroup.java b/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvGroup.java index f9d6ed87..46a03a89 100644 --- a/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvGroup.java +++ b/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvGroup.java @@ -44,6 +44,10 @@ public class RtkrcvGroup { @TableField("outstr1_format") private String outstr1Format; + @TableField("outstr1_type") + private String outstr1Type; + @TableField("outstr1_path") + private String outstr1Path; @TableField("outstr2_type") private String outstr2Type; diff --git a/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvProfile.java b/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvProfile.java index cd0989bd..b824f0f1 100644 --- a/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvProfile.java +++ b/sec-api/src/main/java/com/imdroid/secapi/dto/RtkrcvProfile.java @@ -24,6 +24,8 @@ public class RtkrcvProfile { private String inpstr3Path; @TableField("outstr1_path") private String outstr1Path; + @TableField("outstr2_path") + private String outstr2Path; @TableField("out_height") private Integer outHeight; @TableField("updated_at") diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java index b01885b9..f9982554 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java @@ -6,6 +6,8 @@ import com.imdroid.secapi.dto.RtkrcvProfileMapper; import com.imdroid.secapi.dto.RtkrcvSession; import com.imdroid.secapi.dto.RtkrcvSessionMapper; import com.imdroid.sideslope.bd.RtcmGgaUtil; +import com.imdroid.secapi.dto.RtkrcvGroup; +import com.imdroid.secapi.dto.RtkrcvGroupMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,6 +42,8 @@ public class RtkClusterService implements ApplicationRunner { @Value("${rtkrcv.workdir:/opt/rtk}") private String rtkWorkDir; + @Value("${rtkrcv.bin:rtkrcv}") + private String rtkBinary; @Autowired private RtkrcvProfileMapper profileMapper; @@ -47,6 +51,8 @@ public class RtkClusterService implements ApplicationRunner { private RtkrcvSessionMapper sessionMapper; @Autowired private RtkrcvConfigService configService; + @Autowired(required = false) + private RtkrcvGroupMapper groupMapper; private final Map endpoints = new ConcurrentHashMap<>(); private final Map processes = new ConcurrentHashMap<>(); @@ -89,6 +95,15 @@ public class RtkClusterService implements ApplicationRunner { String localPath = "127.0.0.1:" + workPort; profile.setInpstr1Path(localPath); profile.setOutstr1Path(localPath); + // Also write outstr2_path from group if present + try { + if (profile.getGroupId() != null && groupMapper != null) { + RtkrcvGroup group = groupMapper.selectById(profile.getGroupId()); + if (group != null && group.getOutstr2Path() != null && !group.getOutstr2Path().trim().isEmpty()) { + profile.setOutstr2Path(group.getOutstr2Path().trim()); + } + } + } catch (Exception ignore) {} profileMapper.updateById(profile); // 3) Generate config and start rtkrcv @@ -120,7 +135,7 @@ public class RtkClusterService implements ApplicationRunner { } worker.submit(() -> { try { - ProcessBuilder builder = new ProcessBuilder("/opt/rtk/bin/rtkrcv", "-nc", "-o", confPath); + ProcessBuilder builder = new ProcessBuilder(rtkBinary, "-nc", "-o", confPath); builder.directory(new File(workDir)); builder.redirectErrorStream(true); LOGGER.info("Starting rtkrcv for {} with {}", deviceId, confPath); diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkrcvConfigService.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkrcvConfigService.java index 30c69454..96c94c49 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkrcvConfigService.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkrcvConfigService.java @@ -65,10 +65,12 @@ public class RtkrcvConfigService { replaced = replaceValueLine(replaced, e.getKey(), e.getValue()); } } - replaced = replaceValueLine(replaced, "inpstr1-path", nz(profile.getInpstr1Path())); - replaced = replaceValueLine(replaced, "inpstr2-path", nz(profile.getInpstr2Path())); - replaced = replaceValueLine(replaced, "inpstr3-path", nz(profile.getInpstr3Path())); - replaced = replaceValueLine(replaced, "outstr1-path", nz(profile.getOutstr1Path())); + // Apply device-level paths if present (do not override group when blank) + replaced = replaceIfNotBlank(replaced, "inpstr1-path", profile.getInpstr1Path()); + replaced = replaceIfNotBlank(replaced, "inpstr2-path", profile.getInpstr2Path()); + replaced = replaceIfNotBlank(replaced, "inpstr3-path", profile.getInpstr3Path()); + replaced = replaceIfNotBlank(replaced, "outstr1-path", profile.getOutstr1Path()); + replaced = replaceIfNotBlank(replaced, "outstr2-path", profile.getOutstr2Path()); // If local tcp endpoints are used (e.g., 127.0.0.1:port), force type to tcpcli if (looksLikeTcpEndpoint(profile.getInpstr1Path())) { replaced = replaceValueLine(replaced, "inpstr1-type", "tcpcli"); @@ -115,6 +117,8 @@ public class RtkrcvConfigService { putIfNotNull(map, "inpstr3-path", group.getInpstr3Path()); putIfNotNull(map, "inpstr3-format", group.getInpstr3Format()); putIfNotNull(map, "outstr1-format", group.getOutstr1Format()); + putIfNotNull(map, "outstr1-type", group.getOutstr1Type()); + putIfNotNull(map, "outstr1-path", group.getOutstr1Path()); putIfNotNull(map, "outstr2-type", group.getOutstr2Type()); putIfNotNull(map, "outstr2-format", group.getOutstr2Format()); putIfNotNull(map, "outstr2-path", group.getOutstr2Path()); @@ -147,6 +151,13 @@ public class RtkrcvConfigService { return s == null ? "" : s; } + private String replaceIfNotBlank(String line, String key, String value) { + if (value == null) return line; + String v = value.trim(); + if (v.isEmpty()) return line; + return replaceValueLine(line, key, v); + } + private boolean looksLikeTcpEndpoint(String path) { if (path == null) return false; String p = path.trim();