feat(face): 优化模板渲染状态查询逻辑

- 引入 TaskMapper 依赖以支持任务查询
- 移除带过期时间的模板渲染状态设置方法
- 在缓存缺失时查询最新任务记录以确定渲染状态
- 新增 listLastFaceTemplateTask 方法用于获取最新的人脸模板任务
- 实现根据任务状态自动设置模板渲染状态的逻辑
- 添加对任务状态为 1 和 2 时的渲染状态映射处理
This commit is contained in:
2025-12-17 16:06:35 +08:00
parent 6cd47649fc
commit 171932c05c
4 changed files with 33 additions and 43 deletions

View File

@@ -356,6 +356,10 @@ public class GoodsServiceImpl implements GoodsService {
if (status == FaceCutStatus.COMPLETED) {
// 切片已完成,查询该人脸关联的视频信息
List<MemberVideoEntity> taskList = videoMapper.listRelationByFace(faceId);
if (taskList == null || taskList.isEmpty() || taskList.getLast().getVideoId() == null) {
response.setStatus(VideoTaskStatus.PROCESSING.getCode());
return response;
}
// 设置最新的视频信息(取最后一个)
response.setTaskId(taskList.getLast().getTaskId());
@@ -460,10 +464,10 @@ public class GoodsServiceImpl implements GoodsService {
// 该模板已渲染完成,查询对应的视频信息
List<MemberVideoEntity> taskList = videoMapper.listRelationByFaceAndTemplate(faceId, templateId);
if (taskList.isEmpty()) {
if (taskList.isEmpty() || taskList.getLast().getVideoId() == null) {
// 理论上不应该出现:渲染完成但无视频记录
// 可能是数据不一致,返回待制作状态
response.setStatus(VideoTaskStatus.PENDING.getCode());
response.setStatus(VideoTaskStatus.PROCESSING.getCode());
return response;
}