parent
3acf82d3be
commit
9e912dcfc3
|
@ -97,10 +97,11 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
MulReturnType<ErrorCode, Long> ret;
|
MulReturnType<ErrorCode, Long> ret;
|
||||||
|
|
||||||
// 调用设备执行处置任务
|
// 调用设备执行处置任务
|
||||||
ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null, null);
|
ret = ai.getDb()
|
||||||
|
.stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null, null);
|
||||||
|
|
||||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||||
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),disposeTask.getFlowDirection(), 0L);
|
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(), disposeTask.getFlowDirection(), 0L);
|
||||||
log.info("VIRTUAL_DISPOSE stop task succeed: {}", deviceTask);
|
log.info("VIRTUAL_DISPOSE stop task succeed: {}", deviceTask);
|
||||||
} else {
|
} else {
|
||||||
log.error("VIRTUAL_DISPOSE stop task error {}: {}", ret.getFirstParam(), deviceTask);
|
log.error("VIRTUAL_DISPOSE stop task error {}: {}", ret.getFirstParam(), deviceTask);
|
||||||
|
@ -183,7 +184,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
// 设置任务状态为结束
|
// 设置任务状态为结束
|
||||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_FINISHED);
|
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_FINISHED);
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
||||||
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),disposeTask.getFlowDirection(), 0L);
|
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(), disposeTask.getFlowDirection(), 0L);
|
||||||
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
|
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
|
||||||
// 记录任务出错重试次数
|
// 记录任务出错重试次数
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
|
||||||
|
@ -431,19 +432,23 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
// 设置任务状态, 开始创建任务
|
// 设置任务状态, 开始创建任务
|
||||||
disposeTaskManager.changeDisposeTaskStatus(v.getId(), DisposeTaskStatus.TASK_STARTING);
|
disposeTaskManager.changeDisposeTaskStatus(v.getId(), DisposeTaskStatus.TASK_STARTING);
|
||||||
|
|
||||||
|
// 检查改任务是否能够被处置
|
||||||
|
ErrorCode ret = disposeAbilityRouterService.verifyDisposeCapacity(v.getDeviceId(),
|
||||||
|
v.getDisposeObject(),
|
||||||
|
v.getDisposeCapacity());
|
||||||
|
|
||||||
|
if (ret != ErrorCode.ERR_OK) {
|
||||||
|
log.warn("{}: Not found support dispose device for [{}]", ret, v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 为当前所有可用处置设备创建对应的处置任务
|
// 为当前所有可用处置设备创建对应的处置任务
|
||||||
disposeAbilityRouterService.getAllAbilityDevices().stream()
|
disposeAbilityRouterService.getAllAbilityDevices().forEach(d -> {
|
||||||
// 判断是否是当前设备的处置任务
|
|
||||||
.filter(f -> v.getDeviceId() == -1 || f.getDev().getId().equals(v.getDeviceId()))
|
|
||||||
// 当前设备是否支持该处置能力
|
|
||||||
.filter(c -> c.getDev().getDevCapacity().stream().anyMatch(m -> m.getCapacityType() == v
|
|
||||||
.getDisposeCapacity()))
|
|
||||||
.filter(c -> c.getDb().isCarryProtectIp(v.getDisposeObject()))
|
|
||||||
.forEach(d -> {
|
|
||||||
log.info("Add dispose task for device: {}", d.getDev());
|
log.info("Add dispose task for device: {}", d.getDev());
|
||||||
|
|
||||||
if (!deviceTaskManager.addDisposeDeviceTaskInfo(v.getId(), d.getDev().getId(),
|
if (!deviceTaskManager.addDisposeDeviceTaskInfo(v.getId(), d.getDev().getId(),
|
||||||
d.getDb().toDeviceAttackType(v.getAttackType()))) {
|
d.getDb()
|
||||||
|
.toDeviceAttackType(v.getAttackType()))) {
|
||||||
log.error("Add task {} to device {} error", v, d);
|
log.error("Add task {} to device {} error", v, d);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -467,7 +472,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId());
|
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId());
|
||||||
|
|
||||||
// 如果设备已经删除或者禁用,跳过处理
|
// 如果设备已经删除或者禁用,跳过处理
|
||||||
if(ai == null) {
|
if (ai == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue