视频任务管理更新

This commit is contained in:
super
2026-07-19 22:23:26 +08:00
parent f189a5b4eb
commit 5e12e7ea52
62 changed files with 2164 additions and 280 deletions
@@ -18,17 +18,17 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/tasks")
@Tag(name = "Task heartbeat", description = "Unified heartbeat API for Python task workers")
@Tag(name = "任务心跳", description = "供 Python 任务执行器统一上报运行状态和进度的心跳接口")
public class TaskHeartbeatController {
private final TaskHeartbeatService taskHeartbeatService;
@PostMapping("/{taskId}/heartbeat")
@Operation(
summary = "Task heartbeat",
description = "Python calls this during execution. The backend resolves biz_file_task or brand task by taskId only.")
summary = "上报任务心跳",
description = "Python 在任务执行期间调用。后端仅根据 taskId 识别文件任务或品牌任务并更新心跳。")
public ApiResponse<TaskHeartbeatVo> heartbeat(
@Parameter(description = "Task ID", required = true, example = "200")
@Parameter(description = "任务 ID", required = true, example = "200")
@PathVariable Long taskId,
@Valid @RequestBody(required = false) TaskHeartbeatRequest request) {
return ApiResponse.success(taskHeartbeatService.heartbeat(taskId, request));
@@ -6,15 +6,15 @@ import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "Task heartbeat request")
@Schema(description = "任务心跳请求")
public class TaskHeartbeatRequest {
@Schema(description = "Optional phase label", example = "crawling")
@Schema(description = "可选的任务阶段标识", example = "crawling")
private String phase;
@Schema(description = "Optional current progress", example = "42")
@Schema(description = "可选的当前进度", example = "42")
private Integer current;
@Schema(description = "Optional total progress", example = "1100")
@Schema(description = "可选的总进度", example = "1100")
private Integer total;
}
@@ -4,19 +4,19 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "Task heartbeat response")
@Schema(description = "任务心跳响应")
public class TaskHeartbeatVo {
@Schema(description = "Whether the task can continue", example = "true")
@Schema(description = "任务是否可以继续执行", example = "true")
private boolean alive;
@Schema(description = "Task status", example = "RUNNING")
@Schema(description = "任务状态", example = "RUNNING")
private String status;
@Schema(description = "Resolved task module", example = "PRODUCT_RISK_RESOLVE")
@Schema(description = "识别出的任务模块", example = "PRODUCT_RISK_RESOLVE")
private String moduleType;
@Schema(description = "Message", example = "ok")
@Schema(description = "提示信息", example = "ok")
private String message;
public static TaskHeartbeatVo alive(String moduleType, String status) {