头像视频合成
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.dto.VideoSynthesisRequestDto;
|
||||
import com.rj.entity.VideoSynthesisLog;
|
||||
import com.rj.mapper.VideoSynthesisLogMapper;
|
||||
import com.rj.service.IVideoSynthesisService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -29,6 +32,9 @@ public class VideoSynthesisFromController {
|
||||
|
||||
@Autowired
|
||||
private IVideoSynthesisService videoSynthesisService;
|
||||
|
||||
@Autowired
|
||||
private VideoSynthesisLogMapper videoSynthesisLogMapper;
|
||||
|
||||
/**
|
||||
* 视频合成接口
|
||||
@@ -47,7 +53,7 @@ public class VideoSynthesisFromController {
|
||||
|
||||
// 构建响应结果
|
||||
result.put("success", synthesisLog.getSuccess());
|
||||
result.put("message", synthesisLog.getSuccess() ? "视频合成成功" : "视频合成失败");
|
||||
result.put("message", synthesisLog.getTaskStatus());
|
||||
result.put("requestId", synthesisLog.getRequestId());
|
||||
result.put("taskId", synthesisLog.getTaskId());
|
||||
result.put("taskStatus", synthesisLog.getTaskStatus());
|
||||
@@ -177,4 +183,77 @@ public class VideoSynthesisFromController {
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询视频合成日志列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询视频合成日志列表", description = "分页查询视频合成日志")
|
||||
public ResponseEntity<Map<String, Object>> getVideoSynthesisLogs(
|
||||
@Parameter(description = "页码") @RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@Parameter(description = "每页大小") @RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@Parameter(description = "任务状态") @RequestParam(required = false) String taskStatus,
|
||||
@Parameter(description = "模型") @RequestParam(required = false) String model,
|
||||
@Parameter(description = "模型供应商") @RequestParam(required = false) String modelProvider,
|
||||
@Parameter(description = "归属人姓名") @RequestParam(required = false) String ownerName,
|
||||
@Parameter(description = "归属人电话") @RequestParam(required = false) String ownerPhone,
|
||||
@Parameter(description = "是否成功") @RequestParam(required = false) Boolean success,
|
||||
@Parameter(description = "开始时间") @RequestParam(required = false) String startTime,
|
||||
@Parameter(description = "结束时间") @RequestParam(required = false) String endTime) {
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
Page<VideoSynthesisLog> page = new Page<>(pageNum, pageSize);
|
||||
QueryWrapper<VideoSynthesisLog> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 添加查询条件
|
||||
if (taskStatus != null && !taskStatus.trim().isEmpty()) {
|
||||
queryWrapper.eq("task_status", taskStatus);
|
||||
}
|
||||
if (model != null && !model.trim().isEmpty()) {
|
||||
queryWrapper.like("model", model);
|
||||
}
|
||||
if (modelProvider != null && !modelProvider.trim().isEmpty()) {
|
||||
queryWrapper.like("model_provider", modelProvider);
|
||||
}
|
||||
if (ownerName != null && !ownerName.trim().isEmpty()) {
|
||||
queryWrapper.like("owner_name", ownerName);
|
||||
}
|
||||
if (ownerPhone != null && !ownerPhone.trim().isEmpty()) {
|
||||
queryWrapper.like("owner_phone", ownerPhone);
|
||||
}
|
||||
if (success != null) {
|
||||
queryWrapper.eq("success", success);
|
||||
}
|
||||
if (startTime != null && !startTime.trim().isEmpty()) {
|
||||
queryWrapper.ge("request_time", startTime);
|
||||
}
|
||||
if (endTime != null && !endTime.trim().isEmpty()) {
|
||||
queryWrapper.le("request_time", endTime);
|
||||
}
|
||||
|
||||
// 按请求时间倒序排列
|
||||
queryWrapper.orderByDesc("request_time");
|
||||
|
||||
// 执行查询
|
||||
Page<VideoSynthesisLog> pageResult = videoSynthesisLogMapper.selectPage(page, queryWrapper);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", pageResult.getRecords());
|
||||
result.put("total", pageResult.getTotal());
|
||||
result.put("pageNum", pageResult.getCurrent());
|
||||
result.put("pageSize", pageResult.getSize());
|
||||
result.put("pages", pageResult.getPages());
|
||||
|
||||
return ResponseEntity.ok(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("查询视频合成日志失败: {}", e.getMessage(), e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询失败: " + e.getMessage());
|
||||
return ResponseEntity.status(500).body(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user