fix(task): 修复任务重复处理中的日志和更新逻辑

- 移除了创建任务日志中的敏感参数信息
- 更新重复任务日志以包含任务ID信息
- 移除了workerId重置逻辑,改为显式清除方法
- 修复TaskMapper中status字段的SQL语法问题
- 优化了任务参数更新的处理流程
This commit is contained in:
2025-12-31 20:36:31 +08:00
parent b4628bd3e8
commit 41e90bab9c
2 changed files with 6 additions and 5 deletions

View File

@@ -399,7 +399,7 @@ public class TaskTaskServiceImpl implements TaskService {
memberVideoEntity.setTemplateId(templateId); memberVideoEntity.setTemplateId(templateId);
memberVideoEntity.setIsBuy(0); memberVideoEntity.setIsBuy(0);
if (list.isEmpty()) { if (list.isEmpty()) {
log.info("创建任务! faceId:{},templateId:{},taskParams:{}", faceId, templateId, sourcesMap); log.info("创建任务! faceId:{},templateId:{}", faceId, templateId);
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(face.getScenicId()); ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(face.getScenicId());
TaskEntity taskEntity = null; TaskEntity taskEntity = null;
boolean isReuseOldTask = false; boolean isReuseOldTask = false;
@@ -439,15 +439,16 @@ public class TaskTaskServiceImpl implements TaskService {
} }
memberVideoEntity.setTaskId(taskEntity.getId()); memberVideoEntity.setTaskId(taskEntity.getId());
} else { } else {
log.info("重复task,更新旧任务! faceId:{},templateId:{},taskParams:{}", faceId, templateId, sourcesMap);
TaskRespVO existingTask = list.getFirst(); TaskRespVO existingTask = list.getFirst();
// 更新旧任务:重置workerId为空,status为0,更新taskParams log.info("重复task,更新旧任务! faceId:{},templateId:{},taskId:{}", faceId, templateId, existingTask.getId());
// 更新旧任务:重置status为0,更新taskParams
TaskEntity taskUpdate = new TaskEntity(); TaskEntity taskUpdate = new TaskEntity();
taskUpdate.setId(existingTask.getId()); taskUpdate.setId(existingTask.getId());
taskUpdate.setWorkerId(null);
taskUpdate.setStatus(0); taskUpdate.setStatus(0);
taskUpdate.setTaskParams(JacksonUtil.toJSONString(sourcesMap)); taskUpdate.setTaskParams(JacksonUtil.toJSONString(sourcesMap));
taskMapper.update(taskUpdate); taskMapper.update(taskUpdate);
// 显式清除workerId(update方法的动态SQL会跳过null值)
taskMapper.deassign(existingTask.getId());
videoTaskRepository.clearTaskCache(existingTask.getId()); videoTaskRepository.clearTaskCache(existingTask.getId());
memberVideoEntity.setTaskId(existingTask.getId()); memberVideoEntity.setTaskId(existingTask.getId());

View File

@@ -15,7 +15,7 @@
<if test="scenicId!= null">scenic_id = #{scenicId}, </if> <if test="scenicId!= null">scenic_id = #{scenicId}, </if>
<if test="taskParams!= null">task_params = #{taskParams}, </if> <if test="taskParams!= null">task_params = #{taskParams}, </if>
<if test="videoUrl!= null">video_url = #{videoUrl}, </if> <if test="videoUrl!= null">video_url = #{videoUrl}, </if>
<if test="status!= null">status = #{status}, </if> <if test="status!= null">`status` = #{status}, </if>
<if test="result!= null">result = #{result}, </if> <if test="result!= null">result = #{result}, </if>
</set> </set>
where id = #{id} where id = #{id}