任务调度修改
This commit is contained in:
parent
a8601548c6
commit
a5f67b1eac
src/main
java/com/ycwl/basic
resources/mapper
@ -53,4 +53,6 @@ public interface TaskMapper {
|
|||||||
TaskEntity get(Long taskId);
|
TaskEntity get(Long taskId);
|
||||||
|
|
||||||
List<TaskEntity> listEntity(TaskReqQuery taskReqQuery);
|
List<TaskEntity> listEntity(TaskReqQuery taskReqQuery);
|
||||||
|
|
||||||
|
List<TaskRespVO> selectNotRunningByScenicId(Long scenicOnly);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,12 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
try {
|
try {
|
||||||
if (lock.tryLock(2, TimeUnit.SECONDS)) {
|
if (lock.tryLock(2, TimeUnit.SECONDS)) {
|
||||||
try {
|
try {
|
||||||
List<TaskRespVO> taskList = taskMapper.selectNotRunning();
|
List<TaskRespVO> taskList;
|
||||||
|
if (worker.getScenicOnly() != null) {
|
||||||
|
taskList = taskMapper.selectNotRunningByScenicId(worker.getScenicOnly());
|
||||||
|
} else {
|
||||||
|
taskList = taskMapper.selectNotRunning();
|
||||||
|
}
|
||||||
resp.setTasks(taskList);
|
resp.setTasks(taskList);
|
||||||
resp.setTemplates(updTemplateList);
|
resp.setTemplates(updTemplateList);
|
||||||
taskList.forEach(task -> {
|
taskList.forEach(task -> {
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
<select id="selectNotRunning" resultType="com.ycwl.basic.model.pc.task.resp.TaskRespVO">
|
<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
|
select id, worker_id, member_id, template_id, scenic_id, task_params, video_url, `status`, result, create_time, update_time
|
||||||
from task
|
from task
|
||||||
where status = 0 and worker_id is null
|
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)
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAllNotRunning" resultType="com.ycwl.basic.model.pc.task.entity.TaskEntity">
|
<select id="selectAllNotRunning" resultType="com.ycwl.basic.model.pc.task.entity.TaskEntity">
|
||||||
@ -133,4 +133,9 @@
|
|||||||
from task
|
from task
|
||||||
where status = 2
|
where status = 2
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectNotRunningByScenicId" 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}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user