feat: store jt808 daily mileage as metric

This commit is contained in:
lingniu
2026-07-01 01:39:13 +08:00
parent af899d03b7
commit c6a647ce36
9 changed files with 210 additions and 5 deletions

View File

@@ -10,7 +10,8 @@ Consume JT808 Kafka location events, keep rolling daily state, and write the der
- Runtime app: `vehicle-analytics-app`
- State: Redis or in-memory `Jt808MileageStateStore`
- Metric output: `VehicleStatRepository.saveDailyStat(...)`
- Default metric storage: `VEHICLE_STAT_FILE_PATH/daily-stats.tsv`
- Production metric storage: JDBC/MySQL `vehicle_stat_metric`
- Local fallback storage: `VEHICLE_STAT_FILE_PATH/daily-stats.tsv`
- Date boundary: `Asia/Shanghai`
JT808 daily mileage is calculated only from the GPS total mileage reported by JT808 location additional information:
@@ -27,8 +28,11 @@ The stream saves a metric only when at least two ordered location points for the
KAFKA_TOPIC_JT808_EVENT=vehicle.event.jt808.v1
VEHICLE_STAT_ENABLED=true
VEHICLE_STAT_JT808_MILEAGE_ENABLED=true
VEHICLE_STAT_REPOSITORY_TYPE=jdbc
VEHICLE_STAT_JT808_STATE_STORE=redis
VEHICLE_STAT_FILE_PATH=/data/vehicle-stat
MYSQL_JDBC_URL=<jdbc-url>
MYSQL_USERNAME=<user>
MYSQL_PASSWORD=<password>
REDIS_HOST=<host>
REDIS_PORT=6379
REDIS_DATABASE=50