1. 审核状态添加“草稿”

2. 添加指令中“任务名称,事件类型,局点,部门四个字段
This commit is contained in:
EnderByEndera
2024-04-15 11:25:54 +08:00
parent 9ceb2e583e
commit de6437b8b0
5 changed files with 22 additions and 19 deletions

View File

@@ -25,7 +25,7 @@ public class TaskCommandInfo {
@JsonProperty("task_create_username")
private String taskCreateUsername;
@Schema(description = "任务创建人处室", accessMode = Schema.AccessMode.READ_ONLY)
@Schema(description = "任务创建人处室", example = "XXX")
@JsonProperty("task_create_depart")
private String taskCreateDepart;
@@ -48,13 +48,13 @@ public class TaskCommandInfo {
@JsonProperty("task_act")
private String taskAct;
@Schema(description = "部门", example = "XXX")
@JsonProperty("department")
private String department;
@Schema(description = "局点", example = "北京")
@Schema(description = "局点", example = "123456")
@JsonProperty("distribute_point")
private String distributePoint;
private Integer distributePoint;
@Schema(description = "事件类型(策略模板名称)", example = "DDOS")
@JsonProperty("event_type")
private String eventType;
@Schema(description = "指令下发频率", example = "30")
@NotNull(message = "指令下发频率不能为空。")
@@ -122,7 +122,6 @@ public class TaskCommandInfo {
this.taskName = original.taskName;
this.taskType = original.taskType;
this.taskAct = original.taskAct;
this.department = original.department;
this.distributePoint = original.distributePoint;
this.frequency = original.frequency;
this.startTime = original.startTime;

View File

@@ -4,9 +4,10 @@ import lombok.Getter;
@Getter
public enum AuditStatus {
PENDING(0),
UNAUDITED(1),
AUDITED(2);
PENDING(0), // 未审核状态
RETURNED(1), // 退回状态
AUDITED(2), // 已审核状态
DRAFT(3); // 草稿
private final int auditStatus;

View File

@@ -24,7 +24,7 @@ public class AuditStatusValidator {
return auditStatusOriginal != 1;
}
default -> {
log.debug("欲修改的审核状态不正确,需要使用正确的审核状态,当前的审核状态:" + auditStatusOriginal);
log.debug("欲修改的审核状态不正确,需要使用正确的审核状态,当前的审核状态:{}", auditStatusOriginal);
return false;
}
}

View File

@@ -103,7 +103,7 @@ public class StateHandler {
AtomicReference<Boolean> success = new AtomicReference<>(false);
Mono<SimpleResponse> mono = client.post()
.uri("192.168.107.89:65432") // todo: unfinished
.uri("http://192.168.107.89:9081/api/v1/kafkasend") // todo: untested
.bodyValue(dynamicTaskInfos)
.exchangeToMono(res -> {
if (res.statusCode().equals(HttpStatus.OK)) {

View File

@@ -4,12 +4,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.realtime.protection.server.command.CommandMapper">
<insert id="createCommand" parameterType="com.realtime.protection.configuration.entity.task.TaskCommandInfo">
insert into t_command(COMMAND_ID, TASK_ID, TASK_ACT, DEPARTMENT, DISTRIBUTEPOINT, FREQUENCY, ADDR_TYPE, SRC_IP, SRC_PORT, DST_IP, DST_PORT,
PROTOCOL,
insert into t_command(COMMAND_ID, TASK_ID, TASK_ACT, TASKNAME, EVENTTYPE, DEPARTMENT, DISTRIBUTEPOINT, FREQUENCY,
ADDR_TYPE, SRC_IP, SRC_PORT, DST_IP, DST_PORT, PROTOCOL,
MASK_SRC_IP, MASK_SRC_PORT, MASK_DST_IP, MASK_DST_PORT, MASK_PROTOCOL, VALID_TIME,
INVALID_TIME, IS_VALID, IS_JUDGED,
SEND_TIMES, SUCCESS_TIMES, CREATE_TIME, LAST_UPDATE, IS_DELETED)
values (#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.department}, #{info.distributePoint}, #{info.frequency},
values (#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.taskName}, #{info.eventType}, #{info.department}, #{info.distributePoint},
#{info.frequency},
DEFAULT,
#{info.fiveTupleWithMask.sourceIP}, #{info.fiveTupleWithMask.sourcePort},
#{info.fiveTupleWithMask.destinationIP}, #{info.fiveTupleWithMask.destinationPort},
@@ -24,14 +25,16 @@
</insert>
<insert id="createCommands" parameterType="com.realtime.protection.configuration.entity.task.TaskCommandInfo">
insert into t_command(COMMAND_ID, TASK_ID, TASK_ACT, DEPARTMENT, DISTRIBUTEPOINT, FREQUENCY, ADDR_TYPE, SRC_IP, SRC_PORT, DST_IP, DST_PORT,
PROTOCOL,
insert into t_command(
COMMAND_ID, TASK_ID, TASK_ACT, TASK_NAME, EVENT_TYPE, DEPARTMENT, DISTRIBUTEPOINT, FREQUENCY,
ADDR_TYPE, SRC_IP, SRC_PORT, DST_IP, DST_PORT, PROTOCOL,
MASK_SRC_IP, MASK_SRC_PORT, MASK_DST_IP, MASK_DST_PORT, MASK_PROTOCOL, VALID_TIME, INVALID_TIME, IS_VALID,
IS_JUDGED,
SEND_TIMES, SUCCESS_TIMES, CREATE_TIME, LAST_UPDATE, IS_DELETED)
values
<foreach collection="command_infos" item="info" separator=",">
(#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.department}, #{info.distributePoint}, #{info.frequency},
(#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.taskName}, #{info.eventType}, #{info.taskCreateDepart}, #{info.distributePoint},
#{info.frequency},
DEFAULT,
#{info.fiveTupleWithMask.sourceIP}, #{info.fiveTupleWithMask.sourcePort},
#{info.fiveTupleWithMask.destinationIP}, #{info.fiveTupleWithMask.destinationPort},