Files
iotlcm/admin-svr/server/internal/controller/iot/iot_v1_tsimpoolbindpackage.go

132 lines
5.7 KiB
Go

package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
)
// List 查看卡池加油包订购表列表
func (c *ControllerV1) TSimPoolBindPackageList(ctx context.Context, req *v1.TSimPoolBindPackageListReq) (res *v1.TSimPoolBindPackageListRes, err error) {
list, totalCount, err := service.IotTSimPoolBindPackage().List(ctx, &req.TSimPoolBindPackageListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TSimPoolBindPackageListModel{}
}
res = new(v1.TSimPoolBindPackageListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出卡池加油包订购表列表
func (c *ControllerV1) TSimPoolBindPackageExport(ctx context.Context, req *v1.TSimPoolBindPackageExportReq) (res *v1.TSimPoolBindPackageExportRes, err error) {
err = service.IotTSimPoolBindPackage().Export(ctx, &req.TSimPoolBindPackageListParam)
return
}
// Edit 更新卡池加油包订购表
func (c *ControllerV1) TSimPoolBindPackageEdit(ctx context.Context, req *v1.TSimPoolBindPackageEditReq) (res *v1.TSimPoolBindPackageEditRes, err error) {
err = service.IotTSimPoolBindPackage().Edit(ctx, &req.TSimPoolBindPackageEditParam)
return
}
// View 获取指定卡池加油包订购表信息
func (c *ControllerV1) TSimPoolBindPackageView(ctx context.Context, req *v1.TSimPoolBindPackageViewReq) (res *v1.TSimPoolBindPackageViewRes, err error) {
data, err := service.IotTSimPoolBindPackage().View(ctx, &req.TSimPoolBindPackageViewParam)
if err != nil {
return
}
res = new(v1.TSimPoolBindPackageViewRes)
res.TSimPoolBindPackageViewModel = data
return
}
// Delete 删除卡池加油包订购表
func (c *ControllerV1) TSimPoolBindPackageDelete(ctx context.Context, req *v1.TSimPoolBindPackageDeleteReq) (res *v1.TSimPoolBindPackageDeleteRes, err error) {
err = service.IotTSimPoolBindPackage().Delete(ctx, &req.TSimPoolBindPackageDeleteParam)
return
}
func (c *ControllerV1) TSimPoolBindPackageAddPackagePaymentContext(ctx context.Context, req *v1.TSimPoolBindPackageAddPackagePaymentContextReq) (res *v1.TSimPoolBindPackageAddPackagePaymentContextRes, err error) {
data, err := service.IotTSimPoolBindPackage().AddPackagePaymentContext(ctx)
if err != nil {
return nil, err
}
if data == nil {
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
}
return &v1.TSimPoolBindPackageAddPackagePaymentContextRes{TSimAddPackageOptionsRes: data}, nil
}
func (c *ControllerV1) TSimPoolBindPackageAddPackageOptions(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageOptionsReq) (res *v1.TSimPoolBindPackageAddPackageOptionsRes, err error) {
data, err := service.IotTSimPoolBindPackage().AddPackageOptions(ctx, &req.TSimPoolAddPackageOptionsParam)
if err != nil {
return nil, err
}
if data == nil {
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
}
if data.Items == nil {
data.Items = []*model.TSimAddPackageOptionModel{}
}
return &v1.TSimPoolBindPackageAddPackageOptionsRes{TSimAddPackageOptionsRes: data}, nil
}
func (c *ControllerV1) TSimPoolBindPackageDownloadExcelTemplate(ctx context.Context, req *v1.TSimPoolBindPackageDownloadExcelTemplateReq) (res *v1.TSimPoolBindPackageDownloadExcelTemplateRes, err error) {
err = service.IotTSimPoolBindPackage().DownloadExcelTemplate(ctx)
return
}
func (c *ControllerV1) TSimPoolBindPackageSubmitExcel(ctx context.Context, req *v1.TSimPoolBindPackageSubmitExcelReq) (res *v1.TSimPoolBindPackageSubmitExcelRes, err error) {
data, err := service.IotTSimPoolBindPackage().SubmitExcel(ctx, &req.TSimPoolBindPackageAddPackageExcelSubmitParam)
if err != nil {
return
}
res = &v1.TSimPoolBindPackageSubmitExcelRes{TSimPoolBindPackageAddPackageExcelSubmitRes: data}
return
}
func (c *ControllerV1) TSimPoolBindPackageSubmitInput(ctx context.Context, req *v1.TSimPoolBindPackageSubmitInputReq) (res *v1.TSimPoolBindPackageSubmitInputRes, err error) {
data, err := service.IotTSimPoolBindPackage().SubmitInput(ctx, &req.TSimPoolBindPackageAddPackageInputSubmitParam)
if err != nil {
return
}
res = &v1.TSimPoolBindPackageSubmitInputRes{TSimPoolBindPackageAddPackageInputSubmitRes: data}
return
}
func (c *ControllerV1) TSimPoolBindPackageAddPackageInputPrepare(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageInputPrepareReq) (res *v1.TSimPoolBindPackageAddPackageInputPrepareRes, err error) {
data, err := service.IotTSimPoolBindPackage().PrepareInput(ctx, &req.TSimPoolBindPackageAddPackageInputPrepareParam)
if err != nil {
return nil, err
}
return &v1.TSimPoolBindPackageAddPackageInputPrepareRes{TSimPoolBindPackageAddPackageInputPrepareRes: data}, nil
}
func (c *ControllerV1) TSimPoolBindPackageAddPackagePrepareResult(ctx context.Context, req *v1.TSimPoolBindPackageAddPackagePrepareResultReq) (res *v1.TSimPoolBindPackageAddPackagePrepareResultRes, err error) {
data, err := service.IotTSimPoolBindPackage().PrepareResult(ctx, req.BatchNo)
if err != nil {
return nil, err
}
return &v1.TSimPoolBindPackageAddPackagePrepareResultRes{TSimPoolBindPackageAddPackagePrepareResultRes: data}, nil
}
func (c *ControllerV1) TSimPoolBindPackageAddPackageBatchConfirm(ctx context.Context, req *v1.TSimPoolBindPackageAddPackageBatchConfirmReq) (res *v1.TSimPoolBindPackageAddPackageBatchConfirmRes, err error) {
data, err := service.IotTSimPoolBindPackage().ConfirmBatch(ctx, &req.TSimPoolBindPackageAddPackageBatchConfirmParam)
if err != nil {
return nil, err
}
return &v1.TSimPoolBindPackageAddPackageBatchConfirmRes{TSimPoolBindPackageAddPackageBatchConfirmRes: data}, nil
}