docs: 归档 excel-import-refactor,同步更新主 specs
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 50s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 50s
- 将变更目录移至 archive/2026-04-09-excel-import-refactor - device-import spec:更新为固定列位置读取(IMEI 调整至第5列),新增 MaxSimSlots 范围校验说明 - iot-card-import-task spec:更新为固定列位置读取,新增"导入批次支持卡业务类型"需求 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
## Why
|
||||
|
||||
业务侧要求 Excel 导入模板使用中文表头,但现有实现依赖英文列名匹配,导致中文表头的文件无法正确导入。同时,IoT 卡导入时卡业务类型(行业卡/普通卡)写死为普通卡,无法在导入批次中指定行业卡。
|
||||
|
||||
## What Changes
|
||||
|
||||
- **Excel 按列位置读取**:移除基于列名识别的逻辑,改为按固定列索引取值,第一行固定作为表头跳过,表头内容不再影响解析结果
|
||||
- **删除冗余函数**:删除 `findCardColumns()` 和 `buildDeviceColumnIndex()` 两个函数
|
||||
- **设备列顺序调整**:设备导入列顺序从原来的排列调整为业务确认的顺序(IMEI 提前至第5列)
|
||||
- **IoT 卡导入支持卡业务类型**:`ImportIotCardRequest` 新增 `card_category` 字段(批次级别),导入时按请求参数设置,默认为 `normal`
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
(无新能力)
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `iot-card-import-task`:导入请求新增 `card_category` 字段,任务模型同步新增该字段,导入时按批次统一设置卡业务类型
|
||||
- `device-import`:移除列名识别逻辑,改为按固定列位置读取,列顺序调整为业务确认顺序
|
||||
|
||||
## Impact
|
||||
|
||||
- `pkg/utils/excel.go`:核心解析逻辑重写(按列位置取值),删除 `findCardColumns` / `buildDeviceColumnIndex` 两个函数
|
||||
- `internal/model/dto/iot_card_dto.go`:`ImportIotCardRequest` 新增 `CardCategory` 字段(带 `oneof=normal industry` 校验),`ImportTaskResponse` 新增 `card_category` 返回
|
||||
- `internal/model/iot_card_import_task.go`:`IotCardImportTask` 新增 `CardCategory` 字段
|
||||
- `migrations/`:新增迁移为 `tb_iot_card_import_task` 增加 `card_category` 列(注:卡主表 `tb_iot_card` 早已有该字段,本次只补"批次级载体列")
|
||||
- `internal/service/iot_card_import/service.go`:`CreateImportTask` 将 `req.CardCategory` 写入 task,空串兜底为 `normal`
|
||||
- `internal/task/iot_card_import.go`:使用 `task.CardCategory` 替代写死的 `CardCategoryNormal`
|
||||
- **模板文件**:需同步更新 IoT 卡、设备导入模板 `.xlsx`,确保列顺序与代码一致(高风险:列顺序不匹配会导致数据静默错位)
|
||||
Reference in New Issue
Block a user