refactor: store jt808 mileage as metric diff
This commit is contained in:
@@ -159,15 +159,16 @@ Responsibilities:
|
||||
- Consume normalized telemetry events from Kafka.
|
||||
- Maintain day-level vehicle point state needed for statistics.
|
||||
- Run scheduled and event-triggered calculations.
|
||||
- Store daily results in a statistics database.
|
||||
- Support per-vehicle calculation rules.
|
||||
- Store derived results in the common metric table.
|
||||
|
||||
Initial daily mileage strategies:
|
||||
Current JT808 daily mileage strategy:
|
||||
|
||||
| Strategy | Formula |
|
||||
|---|---|
|
||||
| `CURRENT_LAST_MINUS_PREVIOUS_LAST` | Current day last valid total mileage minus previous day last valid total mileage |
|
||||
| `DAY_MAX_MINUS_DAY_MIN` | Current day max valid total mileage minus current day min valid total mileage |
|
||||
| `JT808_TOTAL_MILEAGE_DIFF` | Current local day last valid JT808 GPS total mileage minus first valid JT808 GPS total mileage |
|
||||
|
||||
The derived value is stored as `metric_key = daily_mileage_km` in
|
||||
`vehicle_stat_metric`; there is no protocol-specific JT808 daily-mileage table.
|
||||
|
||||
Hydrogen and electricity statistics use internal fields from the same event
|
||||
contract. Refueling and charging resets must be handled in statistics logic, not
|
||||
|
||||
Reference in New Issue
Block a user