统一导出任务
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m4s

This commit is contained in:
2026-04-27 09:47:03 +08:00
parent 531de3c760
commit 60debb7505
29 changed files with 2580 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package routes
import (
"github.com/gofiber/fiber/v2"
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
"github.com/break/junhong_cmp_fiber/internal/model/dto"
"github.com/break/junhong_cmp_fiber/pkg/openapi"
)
func registerExportTaskRoutes(router fiber.Router, handler *admin.ExportTaskHandler, doc *openapi.Generator, basePath string) {
exportTasks := router.Group("/export-tasks")
groupPath := basePath + "/export-tasks"
Register(exportTasks, doc, groupPath, "POST", "", handler.Create, RouteSpec{
Summary: "创建导出任务",
Description: "创建统一导出任务,支持场景 scene=device/iot_card 和格式 format=xlsx/csv。",
Tags: []string{"导出任务"},
Input: new(dto.CreateExportTaskRequest),
Output: new(dto.CreateExportTaskResponse),
Auth: true,
})
Register(exportTasks, doc, groupPath, "GET", "", handler.List, RouteSpec{
Summary: "导出任务列表",
Description: "支持按 scene/status/time 过滤,分页默认 20最大 100。",
Tags: []string{"导出任务"},
Input: new(dto.ListExportTaskRequest),
Output: new(dto.ListExportTaskResponse),
Auth: true,
})
Register(exportTasks, doc, groupPath, "GET", "/:id", handler.GetByID, RouteSpec{
Summary: "导出任务详情",
Description: "已完成任务返回 download_url链接固定有效期 24 小时。",
Tags: []string{"导出任务"},
Input: new(dto.GetExportTaskRequest),
Output: new(dto.ExportTaskDetailResponse),
Auth: true,
})
Register(exportTasks, doc, groupPath, "POST", "/:id/cancel", handler.Cancel, RouteSpec{
Summary: "取消导出任务",
Description: "支持取消待处理/处理中任务;已完成/已失败/已取消任务不可取消。",
Tags: []string{"导出任务"},
Input: new(dto.CancelExportTaskRequest),
Output: new(dto.CancelExportTaskResponse),
Auth: true,
})
}