feat: sync vehicle monitoring and accumulated platform updates
Add monitoring metrics, numeric sorting, report-time display, vehicle number labels, and map layout fixes. Include accumulated mileage, hydrogen, OneOS authentication, open platform, ingestion, deployment, and UI updates. Exclude temporary files, generated reports, and credentials. Validate frontend 632 tests and production build, API packages, vehicle-map tests, and release installer tests. Gateway suite has one pre-existing date-sensitive identity throttling test failure reproduced on the parent commit.
This commit is contained in:
@@ -132,6 +132,16 @@ vin,modelName,vehicleType,companyName,operationStatus,accessProvider,firstAccess
|
||||
|
||||
`/api/vehicles/detail` remains available as a compatibility alias. New UI and integrations should use `/api/vehicle-service` to make the vehicle-first boundary explicit.
|
||||
|
||||
The live vehicle workspace sends `includeHistory=0`. It receives identity,
|
||||
profile, business relation, quality and realtime sources without querying
|
||||
historical location, RAW or mileage previews or probing historical source
|
||||
availability. `historyIncluded=false` distinguishes omitted previews from
|
||||
empty history. Omitting the parameter preserves the full-detail response and
|
||||
returns `historyIncluded=true`; historical authorization checks still apply.
|
||||
Latest telemetry allows at most one second for optional historical RAW
|
||||
enrichment, then returns the durable latest projection for any slow source.
|
||||
Frame IDs and timestamps retain their actual evidence and freshness.
|
||||
|
||||
`sourceConsistency` is the vehicle-level diagnosis across GB32960, JT808, and Yutong MQTT sources. The three protocols are source evidence for one vehicle service, so callers should display the diagnosis result instead of asking users to compare protocol rows manually.
|
||||
|
||||
```json
|
||||
@@ -162,6 +172,12 @@ GET /api/realtime/vehicles?keyword=粤AG18312&protocol=JT808&online=online&servi
|
||||
|
||||
Returns VIN-level realtime rows with canonical vehicle-level `serviceStatus`. Protocol is a source filter, not a product boundary.
|
||||
|
||||
The monitor list sends `includeEnergy=1` to include available `hydrogenPressureMpa`, `hydrogenMassKg`, and `hydrogenConsumptionKgPer100Km`. Inputs come from the durable latest GB32960 projection for vehicles on the current authorized page, fetched in batches of at most 200 VINs; map requests do not load this payload. Pressure uses `gb32960.fuel_cell.max_hydrogen_pressure_mpa` (the maximum reported probe pressure), and consumption uses `gb32960.fuel_cell.hydrogen_consumption_kg_per_100km` (the vehicle-reported rate in kg/100km, not the daily SOC-balanced statistic). Remaining mass **always** uses the existing real-gas pressure/temperature conversion with that VIN’s active `vehicle_hydrogen_tank_capacity.tank_capacity_l` (total water volume). All directly reported kg fields are ignored, including zero or invalid readings. No default volume or temperature is assumed; missing or invalid calculation inputs leave kg unavailable with no fallback to reported or previous mass. Valid zero pressure produces zero kg. Available mass has `hydrogenMassSource=ESTIMATED`, and the UI labels estimates. Battery SOC remains `socPercent` with `socAvailable` controlling availability.
|
||||
|
||||
The list accepts `sort=speedKmh|lastSeen|todayMileageKm|totalMileageKm|socPercent|hydrogenPressureMpa` and `sortOrder=asc|desc` for numeric or chronological (`lastSeen`) ordering of all authorized matching vehicles before `limit`/`offset` pagination. Hydrogen ordering uses the MPa pressure value, independent of kg; invalid/missing values sort last in both directions, and equal values use ascending VIN order. `sort=identity` retains the existing plate/VIN ordering. Only the six listed sort keys are accepted, and directions other than `desc` default to ascending. The UI resets to the first page when the selected sort changes and preserves the choice in its monitor URL and vehicle return links.
|
||||
|
||||
Durable energy fields may contain JSON numbers or decimal numeric strings. Both forms are normalized to numeric response values and use the same numeric ordering; nonnumeric strings, booleans, negative values, and missing values remain unavailable.
|
||||
|
||||
### Vehicle Coverage
|
||||
|
||||
```http
|
||||
@@ -498,3 +514,13 @@ Existing callers may still send `vin`. The BFF treats `vin` as a vehicle lookup
|
||||
- Positive subsecond intervals remain continuous telemetry even when their displayed whole-second duration rounds to zero; only invalid/non-increasing timestamps or intervals over ten minutes become `gap`.
|
||||
- Sampling preserves the route endpoints, event points, stop centers and every retained segment boundary. `sampledIndex` fields point directly into the returned `points` array; clients must not approximate an original index by ratio when this field is present.
|
||||
- Playback points and events carry synchronized speed, SOC availability/value, direction and alarm fields. The browser resolves only the paused/current coordinate through the cached reverse-geocode endpoint; playback never triggers one address request per point.
|
||||
|
||||
For pressure sorting with `includeEnergy=1`, the same database statement returns the snapshot payload used by `ORDER BY`, so a live update between sorting and value hydration cannot change the displayed pressure out of order. Mileage sorting honors the corresponding availability flag and casts the selected projection to a number before sorting.
|
||||
|
||||
The monitor list displays `氢气压力(MPa)` and `剩余氢量(Kg)` in separate columns. Speed, report time, pressure, today mileage, total mileage, and SOC support sorting; kg is display-only. Fresh monitor URLs default to `hydrogenPressureMpa` ascending. Explicit URL sorting remains preserved on reload and return navigation.
|
||||
|
||||
The monitor list uses `lastSeen` for the report-time column. Zone-less timestamps are interpreted as Asia/Shanghai. For the current Beijing calendar day, elapsed time under one hour displays `实时`, otherwise whole hours display `x小时前`; the preceding calendar day displays `昨天`, and earlier days display `x天前`. Hover shows `yyyy-MM-dd HH:mm:ss` in Beijing time; missing/invalid timestamps display `—`. Relative labels refresh once per minute even without telemetry changes.
|
||||
|
||||
Report-time colors: `实时` is green; other times today and `昨天` are yellow; older or unavailable report times are red. The text and full hover timestamp remain available alongside color.
|
||||
|
||||
Report-time badges retain the relative text, freshness colors and exact hover timestamp. Clicking a valid badge opens the full `yyyy-MM-DD HH:mm:ss` timestamp in Beijing time; Escape, outside click, or the close button dismisses it. Missing timestamps have no detail trigger.
|
||||
|
||||
@@ -35,6 +35,40 @@ Content-Type: application/json
|
||||
|
||||
任一车辆未授权时整批返回 `403 FORBIDDEN`,不会返回部分结果。单日聚合不开放授权首日或结束日的半日数据。
|
||||
|
||||
## 综合运营数据批量查询
|
||||
|
||||
```http
|
||||
POST /api/v1/vehicles/operating-data/query
|
||||
```
|
||||
|
||||
```json
|
||||
{"plateNumbers":["粤A09635F"],"dailyDate":"2026-10-23","dataTypes":["REALTIME","DAILY_MILEAGE","DAILY_HYDROGEN"],"protocolPriority":["GB32960","MQTT","JT808"]}
|
||||
```
|
||||
|
||||
新端点车牌可选,省略或传空数组时查询所选时间范围内均有效授权的全部车辆(多范围取交集),按车牌排序;无授权车辆返回空数组。省略或空数组返回全部有效授权车辆,不受 200 辆限制,不分页、不截断。显式指定车牌最多 200 项,超出返回 HTTP 400 / `BATCH_SIZE_EXCEEDED` 并提示可省略或传空数组查询全部。规范化后重复车牌报错;最大请求体 64 KiB。`dataTypes` 省略默认全部,含日统计时 `dailyDate` 必填且不能为未来日期;仅实时可省略,响应 `queryDate=null`。`protocolPriority` 只允许在选择里程时提供。未知字段及显式 null 均拒绝。日期不设置新的历史下界,结果取决于授权和保留投影,不承诺历史完整性。
|
||||
|
||||
所有范围先授权:appKey 当前有效,实时车辆授权覆盖请求时点,日统计授权完整覆盖查询日;任一越权整批失败。按 VIN 合并,保持车牌顺序。`realtime`、`dailyMileage`、`dailyHydrogen` 仅返回所选块,字段及业务口径沿用独立接口,原可选缺失字段显式 null;时间转成带 `+08:00` 的 RFC3339。`requestAt`、`generatedAt` 不表示共同数据快照。
|
||||
|
||||
块内 `queryStatus=SUCCESS` 后仍需判断业务状态与质量。失败块仅含 `queryStatus=FAILED`、`status=null`、`errorCode`、`errorMessage`;失败不丢弃其他结果,全部子查询失败也可返回 HTTP 200。`summary` 按车辆统计所选块执行成功、部分成功或全失败,NO_DATA/异常不改变执行成功计数。保留 CARRIED_FORWARD、PRELIMINARY/FINAL、实时储氢逐字段状态及来源;补充查询已降级的 MISSING/UNKNOWN 无法严格区分无记录和补充存储失败。接口不计算百公里氢耗,同日、NORMAL 不证明数据区间可比。
|
||||
|
||||
内部三类集合批量并行查询,共享已授权 VIN 映射,不扫描新原始全日数据。总预算 6 秒,数据子查询共享最多 4.5 秒。独立复用现有应用限流器:每应用每实例 30 批/60 秒、最多 2 批并发;本端点全局每实例最多 16 批,超限 `429 RATE_LIMIT_EXCEEDED` 带 `Retry-After`。多实例统一配额及更长网关预算由部署配置,不宣称未经压测的性能目标。
|
||||
|
||||
完整请求、响应、字段和错误码见 `/open-api/openapi.yaml` 及 `/open-api/docs/#operating-data`。原三个独立接口保持兼容。
|
||||
|
||||
### 小程序精简模式
|
||||
|
||||
```json
|
||||
{"responseMode":"SIMPLE","plateNumbers":["沪A01933F"],"dailyDate":"2026-10-23"}
|
||||
```
|
||||
|
||||
省略 `responseMode` 或指定 `FULL` 保持已上线响应;显式 `SIMPLE` 时,外层不变,每辆车固定返回 `plateNumber`、`reportTime`、`offline`、`remainingHydrogenKg`、`socPercent`、`totalMileageKm`、`dailyHydrogenConsumptionKg`、`dailyMileageKm`、`hydrogenConsumptionPer100KmKg` 九个字段,不输出 VIN、嵌套块或内部质量字段。
|
||||
|
||||
未知、未选或不满足质量的字段为 null,真实零及布尔 false 保留。剩余氢量要求逐字段 NORMAL、有可信采集时点且在300秒时效范围;不展示陈旧值。日用氢要求 NORMAL+OK,日里程要求 NORMAL 且不是 CARRIED_FORWARD;结转补零为 null,不能冒充实测零。`offline` 仅在主记录可用且 online 已知时取反,无记录或失败为 null。reportTime 直接使用实时主记录 event_time;没有真实源时点时为 null,不使用投影 updated_at、接收时间或请求时间代替。SQL 总里程为空时为 null,不沿用旧接口的补零,也不使用日统计兜底。
|
||||
|
||||
SIMPLE summary 按所选展示字段可用性统计(实时5项、日里程1项、日用氢1项):全有值为成功、部分为部分成功、全空为失败。车牌、未选类型及预留百公里氢耗不参与;null 和失败计数不等于查询执行失败,不用于自动重试。FULL 仍按子查询执行结果统计。
|
||||
|
||||
`hydrogenConsumptionPer100KmKg` 当前固定 null:独立日投影不提供完整可比覆盖证明,本次不新增算法或同日相除。日内用氢可能为 PRELIMINARY;正式对账使用 FULL 核查阶段、质量与来源。授权、批量上限、查询次数、超时和限流均沿用原实现。
|
||||
|
||||
## 单日用氢量
|
||||
|
||||
```http
|
||||
|
||||
Reference in New Issue
Block a user