docs: add detailed 32960 pipeline comments

This commit is contained in:
kkfluous
2026-06-23 13:17:37 +08:00
parent ba68ffe061
commit a096e4ce0e
125 changed files with 493 additions and 14 deletions

View File

@@ -11,4 +11,5 @@ import org.springframework.web.servlet.DispatcherServlet;
@ConditionalOnProperty(prefix = "lingniu.ingest.command-gateway", name = "enabled", havingValue = "true", matchIfMissing = true)
@ComponentScan(basePackageClasses = TerminalCommandController.class)
public class CommandGatewayAutoConfiguration {
// 只扫描 REST 下行命令网关;不参与 32960 接收、RAW 冷存或历史查询链路。
}

View File

@@ -205,12 +205,14 @@ public class TerminalCommandController {
// ===== helpers =====
private Optional<DeviceSession> resolveSession(String clientId) {
// 运维侧常拿到 VIN、手机号或 sessionId 中任意一个;这里按三索引兜底解析到在线连接。
return sessions.findBySessionId(clientId)
.or(() -> sessions.findByPhone(clientId))
.or(() -> sessions.findByVin(clientId));
}
private CommandResult awaitSync(String clientId, Jt808Commands.DownlinkCommand cmd, String op) {
// 需要终端应答的命令走 request-response超时时间由网关统一兜底避免 HTTP 线程无限等待。
CompletableFuture<Jt808Message> future =
dispatcher.request(clientId, cmd, Jt808Message.class, DEFAULT_TIMEOUT);
try {
@@ -229,6 +231,7 @@ public class TerminalCommandController {
private CommandResult fireAndForget(String clientId, Jt808Commands.DownlinkCommand cmd, String op) {
try {
// ACK 类命令不等待终端回包;只确认写入在线 session 对应的 channel。
dispatcher.notify(clientId, cmd).join();
return CommandResult.ok(Map.of("op", op));
} catch (Exception e) {