From 50aaf7cb1a93c2c76aac380d9327e84d266525f5 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 17 Jan 2026 02:50:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor(puzzle):=20=E7=A7=BB=E9=99=A4=E8=BE=B9?= =?UTF-8?q?=E7=BC=98=E6=B8=B2=E6=9F=93=E4=BB=BB=E5=8A=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除了 PuzzleEdgeRenderTaskMapper 接口文件 - 移除了对应的 MyBatis XML 映射文件 - 清理了数据库操作相关的实体映射配置 - 移除了任务领取、成功标记、失败标记等数据库操作方法 - 删除了查询下一条可领取任务的业务逻辑实现 --- .../mapper/PuzzleEdgeRenderTaskMapper.java | 34 ------ .../mapper/PuzzleEdgeRenderTaskMapper.xml | 108 ------------------ 2 files changed, 142 deletions(-) delete mode 100644 src/main/java/com/ycwl/basic/puzzle/edge/mapper/PuzzleEdgeRenderTaskMapper.java delete mode 100644 src/main/resources/mapper/PuzzleEdgeRenderTaskMapper.xml diff --git a/src/main/java/com/ycwl/basic/puzzle/edge/mapper/PuzzleEdgeRenderTaskMapper.java b/src/main/java/com/ycwl/basic/puzzle/edge/mapper/PuzzleEdgeRenderTaskMapper.java deleted file mode 100644 index b4d2a1bd..00000000 --- a/src/main/java/com/ycwl/basic/puzzle/edge/mapper/PuzzleEdgeRenderTaskMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ycwl.basic.puzzle.edge.mapper; - -import com.ycwl.basic.puzzle.edge.entity.PuzzleEdgeRenderTaskEntity; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.Date; - -@Mapper -public interface PuzzleEdgeRenderTaskMapper { - - PuzzleEdgeRenderTaskEntity getById(@Param("id") Long id); - - int insert(PuzzleEdgeRenderTaskEntity entity); - - /** - * 获取下一条可领取任务ID:PENDING 或 RUNNING但租约已过期 - */ - Long findNextClaimableTaskId(); - - /** - * 领取任务(并写入租约与attempt) - */ - int claimTask(@Param("taskId") Long taskId, - @Param("workerId") Long workerId, - @Param("leaseExpireTime") Date leaseExpireTime); - - int markSuccess(@Param("taskId") Long taskId, @Param("workerId") Long workerId); - - int markFail(@Param("taskId") Long taskId, - @Param("workerId") Long workerId, - @Param("errorMessage") String errorMessage); -} - diff --git a/src/main/resources/mapper/PuzzleEdgeRenderTaskMapper.xml b/src/main/resources/mapper/PuzzleEdgeRenderTaskMapper.xml deleted file mode 100644 index 9e285f61..00000000 --- a/src/main/resources/mapper/PuzzleEdgeRenderTaskMapper.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, record_id, template_id, template_code, scenic_id, face_id, content_hash, - status, worker_id, lease_expire_time, attempt_count, - output_format, output_quality, - original_object_key, cropped_object_key, - payload_json, error_message, - create_time, update_time - - - - - - INSERT INTO puzzle_edge_render_task ( - record_id, template_id, template_code, scenic_id, face_id, content_hash, - status, worker_id, lease_expire_time, attempt_count, - output_format, output_quality, - original_object_key, cropped_object_key, - payload_json, error_message, - create_time, update_time - ) VALUES ( - #{recordId}, #{templateId}, #{templateCode}, #{scenicId}, #{faceId}, #{contentHash}, - #{status}, #{workerId}, #{leaseExpireTime}, #{attemptCount}, - #{outputFormat}, #{outputQuality}, - #{originalObjectKey}, #{croppedObjectKey}, - #{payloadJson}, #{errorMessage}, - NOW(), NOW() - ) - - - - - - UPDATE puzzle_edge_render_task - SET worker_id = #{workerId}, - status = 1, - lease_expire_time = #{leaseExpireTime}, - attempt_count = attempt_count + 1, - update_time = NOW() - WHERE id = #{taskId} - AND ( - status = 0 - OR (status = 1 AND lease_expire_time IS NOT NULL AND lease_expire_time < NOW()) - ) - - - - UPDATE puzzle_edge_render_task - SET status = 2, - lease_expire_time = NULL, - error_message = NULL, - update_time = NOW() - WHERE id = #{taskId} - AND worker_id = #{workerId} - AND status = 1 - - - - UPDATE puzzle_edge_render_task - SET status = 3, - lease_expire_time = NULL, - error_message = #{errorMessage}, - update_time = NOW() - WHERE id = #{taskId} - AND worker_id = #{workerId} - AND status = 1 - - -