批量收回功能
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m1s

This commit is contained in:
2026-07-28 10:53:15 +08:00
parent 7c5b6ee036
commit 178cc45bc2
16 changed files with 117 additions and 71 deletions

View File

@@ -3784,19 +3784,19 @@ components:
minLength: 1
type: string
operation_type:
description: 操作类型 (assign_shop:分配目标代理, assign_series:设置套餐系列)
description: 操作类型 (assign_shop:分配目标代理, assign_series:设置套餐系列, recall:回收设备)
enum:
- assign_shop
- assign_series
- recall
type: string
target_id:
description: 目标代理店铺ID或套餐系列ID,由 operation_type 决定
description: 目标代理店铺ID或套餐系列IDrecall 时不传
minimum: 1
type: integer
required:
- file_key
- operation_type
- target_id
type: object
DtoCreateDeviceBatchAllocationResponse:
properties:
@@ -5051,7 +5051,7 @@ components:
description: 任务业务类型名称(中文)
type: string
operation_type:
description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列)
description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列, recall:回收设备)
type: string
realname_policy:
description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名)
@@ -5083,7 +5083,7 @@ components:
description: 成功数
type: integer
target_id:
description: 批量分配目标店铺或套餐系列ID
description: 批量分配目标店铺或套餐系列ID,回收任务为空
minimum: 0
nullable: true
type: integer
@@ -5137,7 +5137,7 @@ components:
description: 任务业务类型名称(中文)
type: string
operation_type:
description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列)
description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列, recall:回收设备)
type: string
realname_policy:
description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名)
@@ -5163,7 +5163,7 @@ components:
description: 成功数
type: integer
target_id:
description: 批量分配目标店铺或套餐系列ID
description: 批量分配目标店铺或套餐系列ID,回收任务为空
minimum: 0
nullable: true
type: integer
@@ -6296,7 +6296,7 @@ components:
minLength: 1
type: string
purpose:
description: 文件用途 (iot_import:ICCID导入, export:数据导出, attachment:附件, batch_purchase:资产套餐批量订购CSV, device_batch_allocation:设备批量分配CSV)
description: 文件用途 (iot_import:ICCID导入, export:数据导出, attachment:附件, batch_purchase:资产套餐批量订购CSV, device_batch_allocation:设备批量分配或回收CSV)
enum:
- iot_import
- export
@@ -17181,7 +17181,7 @@ paths:
- 设备管理
/api/admin/devices/import/allocations:
post:
description: 复用设备导入任务。CSV只能包含一列设备标识每行支持VirtualNo、IMEI或SN整批选择分配目标代理设置目标套餐系列。
description: 复用设备导入任务。CSV只能包含一列设备标识每行支持VirtualNo、IMEI或SN整批分配目标代理设置目标套餐系列或回收设备
requestBody:
content:
application/json:
@@ -17240,7 +17240,7 @@ paths:
description: 服务器内部错误
security:
- BearerAuth: []
summary: 创建CSV设备批量分配任务
summary: 创建CSV设备批量分配或回收任务
tags:
- 设备管理
/api/admin/devices/import/tasks:
@@ -17271,15 +17271,16 @@ paths:
minimum: 1
nullable: true
type: integer
- description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列)
- description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列, recall:回收设备)
in: query
name: operation_type
schema:
description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列)
description: 任务业务类型 (import:导入设备, assign_shop:分配目标代理, assign_series:设置套餐系列, recall:回收设备)
enum:
- import
- assign_shop
- assign_series
- recall
type: string
- description: 批次号(模糊查询)
in: query
@@ -27501,7 +27502,7 @@ paths:
|---|------|-------------|
| iot_import | ICCID/设备导入 (Excel) | imports/YYYY/MM/DD/uuid.xlsx |
| batch_purchase | 资产套餐批量订购 (CSV) | batch-purchases/YYYY/MM/DD/uuid.csv |
| device_batch_allocation | 设备批量分配代理或套餐系列 (CSV) | device-batch-allocations/YYYY/MM/DD/uuid.csv |
| device_batch_allocation | 设备批量分配、设置套餐系列或回收 (CSV) | device-batch-allocations/YYYY/MM/DD/uuid.csv |
| export | 数据导出 | exports/YYYY/MM/DD/uuid.xlsx |
| attachment | 附件上传 | attachments/YYYY/MM/DD/uuid.ext |

View File

@@ -1,4 +1,4 @@
# 设备 CSV 批量分配功能总结
# 设备 CSV 批量分配与回收功能总结
## 功能边界
@@ -22,7 +22,8 @@ POST /api/admin/devices/import/allocations
- `assign_shop``target_id` 为目标代理店铺 ID。
- `assign_series``target_id` 为目标套餐系列 ID。
- 每个任务只能选择一种操作和一个目标,不能逐行指定不同目标
- `recall`:不传 `target_id`;平台回收到平台库存,代理回收到自己店铺
- 每个任务只能选择一种操作,不能逐行指定不同操作或目标。
## CSV 格式
@@ -34,8 +35,9 @@ Worker 批量解析设备后调用现有业务方法:
- 分配代理调用 `DeviceService.AllocateDevices`,沿用直属下级、平台库存、绑定卡归属同步、分配记录和资产审计规则。
- 设置套餐系列调用 `DeviceService.BatchSetSeriesBinding`,沿用套餐系列有效性、代理授权、设备归属和资产审计规则。
- 回收设备调用 `DeviceService.RecallDevices`,代理只能回收直属下级的设备,平台可回收店铺设备,并同步绑定卡归属、分配记录和资产审计。
任务创建时冻结操作者 ID、类型和店铺 IDWorker 重建权限上下文,不能因异步执行丢失数据范围。重复消费时,已经属于目标店铺已经绑定目标系列的设备直接按成功处理任务完成或失败后不重复执行。CSV 内重复设备记录为跳过,不产生重复副作用。
任务创建时冻结操作者 ID、类型和店铺 IDWorker 重建权限上下文,不能因异步执行丢失数据范围。重复消费时,已经属于目标店铺已经绑定目标系列或已经回收到操作者归属的设备直接按成功处理任务完成或失败后不重复执行。CSV 内重复设备记录为跳过,不产生重复副作用。
## 任务查询与回滚