docs(changelog): #5895 排车页槽位卡头车型大类标签修复(PR #5907)
所有检测均成功
changelog-filename-gate / validate (push) Successful in 2s
所有检测均成功
changelog-filename-gate / validate (push) Successful in 2s
这个提交包含在:
父节点
c8ec9e440b
当前提交
d7d2083276
@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
schema: "hl-changelog/v2"
|
||||||
|
ticket: "5895"
|
||||||
|
title: "排车页槽位卡头车型大类标签修复——type_key 别名 normalize 成中文标签"
|
||||||
|
consumer: "admin"
|
||||||
|
change_type: "修复"
|
||||||
|
author: "wx(GIT)"
|
||||||
|
backend_status: "deployed"
|
||||||
|
gateway_status: "not_required"
|
||||||
|
frontend_status: "not_required"
|
||||||
|
frontend_owner: ""
|
||||||
|
frontend_ref: ""
|
||||||
|
target_release: ""
|
||||||
|
verified_at: ""
|
||||||
|
status_note: "后端已修复并部署测试服,API 实测通过。排车页「车辆槽位 N」卡片头在 PR #5904 新增的 vehicleCategoryLabel 字段实测返回别名 suv2(应显示 SUV):因为 fleet_vehicle_type.type_key 存的是别名,而 VehicleCategoryNormalizer.categoryLabel() 只认规范 key suv/mpv/bus/sedan,直接传入会原样返回别名。修复=先 normalize() 成规范 key 再取中文标签。实测订单 26-3698(蒙A-H7777 type_key=suv2):vehicleCategoryKey 由 suv2 → suv、vehicleCategoryLabel 由 suv2 → SUV。"
|
||||||
|
updated_at: "2026-08-12"
|
||||||
|
base: "dev-v3"
|
||||||
|
---
|
||||||
|
|
||||||
|
# 排车页槽位卡头车型大类标签修复——type_key 别名 normalize 成中文标签(#5895)
|
||||||
|
|
||||||
|
> **服务**: hl-fleet-service
|
||||||
|
> **PR**: #5904(槽位头车型大类字段新增)+ #5907(别名标签修复,本条)
|
||||||
|
> **日期**: 2026-08-12
|
||||||
|
> **背景**: 用户要求排车页「车辆槽位 N」卡片头显示车型大类名(多个和车牌一样分割显示)。#5904 加了 vehicleCategoryKey/vehicleCategoryLabel 字段,但实测发现已派车辆的大类标签返回了别名 `suv2` 而非中文「SUV」。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 修复内容(对前端透明,无接口契约变化)
|
||||||
|
|
||||||
|
**根因**:`fleet_vehicle_type.type_key` 存的是别名(如 `suv2`、`mpv2`),`BoardOrderService.toVehicleSlotVO` 直接把它传给 `VehicleCategoryNormalizer.categoryLabel()`,而该方法只认规范 key `suv/mpv/bus/sedan`,未匹配时**原样返回**别名 → 前端拿到 `suv2`。
|
||||||
|
|
||||||
|
**修复**:先 `VehicleCategoryNormalizer.normalize(info.getCategoryKey())` 归一别名到规范 key,再取 `categoryLabel()`;归一失败(null)时保留原值兜底。
|
||||||
|
|
||||||
|
```java
|
||||||
|
String categoryKey = VehicleCategoryNormalizer.normalize(info.getCategoryKey());
|
||||||
|
vehicleCategoryKey = categoryKey == null ? info.getCategoryKey() : categoryKey;
|
||||||
|
vehicleCategoryLabel = VehicleCategoryNormalizer.categoryLabel(vehicleCategoryKey);
|
||||||
|
```
|
||||||
|
|
||||||
|
**字段口径(#5904 原有,本条不改)**:
|
||||||
|
- 未派:`vehicleCategoryKey/Label` = 需求车型大类(如 `suv/SUV`)
|
||||||
|
- 已派:`vehicleCategoryKey/Label` = 实际车辆车型大类 normalize 后的规范 key + 中文标签
|
||||||
|
|
||||||
|
## 验证证据(测试服 API 实测,订单 26-3698 / 2086270138171994114)
|
||||||
|
|
||||||
|
`GET /admin/fleet/board/orders/2086270138171994114` → `vehicleSlots[0]`:
|
||||||
|
|
||||||
|
| 字段 | 修复前 | 修复后 |
|
||||||
|
|---|---|---|
|
||||||
|
| vehicleCategoryKey | `suv2` | `suv` |
|
||||||
|
| vehicleCategoryLabel | `suv2` | `SUV` |
|
||||||
|
|
||||||
|
DB 佐证:`fleet_vehicle` 蒙A-H7777 的 `vehicle_type_id` 对应 `fleet_vehicle_type.type_key=suv2`(别名,非规范 key),确认是别名 → normalize 路径生效。
|
||||||
|
|
||||||
|
## 测试
|
||||||
|
|
||||||
|
- 新增用例 `BoardOrderServiceTest.queryOrderDetail_vehicleSlots_vehicleCategoryAliasKeyNormalized`:已派槽位 `type_key=suv2` 别名 → normalize 成 `SUV`。
|
||||||
|
- `BoardOrderServiceTest` 125/125 绿。
|
||||||
正在加载...
x
在新工单中引用
屏蔽一个用户