// ================================================================================ // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. // You can delete these comments if you wish manually maintain this interface file. // ================================================================================ package service import ( "context" "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model" "time" ) type ( ITrafficUsage interface { // WriteDaily 批量写入日流量数据。 // 每个 ICCID 会落到独立子表,子表通过 t_sim_card_usage_daily 超级表自动创建。 WriteDaily(ctx context.Context, items []model.TrafficUsageDailyItem) error // WriteMonthly 批量写入月流量数据。 // 月流量和日流量共用同一个 TDengine database,但使用不同超级表。 WriteMonthly(ctx context.Context, items []model.TrafficUsageMonthlyItem) error // WritePoolUsageDaily 批量写入流量池的流量使用记录。 // 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_usage_daily 超级表自动创建。 WritePoolUsageDaily(ctx context.Context, items []model.TrafficPoolUsageItem) error // WritePoolUsageMonthly 批量写入流量池的流量使用记录。 // 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_usage_monthly 超级表自动创建。 WritePoolUsageMonthly(ctx context.Context, items []model.TrafficPoolUsageItem) error // WritePoolCardCountDaily 批量写入流量池的卡数量记录。 // 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_card_count_daily 超级表自动创建。 WritePoolCardCountDaily(ctx context.Context, items []model.TrafficPoolCardCountItem) error // WritePoolCardCountMonthly 批量写入流量池的卡数量记录。 // 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_card_count_monthly 超级表自动创建。 WritePoolCardCountMonthly(ctx context.Context, items []model.TrafficPoolCardCountItem) error // UpdateDaily 更新日流量数据。 UpdateDaily(ctx context.Context, items []model.TrafficUsageDailyItem) error // UpdateMonthly 更新月流量数据。 UpdateMonthly(ctx context.Context, items []model.TrafficUsageMonthlyItem) error // DeleteDaily 删除日流量数据。 DeleteDaily(ctx context.Context, input model.TrafficUsageDeleteInput) error // DeleteMonthly 删除月流量数据。 DeleteMonthly(ctx context.Context, input model.TrafficUsageDeleteInput) error // QueryDaily 查询日流量数据。 QueryDaily(ctx context.Context, input model.TrafficUsageQueryInput) ([]model.TrafficUsageDailyRecord, int, error) // QueryMonthly 查询月流量数据。 QueryMonthly(ctx context.Context, input model.TrafficUsageQueryInput) ([]model.TrafficUsageMonthlyRecord, int, error) // AggregatePoolUsageDaily 汇总日流量数据。 AggregatePoolUsageDaily(ctx context.Context, date time.Time, cards []model.TrafficPoolCard) ([]model.TrafficPoolUsageAggregate, error) // AggregatePoolUsageMonthly 汇总月流量数据。 AggregatePoolUsageMonthly(ctx context.Context, month time.Time, cards []model.TrafficPoolCard) ([]model.TrafficPoolUsageAggregate, error) // GetTopUsageCardsYesterday 查询前一天流量使用前五名的卡片 GetTopUsageCardsYesterday(ctx context.Context) ([]model.TopUsageCard, error) } ITrafficUsageDailySync interface { // StartDaily publishes a command for Worker to run the previous-day usage // full sync. This is the production entry point. StartDaily(ctx context.Context) error StartDailyRun(ctx context.Context) (string, error) // StartDailyRunScoped narrows the run to a channel whitelist; a nil or // empty scope is a full sync. StartDailyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) // StartDailyRunScopedAt starts a run for a specific day (yyyyMMdd). An // empty queryDate behaves exactly like StartDailyRunScoped. StartDailyRunScopedAt(ctx context.Context, scope *model.SyncScope, queryDate string) (string, error) // SyncDaily is the legacy in-process scan, kept only as the rollback path // until the Worker chain is verified in production. SyncDaily(ctx context.Context) } ITrafficUsageMonthlySync interface { SyncMonthly(ctx context.Context) // StartMonthly publishes a command for Worker to run the full monthly usage sync. StartMonthly(ctx context.Context) error StartMonthlyRun(ctx context.Context) (string, error) // StartMonthlyRunScoped narrows the run to a channel whitelist; a nil or // empty scope is a full sync. StartMonthlyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) // StartMonthlyHistory publishes a command for Worker to backfill the // previous month into the TDengine monthly table. This is distinct from // StartMonthly, which fills the MySQL current-month snapshot. StartMonthlyHistory(ctx context.Context) error StartMonthlyHistoryRun(ctx context.Context) (string, error) // StartMonthlyHistoryRunScoped narrows the run to a channel whitelist; a // nil or empty scope is a full sync. StartMonthlyHistoryRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) // StartMonthlyHistoryRunScopedAt starts a run for a specific month // (yyyyMM). An empty queryMonth behaves exactly like // StartMonthlyHistoryRunScoped. StartMonthlyHistoryRunScopedAt(ctx context.Context, scope *model.SyncScope, queryMonth string) (string, error) } ITrafficPoolUsageSync interface { // TODO: 流量池查询逻辑还未确定 // SyncDaily 同步流量池的流量使用记录 SyncDaily(ctx context.Context) // SyncMonthly 同步流量池的流量使用记录 SyncMonthly(ctx context.Context) } ) var ( localTrafficUsage ITrafficUsage localTrafficUsageDailySync ITrafficUsageDailySync localTrafficUsageMonthlySync ITrafficUsageMonthlySync localTrafficPoolUsageSync ITrafficPoolUsageSync ) func TrafficUsage() ITrafficUsage { if localTrafficUsage == nil { panic("implement not found for interface ITrafficUsage, forgot register?") } return localTrafficUsage } func RegisterTrafficUsage(i ITrafficUsage) { localTrafficUsage = i } func TrafficUsageDailySync() ITrafficUsageDailySync { if localTrafficUsageDailySync == nil { panic("implement not found for interface ITrafficUsageDailySync, forgot register?") } return localTrafficUsageDailySync } func RegisterTrafficUsageDailySync(i ITrafficUsageDailySync) { localTrafficUsageDailySync = i } func TrafficUsageMonthlySync() ITrafficUsageMonthlySync { if localTrafficUsageMonthlySync == nil { panic("implement not found for interface ITrafficUsageMonthlySync, forgot register?") } return localTrafficUsageMonthlySync } func RegisterTrafficUsageMonthlySync(i ITrafficUsageMonthlySync) { localTrafficUsageMonthlySync = i } func TrafficPoolUsageSync() ITrafficPoolUsageSync { if localTrafficPoolUsageSync == nil { panic("implement not found for interface ITrafficPoolUsageSync, forgot register?") } return localTrafficPoolUsageSync } func RegisterTrafficPoolUsageSync(i ITrafficPoolUsageSync) { localTrafficPoolUsageSync = i }