parent
5b7f390e73
commit
cd865e79e2
|
@ -11,6 +11,7 @@ import com.dispose.mapper.DisposeTaskMapper;
|
||||||
import com.dispose.mapper.TaskInfoMapper;
|
import com.dispose.mapper.TaskInfoMapper;
|
||||||
import com.dispose.pojo.entity.DisposeDevice;
|
import com.dispose.pojo.entity.DisposeDevice;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
|
import com.dispose.pojo.vo.common.TaskInfo;
|
||||||
import com.dispose.pojo.vo.common.TaskInfoDetail;
|
import com.dispose.pojo.vo.common.TaskInfoDetail;
|
||||||
import com.dispose.service.DisposeNodeManager;
|
import com.dispose.service.DisposeNodeManager;
|
||||||
import com.dispose.service.TaskService;
|
import com.dispose.service.TaskService;
|
||||||
|
@ -224,7 +225,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
log.error("Start task: taskId:{}, disposeIp:{}, error:{}",
|
log.error("Start task: taskId:{}, disposeIp:{}, error:{}",
|
||||||
taskId, task.getDisposeIp(), v.getFirstParam().getMsg());
|
taskId, task.getDisposeIp(), v.getFirstParam().getMsg());
|
||||||
} else {
|
} else {
|
||||||
// 执行任务失败恢复缓存中的任务状态
|
// 执行任务成功
|
||||||
taskInfoMapper.addNewTaskInfo(taskId, k.getId(), v.getSecondParam(), (long) v.getFirstParam().getCode());
|
taskInfoMapper.addNewTaskInfo(taskId, k.getId(), v.getSecondParam(), (long) v.getFirstParam().getCode());
|
||||||
log.info("Start task finished: taskId:{}, disposeId:{}, type:{}",
|
log.info("Start task finished: taskId:{}, disposeId:{}, type:{}",
|
||||||
taskId, task.getDisposeIp(), task.getType());
|
taskId, task.getDisposeIp(), task.getType());
|
||||||
|
@ -269,8 +270,15 @@ public class TaskServiceImpl implements TaskService {
|
||||||
dev.forEach(k -> {
|
dev.forEach(k -> {
|
||||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(k.getType(), k.getIpAddr());
|
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(k.getType(), k.getIpAddr());
|
||||||
|
|
||||||
|
List<TaskInfo> TaskInfoList = taskInfoMapper.getTaskInfo(taskId, k.getId());
|
||||||
|
|
||||||
|
TaskInfoList.forEach(t -> {
|
||||||
|
if (t.getExternId() == null) {
|
||||||
|
t.setExternId(-1L);
|
||||||
|
}
|
||||||
|
|
||||||
// 异步启动处置任务
|
// 异步启动处置任务
|
||||||
CompletableFuture.supplyAsync(() -> dp.stopDispose(task.getDisposeIp(), DeviceCapacity.values()[task.getType()], -1L))
|
CompletableFuture.supplyAsync(() -> dp.stopDispose(task.getDisposeIp(), DeviceCapacity.values()[task.getType()], t.getExternId()))
|
||||||
.whenComplete((v, ex) -> {
|
.whenComplete((v, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
// 恢复缓存中任务状态到先前状态
|
// 恢复缓存中任务状态到先前状态
|
||||||
|
@ -290,6 +298,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
log.error("No such task: taskId:{}", taskId);
|
log.error("No such task: taskId:{}", taskId);
|
||||||
return ErrorCode.ERR_NOSUCHTASK;
|
return ErrorCode.ERR_NOSUCHTASK;
|
||||||
|
|
Loading…
Reference in New Issue