feat: persist jt808 registration identity
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
lingniu
2026-06-29 17:42:04 +08:00
parent d003757308
commit 1d569b7bf3
8 changed files with 281 additions and 11 deletions

View File

@@ -9,6 +9,7 @@ import com.lingniu.ingest.identity.VehicleIdentityLookup;
import com.lingniu.ingest.identity.VehicleIdentityRegistry;
import com.lingniu.ingest.identity.VehicleIdentityResolver;
import com.lingniu.ingest.identity.VehicleIdentitySource;
import com.lingniu.ingest.identity.VehicleRegistrationBinding;
import com.lingniu.ingest.protocol.jt808.codec.Jt808FrameEncoder;
import com.lingniu.ingest.protocol.jt808.codec.Jt808MalformedFrame;
import com.lingniu.ingest.protocol.jt808.codec.Jt808MessageDecoder;
@@ -286,7 +287,18 @@ public class Jt808ChannelHandler extends SimpleChannelInboundHandler<Object> {
Instant.now(), Instant.now(),
Map.of("protocolVersion", msg.header().version().name())));
session = session.withVin(identity.vin());
if (msg.body() instanceof Jt808Body.Register reg && reg.plate() != null) {
if (msg.body() instanceof Jt808Body.Register reg) {
identityRegistry.register(new VehicleRegistrationBinding(
ProtocolId.JT808,
session.vin(),
phone,
reg.deviceId(),
reg.plate(),
reg.province(),
reg.city(),
reg.maker(),
reg.deviceType(),
reg.plateColor()));
if (identity.resolved() && session.vin() != null
&& !session.vin().isBlank()
&& !"unknown".equalsIgnoreCase(session.vin())) {