chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/iot/simcardbatch/cancel"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
type sIotTSimCardCancel struct {
|
||||
submitter *cancel.Submitter
|
||||
}
|
||||
|
||||
func NewIotTSimCardCancel() *sIotTSimCardCancel {
|
||||
return &sIotTSimCardCancel{submitter: cancel.NewSubmitter()}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterIotTSimCardCancel(NewIotTSimCardCancel())
|
||||
}
|
||||
|
||||
func (s *sIotTSimCardCancel) DownloadExcelTemplate(ctx context.Context) error {
|
||||
return writeLifecycleTemplate(ctx, "sim_card_cancel_template")
|
||||
}
|
||||
|
||||
func (s *sIotTSimCardCancel) SubmitExcel(ctx context.Context, in *model.TSimCardCancelExcelSubmitParam) (*model.TSimCardCancelExcelSubmitRes, error) {
|
||||
if in == nil {
|
||||
in = &model.TSimCardCancelExcelSubmitParam{}
|
||||
}
|
||||
file, err := lifecycleUploadFile(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result, err := s.submitter.SubmitExcel(ctx, file, in.Remark)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cancelSubmitResponse(result), nil
|
||||
}
|
||||
|
||||
func (s *sIotTSimCardCancel) SubmitInput(ctx context.Context, in *model.TSimCardCancelInputSubmitParam) (*model.TSimCardCancelInputSubmitRes, error) {
|
||||
if in == nil {
|
||||
in = &model.TSimCardCancelInputSubmitParam{}
|
||||
}
|
||||
result, err := s.submitter.SubmitInput(ctx, in.Input, in.Remark)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cancelSubmitResponse(result), nil
|
||||
}
|
||||
|
||||
func cancelSubmitResponse(result *cancel.SubmitResult) *model.TSimCardCancelExcelSubmitRes {
|
||||
res := &model.TSimCardCancelExcelSubmitRes{}
|
||||
if result == nil {
|
||||
return res
|
||||
}
|
||||
res.BatchNo = result.BatchNo
|
||||
res.BatchType = result.BatchType
|
||||
res.BatchAsyncStatus = result.BatchAsyncStatus
|
||||
res.Total = result.Total
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user