50 lines
2.1 KiB
Go
50 lines
2.1 KiB
Go
package iot
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
|
)
|
|
|
|
func (c *ControllerV1) TSimCardAllocateExcelTemplate(ctx context.Context, req *v1.TSimCardAllocateExcelTemplateReq) (res *v1.TSimCardAllocateExcelTemplateRes, err error) {
|
|
err = service.IotTSimCardAllocate().DownloadExcelTemplate(ctx)
|
|
return nil, err
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardAllocateTargetList(ctx context.Context, req *v1.TSimCardAllocateTargetListReq) (res *v1.TSimCardAllocateTargetListRes, err error) {
|
|
items, err := service.IotTSimCardAllocate().ListTargets(ctx, &req.TSimCardAllocateTargetListParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardAllocateTargetListRes{Items: items, MaxInputRows: model.SimCardAllocateMaxInputRows}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardAllocateInputPrepare(ctx context.Context, req *v1.TSimCardAllocateInputPrepareReq) (res *v1.TSimCardAllocateInputPrepareRes, err error) {
|
|
if err = req.ValidateInput(); err != nil {
|
|
return nil, err
|
|
}
|
|
data, err := service.IotTSimCardAllocate().PrepareInput(ctx, &req.TSimCardAllocatePrepareParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardAllocateInputPrepareRes{TSimCardAllocateBatchModel: data}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardAllocateExcelSubmit(ctx context.Context, req *v1.TSimCardAllocateExcelSubmitReq) (res *v1.TSimCardAllocateExcelSubmitRes, err error) {
|
|
data, err := service.IotTSimCardAllocate().PrepareExcel(ctx, &req.TSimCardAllocateExcelSubmitParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardAllocateExcelSubmitRes{TSimCardAllocateBatchModel: data}, nil
|
|
}
|
|
|
|
func (c *ControllerV1) TSimCardAllocateBatchSubmit(ctx context.Context, req *v1.TSimCardAllocateBatchSubmitReq) (res *v1.TSimCardAllocateBatchSubmitRes, err error) {
|
|
data, err := service.IotTSimCardAllocate().SubmitBatch(ctx, &req.TSimCardAllocateBatchSubmitParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.TSimCardAllocateBatchSubmitRes{TSimCardAllocateBatchModel: data}, nil
|
|
}
|