From 8864c2be3e36a3ed2297689a0b0620cc939090e9 Mon Sep 17 00:00:00 2001 From: EnderByEndera <707475564@qq.com> Date: Thu, 1 Feb 2024 09:08:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=9B=B4=E6=96=B0=E9=98=B2=E6=8A=A4?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=92=8C=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=9B=B4=E5=A4=9A=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alertmessage/AlertMessageMapper.java | 2 +- .../alertmessage/AlertMessageService.java | 2 +- .../staticrule/StaticRuleControllerApi.java | 116 +++++++++--------- .../whitelist/WhiteListControllerApi.java | 20 +-- .../defense/assets/background.a568162c.svg | 2 +- .../defense/assets/company1.b48b661f.svg | 4 +- .../defense/assets/company2.33b66bf6.svg | 4 +- .../nginx/defense/assets/logo.b36f7a7f.svg | 2 +- .../server/alertmessage/AlertMessageTest.java | 8 +- .../defense/template/TemplateServiceTest.java | 6 +- .../server/task/TaskServiceTest.java | 4 +- 11 files changed, 89 insertions(+), 81 deletions(-) diff --git a/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageMapper.java b/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageMapper.java index 212d801..8cf153d 100644 --- a/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageMapper.java +++ b/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageMapper.java @@ -1,8 +1,8 @@ package com.realtime.protection.server.alertmessage; import com.baomidou.dynamic.datasource.annotation.DS; -import com.realtime.protection.configuration.entity.defense.template.ProtectLevel; import com.realtime.protection.configuration.entity.alert.AlertMessage; +import com.realtime.protection.configuration.entity.defense.template.ProtectLevel; import com.realtime.protection.configuration.entity.task.TaskCommandInfo; import org.apache.ibatis.annotations.Mapper; diff --git a/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageService.java b/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageService.java index b7f5c3b..ddf1a4e 100644 --- a/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageService.java +++ b/src/main/java/com/realtime/protection/server/alertmessage/AlertMessageService.java @@ -1,8 +1,8 @@ package com.realtime.protection.server.alertmessage; import com.baomidou.dynamic.datasource.annotation.DSTransactional; -import com.realtime.protection.configuration.entity.defense.template.ProtectLevel; import com.realtime.protection.configuration.entity.alert.AlertMessage; +import com.realtime.protection.configuration.entity.defense.template.ProtectLevel; import com.realtime.protection.configuration.entity.task.FiveTupleWithMask; import com.realtime.protection.configuration.entity.task.TaskCommandInfo; import com.realtime.protection.configuration.utils.enums.StateEnum; diff --git a/src/main/java/com/realtime/protection/server/rule/staticrule/StaticRuleControllerApi.java b/src/main/java/com/realtime/protection/server/rule/staticrule/StaticRuleControllerApi.java index 7155bee..590b9a1 100644 --- a/src/main/java/com/realtime/protection/server/rule/staticrule/StaticRuleControllerApi.java +++ b/src/main/java/com/realtime/protection/server/rule/staticrule/StaticRuleControllerApi.java @@ -11,7 +11,10 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @@ -32,24 +35,25 @@ public interface StaticRuleControllerApi { implementation = ResponseResult.class), examples = @ExampleObject( name = "新增静态规则", - value = "{\n" + - " \"code\": 200,\n" + - " \"message\": \"request succeed\",\n" + - " \"data\": {\n" + - " \"static_rule_id\": 1095,\n" + - " \"static_rule_name\": \"静态规则测试\"\n" + - " }\n" + - "}", - description = "static_rule_id:新增静态规则名称"+ + value = """ + { + "code": 200, + "message": "request succeed", + "data": { + "static_rule_id": 1095, + "static_rule_name": "静态规则测试" + } + }""", + description = "static_rule_id:新增静态规则名称" + "static_rule_name:新增静态规则id" ) - ) + ) ) }, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( description = "静态规则信息") ) - ResponseResult newStaticRuleObject(@RequestBody @Valid StaticRuleObject object) ; + ResponseResult newStaticRuleObject(@RequestBody @Valid StaticRuleObject object); @Operation( summary = "批量导入静态规则", @@ -66,7 +70,7 @@ public interface StaticRuleControllerApi { requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( description = "Excel文件") ) - ResponseResult uploadFile(@NotNull(message = "uploadFile字段不能为空")MultipartFile uploadFile) throws IOException; + ResponseResult uploadFile(@NotNull(message = "uploadFile字段不能为空") MultipartFile uploadFile) throws IOException; @Operation( summary = "下载静态规则模板", @@ -81,7 +85,7 @@ public interface StaticRuleControllerApi { ) } ) - void downloadTemplate(HttpServletResponse response) throws IOException ; + void downloadTemplate(HttpServletResponse response) throws IOException; @Operation( summary = "删除静态规则", @@ -94,17 +98,18 @@ public interface StaticRuleControllerApi { schema = @Schema(implementation = ResponseResult.class), examples = @ExampleObject( name = "删除多个静态规则", - value = "{\n" + - " \"code\": 200,\n" + - " \"message\": \"request succeed\",\n" + - " \"data\": {\n" + - " \"success\": true,\n" + - " \"static_rule_id\": [\n" + - " 11\n" + - " ]\n" + - " }\n" + - "}", - description = "static_rule_id:删除静态规则id列表"+ + value = """ + { + "code": 200, + "message": "request succeed", + "data": { + "success": true, + "static_rule_id": [ + 11 + ] + } + }""", + description = "static_rule_id:删除静态规则id列表" + "success:是否成功" ) @@ -115,7 +120,7 @@ public interface StaticRuleControllerApi { @Parameter(name = "ids", description = "静态规则id数组") } ) - ResponseResult delete(@PathVariable List ids) ; + ResponseResult delete(@PathVariable List ids); @Operation( summary = "修改静态规则", @@ -128,11 +133,12 @@ public interface StaticRuleControllerApi { schema = @Schema(implementation = ResponseResult.class), examples = @ExampleObject( name = "修改静态规则", - value = "{\n" + - " \"code\": 200,\n" + - " \"message\": \"request succeed\",\n" + - " \"data\": {\"success\": true,}\n" + - "}" + value = """ + { + "code": 200, + "message": "request succeed", + "data": {"success": true,} + }""" ) ) @@ -145,7 +151,7 @@ public interface StaticRuleControllerApi { description = "静态规则信息") ) ResponseResult updateStaticRule(@PathVariable Integer id, - @RequestBody @Valid StaticRuleObject object) ; + @RequestBody @Valid StaticRuleObject object); @Operation( summary = "查询单个静态规则", @@ -162,7 +168,7 @@ public interface StaticRuleControllerApi { }, parameters = {@Parameter(name = "id", description = "静态规则ID", example = "38")} ) - ResponseResult queryStaticRuleById(@PathVariable Integer id) ; + ResponseResult queryStaticRuleById(@PathVariable Integer id); @Operation( summary = "分页查询静态规则", @@ -177,17 +183,18 @@ public interface StaticRuleControllerApi { anyOf = {ResponseResult.class, StaticRuleObject.class}), examples = @ExampleObject( name = "分页查询静态规则", - value = "{\n" + - " \"code\": 200,\n" + - " \"message\": \"request succeed\",\n" + - " \"data\": {\n" + - " \"static_rule_list\": [\n" + - " ],\n" + - " \"static_rule_total_num\": 1080\n" + - " }\n" + - "}", + value = """ + { + "code": 200, + "message": "request succeed", + "data": { + "static_rule_list": [ + ], + "static_rule_total_num": 1080 + } + }""", - description = "static_rule_list:静态规则列表"+ + description = "static_rule_list:静态规则列表" + "static_rule_total_num:静态规则总数" ) ) @@ -211,7 +218,7 @@ public interface StaticRuleControllerApi { ); - @Operation( summary = "批量查询静态规则", + @Operation(summary = "批量查询静态规则", description = "根据静态规则ID列表查询多个静态规则的所有详细信息", responses = { @io.swagger.v3.oas.annotations.responses.ApiResponse( @@ -239,11 +246,12 @@ public interface StaticRuleControllerApi { mediaType = "application/json", schema = @Schema(implementation = ResponseResult.class), examples = @ExampleObject( - value = "{\n" + - " \"code\": 200,\n" + - " \"message\": \"request succeed\",\n" + - " \"data\": {}\n" + - "}" + value = """ + { + "code": 200, + "message": "request succeed", + "data": {} + }""" ) ) ) @@ -252,10 +260,7 @@ public interface StaticRuleControllerApi { @Parameter(name = "id", description = "静态规则id") } ) - ResponseResult deleteStaticRule(@PathVariable Integer id) ; - - - + ResponseResult deleteStaticRule(@PathVariable Integer id); @Operation( @@ -275,6 +280,5 @@ public interface StaticRuleControllerApi { @Parameter(name = "auditStatus", description = "要修改为的静态规则审核状态") } ) - public ResponseResult updateStaticRuleAuditStatus(@PathVariable Integer id, @PathVariable Integer auditStatus) ; - - } + ResponseResult updateStaticRuleAuditStatus(@PathVariable Integer id, @PathVariable Integer auditStatus); +} diff --git a/src/main/java/com/realtime/protection/server/whitelist/WhiteListControllerApi.java b/src/main/java/com/realtime/protection/server/whitelist/WhiteListControllerApi.java index a9ac7cc..fb31c4b 100644 --- a/src/main/java/com/realtime/protection/server/whitelist/WhiteListControllerApi.java +++ b/src/main/java/com/realtime/protection/server/whitelist/WhiteListControllerApi.java @@ -9,7 +9,6 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @@ -31,15 +30,16 @@ public interface WhiteListControllerApi { mediaType = "application/json", schema = @Schema(implementation = ResponseResult.class), examples = {@ExampleObject( - value = "{\n" + - " \"code\": 200,\n" + - " \"message\": \"request succeed\",\n" + - " \"data\": {\n" + - " \"whiteobj_name\": \"白名单测试\",\n" + - " \"success\": true,\n" + - " \"whiteobj_id\": 7026\n" + - " }\n" + - "}" + value = """ + { + "code": 200, + "message": "request succeed", + "data": { + "whiteobj_name": "白名单测试", + "success": true, + "whiteobj_id": 7026 + } + }""" )} ) ) diff --git a/src/main/resources/nginx/defense/assets/background.a568162c.svg b/src/main/resources/nginx/defense/assets/background.a568162c.svg index 89c2597..194621f 100644 --- a/src/main/resources/nginx/defense/assets/background.a568162c.svg +++ b/src/main/resources/nginx/defense/assets/background.a568162c.svg @@ -1,5 +1,5 @@ - + Group 21 Created with Sketch. diff --git a/src/main/resources/nginx/defense/assets/company1.b48b661f.svg b/src/main/resources/nginx/defense/assets/company1.b48b661f.svg index d98256c..c122cdd 100644 --- a/src/main/resources/nginx/defense/assets/company1.b48b661f.svg +++ b/src/main/resources/nginx/defense/assets/company1.b48b661f.svg @@ -1,7 +1,7 @@ - + diff --git a/src/main/resources/nginx/defense/assets/company2.33b66bf6.svg b/src/main/resources/nginx/defense/assets/company2.33b66bf6.svg index 6b1412f..8c8e28d 100644 --- a/src/main/resources/nginx/defense/assets/company2.33b66bf6.svg +++ b/src/main/resources/nginx/defense/assets/company2.33b66bf6.svg @@ -1,7 +1,7 @@ - + diff --git a/src/main/resources/nginx/defense/assets/logo.b36f7a7f.svg b/src/main/resources/nginx/defense/assets/logo.b36f7a7f.svg index 07ac542..e2b557f 100644 --- a/src/main/resources/nginx/defense/assets/logo.b36f7a7f.svg +++ b/src/main/resources/nginx/defense/assets/logo.b36f7a7f.svg @@ -1,5 +1,5 @@ - + Vue Created with Sketch. diff --git a/src/test/java/com/realtime/protection/server/alertmessage/AlertMessageTest.java b/src/test/java/com/realtime/protection/server/alertmessage/AlertMessageTest.java index 6fb3d43..fb3978b 100644 --- a/src/test/java/com/realtime/protection/server/alertmessage/AlertMessageTest.java +++ b/src/test/java/com/realtime/protection/server/alertmessage/AlertMessageTest.java @@ -39,8 +39,12 @@ public class AlertMessageTest { @Test void testReceiveAlertMessage() { - List protectObject = protectObjectService.queryProtectObjects(null, null, 1, 1); - List