feat(go): make identity binding read only

This commit is contained in:
lingniu
2026-07-03 15:45:47 +08:00
parent 1d79dc25e0
commit f292d4c0d6
5 changed files with 51 additions and 67 deletions

View File

@@ -63,13 +63,13 @@ NATS 部署在 Kafka ECS 内网 `172.17.111.56:4222`。
| 表 | 核心字段 | 写入方 | 职责 |
| --- | --- | --- | --- |
| `vehicle_identity_binding` | `vin``plate``phone``device_id` | 导入/人工维护Gateway 读 | 通过车牌、手机号、设备号反查 VIN |
| `vehicle_identity_binding` | `vin``plate``phone``oem` | 导入/人工维护Gateway 读 | 通过车牌、手机号反查 VIN |
| `jt808_registration` | `phone``device_id``plate``vin``manufacturer``auth_token``source_endpoint`、首次/最新注册鉴权时间 | Gateway | JT808 注册、鉴权和 VIN 匹配状态 |
| `vehicle_realtime_snapshot` | `protocol``vin``plate``event_time``received_at``event_id` | Realtime API/projector | 每协议每 VIN 最新事件轻量快照 |
| `vehicle_realtime_location` | `protocol``vin``plate`、经纬度、速度、总里程、SOC、事件时间 | Realtime API/projector | 每协议每 VIN 最新位置业务缓存 |
| `vehicle_daily_mileage` | `vin``stat_date``protocol``daily_mileage_km`、首末总里程、样本数 | Stat writer | 基于总里程差值的每日里程;无 VIN 数据不进入正式统计表 |
身份表使用业务主键:`vehicle_identity_binding``vin` 为主键,`jt808_registration``phone` 为主键;两者不保留代理自增主键和 `created_at`
身份表使用业务主键:`vehicle_identity_binding``vin` 为主键,`jt808_registration``phone` 为主键;两者不保留代理自增主键和 `created_at``vehicle_identity_binding` 是外部维护的事实表,服务运行时不回写。
日里程表使用 `(vin, stat_date, protocol)` 作为业务主键,不保留自增 `id``created_at`;首末总里程和样本数保留用于解释差值计算。