refactor(go): simplify daily mileage storage

This commit is contained in:
lingniu
2026-07-02 20:01:03 +08:00
parent abc1b9870a
commit 593dc08870
7 changed files with 74 additions and 203 deletions

View File

@@ -33,7 +33,7 @@ flowchart LR
HW --> TDRAW["TDengine raw_frames"]
HW --> TDLOC["TDengine vehicle_locations"]
SW --> MYMET["MySQL vehicle_daily_metric"]
SW --> MYMET["MySQL vehicle_daily_mileage"]
RA --> REDIS["Redis realtime-raw"]
RA --> MYSNAP["MySQL vehicle_realtime_snapshot"]
RA --> MYLOC["MySQL vehicle_realtime_location"]
@@ -49,7 +49,7 @@ flowchart LR
| TDengine | `vehicle_locations` | High-volume location history | time, vin, protocol, longitude, latitude, speed, direction, mileage | full parsed JSON |
| MySQL | `vehicle_realtime_snapshot` | Latest per-protocol vehicle heartbeat | protocol, vin, plate, event time, received time | phone, device, message sequence, parsed JSON |
| MySQL | `vehicle_realtime_location` | Latest business location cache | vin, plate, location, speed, mileage, SOC, event time | full raw payload and protocol internals |
| MySQL | `vehicle_daily_metric` | Queryable daily metrics | vin or vehicle key, date, metric key, value, method, source mileage | per-frame raw details |
| MySQL | `vehicle_daily_mileage` | Queryable daily mileage | vin or vehicle key, date, protocol, daily mileage, source mileage | generic metric key/value rows, per-frame raw details |
| MySQL | `vehicle_identity_binding` | Manual identity mapping | vin, plate, phone, device id | registration history |
| MySQL | `jt808_registration` | JT808 registration and auth trace | phone, device id, plate, auth code, vin match state, first/latest seen | GB32960 or MQTT records |
| Redis | `realtime-raw:{protocol}:{vin}` | Latest full realtime protocol state | merged latest protocol payload | historical data |