REM:
1. 修改获取数据库正在运行的清洗任务和获取数据库所有清洗任务的方法
This commit is contained in:
chenlinghy 2020-07-08 17:44:21 +08:00
parent cd21a62a0b
commit a06e348088
1 changed files with 18 additions and 6 deletions

View File

@ -127,7 +127,7 @@ public class TaskServiceImpl implements TaskService {
// 查询当前是否有相同能力节点相同用户相同处置IP的且正在执行的处置任务如果存在则忽略该次任务依照产品需求
List<TaskInfoDetail> 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<TaskInfoDetail> getNodeAllTask(Long devId) {
List<TaskInfoDetail> taskList = disposeTaskMapper.getAllTaskByNodeDevId(devId);
List<TaskInfoDetail> taskList = new ArrayList<>();
//-1广播所有设备都下发清洗任务
List<TaskInfoDetail> curId = disposeTaskMapper.getAllTaskByNodeDevId(devId);
List<TaskInfoDetail> 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;
}
/**