diff --git a/src/main/java/com/realtime/protection/configuration/entity/rule/staticrule/StaticRuleObject.java b/src/main/java/com/realtime/protection/configuration/entity/rule/staticrule/StaticRuleObject.java index d3a1e14..043f8af 100644 --- a/src/main/java/com/realtime/protection/configuration/entity/rule/staticrule/StaticRuleObject.java +++ b/src/main/java/com/realtime/protection/configuration/entity/rule/staticrule/StaticRuleObject.java @@ -75,46 +75,46 @@ public class StaticRuleObject { @JsonProperty("static_rule_sip") @ExcelProperty("源IP地址") - @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address") + @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "错误 IPv4 地址") @Schema(description = "源IP地址", example = "1.1.1.1") private String staticRuleSip; @JsonProperty("static_rule_msip") - @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address") + @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "I错误 IPv4 地址") @ExcelProperty("源IP地址掩码") @Schema(description = "源IP地址掩码", example = "255.255.255.0") private String staticRuleMsip; @JsonProperty("static_rule_sport") @ExcelProperty("源端口") - @Max(value = 65535, message = "port should not be more than 65535") - @Min(value = 1, message = "port should not be less than 1") + @Max(value = 65535, message = "端口号不能大于65535") + @Min(value = 1, message = "端口号不能小于1") @Schema(description = "源端口", example = "8080") private Integer staticRuleSport; @JsonProperty("static_rule_msport") @ExcelProperty("源端口掩码") - @Max(value = 65535, message = "port should not be more than 65535") - @Min(value = 1, message = "port should not be less than 1") + @Max(value = 65535, message = "端口号不能大于65535") + @Min(value = 1, message = "端口号不能小于1") @Schema(description = "源端口掩码", example = "65535") private Integer staticRuleMsport; @JsonProperty("static_rule_dip") - @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address") + @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "错误 IPv4 地址") @ExcelProperty("目的IP地址") @Schema(description = "目的IP地址", example = "2.2.2.2") private String staticRuleDip; @JsonProperty("static_rule_mdip") @ExcelProperty("目的IP地址掩码") - @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address") + @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "错误 IPv4 地址") @Schema(description = "目的IP地址掩码", example = "255.255.255.0") private String staticRuleMdip; @JsonProperty("static_rule_dport") @ExcelProperty("目的端口") - @Max(value = 65535, message = "port should not be more than 65535") - @Min(value = 1, message = "port should not be less than 1") + @Max(value = 65535, message = "端口号不能大于65535") + @Min(value = 1, message = "端口号不能小于1") @Schema(description = "目的端口", example = "8080") private Integer staticRuleDport; @JsonProperty("static_rule_mdport") @ExcelProperty("目的端口掩码") - @Max(value = 65535, message = "port should not be more than 65535") - @Min(value = 1, message = "port should not be less than 1") + @Max(value = 65535, message = "端口号不能大于65535") + @Min(value = 1, message = "端口号不能小于1") @Schema(description = "目的端口掩码", example = "65535") private Integer staticRuleMdport; @JsonProperty("static_rule_protocol") diff --git a/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java b/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java index 0c4b275..0ae5ce7 100644 --- a/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java +++ b/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java @@ -33,15 +33,15 @@ public class WhiteListObject { @NotNull @JsonProperty("whiteobj_ip_address") - @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address") + @Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "错误 IPv4 地址") @ExcelProperty("IP地址") @Schema(description = "白名单对象IPv4地址", example = "1.1.1.1", requiredMode = Schema.RequiredMode.REQUIRED) private String whiteListIP; @NotNull @JsonProperty("whiteobj_port") - @Max(value = 65535, message = "port should not be more than 65535") - @Min(value = 1, message = "port should not be less than 1") + @Max(value = 65535, message = "端口不应大于 65535") + @Min(value = 1, message = "端口不应小于 1") @ExcelProperty("端口") @Schema(description = "白名单对象端口", maximum = "65535", minimum = "1", example = "8080", requiredMode = Schema.RequiredMode.REQUIRED) private int whiteListPort; diff --git a/src/main/java/com/realtime/protection/server/task/TaskService.java b/src/main/java/com/realtime/protection/server/task/TaskService.java index 78c176a..012c689 100644 --- a/src/main/java/com/realtime/protection/server/task/TaskService.java +++ b/src/main/java/com/realtime/protection/server/task/TaskService.java @@ -14,6 +14,7 @@ import com.realtime.protection.configuration.utils.enums.StateEnum; import com.realtime.protection.configuration.utils.enums.TaskTypeEnum; import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum; import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator; +import com.realtime.protection.server.command.CommandMapper; import com.realtime.protection.server.rule.dynamicrule.DynamicRuleMapper; import com.realtime.protection.server.rule.staticrule.StaticRuleMapper; import lombok.extern.slf4j.Slf4j; @@ -40,13 +41,15 @@ public class TaskService { private static final int BATCH_SIZE = 100; private final DynamicRuleMapper dynamicRuleMapper; private final Counter counter; + private final CommandMapper commandMapper; - public TaskService(TaskMapper taskMapper, StaticRuleMapper staticRuleMapper, SqlSessionWrapper sqlSessionWrapper, DynamicRuleMapper dynamicRuleMapper, Counter counter) { + public TaskService(TaskMapper taskMapper, StaticRuleMapper staticRuleMapper, SqlSessionWrapper sqlSessionWrapper, DynamicRuleMapper dynamicRuleMapper, Counter counter, CommandMapper commandMapper) { this.taskMapper = taskMapper; this.staticRuleMapper = staticRuleMapper; this.sqlSessionWrapper = sqlSessionWrapper; this.dynamicRuleMapper = dynamicRuleMapper; this.counter = counter; + this.commandMapper = commandMapper; } @Transactional @@ -350,6 +353,9 @@ public class TaskService { updateDynamicRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED); taskMapper.clearTaskConnectedStaticRule(task.getTaskId()); taskMapper.clearTaskConnectedDynamicRule(task.getTaskId()); + + commandMapper.removeCommandsByTaskId(taskId); + return taskMapper.deleteTask(taskId); } diff --git a/src/main/resources/mappers/DynamicRuleMapper.xml b/src/main/resources/mappers/DynamicRuleMapper.xml index 3160e15..ee9272a 100644 --- a/src/main/resources/mappers/DynamicRuleMapper.xml +++ b/src/main/resources/mappers/DynamicRuleMapper.xml @@ -297,6 +297,8 @@ + + diff --git a/src/main/resources/mappers/WhiteListMapper.xml b/src/main/resources/mappers/WhiteListMapper.xml index 06b63a3..efa89a6 100644 --- a/src/main/resources/mappers/WhiteListMapper.xml +++ b/src/main/resources/mappers/WhiteListMapper.xml @@ -57,7 +57,7 @@ select white_list_id, white_list_name, - effective_time,expire_time, + NOW(),null, white_list_system_name, white_list_ip, white_list_url, @@ -81,7 +81,7 @@ insert into t_white_list_status_log( white_list_id, white_list_name, - effective_time,expire_time, + effective_time,expire_time, white_list_system_name, white_list_ip, white_list_url, @@ -102,7 +102,7 @@ select white_list_id, white_list_name, - effective_time,expire_time, + NOW(),null, white_list_system_name, white_list_ip, white_list_url, @@ -155,6 +155,8 @@ + +