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 - - -