From a06e3480882030775d598045eb21c995542ba5dd Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 8 Jul 2020 17:44:21 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=94=B9=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE=E5=BA=93=E6=AD=A3=E5=9C=A8=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=E6=B8=85=E6=B4=97=E4=BB=BB=E5=8A=A1=E5=92=8C?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E5=BA=93=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=B8=85=E6=B4=97=E4=BB=BB=E5=8A=A1=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dispose/service/impl/TaskServiceImpl.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/dispose/service/impl/TaskServiceImpl.java b/src/main/java/com/dispose/service/impl/TaskServiceImpl.java index a95b501a..cf97cbb6 100644 --- a/src/main/java/com/dispose/service/impl/TaskServiceImpl.java +++ b/src/main/java/com/dispose/service/impl/TaskServiceImpl.java @@ -127,7 +127,7 @@ public class TaskServiceImpl implements TaskService { // 查询当前是否有相同能力节点,相同用户,相同处置IP的且正在执行的处置任务,如果存在则忽略该次任务(依照产品需求) List taskList = taskCacheManager.getAllRunningTask() .stream() - .filter(v -> ((taskId == null || taskId == -1L) || Objects.equals(v.getDeviceId(), task.getDeviceId()) || (v.getDeviceId() == -1L)) + .filter(v -> ((taskId == null || taskId == -1L) || Objects.equals(v.getDeviceId(), task.getDeviceId())) && Objects.equals(v.getAccountId(), task.getAccountId()) && taskIsRunning(v) && Objects.equals(v.getType(), task.getType()) @@ -346,7 +346,7 @@ public class TaskServiceImpl implements TaskService { .getAllRunningTask() .stream() .filter(v -> v.getCurrentStatus() == DisposeTaskStatus.TASK_RUNNING.getCode() - && v.getDeviceId().equals(devId)) + && (v.getDeviceId().equals(devId)) || v.getDeviceId() == -1L) .collect(Collectors.toList()); if (taskList.size() > 0) { @@ -365,15 +365,27 @@ public class TaskServiceImpl implements TaskService { */ @Override public List getNodeAllTask(Long devId) { - List taskList = disposeTaskMapper.getAllTaskByNodeDevId(devId); + List taskList = new ArrayList<>(); + + //-1广播,所有设备都下发清洗任务 + List curId = disposeTaskMapper.getAllTaskByNodeDevId(devId); + List allId = disposeTaskMapper.getAllTaskByNodeDevId(-1L); + + if(allId != null && allId.size() > 0) { + taskList.addAll(allId); + } + + if(curId != null && curId.size() > 0) { + taskList.addAll(curId); + } if (taskList.size() > 0) { log.info("The device has tasks: devId:{}, tasksNumber:{}", devId, taskList.size()); - return taskList; + } else { + log.info("The device has nothing tasks: devId:{}", devId); } - log.info("The device has nothing tasks: devId:{}", devId); - return new ArrayList<>(); + return taskList; } /**