parent
e8937bfd44
commit
bf512cab01
|
@ -136,6 +136,15 @@ public interface DeviceTaskManager {
|
|||
*/
|
||||
DeviceTask getTaskById(Long id);
|
||||
|
||||
/**
|
||||
* Device task created boolean.
|
||||
*
|
||||
* @param taskId the task id
|
||||
* @param devId the dev id
|
||||
* @return the boolean
|
||||
*/
|
||||
boolean deviceTaskCreated(Long taskId, Long devId);
|
||||
|
||||
/**
|
||||
* Gets peng xin task.
|
||||
*
|
||||
|
|
|
@ -25,6 +25,18 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
@Resource
|
||||
private DeviceTaskMapper deviceTaskMapper;
|
||||
|
||||
/**
|
||||
* Device task created boolean.
|
||||
*
|
||||
* @param taskId the task id
|
||||
* @param devId the dev id
|
||||
* @return the boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean deviceTaskCreated(Long taskId, Long devId) {
|
||||
return deviceTaskMapper.getTaskByDetails(taskId, devId).size() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add dispose device task info boolean.
|
||||
*
|
||||
|
@ -80,11 +92,11 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Change dispose device task info dev status long.
|
||||
* Change dispose device task info dev status int.
|
||||
*
|
||||
* @param id the id
|
||||
* @param devStatus the dev status
|
||||
* @return the long
|
||||
* @return the int
|
||||
*/
|
||||
@Override
|
||||
public int changeDisposeDeviceTaskInfoDevStatus(Long id, Long devStatus) {
|
||||
|
@ -297,9 +309,9 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets PengXin device task info.
|
||||
* Get peng xin task list.
|
||||
*
|
||||
* @return the minId task info.
|
||||
* @return the list
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceTask> getPengXinTask(){
|
||||
|
|
|
@ -462,7 +462,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
}
|
||||
|
||||
// 对新建的任务,创建对应处置设备任务信息
|
||||
for (DisposeTask v : disposeTaskManager.getNewDisposeTasks()) {
|
||||
for (DisposeTask v : disposeTaskManager.getExpiredTasks()) {
|
||||
// 设置任务状态, 开始创建任务
|
||||
disposeTaskManager.changeDisposeTaskStatus(v.getId(), DisposeTaskStatus.TASK_STARTING);
|
||||
|
||||
|
@ -482,8 +482,13 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
// 判断设备是否就绪
|
||||
.filter(c -> c.getDb().deviceReady())
|
||||
.forEach(d -> {
|
||||
log.info("Add dispose task for device: {}", d.getDev());
|
||||
// 检查当前设备是否已经创建了该任务
|
||||
if (deviceTaskManager.deviceTaskCreated(v.getId(),
|
||||
d.getDev().getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("Add dispose task for device: {}", d.getDev());
|
||||
if (!deviceTaskManager
|
||||
.addDisposeDeviceTaskInfo(v.getId(),
|
||||
d.getDev().getId(),
|
||||
|
|
Loading…
Reference in New Issue