1、静态规则文件上传bug解决,文件上传增加ip、掩码不匹配判断
2、策略模板新增querySourceSystem、queryEventNam、queryTemplateId方法用于动态规则新建
This commit is contained in:
@@ -7,6 +7,7 @@ import jakarta.validation.constraints.Min;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/template")
|
||||
@@ -75,4 +76,29 @@ public class TemplateController implements TemplateControllerApi {
|
||||
.setData("template_id", templateId)
|
||||
.setData("success", templateService.deleteTemplate(templateId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping("/query/source_system")
|
||||
public ResponseResult querySourceSystem() {
|
||||
return ResponseResult.ok()
|
||||
.setData("source_system", templateService.querySourceSystem());
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping("/query/event_name/{sourceSystem}")
|
||||
public ResponseResult queryEventName(@PathVariable String sourceSystem) {
|
||||
return ResponseResult.ok()
|
||||
.setData("event_name", templateService.queryEventName(sourceSystem));
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping("/query/templateId")
|
||||
public ResponseResult queryTemplateId(@RequestBody Map<String,String> map) {
|
||||
String sourceSystem = map.get("source_system");
|
||||
String eventName = map.get("event_name");
|
||||
return ResponseResult.ok()
|
||||
.setData("template_id", templateService.queryTemplateId(sourceSystem, eventName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "防御策略模板API", description = "防御策略模板模块所有接口")
|
||||
public interface TemplateControllerApi {
|
||||
@PostMapping("/new")
|
||||
@@ -39,7 +41,7 @@ public interface TemplateControllerApi {
|
||||
""",
|
||||
description = """
|
||||
"success": 新建防御策略模板是否成功
|
||||
|
||||
|
||||
"template_id": 新建防御策略模板ID
|
||||
"""
|
||||
)
|
||||
@@ -147,17 +149,17 @@ public interface TemplateControllerApi {
|
||||
""",
|
||||
description = """
|
||||
"template_id": 防御策略模板ID
|
||||
|
||||
|
||||
"template_name": 防御策略模板名称
|
||||
|
||||
|
||||
"protect_level_low": 防御策略模板日常态数据
|
||||
|
||||
|
||||
"protect_level_medium": 防御策略模板应急态数据
|
||||
|
||||
|
||||
"protect_level_high": 防御策略模板紧急态数据
|
||||
|
||||
|
||||
"template_used_times": 防御策略模板使用次数
|
||||
|
||||
|
||||
"running_tasks": 防御策略模板任务运行数量
|
||||
"""
|
||||
)
|
||||
@@ -232,17 +234,17 @@ public interface TemplateControllerApi {
|
||||
""",
|
||||
description = """
|
||||
"template_id": 防御策略模板ID
|
||||
|
||||
|
||||
"template_name": 防御策略模板名称
|
||||
|
||||
|
||||
"protect_level_low": 防御策略模板日常态数据
|
||||
|
||||
|
||||
"protect_level_medium": 防御策略模板应急态数据
|
||||
|
||||
|
||||
"protect_level_high": 防御策略模板紧急态数据
|
||||
|
||||
|
||||
"template_used_times": 防御策略模板使用次数
|
||||
|
||||
|
||||
"running_tasks": 防御策略模板任务运行数量
|
||||
"""
|
||||
)
|
||||
@@ -279,7 +281,7 @@ public interface TemplateControllerApi {
|
||||
""",
|
||||
description = """
|
||||
"success": 更新是否成功
|
||||
|
||||
|
||||
"template_id": 更新的策略模板ID
|
||||
"""
|
||||
)
|
||||
@@ -317,7 +319,7 @@ public interface TemplateControllerApi {
|
||||
""",
|
||||
description = """
|
||||
"success": 删除是否成功
|
||||
|
||||
|
||||
"template_id": 删除的策略模板ID
|
||||
"""
|
||||
)
|
||||
@@ -329,4 +331,54 @@ public interface TemplateControllerApi {
|
||||
}
|
||||
)
|
||||
ResponseResult deleteTemplate(@PathVariable @Min(1) Integer templateId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/source_system")
|
||||
@Operation(
|
||||
summary = "查询来源系统名称",
|
||||
description = "查询策略模板中的所有来源系统名称",
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "返回来源系统名称查询结果,返回字符串列表",
|
||||
content = @Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = ResponseResult.class)
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
ResponseResult querySourceSystem();
|
||||
|
||||
@GetMapping("/query/event_name/{sourceSystem}")
|
||||
@Operation(
|
||||
summary = "查询事件类型",
|
||||
description = "查询当前来源系统下的事件类型",
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "返回当前来源系统下的事件类型,返回字符串列表",
|
||||
content = @Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = ResponseResult.class)
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
ResponseResult queryEventName(@PathVariable String sourceSystem);
|
||||
|
||||
@PostMapping("/query/templateId")
|
||||
@Operation(
|
||||
summary = "查询策略模板id",
|
||||
description = "根据来源系统和事件类型查询策略模板id",
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "返回来源系统和事件类型对应的策略模板id,整数",
|
||||
content = @Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = ResponseResult.class)
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
public ResponseResult queryTemplateId(@RequestBody Map<String,String> map);
|
||||
}
|
||||
@@ -28,4 +28,10 @@ public interface TemplateMapper {
|
||||
Boolean deleteTemplate(@Param("template_id") Integer templateId);
|
||||
|
||||
Integer queryTemplateTotalNum(String templateName);
|
||||
|
||||
List<String> querySourceSystem();
|
||||
|
||||
List<String> queryEventName(String sourceSystem);
|
||||
|
||||
Integer queryTemplateId(String sourceSystem, String eventName);
|
||||
}
|
||||
|
||||
@@ -50,4 +50,16 @@ public class TemplateService {
|
||||
public Integer queryTemplateTotalNum(String templateName) {
|
||||
return templateMapper.queryTemplateTotalNum(templateName);
|
||||
}
|
||||
|
||||
public List<String> querySourceSystem() {
|
||||
return templateMapper.querySourceSystem();
|
||||
}
|
||||
|
||||
public List<String> queryEventName(String sourceSystem) {
|
||||
return templateMapper.queryEventName(sourceSystem);
|
||||
}
|
||||
|
||||
public Integer queryTemplateId(String sourceSystem, String eventName) {
|
||||
return templateMapper.queryTemplateId(sourceSystem, eventName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user