You've already forked FrameTour-BE
Merge branch 'puzzle_edge_w'
# Conflicts: # src/main/java/com/ycwl/basic/config/WebMvcConfig.java
This commit is contained in:
@@ -55,4 +55,12 @@ logging:
|
||||
com.ycwl.basic.integration.scenic.client: DEBUG
|
||||
|
||||
zhipu:
|
||||
api-key: a331e0fcf3f74518818b8e5129b79058.RXuUxUUjKdcxbF4L
|
||||
api-key: a331e0fcf3f74518818b8e5129b79058.RXuUxUUjKdcxbF4L
|
||||
|
||||
# 边缘 Worker 接口安全(仅允许 100.64.0.0/24 网段访问)
|
||||
puzzle:
|
||||
edge:
|
||||
worker:
|
||||
security:
|
||||
enabled: true
|
||||
allowed-ip-cidr: 100.64.0.0/24
|
||||
|
||||
@@ -25,4 +25,12 @@ logging:
|
||||
com.ycwl.basic.integration.scenic.client: WARN
|
||||
|
||||
zhipu:
|
||||
api-key: a331e0fcf3f74518818b8e5129b79058.RXuUxUUjKdcxbF4L
|
||||
api-key: a331e0fcf3f74518818b8e5129b79058.RXuUxUUjKdcxbF4L
|
||||
|
||||
# 边缘 Worker 接口安全(仅允许 100.64.0.0/24 网段访问)
|
||||
puzzle:
|
||||
edge:
|
||||
worker:
|
||||
security:
|
||||
enabled: true
|
||||
allowed-ip-cidr: 100.64.0.0/24
|
||||
|
||||
108
src/main/resources/mapper/PuzzleEdgeRenderTaskMapper.xml
Normal file
108
src/main/resources/mapper/PuzzleEdgeRenderTaskMapper.xml
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.puzzle.edge.mapper.PuzzleEdgeRenderTaskMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ycwl.basic.puzzle.edge.entity.PuzzleEdgeRenderTaskEntity">
|
||||
<id column="id" property="id"/>
|
||||
<result column="record_id" property="recordId"/>
|
||||
<result column="template_id" property="templateId"/>
|
||||
<result column="template_code" property="templateCode"/>
|
||||
<result column="scenic_id" property="scenicId"/>
|
||||
<result column="face_id" property="faceId"/>
|
||||
<result column="content_hash" property="contentHash"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="worker_id" property="workerId"/>
|
||||
<result column="lease_expire_time" property="leaseExpireTime"/>
|
||||
<result column="attempt_count" property="attemptCount"/>
|
||||
<result column="output_format" property="outputFormat"/>
|
||||
<result column="output_quality" property="outputQuality"/>
|
||||
<result column="original_object_key" property="originalObjectKey"/>
|
||||
<result column="cropped_object_key" property="croppedObjectKey"/>
|
||||
<result column="payload_json" property="payloadJson"/>
|
||||
<result column="error_message" property="errorMessage"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="getById" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM puzzle_edge_render_task
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.ycwl.basic.puzzle.edge.entity.PuzzleEdgeRenderTaskEntity"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
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()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="findNextClaimableTaskId" resultType="java.lang.Long">
|
||||
SELECT id
|
||||
FROM puzzle_edge_render_task
|
||||
WHERE status = 0
|
||||
OR (status = 1 AND lease_expire_time IS NOT NULL AND lease_expire_time < NOW())
|
||||
ORDER BY id ASC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="claimTask">
|
||||
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>
|
||||
|
||||
<update id="markSuccess">
|
||||
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>
|
||||
|
||||
<update id="markFail">
|
||||
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
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user