渲染机支持仅渲染几个景区的工作

This commit is contained in:
Jerry Yan 2025-04-12 14:35:26 +08:00
parent b5b9064f30
commit 45409ba1ab
4 changed files with 15 additions and 6 deletions

View File

@ -54,5 +54,5 @@ public interface TaskMapper {
List<TaskEntity> listEntity(TaskReqQuery taskReqQuery);
List<TaskRespVO> selectNotRunningByScenicId(Long scenicOnly);
List<TaskRespVO> selectNotRunningByScenicList(String scenicOnly);
}

View File

@ -60,7 +60,7 @@ public class RenderWorkerEntity {
/**
* 是否仅用于指定景区空或0不适用否则为景区ID
*/
private Long scenicOnly;
private String scenicOnly;
/**
* 是否仅用于测试0不是1是
*/

View File

@ -191,7 +191,7 @@ public class TaskTaskServiceImpl implements TaskService {
try {
List<TaskRespVO> taskList;
if (worker.getScenicOnly() != null) {
taskList = taskMapper.selectNotRunningByScenicId(worker.getScenicOnly());
taskList = taskMapper.selectNotRunningByScenicList(worker.getScenicOnly());
} else {
taskList = taskMapper.selectNotRunning();
}

View File

@ -82,7 +82,15 @@
<select id="selectNotRunning" resultType="com.ycwl.basic.model.pc.task.resp.TaskRespVO">
select id, worker_id, member_id, template_id, scenic_id, task_params, video_url, `status`, result, create_time, update_time
from task
where status = 0 and worker_id is null and scenic_id not in (select scenic_only from render_worker where scenic_only is not null and status = 1)
where status = 0
and worker_id is null
and NOT EXISTS (
SELECT 1
FROM render_worker rw
WHERE
rw.status = 1
AND FIND_IN_SET(task.scenic_id, rw.scenic_only) > 0 -- 检查scenic_id是否在逗号分隔的字符串中
)
limit 1
</select>
<select id="selectAllNotRunning" resultType="com.ycwl.basic.model.pc.task.entity.TaskEntity">
@ -133,9 +141,10 @@
from task
where status = 2
</select>
<select id="selectNotRunningByScenicId" resultType="com.ycwl.basic.model.pc.task.resp.TaskRespVO">
<select id="selectNotRunningByScenicList" resultType="com.ycwl.basic.model.pc.task.resp.TaskRespVO">
select id, worker_id, member_id, template_id, scenic_id, task_params, video_url, `status`, result, create_time, update_time
from task
where status = 0 and worker_id is null and scenic_id = #{scenicId}
where status = 0 and worker_id is null and FIND_IN_SET(scenic_id, #{scenicId})
limit 1
</select>
</mapper>