feat: 导入 Service 和 Worker 传递 realname_policy 写入资产记录
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -44,11 +44,12 @@ func (s *Service) CreateImportTask(ctx context.Context, req *dto.ImportDeviceReq
|
||||
fileName := filepath.Base(req.FileKey)
|
||||
|
||||
task := &model.DeviceImportTask{
|
||||
TaskNo: taskNo,
|
||||
Status: model.ImportTaskStatusPending,
|
||||
BatchNo: req.BatchNo,
|
||||
FileName: fileName,
|
||||
StorageKey: req.FileKey,
|
||||
TaskNo: taskNo,
|
||||
Status: model.ImportTaskStatusPending,
|
||||
BatchNo: req.BatchNo,
|
||||
FileName: fileName,
|
||||
StorageKey: req.FileKey,
|
||||
RealnamePolicy: req.RealnamePolicy,
|
||||
}
|
||||
task.Creator = userID
|
||||
task.Updater = userID
|
||||
|
||||
@@ -76,15 +76,16 @@ func (s *Service) CreateImportTask(ctx context.Context, req *dto.ImportIotCardRe
|
||||
}
|
||||
|
||||
task := &model.IotCardImportTask{
|
||||
TaskNo: taskNo,
|
||||
Status: model.ImportTaskStatusPending,
|
||||
CarrierID: req.CarrierID,
|
||||
CarrierType: carrier.CarrierType,
|
||||
CarrierName: carrier.CarrierName,
|
||||
BatchNo: req.BatchNo,
|
||||
FileName: fileName,
|
||||
StorageKey: req.FileKey,
|
||||
CardCategory: cardCategory,
|
||||
TaskNo: taskNo,
|
||||
Status: model.ImportTaskStatusPending,
|
||||
CarrierID: req.CarrierID,
|
||||
CarrierType: carrier.CarrierType,
|
||||
CarrierName: carrier.CarrierName,
|
||||
BatchNo: req.BatchNo,
|
||||
FileName: fileName,
|
||||
StorageKey: req.FileKey,
|
||||
CardCategory: cardCategory,
|
||||
RealnamePolicy: req.RealnamePolicy,
|
||||
}
|
||||
task.Creator = userID
|
||||
task.Updater = userID
|
||||
|
||||
@@ -279,15 +279,16 @@ func (h *DeviceImportHandler) processBatch(ctx context.Context, task *model.Devi
|
||||
txIotCardStore := postgres.NewIotCardStore(tx, nil)
|
||||
|
||||
device := &model.Device{
|
||||
VirtualNo: row.VirtualNo,
|
||||
IMEI: row.IMEI,
|
||||
DeviceName: row.DeviceName,
|
||||
DeviceModel: row.DeviceModel,
|
||||
DeviceType: row.DeviceType,
|
||||
MaxSimSlots: row.MaxSimSlots,
|
||||
Manufacturer: row.Manufacturer,
|
||||
BatchNo: task.BatchNo,
|
||||
Status: constants.DeviceStatusInStock,
|
||||
VirtualNo: row.VirtualNo,
|
||||
IMEI: row.IMEI,
|
||||
DeviceName: row.DeviceName,
|
||||
DeviceModel: row.DeviceModel,
|
||||
DeviceType: row.DeviceType,
|
||||
MaxSimSlots: row.MaxSimSlots,
|
||||
Manufacturer: row.Manufacturer,
|
||||
BatchNo: task.BatchNo,
|
||||
Status: constants.DeviceStatusInStock,
|
||||
RealnamePolicy: task.RealnamePolicy,
|
||||
}
|
||||
device.Creator = task.Creator
|
||||
device.Updater = task.Creator
|
||||
|
||||
@@ -358,6 +358,7 @@ func (h *IotCardImportHandler) processBatch(ctx context.Context, task *model.Iot
|
||||
ActivationStatus: constants.ActivationStatusInactive,
|
||||
RealNameStatus: constants.RealNameStatusNotVerified,
|
||||
NetworkStatus: constants.NetworkStatusOffline,
|
||||
RealnamePolicy: task.RealnamePolicy,
|
||||
}
|
||||
iotCard.BaseModel.Creator = task.Creator
|
||||
iotCard.BaseModel.Updater = task.Creator
|
||||
|
||||
Reference in New Issue
Block a user