1. 修改TaskController中的setCommandJudged方式,现在它将直接修改t_command中的IS_JUDGED字段
2. queryCommandInfos方法现在添加了筛选条件以及分页查询
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.realtime.protection.configuration.entity.task;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
@@ -9,51 +10,62 @@ import lombok.Data;
|
||||
@Data
|
||||
public class FiveTupleWithMask {
|
||||
@Schema(description = "地址类型(IPv4 or IPv6)", example = "4")
|
||||
@JsonProperty("addr_type")
|
||||
private Integer addrType;
|
||||
|
||||
@Schema(description = "源IP", example = "192.168.104.14")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "源IP:无效IPv4地址")
|
||||
@JsonProperty("src_ip")
|
||||
private String sourceIP;
|
||||
|
||||
@Schema(description = "源端口", example = "114")
|
||||
@Max(value = 65535, message = "源端口不可大于65535")
|
||||
@Min(value = 1, message = "源端口不可小于1")
|
||||
@JsonProperty("src_port")
|
||||
private String sourcePort;
|
||||
|
||||
@Schema(description = "目的IP", example = "102.165.11.39")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "目的IP:无效IPv4地址")
|
||||
@JsonProperty("dst_ip")
|
||||
private String destinationIP;
|
||||
|
||||
@Schema(description = "目的端口", example = "514")
|
||||
@Max(value = 65535, message = "目的端口不可大于65535")
|
||||
@Min(value = 1, message = "目的端口不可小于1")
|
||||
@JsonProperty("dst_port")
|
||||
private String destinationPort;
|
||||
|
||||
@Schema(description = "协议名称", example = "TCP", accessMode = Schema.AccessMode.WRITE_ONLY)
|
||||
private String protocol;
|
||||
|
||||
@Schema(description = "协议号", example = "6", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("protocol_num")
|
||||
private Integer protocolNum;
|
||||
|
||||
@Schema(description = "源IP掩码", example = "255.255.255.0")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "源IP掩码:无效IPv4地址")
|
||||
@JsonProperty("mask_src_ip")
|
||||
private String maskSourceIP;
|
||||
|
||||
@Schema(description = "源端口掩码", example = "0")
|
||||
@Max(value = 65535, message = "源端口掩码不可大于65535")
|
||||
@Min(value = 1, message = "源端口掩码不可小于1")
|
||||
@JsonProperty("mask_src_port")
|
||||
private String maskSourcePort;
|
||||
|
||||
@Schema(description = "目的IP掩码", example = "255.255.0.0")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "目的IP掩码:无效IPv4地址")
|
||||
@JsonProperty("mask_dst_ip")
|
||||
private String maskDestinationIP;
|
||||
|
||||
@Schema(description = "目的端口掩码", example = "0")
|
||||
@Max(value = 65535, message = "目的端口掩码不可大于65535")
|
||||
@Min(value = 1, message = "目的端口掩码不可小于1")
|
||||
@JsonProperty("mask_dst_port")
|
||||
private String maskDestinationPort;
|
||||
|
||||
@Schema(description = "协议掩码", example = "0")
|
||||
@JsonProperty("mask_protocol")
|
||||
private String maskProtocol;
|
||||
|
||||
// 复制构造函数
|
||||
@@ -70,6 +82,5 @@ public class FiveTupleWithMask {
|
||||
this.maskDestinationIP = original.maskDestinationIP;
|
||||
this.maskDestinationPort = original.maskDestinationPort;
|
||||
this.maskProtocol = original.maskProtocol;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.realtime.protection.configuration.entity.task;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -9,64 +10,82 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class TaskCommandInfo {
|
||||
@Schema(description = "指令UUID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("uuid")
|
||||
private String UUID;
|
||||
|
||||
@Schema(description = "任务ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("task_id")
|
||||
private Long taskId;
|
||||
|
||||
@Schema(description = "规则ID", hidden = true)
|
||||
@JsonProperty("rule_id")
|
||||
private Long ruleId;
|
||||
|
||||
@Schema(description = "任务创建人名称", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("task_create_username")
|
||||
private String taskCreateUsername;
|
||||
|
||||
@Schema(description = "任务创建人处室", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("task_create_depart")
|
||||
private String taskCreateDepart;
|
||||
|
||||
@Schema(description = "任务创建人ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("task_create_userid")
|
||||
private Integer taskCreateUserId;
|
||||
|
||||
@Schema(description = "任务名称", example = "API测试任务")
|
||||
@NotNull(message = "任务名称不能为空")
|
||||
@JsonProperty("task_name")
|
||||
private String taskName;
|
||||
|
||||
@Schema(description = "任务类型", example = "1")
|
||||
@NotNull(message = "任务类型不能为空")
|
||||
@JsonProperty("task_type")
|
||||
private Integer taskType;
|
||||
|
||||
@Schema(description = "任务操作", example = "阻断")
|
||||
@NotNull(message = "任务操作不能为空。")
|
||||
@JsonProperty("task_act")
|
||||
private String taskAct;
|
||||
|
||||
@Schema(description = "指令下发频率", example = "30")
|
||||
@NotNull(message = "指令下发频率不能为空。")
|
||||
@JsonProperty("frequency")
|
||||
private Integer frequency;
|
||||
|
||||
@Schema(description = "任务开始时间", example = "2025-10-14T10:23:33")
|
||||
@NotNull(message = "任务开始时间不能为空。")
|
||||
@JsonProperty("start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Schema(description = "任务结束时间", example = "2026-10-22T10:33:22")
|
||||
@NotNull(message = "指令结束时间不能为空。")
|
||||
@JsonProperty("end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Schema(description = "指令是否生效", example = "false")
|
||||
@JsonProperty("is_valid")
|
||||
private Boolean isValid = true;
|
||||
|
||||
@Schema(description = "五元组信息")
|
||||
@NotNull(message = "五元组信息不能为空。")
|
||||
@JsonProperty("five_tuple_with_mask")
|
||||
private FiveTupleWithMask fiveTupleWithMask;
|
||||
|
||||
@Schema(description = "指令下发次数", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("command_send_times")
|
||||
private Integer commandSentTimes;
|
||||
|
||||
@Schema(description = "指令成功次数", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("command_success_times")
|
||||
private Integer commandSuccessTimes;
|
||||
|
||||
@Schema(description = "首次下发时间", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("earliest_send_times")
|
||||
private LocalDateTime earliestSendTime;
|
||||
|
||||
@Schema(description = "最新下发时间", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("latest_send_times")
|
||||
private LocalDateTime latestSendTime;
|
||||
|
||||
/*
|
||||
@@ -74,8 +93,10 @@ public class TaskCommandInfo {
|
||||
*/
|
||||
@Schema(description = "防御策略模板ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer templateId;
|
||||
|
||||
@Schema(description = "防护等级", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer protectLevel;
|
||||
|
||||
@Schema(description = "指令所属任务的运行状态", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer taskStatus;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GlobalExceptionHandler {
|
||||
@Order(3)
|
||||
@ExceptionHandler(value = {Exception.class})
|
||||
public ResponseResult handleGlobalException(Exception e) {
|
||||
log.error("遭遇全局异常:" + e.getMessage());
|
||||
log.error("遭遇全局异常:" + e.getCause());
|
||||
return ResponseResult.error().setMessage(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user