Files
junhong_cmp_fiber/internal/model/dto/export_task_dto.go
邹进 71fb91f9bf
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m24s
fix: 导出任务场景校验加入按类别拆分的订单导出场景
创建导出任务与导出任务列表的 scene 参数用 oneof 写死了允许的场景,order_platform、order_agent、order_online 被参数校验拒绝。
同时修正提案中资产订单接口按授权范围校验企业账号的不准确描述。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:42:29 +09:00

97 lines
8.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import "time"
// CreateExportTaskRequest 创建导出任务请求。
type CreateExportTaskRequest struct {
Scene string `json:"scene" validate:"required,oneof=device iot_card order order_platform order_agent order_online package agent_wallet_transaction agent_recharge refund exchange commission_record package_traffic_alert expiring_asset operations_activation operations_renewal stop_resume_rule_dry_run polling_pause polling_stop_refused_alert" required:"true" description:"导出场景 (device:设备, iot_card:IoT卡, order:订单, order_platform:平台订单, order_agent:代理商订单, order_online:在线支付订单, package:套餐, agent_wallet_transaction:代理主钱包流水, agent_recharge:代理充值, refund:退款, exchange:换货, commission_record:佣金明细, package_traffic_alert:套餐真流量达量预警, expiring_asset:临期资产, operations_activation:设备激活情况报表, operations_renewal:套餐续费情况报表, stop_resume_rule_dry_run:停复机规则演练明细, polling_pause:不轮询清单, polling_stop_refused_alert:停机被拒告警)"`
Format string `json:"format" validate:"required,oneof=xlsx csv" required:"true" description:"导出格式 (xlsx:Excel, csv:CSV)"`
Query map[string]interface{} `json:"query,omitempty" description:"导出筛选参数(JSON对象,可选);时间筛选固定使用 filters.start_time 与 filters.end_time,取值必须为带显式时区的 RFC3339 秒级时间"`
}
// CreateExportTaskResponse 创建导出任务响应。
type CreateExportTaskResponse struct {
TaskID uint `json:"task_id" description:"导出任务ID"`
TaskNo string `json:"task_no" description:"任务编号"`
Status int `json:"status" description:"任务状态 (1:待处理, 2:处理中, 3:已完成, 4:已失败, 5:已取消)"`
StatusName string `json:"status_name" description:"任务状态名称(中文)"`
Message string `json:"message" description:"提示信息"`
}
// ListExportTaskRequest 导出任务列表请求。
type ListExportTaskRequest struct {
Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"`
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"`
Scene string `json:"scene" query:"scene" validate:"omitempty,oneof=device iot_card order order_platform order_agent order_online package agent_wallet_transaction agent_recharge refund exchange commission_record package_traffic_alert expiring_asset operations_activation operations_renewal stop_resume_rule_dry_run polling_pause polling_stop_refused_alert" description:"导出场景 (device:设备, iot_card:IoT卡, order:订单, order_platform:平台订单, order_agent:代理商订单, order_online:在线支付订单, package:套餐, agent_wallet_transaction:代理主钱包流水, agent_recharge:代理充值, refund:退款, exchange:换货, commission_record:佣金明细, package_traffic_alert:套餐真流量达量预警, expiring_asset:临期资产, operations_activation:设备激活情况报表, operations_renewal:套餐续费情况报表, stop_resume_rule_dry_run:停复机规则演练明细, polling_pause:不轮询清单, polling_stop_refused_alert:停机被拒告警)"`
Status *int `json:"status" query:"status" validate:"omitempty,min=1,max=5" minimum:"1" maximum:"5" description:"任务状态 (1:待处理, 2:处理中, 3:已完成, 4:已失败, 5:已取消)"`
StartTime string `json:"start_time" query:"start_time" description:"创建时间起始(带时区的 RFC3339 秒级时间,闭区间含该时刻,如 2026-09-01T00:00:00+08:00)"`
EndTime string `json:"end_time" query:"end_time" description:"创建时间结束(带时区的 RFC3339 秒级时间,闭区间含该时刻,如 2026-09-30T23:59:59+08:00)"`
}
// ExportTaskItem 导出任务列表项。
type ExportTaskItem struct {
ID uint `json:"id" description:"任务ID"`
TaskID uint `json:"task_id" description:"任务ID"`
TaskNo string `json:"task_no" description:"任务编号"`
Scene string `json:"scene" description:"导出场景 (device:设备, iot_card:IoT卡, order:订单, order_platform:平台订单, order_agent:代理商订单, order_online:在线支付订单, package:套餐, agent_wallet_transaction:代理主钱包流水, agent_recharge:代理充值, refund:退款, exchange:换货, commission_record:佣金明细, package_traffic_alert:套餐真流量达量预警, operations_activation:设备激活情况报表, operations_renewal:套餐续费情况报表, stop_resume_rule_dry_run:停复机规则演练明细, polling_pause:不轮询清单, polling_stop_refused_alert:停机被拒告警)"`
Format string `json:"format" description:"导出格式 (xlsx:Excel, csv:CSV)"`
Status int `json:"status" description:"任务状态 (1:待处理, 2:处理中, 3:已完成, 4:已失败, 5:已取消)"`
StatusName string `json:"status_name" description:"任务状态名称(中文)"`
Progress int `json:"progress" description:"任务进度(0-100)"`
TotalRows int `json:"total_rows" description:"总行数"`
ProcessedRows int `json:"processed_rows" description:"已处理行数"`
TotalShards int `json:"total_shards" description:"总分片数"`
SuccessShards int `json:"success_shards" description:"成功分片数"`
FailedShards int `json:"failed_shards" description:"失败分片数"`
TotalCount int `json:"total_count" description:"统一任务总数"`
SuccessCount int `json:"success_count" description:"统一任务成功数"`
FailedCount int `json:"failed_count" description:"统一任务失败数"`
CancelRequested bool `json:"cancel_requested" description:"是否已请求取消"`
FileKey string `json:"file_key,omitempty" description:"导出文件Key"`
ErrorMessage string `json:"error_message,omitempty" description:"错误信息"`
ErrorCode string `json:"error_code,omitempty" description:"安全错误码"`
ErrorSummary string `json:"error_summary,omitempty" description:"安全失败摘要"`
CreatedAt time.Time `json:"created_at" description:"创建时间"`
UpdatedAt time.Time `json:"updated_at" description:"更新时间"`
StartedAt *time.Time `json:"started_at,omitempty" description:"开始处理时间"`
CompletedAt *time.Time `json:"completed_at,omitempty" description:"完成时间"`
CreatorUserID uint `json:"creator_user_id" description:"创建人用户ID"`
CreatorUserType int `json:"creator_user_type" description:"创建人用户类型 (2:平台, 3:代理, 4:企业)"`
CreatorShopID *uint `json:"creator_shop_id,omitempty" description:"创建人店铺ID"`
CreatorEnterpriseID *uint `json:"creator_enterprise_id,omitempty" description:"创建人企业ID"`
}
// ListExportTaskResponse 导出任务列表响应。
type ListExportTaskResponse struct {
List []*ExportTaskItem `json:"items" description:"任务列表"`
Total int64 `json:"total" description:"总数"`
Page int `json:"page" description:"当前页码"`
PageSize int `json:"size" description:"每页数量"`
}
// GetExportTaskRequest 导出任务详情请求。
type GetExportTaskRequest struct {
ID uint `path:"id" description:"任务ID" required:"true"`
}
// ExportTaskDetailResponse 导出任务详情响应。
type ExportTaskDetailResponse struct {
ExportTaskItem
DownloadURL string `json:"download_url,omitempty" description:"下载链接(仅已完成任务返回)"`
DownloadExpiresAt *time.Time `json:"download_expires_at,omitempty" description:"下载链接过期时间"`
}
// CancelExportTaskRequest 取消导出任务请求。
type CancelExportTaskRequest struct {
ID uint `path:"id" description:"任务ID" required:"true"`
}
// CancelExportTaskResponse 取消导出任务响应。
type CancelExportTaskResponse struct {
TaskID uint `json:"task_id" description:"任务ID"`
Status int `json:"status" description:"任务状态 (1:待处理, 2:处理中, 3:已完成, 4:已失败, 5:已取消)"`
StatusName string `json:"status_name" description:"任务状态名称(中文)"`
CancelRequested bool `json:"cancel_requested" description:"是否已请求取消"`
Message string `json:"message" description:"提示信息"`
}