chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,281 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
|
||||
"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/internal/service/fullsyncretry"
|
||||
)
|
||||
|
||||
type FullSyncMonitorController struct {
|
||||
client fullsyncretry.Client
|
||||
}
|
||||
|
||||
func NewFullSyncMonitor() *FullSyncMonitorController {
|
||||
return &FullSyncMonitorController{client: fullsyncretry.FromEnvironment()}
|
||||
}
|
||||
|
||||
func (c *FullSyncMonitorController) List(ctx context.Context, req *v1.FullSyncRunsListReq) (*v1.FullSyncRunsListRes, error) {
|
||||
result, err := c.client.ListRuns(ctx, req.SyncKind, req.Limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.FullSyncRunsListRes{Items: result.Items, Total: result.Total}, nil
|
||||
}
|
||||
|
||||
func (c *FullSyncMonitorController) Detail(ctx context.Context, req *v1.FullSyncRunDetailReq) (*v1.FullSyncRunDetailRes, error) {
|
||||
view, err := c.client.Run(ctx, req.RunID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
kind, name := fullSyncKindName(view.Run.Operation)
|
||||
return &v1.FullSyncRunDetailRes{RunView: view, SyncKind: kind, SyncName: name}, nil
|
||||
}
|
||||
|
||||
func (c *FullSyncMonitorController) Failures(ctx context.Context, req *v1.FullSyncRunFailuresReq) (*v1.FullSyncRunFailuresRes, error) {
|
||||
page, err := c.client.Failures(ctx, req.RunID, req.Limit, req.Cursor)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.FullSyncRunFailuresRes{Items: page.Items, NextCursor: page.NextCursor}, nil
|
||||
}
|
||||
|
||||
func (c *FullSyncMonitorController) Start(ctx context.Context, req *v1.FullSyncRunStartReq) (*v1.FullSyncRunStartRes, error) {
|
||||
userID := contexts.GetUserId(ctx)
|
||||
if userID == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
|
||||
}
|
||||
if !fullsyncretry.ValidSyncKind(req.SyncKind) {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid full-sync type")
|
||||
}
|
||||
// A period field only applies to its own sync kind. Rejecting a stray field
|
||||
// keeps an operator from believing a backfill was scheduled when it was not.
|
||||
period, err := resolvePeriod(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Validate and canonicalize the channel scope before the active-run check so
|
||||
// a malformed request fails fast without touching Worker state.
|
||||
scope, err := model.NormalizeScope(&model.SyncScope{Channels: req.Channels, TriggerSource: model.TriggerSourceManual})
|
||||
if err != nil {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, err.Error())
|
||||
}
|
||||
list, err := c.client.ListRuns(ctx, req.SyncKind, 100)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, item := range list.Items {
|
||||
if item.Run.Status == "producing" || item.Run.Status == "running" {
|
||||
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "A full-sync run is already active")
|
||||
}
|
||||
}
|
||||
var runID string
|
||||
switch req.SyncKind {
|
||||
case "traffic_usage":
|
||||
runID, err = service.TrafficUsageMonthlySync().StartMonthlyRunScoped(ctx, scope)
|
||||
case "sim_status":
|
||||
runID, err = service.SimStatusQueue().StartFullSyncRunScoped(ctx, scope)
|
||||
case "imei":
|
||||
runID, err = service.ImeiQueue().StartImeiRunScoped(ctx, scope)
|
||||
case "traffic_usage_daily":
|
||||
runID, err = service.TrafficUsageDailySync().StartDailyRunScopedAt(ctx, scope, req.QueryDate)
|
||||
case "traffic_usage_monthly":
|
||||
runID, err = service.TrafficUsageMonthlySync().StartMonthlyHistoryRunScopedAt(ctx, scope, req.QueryMonth)
|
||||
}
|
||||
if err != nil {
|
||||
g.Log().Warningf(ctx, "full_sync_manual_start rejected actor=%d syncKind=%s scopeChannels=%d period=%s error=%q", userID, req.SyncKind, scope.ChannelCount(), period, err.Error())
|
||||
return nil, err
|
||||
}
|
||||
g.Log().Infof(ctx, "full_sync_manual_start accepted actor=%d syncKind=%s runId=%s scopeChannels=%d scopeSample=%s period=%s", userID, req.SyncKind, runID, scope.ChannelCount(), strings.Join(scope.ChannelSample(10), ","), period)
|
||||
return &v1.FullSyncRunStartRes{RunID: runID, SyncKind: req.SyncKind, Status: "published", ScopeChannels: scope.ChannelCount(), QueryPeriod: period}, nil
|
||||
}
|
||||
|
||||
// resolvePeriod returns the requested backfill period for req.SyncKind and
|
||||
// rejects a period field that does not belong to that sync kind.
|
||||
func resolvePeriod(req *v1.FullSyncRunStartReq) (string, error) {
|
||||
if req.QueryDate != "" && req.SyncKind != "traffic_usage_daily" {
|
||||
return "", gerror.NewCodef(gcode.CodeInvalidParameter, "queryDate is only valid for syncKind=traffic_usage_daily, got %s", req.SyncKind)
|
||||
}
|
||||
if req.QueryMonth != "" && req.SyncKind != "traffic_usage_monthly" {
|
||||
return "", gerror.NewCodef(gcode.CodeInvalidParameter, "queryMonth is only valid for syncKind=traffic_usage_monthly, got %s", req.SyncKind)
|
||||
}
|
||||
switch req.SyncKind {
|
||||
case "traffic_usage_daily":
|
||||
return req.QueryDate, nil
|
||||
case "traffic_usage_monthly":
|
||||
return req.QueryMonth, nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Channels returns the channels a partial sync can target, with their card
|
||||
// counts so an operator can judge the blast radius before selecting.
|
||||
func (c *FullSyncMonitorController) Channels(ctx context.Context, _ *v1.FullSyncChannelOptionsReq) (*v1.FullSyncChannelOptionsRes, error) {
|
||||
if contexts.GetUserId(ctx) == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
|
||||
}
|
||||
tenantID := contexts.GetTenantId(ctx)
|
||||
type channelRow struct {
|
||||
ChanKey string `orm:"chan_key"`
|
||||
ChanName string `orm:"chan_name"`
|
||||
TempKey string `orm:"temp_key"`
|
||||
Operator int `orm:"operator"`
|
||||
SyncEnabled int `orm:"sync_enabled"`
|
||||
CardCount int64 `orm:"card_count"`
|
||||
}
|
||||
var rows []*channelRow
|
||||
channels := dao.TSimChannels.Columns()
|
||||
cards := dao.TSimCardInfo.Columns()
|
||||
// Count cards per channel in one pass. The left join keeps channels that
|
||||
// currently hold no cards so they stay selectable (and visibly empty), and
|
||||
// both sides are tenant-scoped so the count cannot leak across tenants.
|
||||
//
|
||||
// The select list and the GROUP BY clause must be built from the same
|
||||
// column set; see channelOptionsQuery for why.
|
||||
query := channelOptionsQuery(channelQueryColumns{
|
||||
ChanKey: channels.ChanKey,
|
||||
ChanName: channels.ChanName,
|
||||
TempKey: channels.TempKey,
|
||||
Operator: channels.Operator,
|
||||
SyncEnabled: channels.SyncEnabled,
|
||||
TenantID: channels.TenantId,
|
||||
}, cardQueryColumns{
|
||||
Id: cards.Id,
|
||||
ChanKey: cards.ChanKey,
|
||||
TenantID: cards.TenantId,
|
||||
}, tenantID)
|
||||
err := dao.TSimChannels.Ctx(ctx).
|
||||
As(query.alias).
|
||||
LeftJoin(query.joinTable, query.joinOn).
|
||||
Fields(query.fields...).
|
||||
Where(query.tenantWhere, query.tenantID).
|
||||
Group(query.groupBy...).
|
||||
OrderAsc(query.orderBy).
|
||||
Scan(&rows)
|
||||
if err != nil {
|
||||
return nil, gerror.Wrap(err, "load full-sync channel options failed")
|
||||
}
|
||||
items := make([]v1.FullSyncChannelOption, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
if row == nil {
|
||||
continue
|
||||
}
|
||||
items = append(items, v1.FullSyncChannelOption{
|
||||
ChanKey: row.ChanKey,
|
||||
ChanName: row.ChanName,
|
||||
TempKey: row.TempKey,
|
||||
Operator: row.Operator,
|
||||
CardCount: row.CardCount,
|
||||
SyncEnabled: row.SyncEnabled == 1,
|
||||
})
|
||||
}
|
||||
return &v1.FullSyncChannelOptionsRes{Items: items}, nil
|
||||
}
|
||||
|
||||
func fullSyncKindName(operation string) (string, string) {
|
||||
switch operation {
|
||||
case "current_month_usage_full_sync":
|
||||
return "traffic_usage", "流量全量同步"
|
||||
case "sim_status_queue_full_sync":
|
||||
return "sim_status", "卡状态全量同步"
|
||||
case "previous_day_usage_full_sync":
|
||||
return "traffic_usage_daily", "日流量全量同步"
|
||||
case "previous_month_usage_full_sync":
|
||||
return "traffic_usage_monthly", "月流量历史全量同步"
|
||||
case "imei_full_sync":
|
||||
return "imei", "IMEI 全量同步"
|
||||
default:
|
||||
return "", operation
|
||||
}
|
||||
}
|
||||
|
||||
// channelQueryColumns / cardQueryColumns carry the physical column names the
|
||||
// channel-options query needs. They keep the builder a pure function so its
|
||||
// SQL shape can be asserted in a unit test.
|
||||
type channelQueryColumns struct {
|
||||
ChanKey string
|
||||
ChanName string
|
||||
TempKey string
|
||||
Operator string
|
||||
SyncEnabled string
|
||||
TenantID string
|
||||
}
|
||||
|
||||
type cardQueryColumns struct {
|
||||
Id string
|
||||
ChanKey string
|
||||
TenantID string
|
||||
}
|
||||
|
||||
// channelOptionsQueryShape holds the assembled pieces of the channel-options query
|
||||
// so the SQL shape can be asserted without a database.
|
||||
type channelOptionsQueryShape struct {
|
||||
alias string
|
||||
joinTable string
|
||||
joinOn string
|
||||
fields []any
|
||||
groupBy []any
|
||||
orderBy string
|
||||
tenantWhere string
|
||||
tenantID string
|
||||
}
|
||||
|
||||
// channelOptionsQuery builds the channel candidate query.
|
||||
//
|
||||
// IMPORTANT: every non-aggregate column in the select list must also appear in
|
||||
// GROUP BY. MySQL runs with ONLY_FULL_GROUP_BY, and GoFrame sends the tenant
|
||||
// filter as a prepared-statement parameter. A bound parameter is not a
|
||||
// constant, so MySQL cannot use the unique key uk_key(tenant_id, chan_key) to
|
||||
// prove that chan_name/temp_key/operator/sync_enabled are functionally
|
||||
// dependent on the grouped column. Grouping by chan_key alone therefore fails
|
||||
// in production with:
|
||||
//
|
||||
// Error 1055: Expression #2 of SELECT list is not in GROUP BY clause and
|
||||
// contains nonaggregated column 'db_iotlcm.c.chan_name' which is not
|
||||
// functionally dependent on columns in GROUP BY clause
|
||||
//
|
||||
// Adding the remaining columns keeps the grouping semantically identical
|
||||
// because (tenant_id, chan_key) is unique, and it satisfies the SQL mode.
|
||||
func channelOptionsQuery(channels channelQueryColumns, cards cardQueryColumns, tenantID string) channelOptionsQueryShape {
|
||||
const alias = "c"
|
||||
const joinAlias = "ci"
|
||||
|
||||
// Single source of truth: the non-aggregate columns that are both selected
|
||||
// and grouped.
|
||||
nonAggregate := []struct{ column, out string }{
|
||||
{channels.ChanKey, "chan_key"},
|
||||
{channels.ChanName, "chan_name"},
|
||||
{channels.TempKey, "temp_key"},
|
||||
{channels.Operator, "operator"},
|
||||
{channels.SyncEnabled, "sync_enabled"},
|
||||
}
|
||||
|
||||
fields := make([]any, 0, len(nonAggregate)+1)
|
||||
groupBy := make([]any, 0, len(nonAggregate))
|
||||
for _, column := range nonAggregate {
|
||||
fields = append(fields, alias+"."+column.column+" AS "+column.out)
|
||||
groupBy = append(groupBy, alias+"."+column.column)
|
||||
}
|
||||
fields = append(fields, "COUNT("+joinAlias+"."+cards.Id+") AS card_count")
|
||||
|
||||
return channelOptionsQueryShape{
|
||||
alias: alias,
|
||||
joinTable: dao.TSimCardInfo.Table() + " AS " + joinAlias,
|
||||
joinOn: alias + "." + channels.ChanKey + " = " + joinAlias + "." + cards.ChanKey +
|
||||
" AND " + joinAlias + "." + cards.TenantID + " = " + alias + "." + channels.TenantID,
|
||||
fields: fields,
|
||||
groupBy: groupBy,
|
||||
orderBy: alias + "." + channels.ChanKey,
|
||||
tenantWhere: alias + "." + channels.TenantID,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// testChannelColumns mirrors the physical column names of t_sim_channels.
|
||||
func testChannelColumns() channelQueryColumns {
|
||||
return channelQueryColumns{
|
||||
ChanKey: "chan_key",
|
||||
ChanName: "chan_name",
|
||||
TempKey: "temp_key",
|
||||
Operator: "operator",
|
||||
SyncEnabled: "sync_enabled",
|
||||
TenantID: "tenant_id",
|
||||
}
|
||||
}
|
||||
|
||||
func testCardColumns() cardQueryColumns {
|
||||
return cardQueryColumns{Id: "id", ChanKey: "chan_key", TenantID: "tenant_id"}
|
||||
}
|
||||
|
||||
// TestChannelOptionsQueryGroupsEverySelectedNonAggregateColumn guards a
|
||||
// production regression.
|
||||
//
|
||||
// MySQL runs with ONLY_FULL_GROUP_BY and GoFrame binds the tenant filter as a
|
||||
// prepared-statement parameter. A bound parameter is not a constant, so MySQL
|
||||
// cannot use the unique key uk_key(tenant_id, chan_key) to prove that the
|
||||
// selected columns are functionally dependent on the grouped column. Grouping
|
||||
// by chan_key alone therefore fails on the real database with:
|
||||
//
|
||||
// Error 1055: Expression #2 of SELECT list is not in GROUP BY clause and
|
||||
// contains nonaggregated column 'db_iotlcm.c.chan_name' ...
|
||||
//
|
||||
// Every selected non-aggregate column must therefore be grouped.
|
||||
func TestChannelOptionsQueryGroupsEverySelectedNonAggregateColumn(t *testing.T) {
|
||||
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
|
||||
|
||||
// Derive the selected non-aggregate columns from the built select list, so
|
||||
// this test fails if someone adds a column to the query without grouping it.
|
||||
selected := make(map[string]string, len(query.fields))
|
||||
for _, field := range query.fields {
|
||||
expression, ok := field.(string)
|
||||
if !ok {
|
||||
t.Fatalf("unexpected non-string field %#v", field)
|
||||
}
|
||||
if strings.Contains(expression, "COUNT(") {
|
||||
continue // aggregate, does not belong in GROUP BY
|
||||
}
|
||||
// "c.chan_key AS chan_key" -> physical column "chan_key"
|
||||
physical := strings.TrimSpace(strings.Split(expression, " AS ")[0])
|
||||
physical = strings.TrimPrefix(physical, query.alias+".")
|
||||
selected[physical] = expression
|
||||
}
|
||||
if len(selected) == 0 {
|
||||
t.Fatal("query selects no non-aggregate columns; test would be vacuous")
|
||||
}
|
||||
|
||||
grouped := make(map[string]struct{}, len(query.groupBy))
|
||||
for _, column := range query.groupBy {
|
||||
name, ok := column.(string)
|
||||
if !ok {
|
||||
t.Fatalf("unexpected non-string group column %#v", column)
|
||||
}
|
||||
grouped[strings.TrimPrefix(name, query.alias+".")] = struct{}{}
|
||||
}
|
||||
|
||||
for physical, expression := range selected {
|
||||
if _, ok := grouped[physical]; !ok {
|
||||
t.Errorf("column %q is selected (%s) but not in GROUP BY; "+
|
||||
"MySQL ONLY_FULL_GROUP_BY will reject this query with Error 1055",
|
||||
physical, expression)
|
||||
}
|
||||
}
|
||||
if len(grouped) != len(selected) {
|
||||
t.Errorf("grouped %d columns but selected %d non-aggregate columns", len(grouped), len(selected))
|
||||
}
|
||||
}
|
||||
|
||||
// TestChannelOptionsQueryGroupsChanKeyAloneRegression pins the exact broken
|
||||
// shape: a GROUP BY that contains only chan_key.
|
||||
func TestChannelOptionsQueryGroupsChanKeyAloneRegression(t *testing.T) {
|
||||
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
|
||||
if len(query.groupBy) == 1 {
|
||||
t.Fatalf("GROUP BY contains only %v; grouping by chan_key alone fails under "+
|
||||
"ONLY_FULL_GROUP_BY with a bound tenant parameter (Error 1055)", query.groupBy)
|
||||
}
|
||||
}
|
||||
|
||||
// TestChannelOptionsQueryGroupsExpectedColumns locks the concrete clause so a
|
||||
// refactor cannot silently drop a column.
|
||||
func TestChannelOptionsQueryGroupsExpectedColumns(t *testing.T) {
|
||||
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
|
||||
got := make([]string, 0, len(query.groupBy))
|
||||
for _, column := range query.groupBy {
|
||||
got = append(got, column.(string))
|
||||
}
|
||||
want := []string{
|
||||
"c.chan_key",
|
||||
"c.chan_name",
|
||||
"c.temp_key",
|
||||
"c.operator",
|
||||
"c.sync_enabled",
|
||||
}
|
||||
if strings.Join(got, ",") != strings.Join(want, ",") {
|
||||
t.Fatalf("GROUP BY = %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// TestChannelOptionsQueryCountsCardsWithAggregate ensures the count column is
|
||||
// present and is not accidentally grouped.
|
||||
func TestChannelOptionsQueryCountsCardsWithAggregate(t *testing.T) {
|
||||
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
|
||||
var found bool
|
||||
for _, field := range query.fields {
|
||||
if strings.Contains(field.(string), "COUNT(ci.id) AS card_count") {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("card_count aggregate missing from fields: %v", query.fields)
|
||||
}
|
||||
for _, column := range query.groupBy {
|
||||
if strings.Contains(column.(string), "COUNT") {
|
||||
t.Fatalf("aggregate must not appear in GROUP BY: %v", query.groupBy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestChannelOptionsQueryScopesBothSidesToTenant keeps the tenant isolation
|
||||
// guarantee: the join condition and the WHERE clause must both be tenant-scoped.
|
||||
func TestChannelOptionsQueryScopesBothSidesToTenant(t *testing.T) {
|
||||
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
|
||||
if !strings.Contains(query.joinOn, "ci.tenant_id = c.tenant_id") {
|
||||
t.Errorf("join must scope both sides by tenant, got %q", query.joinOn)
|
||||
}
|
||||
if query.tenantWhere != "c.tenant_id" {
|
||||
t.Errorf("tenant where = %q, want c.tenant_id", query.tenantWhere)
|
||||
}
|
||||
if query.tenantID != "000000" {
|
||||
t.Errorf("tenant id = %q, want 000000", query.tenantID)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
|
||||
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/imeiqueue"
|
||||
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/simstatusqueue"
|
||||
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/trafficusage"
|
||||
"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/internal/service/fullsyncretry"
|
||||
)
|
||||
|
||||
type scopedStarter func(context.Context, *model.SyncScope) (string, error)
|
||||
|
||||
// periodStarter is the shape of the *At starters: a scope plus a yyyyMMdd or
|
||||
// yyyyMM period.
|
||||
type periodStarter func(context.Context, *model.SyncScope, string) (string, error)
|
||||
|
||||
type monthlyStarterStub struct {
|
||||
service.ITrafficUsageMonthlySync
|
||||
current scopedStarter
|
||||
history scopedStarter
|
||||
at periodStarter
|
||||
}
|
||||
|
||||
func (s monthlyStarterStub) StartMonthlyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
|
||||
return s.current(ctx, scope)
|
||||
}
|
||||
|
||||
func (s monthlyStarterStub) StartMonthlyHistoryRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
|
||||
return s.history(ctx, scope)
|
||||
}
|
||||
|
||||
func (s monthlyStarterStub) StartMonthlyHistoryRunScopedAt(ctx context.Context, scope *model.SyncScope, queryMonth string) (string, error) {
|
||||
return s.at(ctx, scope, queryMonth)
|
||||
}
|
||||
|
||||
type dailyStarterStub struct {
|
||||
service.ITrafficUsageDailySync
|
||||
start scopedStarter
|
||||
at periodStarter
|
||||
}
|
||||
|
||||
func (s dailyStarterStub) StartDailyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
|
||||
return s.start(ctx, scope)
|
||||
}
|
||||
|
||||
func (s dailyStarterStub) StartDailyRunScopedAt(ctx context.Context, scope *model.SyncScope, queryDate string) (string, error) {
|
||||
return s.at(ctx, scope, queryDate)
|
||||
}
|
||||
|
||||
type statusStarterStub struct {
|
||||
service.ISimStatusQueue
|
||||
start scopedStarter
|
||||
}
|
||||
|
||||
func (s statusStarterStub) StartFullSyncRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
|
||||
return s.start(ctx, scope)
|
||||
}
|
||||
|
||||
type imeiStarterStub struct {
|
||||
service.IImeiQueue
|
||||
start scopedStarter
|
||||
}
|
||||
|
||||
func (s imeiStarterStub) StartImeiRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
|
||||
return s.start(ctx, scope)
|
||||
}
|
||||
|
||||
func installFullSyncStarters(t *testing.T, start func(kind string, scope *model.SyncScope, periods ...string) (string, error)) {
|
||||
t.Helper()
|
||||
var (
|
||||
monthly = service.TrafficUsageMonthlySync()
|
||||
daily = service.TrafficUsageDailySync()
|
||||
status = service.SimStatusQueue()
|
||||
imei = service.ImeiQueue()
|
||||
)
|
||||
t.Cleanup(func() {
|
||||
service.RegisterTrafficUsageMonthlySync(monthly)
|
||||
service.RegisterTrafficUsageDailySync(daily)
|
||||
service.RegisterSimStatusQueue(status)
|
||||
service.RegisterImeiQueue(imei)
|
||||
})
|
||||
forKind := func(kind string) scopedStarter {
|
||||
return func(_ context.Context, scope *model.SyncScope) (string, error) { return start(kind, scope) }
|
||||
}
|
||||
forKindAt := func(kind string) periodStarter {
|
||||
return func(_ context.Context, scope *model.SyncScope, period string) (string, error) {
|
||||
return start(kind, scope, period)
|
||||
}
|
||||
}
|
||||
service.RegisterTrafficUsageMonthlySync(monthlyStarterStub{current: forKind("traffic_usage"), history: forKind("traffic_usage_monthly"), at: forKindAt("traffic_usage_monthly")})
|
||||
service.RegisterTrafficUsageDailySync(dailyStarterStub{start: forKind("traffic_usage_daily"), at: forKindAt("traffic_usage_daily")})
|
||||
service.RegisterSimStatusQueue(statusStarterStub{start: forKind("sim_status")})
|
||||
service.RegisterImeiQueue(imeiStarterStub{start: forKind("imei")})
|
||||
}
|
||||
|
||||
func fullSyncActorContext() context.Context {
|
||||
return contexts.Set(context.Background(), &model.Context{User: &model.Identity{BaseClaims: model.BaseClaims{ID: 42}}})
|
||||
}
|
||||
|
||||
func TestFullSyncStartAndMonitorAllFiveKinds(t *testing.T) {
|
||||
var started []string
|
||||
var periods []string
|
||||
installFullSyncStarters(t, func(kind string, scope *model.SyncScope, period ...string) (string, error) {
|
||||
started = append(started, kind)
|
||||
if scope.TriggerSource != model.TriggerSourceManual || !reflect.DeepEqual(scope.Channels, []string{"a", "b"}) {
|
||||
t.Errorf("%s scope = %+v", kind, scope)
|
||||
}
|
||||
// Without a period field the *At starters must receive an empty period,
|
||||
// i.e. the run keeps its historical default window.
|
||||
periods = append(periods, period...)
|
||||
return "run-" + kind, nil
|
||||
})
|
||||
var filters []string
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet || r.URL.Path != "/internal/v1/full-sync-runs" || r.URL.Query().Get("limit") != "100" {
|
||||
t.Errorf("unexpected active-run request: %s %s", r.Method, r.URL)
|
||||
}
|
||||
filters = append(filters, r.URL.Query().Get("syncKind"))
|
||||
_, _ = w.Write([]byte(`{"items":[],"total":0}`))
|
||||
}))
|
||||
defer server.Close()
|
||||
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
|
||||
tests := []struct{ kind, operation string }{
|
||||
{"traffic_usage", "current_month_usage_full_sync"},
|
||||
{"sim_status", "sim_status_queue_full_sync"},
|
||||
{"imei", "imei_full_sync"},
|
||||
{"traffic_usage_daily", "previous_day_usage_full_sync"},
|
||||
{"traffic_usage_monthly", "previous_month_usage_full_sync"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.kind, func(t *testing.T) {
|
||||
var req v1.FullSyncRunStartReq
|
||||
body, _ := json.Marshal(map[string]any{"syncKind": tt.kind, "channels": []string{"b", "a", "b"}})
|
||||
if err := json.Unmarshal(body, &req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
res, err := controller.Start(fullSyncActorContext(), &req)
|
||||
if err != nil || res.RunID != "run-"+tt.kind || res.SyncKind != tt.kind || res.Status != "published" || res.ScopeChannels != 2 {
|
||||
t.Fatalf("start = %+v, err = %v", res, err)
|
||||
}
|
||||
if res.QueryPeriod != "" {
|
||||
t.Fatalf("%s queryPeriod = %q, want empty for the default period", tt.kind, res.QueryPeriod)
|
||||
}
|
||||
if got, name := fullSyncKindName(tt.operation); got != tt.kind || name == "" {
|
||||
t.Fatalf("operation %q maps to %q, %q", tt.operation, got, name)
|
||||
}
|
||||
if _, err := controller.List(context.Background(), &v1.FullSyncRunsListReq{SyncKind: tt.kind, Limit: 100}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
if len(started) != 5 || len(filters) != 10 {
|
||||
t.Fatalf("starts = %v, filters = %v", started, filters)
|
||||
}
|
||||
// Only the daily and monthly-history kinds go through a period-aware starter.
|
||||
if len(periods) != 2 || periods[0] != "" || periods[1] != "" {
|
||||
t.Fatalf("periods = %v, want two empty periods", periods)
|
||||
}
|
||||
for i, tt := range tests {
|
||||
if started[i] != tt.kind || filters[2*i] != tt.kind || filters[2*i+1] != tt.kind {
|
||||
t.Fatalf("incorrect kind routing: starts = %v, filters = %v", started, filters)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFullSyncStartRejectsInvalidAndActiveRequests(t *testing.T) {
|
||||
starts, queries := 0, 0
|
||||
installFullSyncStarters(t, func(string, *model.SyncScope, ...string) (string, error) {
|
||||
starts++
|
||||
return "unexpected", nil
|
||||
})
|
||||
active := "running"
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
queries++
|
||||
_ = json.NewEncoder(w).Encode(fullsyncretry.RunList{Items: []fullsyncretry.RunView{{Run: fullsyncretry.RunMeta{Status: active}}}})
|
||||
}))
|
||||
defer server.Close()
|
||||
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
|
||||
if _, err := controller.Start(context.Background(), &v1.FullSyncRunStartReq{SyncKind: "imei"}); gerror.Code(err) != gcode.CodeNotAuthorized {
|
||||
t.Fatalf("anonymous start = %v", err)
|
||||
}
|
||||
for _, req := range []v1.FullSyncRunStartReq{
|
||||
{SyncKind: ""}, {SyncKind: "unknown"}, {SyncKind: "imei", Channels: []string{"bad/channel"}},
|
||||
} {
|
||||
if _, err := controller.Start(fullSyncActorContext(), &req); gerror.Code(err) != gcode.CodeInvalidParameter {
|
||||
t.Fatalf("invalid request %+v = %v", req, err)
|
||||
}
|
||||
}
|
||||
if queries != 0 {
|
||||
t.Fatal("invalid request queried Worker")
|
||||
}
|
||||
for _, kind := range []string{"traffic_usage", "sim_status", "imei", "traffic_usage_daily", "traffic_usage_monthly"} {
|
||||
for _, active = range []string{"running", "producing"} {
|
||||
if _, err := controller.Start(fullSyncActorContext(), &v1.FullSyncRunStartReq{SyncKind: kind}); gerror.Code(err) != gcode.CodeInvalidParameter {
|
||||
t.Fatalf("%s/%s active run = %v", kind, active, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if starts != 0 || queries != 10 {
|
||||
t.Fatalf("starts = %d, queries = %d", starts, queries)
|
||||
}
|
||||
}
|
||||
|
||||
// TestFullSyncStartForwardsQueryPeriod pins the backfill wiring: the requested
|
||||
// period must reach the period-aware starter, and the response must echo it so
|
||||
// the operator can see which window the run covers.
|
||||
func TestFullSyncStartForwardsQueryDate(t *testing.T) {
|
||||
assertFullSyncPeriodForwarded(t, "traffic_usage_daily", "20261014")
|
||||
}
|
||||
|
||||
func TestFullSyncStartForwardsQueryMonth(t *testing.T) {
|
||||
assertFullSyncPeriodForwarded(t, "traffic_usage_monthly", "202604")
|
||||
}
|
||||
|
||||
func assertFullSyncPeriodForwarded(t *testing.T, syncKind, period string) {
|
||||
t.Helper()
|
||||
type call struct{ kind, period string }
|
||||
var calls []call
|
||||
installFullSyncStarters(t, func(kind string, _ *model.SyncScope, periods ...string) (string, error) {
|
||||
calls = append(calls, call{kind: kind, period: periods[0]})
|
||||
return "run-" + kind, nil
|
||||
})
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = w.Write([]byte(`{"items":[],"total":0}`))
|
||||
}))
|
||||
defer server.Close()
|
||||
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
|
||||
|
||||
req := &v1.FullSyncRunStartReq{SyncKind: syncKind}
|
||||
if syncKind == "traffic_usage_daily" {
|
||||
req.QueryDate = period
|
||||
} else {
|
||||
req.QueryMonth = period
|
||||
}
|
||||
res, err := controller.Start(fullSyncActorContext(), req)
|
||||
if err != nil {
|
||||
t.Fatalf("start = %v", err)
|
||||
}
|
||||
if res.QueryPeriod != period {
|
||||
t.Fatalf("queryPeriod = %q, want %q", res.QueryPeriod, period)
|
||||
}
|
||||
if len(calls) != 1 || calls[0].kind != syncKind || calls[0].period != period {
|
||||
t.Fatalf("starter calls = %+v, want one %s call with period %s", calls, syncKind, period)
|
||||
}
|
||||
}
|
||||
|
||||
// TestFullSyncStartRejectsMismatchedPeriodField keeps a stray period field from
|
||||
// silently doing nothing: queryMonth on a daily run is a caller mistake.
|
||||
func TestFullSyncStartRejectsMismatchedPeriodField(t *testing.T) {
|
||||
starts := 0
|
||||
installFullSyncStarters(t, func(string, *model.SyncScope, ...string) (string, error) {
|
||||
starts++
|
||||
return "unexpected", nil
|
||||
})
|
||||
queries := 0
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
queries++
|
||||
_, _ = w.Write([]byte(`{"items":[],"total":0}`))
|
||||
}))
|
||||
defer server.Close()
|
||||
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
|
||||
|
||||
for _, req := range []v1.FullSyncRunStartReq{
|
||||
{SyncKind: "traffic_usage_daily", QueryMonth: "202604"},
|
||||
{SyncKind: "traffic_usage_monthly", QueryDate: "20261014"},
|
||||
{SyncKind: "imei", QueryDate: "20261014"},
|
||||
{SyncKind: "sim_status", QueryMonth: "202604"},
|
||||
{SyncKind: "traffic_usage", QueryMonth: "202604"},
|
||||
} {
|
||||
if _, err := controller.Start(fullSyncActorContext(), &req); gerror.Code(err) != gcode.CodeInvalidParameter {
|
||||
t.Fatalf("mismatched request %+v = %v, want invalid parameter", req, err)
|
||||
}
|
||||
}
|
||||
if starts != 0 {
|
||||
t.Fatalf("starters called %d times for rejected requests", starts)
|
||||
}
|
||||
if queries != 0 {
|
||||
t.Fatal("rejected request queried Worker")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry"
|
||||
)
|
||||
|
||||
type FullSyncReplayController struct{ client fullsyncretry.Client }
|
||||
|
||||
func NewFullSyncReplay() *FullSyncReplayController {
|
||||
return &FullSyncReplayController{client: fullsyncretry.FromEnvironment()}
|
||||
}
|
||||
|
||||
func (c *FullSyncReplayController) Replay(ctx context.Context, req *v1.FullSyncReplayReq) (*v1.FullSyncReplayRes, error) {
|
||||
userID := contexts.GetUserId(ctx)
|
||||
if userID == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
|
||||
}
|
||||
receipt, err := c.client.Replay(ctx, req.SourceRunID, strconv.FormatInt(userID, 10), req.MaxRounds)
|
||||
if err != nil {
|
||||
g.Log().Warningf(ctx, "full_sync_replay rejected actor=%d sourceRunId=%s maxRounds=%d", userID, req.SourceRunID, req.MaxRounds)
|
||||
return nil, err
|
||||
}
|
||||
g.Log().Infof(ctx, "full_sync_replay accepted actor=%d sourceRunId=%s maxRounds=%d replayRunId=%s", userID, req.SourceRunID, req.MaxRounds, receipt.ReplayRunID)
|
||||
return &v1.FullSyncReplayRes{ReplayRunID: receipt.ReplayRunID, Status: receipt.Status}, nil
|
||||
}
|
||||
|
||||
func (c *FullSyncReplayController) Status(ctx context.Context, req *v1.FullSyncReplayStatusReq) (*v1.FullSyncReplayStatusRes, error) {
|
||||
if contexts.GetUserId(ctx) == 0 {
|
||||
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
|
||||
}
|
||||
status, err := c.client.Get(ctx, req.ReplayRunID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.FullSyncReplayStatusRes{ReplayRunID: status.ReplayRunID, SourceRunID: status.SourceRunID, Status: status.Status, Enqueued: status.Enqueued, Remaining: status.Remaining, RunStatus: status.RunStatus, Error: status.Error}, nil
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry"
|
||||
)
|
||||
|
||||
func TestFullSyncReplayRequestMaxRoundsThroughController(t *testing.T) {
|
||||
var bodies []map[string]any
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost || r.URL.Path != "/internal/v1/full-sync-runs/source/replay" || r.Header.Get("Content-Type") != "application/json" {
|
||||
t.Errorf("unexpected Worker request: %s %s", r.Method, r.URL)
|
||||
}
|
||||
var body map[string]any
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
bodies = append(bodies, body)
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
_, _ = w.Write([]byte(`{"replayRunId":"replay-1","status":"accepted"}`))
|
||||
}))
|
||||
defer server.Close()
|
||||
controller := &FullSyncReplayController{client: fullsyncretry.Client{BaseURL: server.URL}}
|
||||
tests := []struct {
|
||||
body string
|
||||
rounds int
|
||||
}{
|
||||
{`{"sourceRunId":"source"}`, 0},
|
||||
{`{"sourceRunId":"source","maxRounds":0}`, 0},
|
||||
{`{"sourceRunId":"source","maxRounds":1}`, 1},
|
||||
{`{"sourceRunId":"source","maxRounds":3}`, 3},
|
||||
{`{"sourceRunId":"source","maxRounds":7}`, 7},
|
||||
{`{"sourceRunId":"source","maxRounds":100}`, 100},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
var req v1.FullSyncReplayReq
|
||||
if err := json.Unmarshal([]byte(tt.body), &req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := g.Validator().Data(req).Run(context.Background()); err != nil {
|
||||
t.Fatalf("valid request %s: %v", tt.body, err)
|
||||
}
|
||||
res, err := controller.Replay(fullSyncActorContext(), &req)
|
||||
if err != nil || res.ReplayRunID != "replay-1" || res.Status != "accepted" {
|
||||
t.Fatalf("replay = %+v, err = %v", res, err)
|
||||
}
|
||||
body := bodies[i]
|
||||
if body["requestedBy"] != "42" {
|
||||
t.Fatalf("actor not forwarded: %+v", body)
|
||||
}
|
||||
if tt.rounds == 0 {
|
||||
if len(body) != 1 {
|
||||
t.Fatalf("legacy Worker must receive no extra field: %+v", body)
|
||||
}
|
||||
} else if len(body) != 2 || body["maxRounds"] != float64(tt.rounds) {
|
||||
t.Fatalf("rounds not forwarded: %+v", body)
|
||||
}
|
||||
}
|
||||
for _, rounds := range []int{-1, 101} {
|
||||
req := v1.FullSyncReplayReq{SourceRunID: "source", MaxRounds: rounds}
|
||||
if err := g.Validator().Data(req).Run(context.Background()); err == nil {
|
||||
t.Fatalf("API accepted maxRounds=%d", rounds)
|
||||
}
|
||||
if _, err := controller.Replay(fullSyncActorContext(), &req); gerror.Code(err) != gcode.CodeInvalidParameter {
|
||||
t.Fatalf("controller accepted maxRounds=%d: %v", rounds, err)
|
||||
}
|
||||
}
|
||||
if _, err := controller.Replay(context.Background(), &v1.FullSyncReplayReq{SourceRunID: "source", MaxRounds: 3}); gerror.Code(err) != gcode.CodeNotAuthorized {
|
||||
t.Fatalf("anonymous replay = %v", err)
|
||||
}
|
||||
if len(bodies) != len(tests) {
|
||||
t.Fatalf("invalid/anonymous request reached Worker: %d calls", len(bodies))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package iot
|
||||
@@ -0,0 +1,13 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package iot
|
||||
|
||||
import "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot"
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() iot.IIotV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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/model/response"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimWarningConfigExcelTemplate(ctx context.Context, req *v1.TSimWarningConfigExcelTemplateReq) (res *v1.TSimWarningConfigExcelTemplateRes, err error) {
|
||||
err = service.IotTSimWarningConfig().DownloadExcelTemplate(ctx, req.ItemType)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimWarningConfigEmailCode(ctx context.Context, req *v1.TSimWarningConfigEmailCodeReq) (res *v1.TSimWarningConfigEmailCodeRes, err error) {
|
||||
if err = service.IotTSimWarningConfig().SendEmailCode(ctx, &req.TSimWarningConfigEmailCodeParam); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimWarningConfigEmailCodeRes{}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimWarningConfigExcelSubmit(ctx context.Context, req *v1.TSimWarningConfigExcelSubmitReq) (res *v1.TSimWarningConfigExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimWarningConfig().SubmitExcel(ctx, &req.TSimWarningConfigExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimWarningConfigExcelSubmitRes{TSimWarningConfigExcelSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimWarningConfigInputSubmit(ctx context.Context, req *v1.TSimWarningConfigInputSubmitReq) (res *v1.TSimWarningConfigInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimWarningConfig().SubmitInput(ctx, &req.TSimWarningConfigInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimWarningConfigInputSubmitRes{TSimWarningConfigInputSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimWarningConfigRangeSubmit(ctx context.Context, req *v1.TSimWarningConfigRangeSubmitReq) (res *v1.TSimWarningConfigRangeSubmitRes, err error) {
|
||||
data, err := service.IotTSimWarningConfig().SubmitRange(ctx, &req.TSimWarningConfigRangeSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimWarningConfigRangeSubmitRes{TSimWarningConfigRangeSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SimWarningConfigList(ctx context.Context, req *v1.SimWarningConfigListReq) (res *v1.SimWarningConfigListRes, err error) {
|
||||
list, totalCount, err := service.SimWarning().ConfigList(ctx, &req.SimWarningConfigListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*model.SimWarningConfigModel{}
|
||||
}
|
||||
return &v1.SimWarningConfigListRes{
|
||||
PageResult: response.PageResult{
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
Total: totalCount,
|
||||
},
|
||||
Items: list,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SimWarningConfigView(ctx context.Context, req *v1.SimWarningConfigViewReq) (res *v1.SimWarningConfigViewRes, err error) {
|
||||
data, err := service.SimWarning().ConfigView(ctx, &req.SimWarningConfigViewParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SimWarningConfigViewRes{SimWarningConfigModel: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SimWarningConfigSave(ctx context.Context, req *v1.SimWarningConfigSaveReq) (res *v1.SimWarningConfigSaveRes, err error) {
|
||||
data, err := service.SimWarning().ConfigSave(ctx, &req.SimWarningConfigSaveParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SimWarningConfigSaveRes{SimWarningConfigSaveModel: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SimWarningConfigStatus(ctx context.Context, req *v1.SimWarningConfigStatusReq) (res *v1.SimWarningConfigStatusRes, err error) {
|
||||
err = service.SimWarning().ConfigStatus(ctx, &req.SimWarningConfigStatusParam)
|
||||
return &v1.SimWarningConfigStatusRes{}, err
|
||||
}
|
||||
|
||||
func (c *ControllerV1) SimWarningConfigDelete(ctx context.Context, req *v1.SimWarningConfigDeleteReq) (res *v1.SimWarningConfigDeleteRes, err error) {
|
||||
err = service.SimWarning().ConfigDelete(ctx, &req.SimWarningConfigDeleteParam)
|
||||
return &v1.SimWarningConfigDeleteRes{}, err
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataCutExcelSubmit(ctx context.Context, req *v1.TSimCardDataCutExcelSubmitReq) (res *v1.TSimCardDataCutExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardDataCut().SubmitExcel(ctx, &req.TSimCardDataCutExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardDataCutExcelSubmitRes{TSimCardDataCutExcelSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataCutExcelTemplate(ctx context.Context, req *v1.TSimCardDataCutExcelTemplateReq) (res *v1.TSimCardDataCutExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardDataCut().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataCutInputSubmit(ctx context.Context, req *v1.TSimCardDataCutInputSubmitReq) (res *v1.TSimCardDataCutInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardDataCut().SubmitInput(ctx, &req.TSimCardDataCutInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardDataCutInputSubmitRes{TSimCardDataCutInputSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataStartExcelSubmit(ctx context.Context, req *v1.TSimCardDataStartExcelSubmitReq) (res *v1.TSimCardDataStartExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardDataStart().SubmitExcel(ctx, &req.TSimCardDataStartExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardDataStartExcelSubmitRes{TSimCardDataStartSubmitRes: data}, nil
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataStartExcelTemplate(ctx context.Context, req *v1.TSimCardDataStartExcelTemplateReq) (res *v1.TSimCardDataStartExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardDataStart().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataStartInputSubmit(ctx context.Context, req *v1.TSimCardDataStartInputSubmitReq) (res *v1.TSimCardDataStartInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardDataStart().SubmitInput(ctx, &req.TSimCardDataStartInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardDataStartInputSubmitRes{TSimCardDataStartSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataStopExcelSubmit(ctx context.Context, req *v1.TSimCardDataStopExcelSubmitReq) (res *v1.TSimCardDataStopExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardDataStop().SubmitExcel(ctx, &req.TSimCardDataStopExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardDataStopExcelSubmitRes{TSimCardDataStopSubmitRes: data}, nil
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataStopExcelTemplate(ctx context.Context, req *v1.TSimCardDataStopExcelTemplateReq) (res *v1.TSimCardDataStopExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardDataStop().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardDataStopInputSubmit(ctx context.Context, req *v1.TSimCardDataStopInputSubmitReq) (res *v1.TSimCardDataStopInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardDataStop().SubmitInput(ctx, &req.TSimCardDataStopInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardDataStopInputSubmitRes{TSimCardDataStopSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardRestartExcelSubmit(ctx context.Context, req *v1.TSimCardRestartExcelSubmitReq) (res *v1.TSimCardRestartExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardRestart().SubmitExcel(ctx, &req.TSimCardRestartExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardRestartExcelSubmitRes{TSimCardRestartExcelSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardRestartExcelTemplate(ctx context.Context, req *v1.TSimCardRestartExcelTemplateReq) (res *v1.TSimCardRestartExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardRestart().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardRestartInputSubmit(ctx context.Context, req *v1.TSimCardRestartInputSubmitReq) (res *v1.TSimCardRestartInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardRestart().SubmitInput(ctx, &req.TSimCardRestartInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardRestartInputSubmitRes{TSimCardRestartInputSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardStartExcelSubmit(ctx context.Context, req *v1.TSimCardStartExcelSubmitReq) (res *v1.TSimCardStartExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardStart().SubmitExcel(ctx, &req.TSimCardStartExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardStartExcelSubmitRes{TSimCardStartExcelSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardStartExcelTemplate(ctx context.Context, req *v1.TSimCardStartExcelTemplateReq) (res *v1.TSimCardStartExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardStart().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardStartInputSubmit(ctx context.Context, req *v1.TSimCardStartInputSubmitReq) (res *v1.TSimCardStartInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardStart().SubmitInput(ctx, &req.TSimCardStartInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardStartInputSubmitRes{TSimCardStartInputSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardStopExcelSubmit(ctx context.Context, req *v1.TSimCardStopExcelSubmitReq) (res *v1.TSimCardStopExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardStop().SubmitExcel(ctx, &req.TSimCardStopExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardStopExcelSubmitRes{TSimCardStopExcelSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardStopExcelTemplate(ctx context.Context, req *v1.TSimCardStopExcelTemplateReq) (res *v1.TSimCardStopExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardStop().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardStopInputSubmit(ctx context.Context, req *v1.TSimCardStopInputSubmitReq) (res *v1.TSimCardStopInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardStop().SubmitInput(ctx, &req.TSimCardStopInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardStopInputSubmitRes{TSimCardStopInputSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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 查看SIM流量池套餐配置表列表
|
||||
func (c *ControllerV1) TFlowPackageConfigList(ctx context.Context, req *v1.TFlowPackageConfigListReq) (res *v1.TFlowPackageConfigListRes, err error) {
|
||||
list, totalCount, err := service.IotTFlowPackageConfig().List(ctx, &req.TFlowPackageConfigListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TFlowPackageConfigListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TFlowPackageConfigListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出SIM流量池套餐配置表列表
|
||||
func (c *ControllerV1) TFlowPackageConfigExport(ctx context.Context, req *v1.TFlowPackageConfigExportReq) (res *v1.TFlowPackageConfigExportRes, err error) {
|
||||
err = service.IotTFlowPackageConfig().Export(ctx, &req.TFlowPackageConfigListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新SIM流量池套餐配置表
|
||||
func (c *ControllerV1) TFlowPackageConfigEdit(ctx context.Context, req *v1.TFlowPackageConfigEditReq) (res *v1.TFlowPackageConfigEditRes, err error) {
|
||||
err = service.IotTFlowPackageConfig().Edit(ctx, &req.TFlowPackageConfigEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定SIM流量池套餐配置表信息
|
||||
func (c *ControllerV1) TFlowPackageConfigView(ctx context.Context, req *v1.TFlowPackageConfigViewReq) (res *v1.TFlowPackageConfigViewRes, err error) {
|
||||
data, err := service.IotTFlowPackageConfig().View(ctx, &req.TFlowPackageConfigViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TFlowPackageConfigViewRes)
|
||||
res.TFlowPackageConfigViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除SIM流量池套餐配置表
|
||||
func (c *ControllerV1) TFlowPackageConfigDelete(ctx context.Context, req *v1.TFlowPackageConfigDeleteReq) (res *v1.TFlowPackageConfigDeleteRes, err error) {
|
||||
err = service.IotTFlowPackageConfig().Delete(ctx, &req.TFlowPackageConfigDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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) TOrderList(ctx context.Context, req *v1.TOrderListReq) (res *v1.TOrderListRes, err error) {
|
||||
list, totalCount, err := service.IotTOrder().List(ctx, &req.TOrderListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TOrderListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TOrderListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出订单主表列表
|
||||
func (c *ControllerV1) TOrderExport(ctx context.Context, req *v1.TOrderExportReq) (res *v1.TOrderExportRes, err error) {
|
||||
err = service.IotTOrder().Export(ctx, &req.TOrderListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新订单主表
|
||||
func (c *ControllerV1) TOrderEdit(ctx context.Context, req *v1.TOrderEditReq) (res *v1.TOrderEditRes, err error) {
|
||||
err = service.IotTOrder().Edit(ctx, &req.TOrderEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定订单主表信息
|
||||
func (c *ControllerV1) TOrderView(ctx context.Context, req *v1.TOrderViewReq) (res *v1.TOrderViewRes, err error) {
|
||||
data, err := service.IotTOrder().View(ctx, &req.TOrderViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TOrderViewRes)
|
||||
res.TOrderViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除订单主表
|
||||
func (c *ControllerV1) TOrderDelete(ctx context.Context, req *v1.TOrderDeleteReq) (res *v1.TOrderDeleteRes, err error) {
|
||||
err = service.IotTOrder().Delete(ctx, &req.TOrderDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
// SellList 查看销售订单列表
|
||||
func (c *ControllerV1) TOrderSellList(ctx context.Context, req *v1.TOrderSellListReq) (res *v1.TOrderSellListRes, err error) {
|
||||
list, totalCount, err := service.IotTOrder().SellList(ctx, &req.TOrderListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TOrderListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TOrderSellListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看订购表列表
|
||||
func (c *ControllerV1) TSimCardBindPkgList(ctx context.Context, req *v1.TSimCardBindPkgListReq) (res *v1.TSimCardBindPkgListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimCardBindPkg().List(ctx, &req.TSimCardBindPkgListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimCardBindPkgListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardBindPkgListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出订购表列表
|
||||
func (c *ControllerV1) TSimCardBindPkgExport(ctx context.Context, req *v1.TSimCardBindPkgExportReq) (res *v1.TSimCardBindPkgExportRes, err error) {
|
||||
err = service.IotTSimCardBindPkg().Export(ctx, &req.TSimCardBindPkgListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新订购表
|
||||
func (c *ControllerV1) TSimCardBindPkgEdit(ctx context.Context, req *v1.TSimCardBindPkgEditReq) (res *v1.TSimCardBindPkgEditRes, err error) {
|
||||
err = service.IotTSimCardBindPkg().Edit(ctx, &req.TSimCardBindPkgEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定订购表信息
|
||||
func (c *ControllerV1) TSimCardBindPkgView(ctx context.Context, req *v1.TSimCardBindPkgViewReq) (res *v1.TSimCardBindPkgViewRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().View(ctx, &req.TSimCardBindPkgViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardBindPkgViewRes)
|
||||
res.TSimCardBindPkgViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除订购表
|
||||
func (c *ControllerV1) TSimCardBindPkgDelete(ctx context.Context, req *v1.TSimCardBindPkgDeleteReq) (res *v1.TSimCardBindPkgDeleteRes, err error) {
|
||||
err = service.IotTSimCardBindPkg().Delete(ctx, &req.TSimCardBindPkgDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
// GetPkgInfo 套餐详情查询
|
||||
func (c *ControllerV1) TSimCardBindPkgGetPkgInfo(ctx context.Context, req *v1.TSimCardBindPkgGetPkgInfoReq) (res *v1.TSimCardBindPkgGetPkgInfoRes, err error) {
|
||||
list, totalCount, err := service.IotTSimCardBindPkg().GetPkgInfo(ctx, &req.TSimCardBindPkgInfoParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimCardBindPkgListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardBindPkgGetPkgInfoRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// GetChangePkg 变更套餐查询
|
||||
func (c *ControllerV1) TSimCardBindPkgGetChangePkg(ctx context.Context, req *v1.TSimCardBindPkgGetChangePkgReq) (res *v1.TSimCardBindPkgGetChangePkgRes, err error) {
|
||||
list, totalCount, err := service.IotTSimCardBindPkg().GetChangePkg(ctx, &req.TSimCardBindPkgInfoParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimCardBindPkgListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardBindPkgGetChangePkgRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgAddPackagePaymentContext(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePaymentContextReq) (res *v1.TSimCardBindPkgAddPackagePaymentContextRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().AddPackagePaymentContext(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if data == nil {
|
||||
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
|
||||
}
|
||||
return &v1.TSimCardBindPkgAddPackagePaymentContextRes{TSimAddPackageOptionsRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgAddPackageOptions(ctx context.Context, req *v1.TSimCardBindPkgAddPackageOptionsReq) (res *v1.TSimCardBindPkgAddPackageOptionsRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().AddPackageOptions(ctx, &req.TSimCardAddPackageOptionsParam)
|
||||
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.TSimCardBindPkgAddPackageOptionsRes{TSimAddPackageOptionsRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgDownloadExcelTemplate(ctx context.Context, req *v1.TSimCardBindPkgDownloadExcelTemplateReq) (res *v1.TSimCardBindPkgDownloadExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardBindPkg().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgSubmitExcel(ctx context.Context, req *v1.TSimCardBindPkgSubmitExcelReq) (res *v1.TSimCardBindPkgSubmitExcelRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().SubmitExcel(ctx, &req.TSimCardBindPkgAddPackageExcelSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardBindPkgSubmitExcelRes{TSimCardBindPkgAddPackageExcelSubmitRes: data}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgSubmitInput(ctx context.Context, req *v1.TSimCardBindPkgSubmitInputReq) (res *v1.TSimCardBindPkgSubmitInputRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().SubmitInput(ctx, &req.TSimCardBindPkgAddPackageInputSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardBindPkgSubmitInputRes{TSimCardBindPkgAddPackageInputSubmitRes: data}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgAddPackageInputPrepare(ctx context.Context, req *v1.TSimCardBindPkgAddPackageInputPrepareReq) (res *v1.TSimCardBindPkgAddPackageInputPrepareRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().PrepareInput(ctx, &req.TSimCardBindPkgAddPackageInputPrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardBindPkgAddPackageInputPrepareRes{TSimCardBindPkgAddPackageInputPrepareRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgAddPackagePrepareResult(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePrepareResultReq) (res *v1.TSimCardBindPkgAddPackagePrepareResultRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().PrepareResult(ctx, req.BatchNo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardBindPkgAddPackagePrepareResultRes{TSimCardBindPkgAddPackagePrepareResultRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardBindPkgAddPackageBatchConfirm(ctx context.Context, req *v1.TSimCardBindPkgAddPackageBatchConfirmReq) (res *v1.TSimCardBindPkgAddPackageBatchConfirmRes, err error) {
|
||||
data, err := service.IotTSimCardBindPkg().ConfirmBatch(ctx, &req.TSimCardBindPkgAddPackageBatchConfirmParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardBindPkgAddPackageBatchConfirmRes{TSimCardBindPkgAddPackageBatchConfirmRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardCancelExcelTemplate(ctx context.Context, req *v1.TSimCardCancelExcelTemplateReq) (res *v1.TSimCardCancelExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardCancel().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardCancelExcelSubmit(ctx context.Context, req *v1.TSimCardCancelExcelSubmitReq) (res *v1.TSimCardCancelExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardCancel().SubmitExcel(ctx, &req.TSimCardCancelExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardCancelExcelSubmitRes{TSimCardCancelExcelSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardCancelInputSubmit(ctx context.Context, req *v1.TSimCardCancelInputSubmitReq) (res *v1.TSimCardCancelInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardCancel().SubmitInput(ctx, &req.TSimCardCancelInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardCancelInputSubmitRes{TSimCardCancelInputSubmitRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "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) TSimCardCancellationList(ctx context.Context, req *v1.TSimCardCancellationListReq) (res *v1.TSimCardCancellationListRes, err error) {
|
||||
list, total, err := service.IotTSimCardCancellation().List(ctx, &req.TSimCardCancellationListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*model.TSimCardCancellationListModel{}
|
||||
}
|
||||
res = &v1.TSimCardCancellationListRes{Items: list}
|
||||
res.Page = req.Page
|
||||
res.PageSize = req.PageSize
|
||||
res.Total = total
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardCancellationExport(ctx context.Context, req *v1.TSimCardCancellationExportReq) (res *v1.TSimCardCancellationExportRes, err error) {
|
||||
if err = service.IotTSimCardCancellation().Export(ctx, &req.TSimCardCancellationFilter); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeExcelTemplate(ctx context.Context, req *v1.TSimCardChangeExcelTemplateReq) (res *v1.TSimCardChangeExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardChange().DownloadExcelTemplate(ctx)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeExcelSubmit(ctx context.Context, req *v1.TSimCardChangeExcelSubmitReq) (res *v1.TSimCardChangeExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardChange().SubmitExcel(ctx, &req.TSimCardChangeExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangeExcelSubmitRes{TSimCardChangeExcelSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeInputOptions(ctx context.Context, req *v1.TSimCardChangeInputOptionsReq) (res *v1.TSimCardChangeInputOptionsRes, err error) {
|
||||
data, err := service.IotTSimCardChange().InputOptions(ctx, &req.TSimCardChangeInputOptionsParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangeInputOptionsRes{TSimCardChangeOptionsRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeRangeOptions(ctx context.Context, req *v1.TSimCardChangeRangeOptionsReq) (res *v1.TSimCardChangeRangeOptionsRes, err error) {
|
||||
data, err := service.IotTSimCardChange().RangeOptions(ctx, &req.TSimCardChangeRangeOptionsParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangeRangeOptionsRes{TSimCardChangeOptionsRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeInputPrepare(ctx context.Context, req *v1.TSimCardChangeInputPrepareReq) (res *v1.TSimCardChangeInputPrepareRes, err error) {
|
||||
data, err := service.IotTSimCardChange().PrepareInput(ctx, &req.TSimCardChangeInputPrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangeInputPrepareRes{TSimCardChangeBatchPrepareRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeRangePrepare(ctx context.Context, req *v1.TSimCardChangeRangePrepareReq) (res *v1.TSimCardChangeRangePrepareRes, err error) {
|
||||
data, err := service.IotTSimCardChange().PrepareRange(ctx, &req.TSimCardChangeRangePrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangeRangePrepareRes{TSimCardChangeBatchPrepareRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangeBatchSubmit(ctx context.Context, req *v1.TSimCardChangeBatchSubmitReq) (res *v1.TSimCardChangeBatchSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardChange().SubmitBatch(ctx, &req.TSimCardChangeBatchSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangeBatchSubmitRes{TSimCardChangeBatchSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardChangePrepareResult(ctx context.Context, req *v1.TSimCardChangePrepareResultReq) (res *v1.TSimCardChangePrepareResultRes, err error) {
|
||||
data, err := service.IotTSimCardChange().PrepareResult(ctx, strings.TrimSpace(req.BatchNo))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardChangePrepareResultRes{TSimCardChangePrepareResultRes: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardOutboundExcelTemplate(ctx context.Context, req *v1.TSimCardOutboundExcelTemplateReq) (res *v1.TSimCardOutboundExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardOutbound().DownloadExcelTemplate(ctx)
|
||||
return nil, err
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundExcelSubmit(ctx context.Context, req *v1.TSimCardOutboundExcelSubmitReq) (res *v1.TSimCardOutboundExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().SubmitExcel(ctx, &req.TSimCardOutboundExcelSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundExcelSubmitRes{
|
||||
TSimCardOutboundExcelSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundRangeSubmit(ctx context.Context, req *v1.TSimCardOutboundRangeSubmitReq) (res *v1.TSimCardOutboundRangeSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().SubmitRange(ctx, &req.TSimCardOutboundRangeSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundRangeSubmitRes{
|
||||
TSimCardOutboundRangeSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundInputSubmit(ctx context.Context, req *v1.TSimCardOutboundInputSubmitReq) (res *v1.TSimCardOutboundInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().SubmitInput(ctx, &req.TSimCardOutboundInputSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundInputSubmitRes{
|
||||
TSimCardOutboundInputSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundInboundBatchList(ctx context.Context, req *v1.TSimCardOutboundInboundBatchListReq) (res *v1.TSimCardOutboundInboundBatchListRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().ListInboundBatches(ctx, &req.TSimCardOutboundInboundBatchListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundInboundBatchListRes{
|
||||
TSimCardOutboundInboundBatchListRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundInboundBatchCards(ctx context.Context, req *v1.TSimCardOutboundInboundBatchCardsReq) (res *v1.TSimCardOutboundInboundBatchCardsRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().ListInboundBatchCards(ctx, &req.TSimCardOutboundInboundBatchCardsParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundInboundBatchCardsRes{
|
||||
TSimCardOutboundInboundBatchCardsRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundBatchSubmit(ctx context.Context, req *v1.TSimCardOutboundBatchSubmitReq) (res *v1.TSimCardOutboundBatchSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().SubmitBatch(ctx, &req.TSimCardOutboundBatchSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundBatchSubmitRes{
|
||||
TSimCardOutboundBatchSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardOutboundCustomerBalance(ctx context.Context, req *v1.TSimCardOutboundCustomerBalanceReq) (res *v1.TSimCardOutboundCustomerBalanceRes, err error) {
|
||||
data, err := service.IotTSimCardOutbound().CustomerBalance(ctx, &req.TSimCardOutboundCustomerBalanceParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardOutboundCustomerBalanceRes{
|
||||
TSimCardOutboundCustomerBalanceRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardRenewInputPrepare(ctx context.Context, req *v1.TSimCardRenewInputPrepareReq) (res *v1.TSimCardRenewInputPrepareRes, err error) {
|
||||
data, err := service.IotTSimCardRenew().PrepareInput(ctx, &req.TSimCardRenewInputPrepareParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimCardRenewInputPrepareRes{
|
||||
TSimCardRenewBatchPrepareRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardRenewExcelTemplate(ctx context.Context, req *v1.TSimCardRenewExcelTemplateReq) (res *v1.TSimCardRenewExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardRenew().DownloadExcelTemplate(ctx)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardRenewExcelSubmit(ctx context.Context, req *v1.TSimCardRenewExcelSubmitReq) (res *v1.TSimCardRenewExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardRenew().SubmitExcel(ctx, &req.TSimCardRenewExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimCardRenewExcelSubmitRes{
|
||||
TSimCardRenewExcelSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardRenewBatchConfirm(ctx context.Context, req *v1.TSimCardRenewBatchConfirmReq) (res *v1.TSimCardRenewBatchConfirmRes, err error) {
|
||||
data, err := service.IotTSimCardRenew().ConfirmBatch(ctx, &req.TSimCardRenewBatchConfirmParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimCardRenewBatchConfirmRes{
|
||||
TSimCardRenewBatchConfirmRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardRenewPrepareResult(ctx context.Context, req *v1.TSimCardRenewPrepareResultReq) (res *v1.TSimCardRenewPrepareResultRes, err error) {
|
||||
data, err := service.IotTSimCardRenew().PrepareResult(ctx, strings.TrimSpace(req.BatchNo))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimCardRenewPrepareResultRes{
|
||||
TSimCardRenewPrepareResultRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "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) TSimCardTrafficCutoffExcelTemplate(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelTemplateReq) (res *v1.TSimCardTrafficCutoffExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardTrafficCutoff().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffExcelSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelSubmitReq) (res *v1.TSimCardTrafficCutoffExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardTrafficCutoff().SubmitExcel(ctx, &req.TSimCardTrafficCutoffExcelSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardTrafficCutoffExcelSubmitRes{TSimCardTrafficCutoffExcelSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffInputSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffInputSubmitReq) (res *v1.TSimCardTrafficCutoffInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardTrafficCutoff().SubmitInput(ctx, &req.TSimCardTrafficCutoffInputSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardTrafficCutoffInputSubmitRes{TSimCardTrafficCutoffInputSubmitRes: data}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffRangeSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffRangeSubmitReq) (res *v1.TSimCardTrafficCutoffRangeSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardTrafficCutoff().SubmitRange(ctx, &req.TSimCardTrafficCutoffRangeSubmitParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardTrafficCutoffRangeSubmitRes{TSimCardTrafficCutoffRangeSubmitRes: data}, nil
|
||||
}
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffList(ctx context.Context, req *v1.TSimCardTrafficCutoffListReq) (res *v1.TSimCardTrafficCutoffListRes, err error) {
|
||||
list, total, err := service.IotTSimCardTrafficCutoff().List(ctx, &req.TSimCardTrafficCutoffListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*model.TSimCardInfoListModel{}
|
||||
}
|
||||
res = &v1.TSimCardTrafficCutoffListRes{Items: list}
|
||||
res.Page = req.Page
|
||||
res.PageSize = req.PageSize
|
||||
res.Total = total
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffExport(ctx context.Context, req *v1.TSimCardTrafficCutoffExportReq) (res *v1.TSimCardTrafficCutoffExportRes, err error) {
|
||||
err = service.IotTSimCardTrafficCutoff().Export(ctx, &req.TSimCardTrafficCutoffListParam)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffEdit(ctx context.Context, req *v1.TSimCardTrafficCutoffEditReq) (res *v1.TSimCardTrafficCutoffEditRes, err error) {
|
||||
err = service.IotTSimCardTrafficCutoff().Edit(ctx, &req.TSimCardTrafficCutoffEditParam)
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimCardTrafficCutoffDelete(ctx context.Context, req *v1.TSimCardTrafficCutoffDeleteReq) (res *v1.TSimCardTrafficCutoffDeleteRes, err error) {
|
||||
err = service.IotTSimCardTrafficCutoff().Delete(ctx, &req.TSimCardTrafficCutoffDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardUnsubExcelTemplate(ctx context.Context, req *v1.TSimCardUnsubExcelTemplateReq) (res *v1.TSimCardUnsubExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardUnsub().DownloadExcelTemplate(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardUnsubExcelSubmit(ctx context.Context, req *v1.TSimCardUnsubExcelSubmitReq) (res *v1.TSimCardUnsubExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardUnsub().SubmitExcel(ctx, &req.TSimCardUnsubExcelSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardUnsubExcelSubmitRes{
|
||||
TSimCardUnsubExcelSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardUnsubInputSubmit(ctx context.Context, req *v1.TSimCardUnsubInputSubmitReq) (res *v1.TSimCardUnsubInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardUnsub().SubmitInput(ctx, &req.TSimCardUnsubInputSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardUnsubInputSubmitRes{
|
||||
TSimCardUnsubInputSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardUnsubRangeSubmit(ctx context.Context, req *v1.TSimCardUnsubRangeSubmitReq) (res *v1.TSimCardUnsubRangeSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardUnsub().SubmitRange(ctx, &req.TSimCardUnsubRangeSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardUnsubRangeSubmitRes{
|
||||
TSimCardUnsubRangeSubmitRes: data,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackagePriceAgentDefaultPackagePriceList(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceListReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimFlowPackagePrice().AgentDefaultPackagePriceList(ctx, &req.TSimFlowPackagePriceAgentDefaultPackagePriceListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*iotin.TSimFlowPackagePriceAgentDefaultPackagePriceListItem{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPackagePriceAgentDefaultPackagePriceListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
func (c *ControllerV1) TSimFlowPackagePriceAgentPackagePriceSave(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceSaveReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceSaveRes, err error) {
|
||||
err = service.IotTSimFlowPackagePrice().SaveAgentPackagePrice(ctx, &req.TSimFlowPackagePriceAgentPackagePriceSaveParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = new(v1.TSimFlowPackagePriceAgentPackagePriceSaveRes)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackagePriceAgentDefaultPackagePriceSave(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveRes, err error) {
|
||||
err = service.IotTSimFlowPackagePrice().SaveAgentDefaultPackagePrice(ctx, &req.TSimFlowPackagePriceAgentDefaultPackagePriceSaveParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = new(v1.TSimFlowPackagePriceAgentDefaultPackagePriceSaveRes)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackagePriceAgentDefaultPackagePriceInherit(ctx context.Context, req *v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritReq) (res *v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritRes, err error) {
|
||||
err = service.IotTSimFlowPackagePrice().InheritAgentDefaultPackagePrice(ctx, &req.TSimFlowPackagePriceAgentDefaultPackagePriceInheritParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = new(v1.TSimFlowPackagePriceAgentDefaultPackagePriceInheritRes)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/exportcenter"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/iot/simcardquery"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/iot_excelize"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
// simCardQueryService 两个查询功能共用同一份实现,避免重复注册。
|
||||
var simCardQueryService = simcardquery.New()
|
||||
|
||||
// SimCardBaseQueryTemplate 下载卡基础信息查询模板
|
||||
func (c *ControllerV1) SimCardBaseQueryTemplate(ctx context.Context, req *v1.SimCardBaseQueryTemplateReq) (res *v1.SimCardBaseQueryTemplateRes, err error) {
|
||||
file, name, err := simCardQueryService.BaseTemplate(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
return &v1.SimCardBaseQueryTemplateRes{}, iot_excelize.WriteHTTP(ctx, file, name)
|
||||
}
|
||||
|
||||
// SimCardBaseQueryColumns 卡基础信息查询可选导出列
|
||||
func (c *ControllerV1) SimCardBaseQueryColumns(ctx context.Context, req *v1.SimCardBaseQueryColumnsReq) (res *v1.SimCardBaseQueryColumnsRes, err error) {
|
||||
return &v1.SimCardBaseQueryColumnsRes{Items: simCardQueryService.BaseColumnOptions()}, nil
|
||||
}
|
||||
|
||||
// SimCardBaseQueryExport 提交卡基础信息查询导出
|
||||
func (c *ControllerV1) SimCardBaseQueryExport(ctx context.Context, req *v1.SimCardBaseQueryExportReq) (res *v1.SimCardBaseQueryExportRes, err error) {
|
||||
input, err := excelInput(ctx, req.Mode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
submit, err := simCardQueryService.ExportBase(ctx, &req.SimCardQueryExportParam, input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SimCardBaseQueryExportRes{SimCardQuerySubmitRes: toSubmitRes(submit)}, nil
|
||||
}
|
||||
|
||||
// SimCardUsageHistoryTemplate 下载月历史用量查询模板
|
||||
func (c *ControllerV1) SimCardUsageHistoryTemplate(ctx context.Context, req *v1.SimCardUsageHistoryTemplateReq) (res *v1.SimCardUsageHistoryTemplateRes, err error) {
|
||||
file, name, err := simCardQueryService.UsageHistoryTemplate(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
return &v1.SimCardUsageHistoryTemplateRes{}, iot_excelize.WriteHTTP(ctx, file, name)
|
||||
}
|
||||
|
||||
// SimCardUsageHistoryColumns 月历史用量查询固定列与近12个月月份清单
|
||||
func (c *ControllerV1) SimCardUsageHistoryColumns(ctx context.Context, req *v1.SimCardUsageHistoryColumnsReq) (res *v1.SimCardUsageHistoryColumnsRes, err error) {
|
||||
return &v1.SimCardUsageHistoryColumnsRes{
|
||||
Items: simCardQueryService.UsageHistoryColumnOptions(),
|
||||
Months: simCardQueryService.UsageHistoryMonths(time.Now()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SimCardUsageHistoryDeptOptions 月历史用量查询可选公司
|
||||
func (c *ControllerV1) SimCardUsageHistoryDeptOptions(ctx context.Context, req *v1.SimCardUsageHistoryDeptOptionsReq) (res *v1.SimCardUsageHistoryDeptOptionsRes, err error) {
|
||||
items, err := simCardQueryService.DeptOptions(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SimCardUsageHistoryDeptOptionsRes{
|
||||
Items: items,
|
||||
CurrentDeptId: contexts.GetDeptId(ctx),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SimCardUsageHistoryExport 提交月历史用量查询导出
|
||||
func (c *ControllerV1) SimCardUsageHistoryExport(ctx context.Context, req *v1.SimCardUsageHistoryExportReq) (res *v1.SimCardUsageHistoryExportRes, err error) {
|
||||
input, err := excelInput(ctx, req.Mode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
submit, err := simCardQueryService.ExportUsageHistory(ctx, &req.SimCardUsageHistoryExportParam, input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.SimCardUsageHistoryExportRes{SimCardQuerySubmitRes: toSubmitRes(submit)}, nil
|
||||
}
|
||||
|
||||
// excelInput 只在 Excel 模式下读取上传文件。
|
||||
// 一次性读进内存再交给后台解析:提交接口必须立即返回,
|
||||
// 而 HTTP 请求结束后临时上传文件可能被清理,不能在后台协程里再读。
|
||||
func excelInput(ctx context.Context, mode string) (simcardquery.ExcelInput, error) {
|
||||
if mode != model.SimCardQueryModeExcel {
|
||||
return nil, nil
|
||||
}
|
||||
request := g.RequestFromCtx(ctx)
|
||||
if request == nil {
|
||||
return nil, gerror.New("当前上下文不是HTTP请求")
|
||||
}
|
||||
file := request.GetUploadFile("file")
|
||||
if file == nil {
|
||||
return nil, gerror.New("请先上传 Excel 文件")
|
||||
}
|
||||
content, err := readUploadContent(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(content) == 0 {
|
||||
return nil, gerror.New("上传的 Excel 文件为空")
|
||||
}
|
||||
return func() (io.Reader, error) {
|
||||
return bytes.NewReader(content), nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
func toSubmitRes(submit *exportcenter.SubmitResult) *model.SimCardQuerySubmitRes {
|
||||
if submit == nil {
|
||||
return nil
|
||||
}
|
||||
return &model.SimCardQuerySubmitRes{
|
||||
TaskId: submit.TaskId,
|
||||
TaskNo: submit.TaskNo,
|
||||
Total: submit.Total,
|
||||
}
|
||||
}
|
||||
|
||||
// maxUploadBytes Excel 上传大小上限(MB 换算后的字节数)。
|
||||
// 20MB 足够容纳 20000 行三列号码,再大基本是用户传错文件。
|
||||
const maxUploadBytes = 20 << 20
|
||||
|
||||
// readUploadContent 一次性读出上传文件内容。
|
||||
func readUploadContent(file *ghttp.UploadFile) ([]byte, error) {
|
||||
reader, err := file.Open()
|
||||
if err != nil {
|
||||
return nil, gerror.Wrap(err, "读取上传文件失败")
|
||||
}
|
||||
defer reader.Close()
|
||||
if file.Size > maxUploadBytes {
|
||||
return nil, gerror.Newf("上传文件超过 %dMB 上限", maxUploadBytes>>20)
|
||||
}
|
||||
content, err := io.ReadAll(reader)
|
||||
if err != nil {
|
||||
return nil, gerror.Wrap(err, "读取上传文件失败")
|
||||
}
|
||||
return content, nil
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import ()
|
||||
@@ -0,0 +1,46 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimCardInboundExcelTemplate(ctx context.Context, req *v1.TSimCardInboundExcelTemplateReq) (res *v1.TSimCardInboundExcelTemplateRes, err error) {
|
||||
err = service.IotTSimCardInbound().DownloadExcelTemplate(ctx)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardInboundExcelSubmit(ctx context.Context, req *v1.TSimCardInboundExcelSubmitReq) (res *v1.TSimCardInboundExcelSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardInbound().SubmitExcel(ctx, &req.TSimCardInboundExcelSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardInboundExcelSubmitRes)
|
||||
res.TSimCardInboundExcelSubmitRes = data
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardInboundRangeSubmit(ctx context.Context, req *v1.TSimCardInboundRangeSubmitReq) (res *v1.TSimCardInboundRangeSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardInbound().SubmitRange(ctx, &req.TSimCardInboundRangeSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardInboundRangeSubmitRes)
|
||||
res.TSimCardInboundRangeSubmitRes = data
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimCardInboundInputSubmit(ctx context.Context, req *v1.TSimCardInboundInputSubmitReq) (res *v1.TSimCardInboundInputSubmitRes, err error) {
|
||||
data, err := service.IotTSimCardInbound().SubmitInput(ctx, &req.TSimCardInboundInputSubmitParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardInboundInputSubmitRes)
|
||||
res.TSimCardInboundInputSubmitRes = data
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看卡信息表列表
|
||||
func (c *ControllerV1) TSimCardInfoList(ctx context.Context, req *v1.TSimCardInfoListReq) (res *v1.TSimCardInfoListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimCardInfo().List(ctx, &req.TSimCardInfoListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimCardInfoListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardInfoListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出卡信息表列表
|
||||
func (c *ControllerV1) TSimCardInfoExport(ctx context.Context, req *v1.TSimCardInfoExportReq) (res *v1.TSimCardInfoExportRes, err error) {
|
||||
err = service.IotTSimCardInfo().Export(ctx, &req.TSimCardInfoListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增卡信息表
|
||||
func (c *ControllerV1) TSimCardInfoEdit(ctx context.Context, req *v1.TSimCardInfoEditReq) (res *v1.TSimCardInfoEditRes, err error) {
|
||||
if req.Id > 0 {
|
||||
err = service.IotTSimCardInfo().Edit(ctx, &model.TSimCardInfoEditParam{
|
||||
Id: req.Id,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
return
|
||||
}
|
||||
err = service.IotTSimCardInfo().Edit(ctx, &req.TSimCardInfoEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定卡信息表信息
|
||||
func (c *ControllerV1) TSimCardInfoView(ctx context.Context, req *v1.TSimCardInfoViewReq) (res *v1.TSimCardInfoViewRes, err error) {
|
||||
data, err := service.IotTSimCardInfo().View(ctx, &req.TSimCardInfoViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardInfoViewRes)
|
||||
res.TSimCardInfoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除卡信息表
|
||||
func (c *ControllerV1) TSimCardInfoDelete(ctx context.Context, req *v1.TSimCardInfoDeleteReq) (res *v1.TSimCardInfoDeleteRes, err error) {
|
||||
err = service.IotTSimCardInfo().Delete(ctx, &req.TSimCardInfoDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
// SyncCardFlow 同步卡流量
|
||||
func (c *ControllerV1) TSimCardInfoSyncSimCardFlow(ctx context.Context, req *v1.TSimCardInfoSyncSimCardFlowReq) (res *v1.TSimCardInfoSyncSimCardFlowRes, err error) {
|
||||
err = service.IotTSimCardInfo().SyncSimCardFlow(ctx, &req.SyncSimCardFlowInput)
|
||||
return
|
||||
}
|
||||
|
||||
// SyncSimCardStatus 同步SIM卡状态
|
||||
func (c *ControllerV1) TSimCardInfoSyncSimCardStatus(ctx context.Context, req *v1.TSimCardInfoSyncSimCardStatusReq) (res *v1.TSimCardInfoSyncSimCardStatusRes, err error) {
|
||||
err = service.IotTSimCardInfo().SyncSimCardStatus(ctx, &req.SyncSimCardStatusInput)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardInfoSyncSimCardStatusRes{}
|
||||
return
|
||||
}
|
||||
|
||||
// QuerySimSession 查询SIM卡会话
|
||||
func (c *ControllerV1) TSimCardInfoQuerySimSession(ctx context.Context, req *v1.TSimCardInfoQuerySimSessionReq) (res *v1.TSimCardInfoQuerySimSessionRes, err error) {
|
||||
simSessionOutput, err := service.IotTSimCardInfo().QuerySimSession(ctx, &req.QuerySimSessionInput)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardInfoQuerySimSessionRes{QuerySimSessionOutput: simSessionOutput}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// QuerySimStatus 查询SIM卡状态
|
||||
func (c *ControllerV1) TSimCardInfoQuerySimStatus(ctx context.Context, req *v1.TSimCardInfoQuerySimStatusReq) (res *v1.TSimCardInfoQuerySimStatusRes, err error) {
|
||||
simStatusOutput, err := service.IotTSimCardInfo().QuerySimStatus(ctx, &req.QuerySimStatusInput)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimCardInfoQuerySimStatusRes{QuerySimStatusOutput: simStatusOutput}
|
||||
return res, nil
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
// TSimCardInfoSyncSimCardStatusQueue enqueues a status query. The existing
|
||||
// TSimCardInfoSyncSimCardStatus endpoint remains synchronous and untouched.
|
||||
func (c *ControllerV1) TSimCardInfoSyncSimCardStatusQueue(ctx context.Context, req *v1.TSimCardInfoSyncSimCardStatusQueueReq) (res *v1.TSimCardInfoSyncSimCardStatusQueueRes, err error) {
|
||||
if err = service.IotTSimCardInfo().EnqueueSimCardStatus(ctx, &req.SyncSimCardStatusInput); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimCardInfoSyncSimCardStatusQueueRes{}, nil
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
|
||||
// List 查看库存卡信息表列表
|
||||
func (c *ControllerV1) TSimCardStockList(ctx context.Context, req *v1.TSimCardStockListReq) (res *v1.TSimCardStockListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimCardStock().List(ctx, &req.TSimCardStockListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimCardStockListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardStockListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出库存卡信息表列表
|
||||
func (c *ControllerV1) TSimCardStockExport(ctx context.Context, req *v1.TSimCardStockExportReq) (res *v1.TSimCardStockExportRes, err error) {
|
||||
err = service.IotTSimCardStock().Export(ctx, &req.TSimCardStockListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新库存卡信息表
|
||||
func (c *ControllerV1) TSimCardStockEdit(ctx context.Context, req *v1.TSimCardStockEditReq) (res *v1.TSimCardStockEditRes, err error) {
|
||||
err = service.IotTSimCardStock().Edit(ctx, &req.TSimCardStockEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定库存卡信息表信息
|
||||
func (c *ControllerV1) TSimCardStockView(ctx context.Context, req *v1.TSimCardStockViewReq) (res *v1.TSimCardStockViewRes, err error) {
|
||||
data, err := service.IotTSimCardStock().View(ctx, &req.TSimCardStockViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimCardStockViewRes)
|
||||
res.TSimCardStockViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除库存卡信息表
|
||||
func (c *ControllerV1) TSimCardStockDelete(ctx context.Context, req *v1.TSimCardStockDeleteReq) (res *v1.TSimCardStockDeleteRes, err error) {
|
||||
err = service.IotTSimCardStock().Delete(ctx, &req.TSimCardStockDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看通道模板列表
|
||||
func (c *ControllerV1) TSimChannelTemplateList(ctx context.Context, req *v1.TSimChannelTemplateListReq) (res *v1.TSimChannelTemplateListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimChannelTemplate().List(ctx, &req.TSimChannelTemplateListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimChannelTemplateListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimChannelTemplateListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出通道模板列表
|
||||
func (c *ControllerV1) TSimChannelTemplateExport(ctx context.Context, req *v1.TSimChannelTemplateExportReq) (res *v1.TSimChannelTemplateExportRes, err error) {
|
||||
err = service.IotTSimChannelTemplate().Export(ctx, &req.TSimChannelTemplateListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新通道模板
|
||||
func (c *ControllerV1) TSimChannelTemplateEdit(ctx context.Context, req *v1.TSimChannelTemplateEditReq) (res *v1.TSimChannelTemplateEditRes, err error) {
|
||||
err = service.IotTSimChannelTemplate().Edit(ctx, &req.TSimChannelTemplateEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定通道模板信息
|
||||
func (c *ControllerV1) TSimChannelTemplateView(ctx context.Context, req *v1.TSimChannelTemplateViewReq) (res *v1.TSimChannelTemplateViewRes, err error) {
|
||||
data, err := service.IotTSimChannelTemplate().View(ctx, &req.TSimChannelTemplateViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimChannelTemplateViewRes)
|
||||
res.TSimChannelTemplateViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除通道模板
|
||||
func (c *ControllerV1) TSimChannelTemplateDelete(ctx context.Context, req *v1.TSimChannelTemplateDeleteReq) (res *v1.TSimChannelTemplateDeleteRes, err error) {
|
||||
err = service.IotTSimChannelTemplate().Delete(ctx, &req.TSimChannelTemplateDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看通道列表列表
|
||||
func (c *ControllerV1) TSimChannelsList(ctx context.Context, req *v1.TSimChannelsListReq) (res *v1.TSimChannelsListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimChannels().List(ctx, &req.TSimChannelsListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimChannelsListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimChannelsListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出通道列表列表
|
||||
func (c *ControllerV1) TSimChannelsExport(ctx context.Context, req *v1.TSimChannelsExportReq) (res *v1.TSimChannelsExportRes, err error) {
|
||||
err = service.IotTSimChannels().Export(ctx, &req.TSimChannelsListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新通道列表
|
||||
func (c *ControllerV1) TSimChannelsEdit(ctx context.Context, req *v1.TSimChannelsEditReq) (res *v1.TSimChannelsEditRes, err error) {
|
||||
err = service.IotTSimChannels().Edit(ctx, &req.TSimChannelsEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定通道列表信息
|
||||
func (c *ControllerV1) TSimChannelsView(ctx context.Context, req *v1.TSimChannelsViewReq) (res *v1.TSimChannelsViewRes, err error) {
|
||||
data, err := service.IotTSimChannels().View(ctx, &req.TSimChannelsViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimChannelsViewRes)
|
||||
res.TSimChannelsViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除通道列表
|
||||
func (c *ControllerV1) TSimChannelsDelete(ctx context.Context, req *v1.TSimChannelsDeleteReq) (res *v1.TSimChannelsDeleteRes, err error) {
|
||||
err = service.IotTSimChannels().Delete(ctx, &req.TSimChannelsDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimChannelsTest(ctx context.Context, req *v1.TSimChannelsTestReq) (res *v1.TSimChannelsTestRes, err error) {
|
||||
output, err := service.IotTSimChannels().Test(ctx, &req.TSimChannelsTestParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.TSimChannelsTestRes{TSimChannelsTestOutput: output}, nil
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimChannelsRefreshCardCount(ctx context.Context, req *v1.TSimChannelsRefreshCardCountReq) (res *v1.TSimChannelsRefreshCardCountRes, err error) {
|
||||
err = service.IotTSimChannels().RefreshCardCounts(ctx)
|
||||
return &v1.TSimChannelsRefreshCardCountRes{}, err
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
// Info 查询SIM卡诊断信息
|
||||
func (c *ControllerV1) TSimDiagnoseInfo(ctx context.Context, req *v1.TSimDiagnoseInfoReq) (res *v1.TSimDiagnoseInfoRes, err error) {
|
||||
output, err := service.IotTSimDiagnose().Info(ctx, &req.TSimDiagnoseInfoReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimDiagnoseInfoRes{TSimDiagnoseInfoOutput: output}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Flow 查询SIM卡使用流量
|
||||
func (c *ControllerV1) TSimDiagnoseFlow(ctx context.Context, req *v1.TSimDiagnoseFlowReq) (res *v1.TSimDiagnoseFlowRes, err error) {
|
||||
output, err := service.IotTSimDiagnose().Flow(ctx, &req.TSimDiagnoseFlowReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &v1.TSimDiagnoseFlowRes{TSimDiagnoseFlowOutput: output}
|
||||
return res, nil
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
// List 查看SIM流量套餐管理列表
|
||||
func (c *ControllerV1) TSimFlowPackageInfoList(ctx context.Context, req *v1.TSimFlowPackageInfoListReq) (res *v1.TSimFlowPackageInfoListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimFlowPackageInfo().List(ctx, &req.TSimFlowPackageInfoListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*iotin.TSimFlowPackageInfoListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPackageInfoListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出SIM流量套餐管理列表
|
||||
func (c *ControllerV1) TSimFlowPackageInfoExport(ctx context.Context, req *v1.TSimFlowPackageInfoExportReq) (res *v1.TSimFlowPackageInfoExportRes, err error) {
|
||||
err = service.IotTSimFlowPackageInfo().Export(ctx, &req.TSimFlowPackageInfoListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新SIM流量套餐管理
|
||||
func (c *ControllerV1) TSimFlowPackageInfoEdit(ctx context.Context, req *v1.TSimFlowPackageInfoEditReq) (res *v1.TSimFlowPackageInfoEditRes, err error) {
|
||||
err = service.IotTSimFlowPackageInfo().Edit(ctx, &req.TSimFlowPackageInfoEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定SIM流量套餐管理信息
|
||||
func (c *ControllerV1) TSimFlowPackageInfoView(ctx context.Context, req *v1.TSimFlowPackageInfoViewReq) (res *v1.TSimFlowPackageInfoViewRes, err error) {
|
||||
data, err := service.IotTSimFlowPackageInfo().View(ctx, &req.TSimFlowPackageInfoViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPackageInfoViewRes)
|
||||
res.TSimFlowPackageInfoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除SIM流量套餐管理
|
||||
func (c *ControllerV1) TSimFlowPackageInfoDelete(ctx context.Context, req *v1.TSimFlowPackageInfoDeleteReq) (res *v1.TSimFlowPackageInfoDeleteRes, err error) {
|
||||
err = service.IotTSimFlowPackageInfo().Delete(ctx, &req.TSimFlowPackageInfoDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackageInfoSyncDeptPackages(ctx context.Context, req *v1.TSimFlowPackageInfoSyncDeptPackagesReq) (res *v1.TSimFlowPackageInfoSyncDeptPackagesRes, err error) {
|
||||
err = service.IotTSimFlowPackageInfo().SyncDeptPackages(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackageInfoFlowPackageList(ctx context.Context, req *v1.TSimFlowPackageInfoFlowPackageListReq) (res *v1.TSimFlowPackageInfoFlowPackageListRes, err error) {
|
||||
list, err := service.IotTSimFlowPackageInfo().FlowPackageList(ctx, &req.TSimFlowPackageInfoFlowPackageListParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimFlowPackageInfoFlowPackageListRes{
|
||||
Items: list,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackageInfoFlowPackageAddList(ctx context.Context, req *v1.TSimFlowPackageInfoFlowPackageAddListReq) (res *v1.TSimFlowPackageInfoFlowPackageAddListRes, err error) {
|
||||
list, err := service.IotTSimFlowPackageInfo().FlowPackageAddList(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimFlowPackageInfoFlowPackageAddListRes{
|
||||
Items: list,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackageInfoRenewablePackageOptions(ctx context.Context, req *v1.TSimFlowPackageInfoRenewablePackageOptionsReq) (res *v1.TSimFlowPackageInfoRenewablePackageOptionsRes, err error) {
|
||||
list, err := service.IotTSimFlowPackageInfo().RenewablePackageOptions(ctx, &req.TSimFlowPackageInfoRenewablePackageOptionsParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimFlowPackageInfoRenewablePackageOptionsRes{
|
||||
Items: list,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackageInfoGetFlowPackageOptions(ctx context.Context, req *v1.TSimFlowPackageInfoGetFlowPackageOptionsReq) (res *v1.TSimFlowPackageInfoGetFlowPackageOptionsRes, err error) {
|
||||
items, err := service.IotTSimFlowPackageInfo().GetFlowPackageOptions(ctx, &req.TSimFlowPackageInfoFlowPackageOptionsParam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &v1.TSimFlowPackageInfoGetFlowPackageOptionsRes{
|
||||
Items: items,
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackagePriceAgentPackagePriceList(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceListReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimFlowPackagePrice().AgentPackagePriceList(ctx, &req.TSimFlowPackagePriceAgentPackagePriceListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*iotin.TSimFlowPackagePriceAgentPackagePriceListItem{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPackagePriceAgentPackagePriceListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackagePriceAgentPackagePriceInherit(ctx context.Context, req *v1.TSimFlowPackagePriceAgentPackagePriceInheritReq) (res *v1.TSimFlowPackagePriceAgentPackagePriceInheritRes, err error) {
|
||||
err = service.IotTSimFlowPackagePrice().InheritAgentPackagePrice(ctx, &req.TSimFlowPackagePriceAgentPackagePriceInheritParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = new(v1.TSimFlowPackagePriceAgentPackagePriceInheritRes)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ControllerV1) TSimFlowPackagePriceagentTree(ctx context.Context, req *v1.TSimFlowPackagePriceagentTreeReq) (res *v1.TSimFlowPackagePriceagentTreeRes, err error) {
|
||||
data, err := service.IotTSimFlowPackagePrice().AgentTree(ctx, &req.TSimFlowPackagePriceAgentTreeParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPackagePriceagentTreeRes)
|
||||
if data != nil {
|
||||
res.Items = data.Items
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看流量池表列表
|
||||
func (c *ControllerV1) TSimFlowPoolList(ctx context.Context, req *v1.TSimFlowPoolListReq) (res *v1.TSimFlowPoolListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimFlowPool().List(ctx, &req.TSimFlowPoolListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimFlowPoolListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPoolListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出流量池表列表
|
||||
func (c *ControllerV1) TSimFlowPoolExport(ctx context.Context, req *v1.TSimFlowPoolExportReq) (res *v1.TSimFlowPoolExportRes, err error) {
|
||||
err = service.IotTSimFlowPool().Export(ctx, &req.TSimFlowPoolListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新流量池表
|
||||
func (c *ControllerV1) TSimFlowPoolEdit(ctx context.Context, req *v1.TSimFlowPoolEditReq) (res *v1.TSimFlowPoolEditRes, err error) {
|
||||
err = service.IotTSimFlowPool().Edit(ctx, &req.TSimFlowPoolEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定流量池表信息
|
||||
func (c *ControllerV1) TSimFlowPoolView(ctx context.Context, req *v1.TSimFlowPoolViewReq) (res *v1.TSimFlowPoolViewRes, err error) {
|
||||
data, err := service.IotTSimFlowPool().View(ctx, &req.TSimFlowPoolViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPoolViewRes)
|
||||
res.TSimFlowPoolViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除流量池表
|
||||
func (c *ControllerV1) TSimFlowPoolDelete(ctx context.Context, req *v1.TSimFlowPoolDeleteReq) (res *v1.TSimFlowPoolDeleteRes, err error) {
|
||||
err = service.IotTSimFlowPool().Delete(ctx, &req.TSimFlowPoolDeleteParam)
|
||||
return
|
||||
}
|
||||
|
||||
// SyncPoolCard 流量池同步卡信息
|
||||
func (c *ControllerV1) TSimFlowPoolSyncPoolCard(ctx context.Context, req *v1.TSimFlowPoolSyncPoolCardReq) (res *v1.TSimFlowPoolSyncPoolCardRes, err error) {
|
||||
err = service.IotTSimFlowPool().SyncPoolCard(ctx, req.DeptId)
|
||||
return
|
||||
}
|
||||
|
||||
// GetCardsByPackageCodes 根据套餐编码列表获取卡列表
|
||||
func (c *ControllerV1) TSimFlowPoolGetCardsByPackageCodes(ctx context.Context, req *v1.TSimFlowPoolGetCardsByPackageCodesReq) (res *v1.TSimFlowPoolGetCardsByPackageCodesRes, err error) {
|
||||
list, totalCount, err := service.IotTSimFlowPool().GetCardsByPackageCodes(ctx, &req.GetCardsByPackageCodesParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimCardInfoListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimFlowPoolGetCardsByPackageCodesRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
|
||||
iotin "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
// List 查看套餐分类表列表
|
||||
func (c *ControllerV1) TSimPackageCategoryList(ctx context.Context, req *v1.TSimPackageCategoryListReq) (res *v1.TSimPackageCategoryListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimPackageCategory().List(ctx, &req.TSimPackageCategoryListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*iotin.TSimPackageCategoryListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimPackageCategoryListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出套餐分类表列表
|
||||
func (c *ControllerV1) TSimPackageCategoryExport(ctx context.Context, req *v1.TSimPackageCategoryExportReq) (res *v1.TSimPackageCategoryExportRes, err error) {
|
||||
err = service.IotTSimPackageCategory().Export(ctx, &req.TSimPackageCategoryListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新套餐分类表
|
||||
func (c *ControllerV1) TSimPackageCategoryEdit(ctx context.Context, req *v1.TSimPackageCategoryEditReq) (res *v1.TSimPackageCategoryEditRes, err error) {
|
||||
err = service.IotTSimPackageCategory().Edit(ctx, &req.TSimPackageCategoryEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定套餐分类表信息
|
||||
func (c *ControllerV1) TSimPackageCategoryView(ctx context.Context, req *v1.TSimPackageCategoryViewReq) (res *v1.TSimPackageCategoryViewRes, err error) {
|
||||
data, err := service.IotTSimPackageCategory().View(ctx, &req.TSimPackageCategoryViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimPackageCategoryViewRes)
|
||||
res.TSimPackageCategoryViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除套餐分类表
|
||||
func (c *ControllerV1) TSimPackageCategoryDelete(ctx context.Context, req *v1.TSimPackageCategoryDeleteReq) (res *v1.TSimPackageCategoryDeleteRes, err error) {
|
||||
err = service.IotTSimPackageCategory().Delete(ctx, &req.TSimPackageCategoryDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看流量池预警配置表列表
|
||||
func (c *ControllerV1) TSimPoolWarnConfigList(ctx context.Context, req *v1.TSimPoolWarnConfigListReq) (res *v1.TSimPoolWarnConfigListRes, err error) {
|
||||
list, totalCount, err := service.IotTSimPoolWarnConfig().List(ctx, &req.TSimPoolWarnConfigListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TSimPoolWarnConfigListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimPoolWarnConfigListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出流量池预警配置表列表
|
||||
func (c *ControllerV1) TSimPoolWarnConfigExport(ctx context.Context, req *v1.TSimPoolWarnConfigExportReq) (res *v1.TSimPoolWarnConfigExportRes, err error) {
|
||||
err = service.IotTSimPoolWarnConfig().Export(ctx, &req.TSimPoolWarnConfigListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新流量池预警配置表
|
||||
func (c *ControllerV1) TSimPoolWarnConfigEdit(ctx context.Context, req *v1.TSimPoolWarnConfigEditReq) (res *v1.TSimPoolWarnConfigEditRes, err error) {
|
||||
err = service.IotTSimPoolWarnConfig().Edit(ctx, &req.TSimPoolWarnConfigEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定流量池预警配置表信息
|
||||
func (c *ControllerV1) TSimPoolWarnConfigView(ctx context.Context, req *v1.TSimPoolWarnConfigViewReq) (res *v1.TSimPoolWarnConfigViewRes, err error) {
|
||||
data, err := service.IotTSimPoolWarnConfig().View(ctx, &req.TSimPoolWarnConfigViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimPoolWarnConfigViewRes)
|
||||
res.TSimPoolWarnConfigViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除流量池预警配置表
|
||||
func (c *ControllerV1) TSimPoolWarnConfigDelete(ctx context.Context, req *v1.TSimPoolWarnConfigDeleteReq) (res *v1.TSimPoolWarnConfigDeleteRes, err error) {
|
||||
err = service.IotTSimPoolWarnConfig().Delete(ctx, &req.TSimPoolWarnConfigDeleteParam)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Package gen
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2026 LiXiujie
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version
|
||||
package iot
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// List 查看上游套餐表列表
|
||||
func (c *ControllerV1) TSimUpstreamPackageList(ctx context.Context, req *v1.TSimUpstreamPackageListReq) (res *v1.TSimUpstreamPackageListRes, err error) {
|
||||
list, totalCount, err := service.IotTUpstreamPackage().List(ctx, &req.TUpstreamPackageListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TUpstreamPackageListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TSimUpstreamPackageListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出上游套餐表列表
|
||||
func (c *ControllerV1) TSimUpstreamPackageExport(ctx context.Context, req *v1.TSimUpstreamPackageExportReq) (res *v1.TSimUpstreamPackageExportRes, err error) {
|
||||
err = service.IotTUpstreamPackage().Export(ctx, &req.TUpstreamPackageListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新上游套餐表
|
||||
func (c *ControllerV1) TSimUpstreamPackageEdit(ctx context.Context, req *v1.TSimUpstreamPackageEditReq) (res *v1.TSimUpstreamPackageEditRes, err error) {
|
||||
err = service.IotTUpstreamPackage().Edit(ctx, &req.TUpstreamPackageEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定上游套餐表信息
|
||||
func (c *ControllerV1) TSimUpstreamPackageView(ctx context.Context, req *v1.TSimUpstreamPackageViewReq) (res *v1.TSimUpstreamPackageViewRes, err error) {
|
||||
data, err := service.IotTUpstreamPackage().View(ctx, &req.TUpstreamPackageViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TSimUpstreamPackageViewRes)
|
||||
res.TUpstreamPackageViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除上游套餐表
|
||||
func (c *ControllerV1) TSimUpstreamPackageDelete(ctx context.Context, req *v1.TSimUpstreamPackageDeleteReq) (res *v1.TSimUpstreamPackageDeleteRes, err error) {
|
||||
err = service.IotTUpstreamPackage().Delete(ctx, &req.TUpstreamPackageDeleteParam)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user