refactor(task): 优化重复任务处理逻辑

- 移除旧任务更新逻辑,简化重复任务处理流程
- 替换视频查询方法调用,使用新的存储库方法
- 保持任务缓存清除功能
- 简化日志输出信息
This commit is contained in:
2026-01-01 19:55:33 +08:00
parent 6e0ebcd1bd
commit 44f5008fd1

View File

@@ -440,19 +440,11 @@ public class TaskTaskServiceImpl implements TaskService {
memberVideoEntity.setTaskId(taskEntity.getId());
} else {
TaskRespVO existingTask = list.getFirst();
log.info("重复task,更新旧任务! faceId:{},templateId:{},taskId:{}", faceId, templateId, existingTask.getId());
// 更新旧任务:重置status为0,更新taskParams
TaskEntity taskUpdate = new TaskEntity();
taskUpdate.setId(existingTask.getId());
taskUpdate.setStatus(0);
taskUpdate.setTaskParams(JacksonUtil.toJSONString(sourcesMap));
taskMapper.update(taskUpdate);
// 显式清除workerId(update方法的动态SQL会跳过null值)
taskMapper.deassign(existingTask.getId());
log.info("重复task! faceId:{},templateId:{},taskId:{}", faceId, templateId, existingTask.getId());
videoTaskRepository.clearTaskCache(existingTask.getId());
memberVideoEntity.setTaskId(existingTask.getId());
VideoEntity video = videoMapper.findByTaskId(existingTask.getId());
VideoEntity video = videoRepository.getVideoByTaskId(existingTask.getId());
if (video != null) {
IsBuyRespVO isBuy = orderBiz.isBuy(existingTask.getScenicId(), face.getMemberId(), face.getId(), 0, video.getId());
if (isBuy.isBuy()) {