parent
119008860f
commit
d42467968a
|
@ -14,6 +14,7 @@ import com.dispose.pojo.po.AbilityInfo;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
import com.dispose.service.DeviceTaskManagerService;
|
import com.dispose.service.DeviceTaskManagerService;
|
||||||
import com.dispose.service.DisposeAbilityRouterService;
|
import com.dispose.service.DisposeAbilityRouterService;
|
||||||
|
import com.pengxin.dispose.common.PengXinTaskStatus;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
@ -442,6 +443,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
|
|
||||||
// 设置任务状态为启动中
|
// 设置任务状态为启动中
|
||||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTING);
|
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTING);
|
||||||
|
// 设置设备任务状态为启动中
|
||||||
|
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(), (long) PengXinTaskStatus.TASK_STARTING.getValue());
|
||||||
// 设置启动任务攻击类型状态
|
// 设置启动任务攻击类型状态
|
||||||
deviceTaskManager.setExecAttackType(deviceTask.getId(), NetflowDirection.DIRECTION_BI,
|
deviceTaskManager.setExecAttackType(deviceTask.getId(), NetflowDirection.DIRECTION_BI,
|
||||||
deviceTask.getTaskAttackType());
|
deviceTask.getTaskAttackType());
|
||||||
|
@ -468,6 +471,9 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
|
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
|
||||||
// 设置该任务为新任务,待下次重试启动
|
// 设置该任务为新任务,待下次重试启动
|
||||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_NEW);
|
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_NEW);
|
||||||
|
// 设置设备任务状态为启动处置任务失败
|
||||||
|
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
|
||||||
|
(long) PengXinTaskStatus.TASK_STARTED_FAILED.getValue());
|
||||||
// 记录任务出错重试次数
|
// 记录任务出错重试次数
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
|
||||||
log.error("PENGXIN_PLATFORM setup task times {} error {}: {}", deviceTask.getErrRetry(),
|
log.error("PENGXIN_PLATFORM setup task times {} error {}: {}", deviceTask.getErrRetry(),
|
||||||
|
@ -476,6 +482,9 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
// 任务出错,不在重试,当做失败任务处理
|
// 任务出错,不在重试,当做失败任务处理
|
||||||
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),
|
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),
|
||||||
disposeTask.getFlowDirection(), 0L);
|
disposeTask.getFlowDirection(), 0L);
|
||||||
|
// 设置设备任务状态为启动处置任务失败
|
||||||
|
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
|
||||||
|
(long) PengXinTaskStatus.TASK_STARTED_FAILED.getValue());
|
||||||
log.error("PENGXIN_PLATFORM setup task error {}: {}", ret.getFirstParam(), deviceTask);
|
log.error("PENGXIN_PLATFORM setup task error {}: {}", ret.getFirstParam(), deviceTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,6 +499,10 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
private void pengXinDeviceTaskStop(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
|
private void pengXinDeviceTaskStop(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
|
||||||
MulReturnType<ErrorCode, Long> ret;
|
MulReturnType<ErrorCode, Long> ret;
|
||||||
|
|
||||||
|
// 设置设备任务状态为解封中
|
||||||
|
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
|
||||||
|
(long) PengXinTaskStatus.TASK_UNBLOCKING.getValue());
|
||||||
|
|
||||||
// 停止处置任务
|
// 停止处置任务
|
||||||
ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null,
|
ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null,
|
||||||
deviceTask.getExternId());
|
deviceTask.getExternId());
|
||||||
|
@ -501,11 +514,17 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
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.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
|
||||||
|
(long) PengXinTaskStatus.TASK_UNBLOCKED_FAILED.getValue());
|
||||||
// 记录任务出错重试次数
|
// 记录任务出错重试次数
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
|
||||||
log.error("PENGXIN_PLATFORM stop task times {} error {}: {}", deviceTask.getErrRetry(),
|
log.error("PENGXIN_PLATFORM stop task times {} error {}: {}", deviceTask.getErrRetry(),
|
||||||
ret.getSecondParam(), deviceTask);
|
ret.getSecondParam(), deviceTask);
|
||||||
} else {
|
} else {
|
||||||
|
// 设置设备任务状态为解封失败
|
||||||
|
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
|
||||||
|
(long) PengXinTaskStatus.TASK_UNBLOCKED_FAILED.getValue());
|
||||||
log.error("PENGXIN_PLATFORM stop task error {}: {}", ret.getFirstParam(), deviceTask);
|
log.error("PENGXIN_PLATFORM stop task error {}: {}", ret.getFirstParam(), deviceTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -808,7 +827,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
MulReturnType<ErrorCode, Long> ret = ai.getDb().taskStatus(v.getExternId());
|
MulReturnType<ErrorCode, Long> ret = ai.getDb().taskStatus(v.getExternId());
|
||||||
|
|
||||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||||
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(v.getExternId(),
|
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(v.getId(),
|
||||||
ret.getSecondParam());
|
ret.getSecondParam());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.pengxin.dispose.common;
|
||||||
|
|
||||||
|
import com.dispose.common.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The enum Dispose task status.
|
||||||
|
*
|
||||||
|
* @author <huangxin@cmhi.chinamoblie.com>
|
||||||
|
*/
|
||||||
|
public enum PengXinTaskStatus implements BaseEnum {
|
||||||
|
/**
|
||||||
|
* The Task starting.
|
||||||
|
*/
|
||||||
|
TASK_STARTING(0, "启动中"),
|
||||||
|
/**
|
||||||
|
* The Task started.
|
||||||
|
*/
|
||||||
|
TASK_STARTED(1, "封堵中"),
|
||||||
|
/**
|
||||||
|
* The user aborted Task finished .
|
||||||
|
*/
|
||||||
|
TASK_FINISHED_USER(2, "用户中止"),
|
||||||
|
/**
|
||||||
|
* The Task finished automatically when the scheduled time is reached.
|
||||||
|
*/
|
||||||
|
TASK_FINISHED_TIME(3, "已结束"),
|
||||||
|
/**
|
||||||
|
* The Task started failed.
|
||||||
|
*/
|
||||||
|
TASK_STARTED_FAILED(4, "设备启动处置任务失败"),
|
||||||
|
/**
|
||||||
|
* The Task reviewing.
|
||||||
|
*/
|
||||||
|
TASK_REVIEWING(5, "待审核"),
|
||||||
|
/**
|
||||||
|
* The Task reviewed failed.
|
||||||
|
*/
|
||||||
|
TASK_REVIEWED_FAILED(6, "审核失败"),
|
||||||
|
/**
|
||||||
|
* The Task unblocked failed.
|
||||||
|
*/
|
||||||
|
TASK_UNBLOCKED_FAILED(7, "解封失败"),
|
||||||
|
/**
|
||||||
|
* The Task unblocked.
|
||||||
|
*/
|
||||||
|
TASK_UNBLOCKED(8, "解封成功"),
|
||||||
|
/**
|
||||||
|
* The Task unblocking.
|
||||||
|
*/
|
||||||
|
TASK_UNBLOCKING(9, "解封中"),
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Code.
|
||||||
|
*/
|
||||||
|
private final Integer code;
|
||||||
|
/**
|
||||||
|
* The Readme.
|
||||||
|
*/
|
||||||
|
private final String readme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Dispose task status.
|
||||||
|
*
|
||||||
|
* @param code the code
|
||||||
|
* @param readme the readme
|
||||||
|
*/
|
||||||
|
PengXinTaskStatus(int code, String readme) {
|
||||||
|
this.code = code;
|
||||||
|
this.readme = readme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets value.
|
||||||
|
*
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer getValue() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets description.
|
||||||
|
*
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return this.readme;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue