1、任务、规则、白名单、策略模板新增更多的分页查询条件
This commit is contained in:
@@ -42,10 +42,12 @@ public class TemplateController implements TemplateControllerApi {
|
|||||||
public ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
public ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
@RequestParam(value = "source_system", required = false) String sourceSystem,
|
@RequestParam(value = "source_system", required = false) String sourceSystem,
|
||||||
@RequestParam(value = "create_user_name", required = false) String createUserName,
|
@RequestParam(value = "create_user_name", required = false) String createUserName,
|
||||||
|
@RequestParam(value = "template_id", required = false) Integer templateId,
|
||||||
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
templateName, sourceSystem, createUserName,
|
templateName, sourceSystem, createUserName, templateId, auditStatus,
|
||||||
page, pageSize
|
page, pageSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ public interface TemplateControllerApi {
|
|||||||
@Parameter(name = "template_name", description = "防御策略模板名称", example = "DDOS"),
|
@Parameter(name = "template_name", description = "防御策略模板名称", example = "DDOS"),
|
||||||
@Parameter(name = "source_system", description = "策略模板来源那系统", example = "xxx系统"),
|
@Parameter(name = "source_system", description = "策略模板来源那系统", example = "xxx系统"),
|
||||||
@Parameter(name = "create_user_name", description = "创建人名称", example = "xxx"),
|
@Parameter(name = "create_user_name", description = "创建人名称", example = "xxx"),
|
||||||
|
@Parameter(name = "template_id", description = "防御策略模板ID", example = "1"),
|
||||||
|
@Parameter(name = "audit_status", description = "审核状态", example = "0"),
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "page_size", description = "每页对象数量", example = "5")
|
@Parameter(name = "page_size", description = "每页对象数量", example = "5")
|
||||||
}
|
}
|
||||||
@@ -178,6 +180,9 @@ public interface TemplateControllerApi {
|
|||||||
ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
@RequestParam(value = "source_system", required = false) String sourceSystem,
|
@RequestParam(value = "source_system", required = false) String sourceSystem,
|
||||||
@RequestParam(value = "create_user_name", required = false) String createUserName,
|
@RequestParam(value = "create_user_name", required = false) String createUserName,
|
||||||
|
@RequestParam(value = "template_id", required = false) Integer templateId,
|
||||||
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize);
|
@RequestParam("page_size") @Min(1) Integer pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public interface TemplateMapper {
|
|||||||
List<Template> queryTemplates(@Param("template_name") String templateName,
|
List<Template> queryTemplates(@Param("template_name") String templateName,
|
||||||
@Param("source_system") String sourceSystem,
|
@Param("source_system") String sourceSystem,
|
||||||
@Param("create_username") String createUsername,
|
@Param("create_username") String createUsername,
|
||||||
|
@Param("template_id")Integer templateId,
|
||||||
|
@Param("audit_status")Integer auditStatus,
|
||||||
@Param("page") Integer page,
|
@Param("page") Integer page,
|
||||||
@Param("page_size") Integer pageSize);
|
@Param("page_size") Integer pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ public class TemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Template> queryTemplates(String templateName, String sourceSystem, String createUserName,
|
public List<Template> queryTemplates(String templateName, String sourceSystem, String createUserName,
|
||||||
|
Integer templateId, Integer auditStatus,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
return templateMapper.queryTemplates(templateName, sourceSystem, createUserName, page, pageSize);
|
return templateMapper.queryTemplates(templateName, sourceSystem, createUserName, templateId, auditStatus, page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean updateTemplate(Integer templateId, Template template) {
|
public Boolean updateTemplate(Integer templateId, Template template) {
|
||||||
@@ -49,7 +50,7 @@ public class TemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Template> queryTemplatesShort() {
|
public List<Template> queryTemplatesShort() {
|
||||||
List<Template> templates = templateMapper.queryTemplates(null, null, null, 1, 10000);
|
List<Template> templates = templateMapper.queryTemplates(null, null, null, null, null,1, 10000);
|
||||||
|
|
||||||
templates.forEach(template -> {
|
templates.forEach(template -> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -109,6 +109,10 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
|||||||
@RequestParam(value = "source_system", required = false) String protectObjectSourceSystem,
|
@RequestParam(value = "source_system", required = false) String protectObjectSourceSystem,
|
||||||
@RequestParam(value = "creator", required = false) String creator,
|
@RequestParam(value = "creator", required = false) String creator,
|
||||||
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(value = "event_type", required = false) String eventType,
|
||||||
|
@RequestParam(value = "protect_level", required = false) Integer protectLevel,
|
||||||
|
@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
|
|
||||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize) {
|
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize) {
|
||||||
log.info("分页查询动态规则: {}:{}:{}:{}", dynamicRuleName, dynamicRuleId, page, pageSize);
|
log.info("分页查询动态规则: {}:{}:{}:{}", dynamicRuleName, dynamicRuleId, page, pageSize);
|
||||||
@@ -116,9 +120,9 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
|||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("success", true)
|
.setData("success", true)
|
||||||
.setData("dynamic_rule_list", dynamicRuleService.queryDynamicRuleObject(dynamicRuleName, dynamicRuleId,
|
.setData("dynamic_rule_list", dynamicRuleService.queryDynamicRuleObject(dynamicRuleName, dynamicRuleId,
|
||||||
protectObjectSourceSystem, creator, auditStatus, page, pageSize))
|
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName, page, pageSize))
|
||||||
.setData("total_num",dynamicRuleService.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
.setData("total_num",dynamicRuleService.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
||||||
protectObjectSourceSystem, creator, auditStatus));
|
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName));
|
||||||
}
|
}
|
||||||
|
|
||||||
//详情查看?? 就是按id查询吧
|
//详情查看?? 就是按id查询吧
|
||||||
@@ -172,7 +176,7 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
|||||||
|
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("dynamic_rule_num", dynamicRuleService.queryDynamicRuleTotalNum(null,null, null,
|
.setData("dynamic_rule_num", dynamicRuleService.queryDynamicRuleTotalNum(null,null, null,
|
||||||
null, null))
|
null, null, null, null, null))
|
||||||
.setData("dynamic_rule_used_num", dynamicRuleService.queryAuditDynamicRuleTotalNum(
|
.setData("dynamic_rule_used_num", dynamicRuleService.queryAuditDynamicRuleTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.USING.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.USING.getState())
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -348,6 +348,9 @@ public interface DynamicRuleControllerApi {
|
|||||||
@Parameter(name = "source_system", description = "来源你系统", example = "BW系统"),
|
@Parameter(name = "source_system", description = "来源你系统", example = "BW系统"),
|
||||||
@Parameter(name = "creator", description = "创建人名称"),
|
@Parameter(name = "creator", description = "创建人名称"),
|
||||||
@Parameter(name = "audit_status", description = "审核状态", example = "1"),
|
@Parameter(name = "audit_status", description = "审核状态", example = "1"),
|
||||||
|
@Parameter(name = "event_type", description = "事件类型", example = "反射型DDOS"),
|
||||||
|
@Parameter(name = "protect_level", description = "保护级别", example = "1"),
|
||||||
|
// @Parameter(name = "template_name", description = "模板名称", example = "test"),
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "page_size", description = "每页大小", example = "10")
|
@Parameter(name = "page_size", description = "每页大小", example = "10")
|
||||||
}
|
}
|
||||||
@@ -357,6 +360,9 @@ public interface DynamicRuleControllerApi {
|
|||||||
@RequestParam(value = "source_system", required = false) String protectObjectSourceSystem,
|
@RequestParam(value = "source_system", required = false) String protectObjectSourceSystem,
|
||||||
@RequestParam(value = "creator", required = false) String creator,
|
@RequestParam(value = "creator", required = false) String creator,
|
||||||
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(value = "event_type", required = false) String eventType,
|
||||||
|
@RequestParam(value = "protect_level", required = false) Integer protectLevel,
|
||||||
|
@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize);
|
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public interface DynamicRuleMapper {
|
|||||||
|
|
||||||
List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, Integer dynamicRuleId,
|
List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, Integer dynamicRuleId,
|
||||||
String sourceSystem, String creator, Integer auditStatus,
|
String sourceSystem, String creator, Integer auditStatus,
|
||||||
|
String eventType, Integer protectLevel, String templateName,
|
||||||
Integer page, Integer pageSize);
|
Integer page, Integer pageSize);
|
||||||
|
|
||||||
void deleteDynamicRuleProtectObjectConcat(Integer dynamicRuleId);
|
void deleteDynamicRuleProtectObjectConcat(Integer dynamicRuleId);
|
||||||
@@ -43,7 +44,8 @@ public interface DynamicRuleMapper {
|
|||||||
boolean queryProtectObjectById(Integer protectObjectId);
|
boolean queryProtectObjectById(Integer protectObjectId);
|
||||||
|
|
||||||
Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
|
Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
|
||||||
String sourceSystem, String creator, Integer auditStatus);
|
String sourceSystem, String creator, Integer auditStatus
|
||||||
|
, String eventType, Integer protectLevel, String templateName);
|
||||||
|
|
||||||
List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids);
|
List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids);
|
||||||
|
|
||||||
@@ -59,5 +61,5 @@ public interface DynamicRuleMapper {
|
|||||||
|
|
||||||
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
||||||
|
|
||||||
List<Integer> queryAuditStatusByIds(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idsWithAuditStatusMap);
|
List<Integer> queryAuditStatusByIds(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,16 +172,17 @@ public class DynamicRuleService {
|
|||||||
//分页查询基础的动态规则,暂时不返回关联的保护对象
|
//分页查询基础的动态规则,暂时不返回关联的保护对象
|
||||||
public List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, Integer dynamicRuleId,
|
public List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, Integer dynamicRuleId,
|
||||||
String templateSourceSystem,String creator,Integer auditStatus,
|
String templateSourceSystem,String creator,Integer auditStatus,
|
||||||
|
String eventType, Integer protectLevel, String templateName,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
return dynamicRuleMapper.queryDynamicRuleObject(dynamicRuleName, dynamicRuleId,
|
return dynamicRuleMapper.queryDynamicRuleObject(dynamicRuleName, dynamicRuleId,
|
||||||
templateSourceSystem, creator, auditStatus, page, pageSize);
|
templateSourceSystem, creator, auditStatus, eventType, protectLevel, templateName, page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
|
public Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
|
||||||
String protectObjectSourceSystem, String creator,
|
String protectObjectSourceSystem, String creator,
|
||||||
Integer auditStatus) {
|
Integer auditStatus, String eventType, Integer protectLevel, String templateName) {
|
||||||
return dynamicRuleMapper.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
return dynamicRuleMapper.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
||||||
protectObjectSourceSystem, creator, auditStatus);
|
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids) {
|
public List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids) {
|
||||||
@@ -215,6 +216,7 @@ public class DynamicRuleService {
|
|||||||
public Object updateAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
public Object updateAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
||||||
//校验id和status是否合法
|
//校验id和status是否合法
|
||||||
List<Integer> originalAuditStatusList = dynamicRuleMapper.queryAuditStatusByIds(idsWithAuditStatusMap);
|
List<Integer> originalAuditStatusList = dynamicRuleMapper.queryAuditStatusByIds(idsWithAuditStatusMap);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
List<Integer> errorIds = new ArrayList<>();
|
List<Integer> errorIds = new ArrayList<>();
|
||||||
for(Map.Entry<Integer, Integer> entry: idsWithAuditStatusMap.entrySet()) {
|
for(Map.Entry<Integer, Integer> entry: idsWithAuditStatusMap.entrySet()) {
|
||||||
|
|||||||
@@ -133,7 +133,10 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
public ResponseResult queryStaticRule(@RequestParam(name = "name", required = false) String static_rule_name,
|
public ResponseResult queryStaticRule(@RequestParam(name = "name", required = false) String static_rule_name,
|
||||||
@RequestParam(name = "id", required = false) Integer static_rule_id,
|
@RequestParam(name = "id", required = false) Integer static_rule_id,
|
||||||
@RequestParam(name = "creator", required = false) String static_rule_creator,
|
@RequestParam(name = "creator", required = false) String static_rule_creator,
|
||||||
@RequestParam(name = "ip", required = false) String static_rule_ip,
|
@RequestParam(name = "sip", required = false) String static_rule_sip,
|
||||||
|
@RequestParam(name = "sport", required = false) Integer static_rule_sport,
|
||||||
|
@RequestParam(name = "dip", required = false) String static_rule_dip,
|
||||||
|
@RequestParam(name = "dport", required = false) Integer static_rule_dport,
|
||||||
@RequestParam(name = "auditStatus", required = false) Integer auditStatus,
|
@RequestParam(name = "auditStatus", required = false) Integer auditStatus,
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
@RequestParam(defaultValue = "1") Integer page,
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize
|
@RequestParam(defaultValue = "10") Integer pageSize
|
||||||
@@ -142,11 +145,11 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
//调用service新增
|
//调用service新增
|
||||||
List<StaticRuleObject> pageResult = staticRuleService.queryStaticRule(
|
List<StaticRuleObject> pageResult = staticRuleService.queryStaticRule(
|
||||||
static_rule_name, static_rule_id,
|
static_rule_name, static_rule_id,
|
||||||
static_rule_creator, static_rule_ip, auditStatus, page, pageSize);
|
static_rule_creator, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus, page, pageSize);
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("static_rule_list", pageResult)
|
.setData("static_rule_list", pageResult)
|
||||||
.setData("total_num",staticRuleService.queryStaticRuleTotalNum(static_rule_name, static_rule_id,
|
.setData("total_num",staticRuleService.queryStaticRuleTotalNum(static_rule_name, static_rule_id,
|
||||||
static_rule_creator, static_rule_ip, auditStatus));
|
static_rule_creator, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -209,7 +212,7 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
public ResponseResult getStaticRuleStatisticsData(){
|
public ResponseResult getStaticRuleStatisticsData(){
|
||||||
|
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("static_rule_num", staticRuleService.queryStaticRuleTotalNum(null, null, null, null, null))
|
.setData("static_rule_num", staticRuleService.queryStaticRuleTotalNum(null, null, null, null, null, null, null, null))
|
||||||
.setData("static_rule_used_num", staticRuleService.queryAuditStaticRuleTotalNum(
|
.setData("static_rule_used_num", staticRuleService.queryAuditStaticRuleTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.USING.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.USING.getState())
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -203,7 +203,10 @@ public interface StaticRuleControllerApi {
|
|||||||
@Parameter(name = "name", description = "静态规则名称"),
|
@Parameter(name = "name", description = "静态规则名称"),
|
||||||
@Parameter(name = "id", description = "静态规则id"),
|
@Parameter(name = "id", description = "静态规则id"),
|
||||||
@Parameter(name = "creator", description = "静态规则创建人"),
|
@Parameter(name = "creator", description = "静态规则创建人"),
|
||||||
@Parameter(name = "ip", description = "静态规则ip,匹配所有源和目的ip"),
|
@Parameter(name = "sip", description = "静态规则ip,匹配源ip并考虑掩码"),
|
||||||
|
@Parameter(name = "sport", description = "静态规则port,匹配源port"),
|
||||||
|
@Parameter(name = "dip", description = "静态规则ip,匹配目的ip并考虑掩码"),
|
||||||
|
@Parameter(name = "dport", description = "静态规则port,匹配目的port"),
|
||||||
@Parameter(name = "auditStatus", description = "静态规则审核状态"),
|
@Parameter(name = "auditStatus", description = "静态规则审核状态"),
|
||||||
@Parameter(name = "page", description = "页码"),
|
@Parameter(name = "page", description = "页码"),
|
||||||
@Parameter(name = "pageSize", description = "每页条数")
|
@Parameter(name = "pageSize", description = "每页条数")
|
||||||
@@ -212,7 +215,10 @@ public interface StaticRuleControllerApi {
|
|||||||
ResponseResult queryStaticRule(@RequestParam(required = false) String static_rule_name,
|
ResponseResult queryStaticRule(@RequestParam(required = false) String static_rule_name,
|
||||||
@RequestParam(required = false) Integer static_rule_id,
|
@RequestParam(required = false) Integer static_rule_id,
|
||||||
@RequestParam(required = false) String static_rule_creator,
|
@RequestParam(required = false) String static_rule_creator,
|
||||||
@RequestParam(required = false) String static_rule_ip,
|
@RequestParam(required = false) String static_rule_sip,
|
||||||
|
@RequestParam(required = false) Integer static_rule_sport,
|
||||||
|
@RequestParam(required = false) String static_rule_dip,
|
||||||
|
@RequestParam(required = false) Integer static_rule_dport,
|
||||||
@RequestParam(required = false) Integer auditStatus,
|
@RequestParam(required = false) Integer auditStatus,
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
@RequestParam(defaultValue = "1") Integer page,
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize
|
@RequestParam(defaultValue = "10") Integer pageSize
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ public interface StaticRuleMapper {
|
|||||||
|
|
||||||
//多页查询静态规则
|
//多页查询静态规则
|
||||||
List<StaticRuleObject> queryStaticRule(String static_rule_name, Integer static_rule_id,
|
List<StaticRuleObject> queryStaticRule(String static_rule_name, Integer static_rule_id,
|
||||||
String static_rule_create_username, String ip, Integer auditStatus,
|
String static_rule_create_username, String sip,
|
||||||
|
Integer sport, String dip, Integer dport,
|
||||||
|
Integer auditStatus,
|
||||||
Integer page, Integer pageSize);
|
Integer page, Integer pageSize);
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +43,10 @@ public interface StaticRuleMapper {
|
|||||||
Boolean updateAuditStatusById(Integer id, Integer auditStatus);
|
Boolean updateAuditStatusById(Integer id, Integer auditStatus);
|
||||||
|
|
||||||
Integer queryStaticRuleTotalNum(String static_rule_name, Integer static_rule_id,
|
Integer queryStaticRuleTotalNum(String static_rule_name, Integer static_rule_id,
|
||||||
String static_rule_create_username, String ip, Integer auditStatus);
|
String static_rule_create_username,
|
||||||
|
String sip, Integer sport,
|
||||||
|
String dip, Integer dport,
|
||||||
|
Integer auditStatus);
|
||||||
|
|
||||||
List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids);
|
List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids);
|
||||||
|
|
||||||
|
|||||||
@@ -166,11 +166,14 @@ public class StaticRuleService {
|
|||||||
*/
|
*/
|
||||||
public List<StaticRuleObject> queryStaticRule(
|
public List<StaticRuleObject> queryStaticRule(
|
||||||
String static_rule_name, Integer static_rule_id,
|
String static_rule_name, Integer static_rule_id,
|
||||||
String creator, String ip, Integer auditStatus,
|
String creator,
|
||||||
|
String static_rule_sip, Integer static_rule_sport,
|
||||||
|
String static_rule_dip, Integer static_rule_dport,
|
||||||
|
Integer auditStatus,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
|
|
||||||
return staticRuleMapper.queryStaticRule(static_rule_name, static_rule_id,
|
return staticRuleMapper.queryStaticRule(static_rule_name, static_rule_id,
|
||||||
creator, ip, auditStatus, page, pageSize);
|
creator, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus, page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean newStaticRuleObjects(List<StaticRuleObject> staticRuleList) {
|
public Boolean newStaticRuleObjects(List<StaticRuleObject> staticRuleList) {
|
||||||
@@ -233,9 +236,13 @@ public class StaticRuleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryStaticRuleTotalNum(String static_rule_name, Integer static_rule_id,
|
public Integer queryStaticRuleTotalNum(String static_rule_name, Integer static_rule_id,
|
||||||
String static_rule_creator, String static_rule_ip, Integer auditStatus) {
|
String static_rule_creator,
|
||||||
|
String static_rule_sip, Integer static_rule_sport,
|
||||||
|
String static_rule_dip, Integer static_rule_dport,
|
||||||
|
Integer auditStatus) {
|
||||||
return staticRuleMapper.queryStaticRuleTotalNum(static_rule_name, static_rule_id,
|
return staticRuleMapper.queryStaticRuleTotalNum(static_rule_name, static_rule_id,
|
||||||
static_rule_creator, static_rule_ip, auditStatus);
|
static_rule_creator, static_rule_sip, static_rule_sport,
|
||||||
|
static_rule_dip, static_rule_dport, auditStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids) {
|
public List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids) {
|
||||||
|
|||||||
@@ -75,12 +75,18 @@ public class TaskController implements TaskControllerApi {
|
|||||||
@RequestParam(value = "task_name", required = false) String taskName,
|
@RequestParam(value = "task_name", required = false) String taskName,
|
||||||
@RequestParam(value = "task_creator", required = false) String taskCreator,
|
@RequestParam(value = "task_creator", required = false) String taskCreator,
|
||||||
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(value = "task_act", required = false) String taskAct,
|
||||||
|
@RequestParam(value = "task_auditor", required = false) String taskAuditor,
|
||||||
|
@RequestParam(value = "task_source", required = false) String taskSource,
|
||||||
|
@RequestParam(value = "rule_name", required = false) String ruleName,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
||||||
List<Task> tasks = taskService.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus, page, pageSize);
|
List<Task> tasks = taskService.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
|
taskAct, taskAuditor, taskSource, ruleName, page, pageSize);
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("task_list", tasks)
|
.setData("task_list", tasks)
|
||||||
.setData("total_num", taskService.queryTaskTotalNum(taskStatus, taskType, taskName, taskCreator, auditStatus));
|
.setData("total_num", taskService.queryTaskTotalNum(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
|
taskAct, taskAuditor, taskSource, ruleName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -192,9 +198,12 @@ public class TaskController implements TaskControllerApi {
|
|||||||
@GetMapping("/statistics")
|
@GetMapping("/statistics")
|
||||||
public ResponseResult statistics() {
|
public ResponseResult statistics() {
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("total_num", taskService.queryTaskTotalNum(null, null, null, null, null))
|
.setData("total_num", taskService.queryTaskTotalNum(null, null, null, null, null,
|
||||||
.setData("running_num", taskService.queryTaskTotalNum(StateEnum.RUNNING.getStateNum(), null, null, null, null))
|
null, null, null, null))
|
||||||
.setData("finished_num", taskService.queryTaskTotalNum(StateEnum.FINISHED.getStateNum(), null, null, null, null))
|
.setData("running_num", taskService.queryTaskTotalNum(StateEnum.RUNNING.getStateNum(), null, null, null, null,
|
||||||
|
null, null, null, null))
|
||||||
|
.setData("finished_num", taskService.queryTaskTotalNum(StateEnum.FINISHED.getStateNum(), null, null, null, null,
|
||||||
|
null, null, null, null))
|
||||||
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(
|
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(
|
||||||
AuditStatusEnum.PENDING.getNum()
|
AuditStatusEnum.PENDING.getNum()
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ public interface TaskControllerApi {
|
|||||||
@Parameter(name = "task_name", description = "任务名称"),
|
@Parameter(name = "task_name", description = "任务名称"),
|
||||||
@Parameter(name = "task_creator", description = "任务创建人"),
|
@Parameter(name = "task_creator", description = "任务创建人"),
|
||||||
@Parameter(name = "audit_status", description = "审批状态"),
|
@Parameter(name = "audit_status", description = "审批状态"),
|
||||||
|
@Parameter(name = "task_act", description = "任务动作"),
|
||||||
|
@Parameter(name = "task_auditor", description = "任务审核人名称"),
|
||||||
|
@Parameter(name = "task_source", description = "任务来源系统"),
|
||||||
|
@Parameter(name = "rule_name", description = "规则名称"),
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "page_size", description = "每页查询个数", example = "10")
|
@Parameter(name = "page_size", description = "每页查询个数", example = "10")
|
||||||
}
|
}
|
||||||
@@ -193,6 +197,10 @@ public interface TaskControllerApi {
|
|||||||
@RequestParam(value = "task_name", required = false) String taskName,
|
@RequestParam(value = "task_name", required = false) String taskName,
|
||||||
@RequestParam(value = "task_creator", required = false) String taskCreator,
|
@RequestParam(value = "task_creator", required = false) String taskCreator,
|
||||||
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(value = "task_act", required = false) String taskAct,
|
||||||
|
@RequestParam(value = "task_auditor", required = false) String taskAuditor,
|
||||||
|
@RequestParam(value = "task_source", required = false) String taskSource,
|
||||||
|
@RequestParam(value = "rule_name", required = false) String ruleName,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize);
|
@RequestParam("page_size") @Min(1) Integer pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public interface TaskMapper {
|
|||||||
List<Task> queryTasks(@Param("task_status") Integer taskStatus, @Param("task_type") Integer task_type,
|
List<Task> queryTasks(@Param("task_status") Integer taskStatus, @Param("task_type") Integer task_type,
|
||||||
@Param("task_name") String taskName, @Param("task_creator") String taskCreator,
|
@Param("task_name") String taskName, @Param("task_creator") String taskCreator,
|
||||||
@Param("task_audit_status") Integer auditStatus,
|
@Param("task_audit_status") Integer auditStatus,
|
||||||
|
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
||||||
|
@Param("task_source")String taskSource, @Param("rule_name")String ruleName,
|
||||||
@Param("page") Integer page, @Param("page_size") Integer pageSize);
|
@Param("page") Integer page, @Param("page_size") Integer pageSize);
|
||||||
|
|
||||||
Task queryTask(@Param("task_id") Long taskId);
|
Task queryTask(@Param("task_id") Long taskId);
|
||||||
@@ -61,7 +63,9 @@ public interface TaskMapper {
|
|||||||
|
|
||||||
Integer queryTaskTotalNum(@Param("task_status") Integer taskStatus, @Param("task_type") Integer task_type,
|
Integer queryTaskTotalNum(@Param("task_status") Integer taskStatus, @Param("task_type") Integer task_type,
|
||||||
@Param("task_name") String taskName, @Param("task_creator") String taskCreator,
|
@Param("task_name") String taskName, @Param("task_creator") String taskCreator,
|
||||||
@Param("audit_status") Integer auditStatus);
|
@Param("audit_status") Integer auditStatus,
|
||||||
|
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
||||||
|
@Param("task_source")String taskSource, @Param("rule_name")String ruleName);
|
||||||
|
|
||||||
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
||||||
|
|
||||||
|
|||||||
@@ -200,8 +200,12 @@ public class TaskService {
|
|||||||
public List<Task> queryTasks(Integer taskStatus,
|
public List<Task> queryTasks(Integer taskStatus,
|
||||||
Integer taskType, String taskName, String taskCreator,
|
Integer taskType, String taskName, String taskCreator,
|
||||||
Integer auditStatus,
|
Integer auditStatus,
|
||||||
|
String taskAct, String taskAuditor,
|
||||||
|
String taskSource, String ruleName,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
List<Task> tasks = taskMapper.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus, page, pageSize);
|
|
||||||
|
List<Task> tasks = taskMapper.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
|
taskAct, taskAuditor, taskSource, ruleName, page, pageSize);
|
||||||
for (Task task : tasks) {
|
for (Task task : tasks) {
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
continue;
|
continue;
|
||||||
@@ -316,8 +320,10 @@ public class TaskService {
|
|||||||
return taskMapper.queryTasksByStatus(StateEnum.FINISHED.getStateNum());
|
return taskMapper.queryTasksByStatus(StateEnum.FINISHED.getStateNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryTaskTotalNum(Integer taskStatus, Integer taskType, String taskName, String taskCreator, Integer auditStatus) {
|
public Integer queryTaskTotalNum(Integer taskStatus, Integer taskType, String taskName, String taskCreator, Integer auditStatus
|
||||||
return taskMapper.queryTaskTotalNum(taskStatus, taskType, taskName, taskCreator, auditStatus);
|
,String taskAct, String taskAuditor, String taskSource, String ruleName) {
|
||||||
|
return taskMapper.queryTaskTotalNum(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
|
taskAct, taskAuditor, taskSource, ruleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object updateAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
public Object updateAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
||||||
@@ -371,4 +377,10 @@ public class TaskService {
|
|||||||
public Integer queryAuditTaskTotalNum(Integer auditState) {
|
public Integer queryAuditTaskTotalNum(Integer auditState) {
|
||||||
return taskMapper.queryAuditTaskTotalNum(auditState);
|
return taskMapper.queryAuditTaskTotalNum(auditState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> queryAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
||||||
|
//校验id和status是否合法
|
||||||
|
return taskMapper.queryAuditStatusByIds(idsWithAuditStatusMap);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public class WhiteListController implements WhiteListControllerApi {
|
|||||||
@GetMapping("/query")
|
@GetMapping("/query")
|
||||||
public ResponseResult queryWhiteListObject(@RequestParam(value = "whiteobj_name", required = false) String whiteListName,
|
public ResponseResult queryWhiteListObject(@RequestParam(value = "whiteobj_name", required = false) String whiteListName,
|
||||||
@RequestParam(value = "whiteobj_id", required = false) Integer whiteListId,
|
@RequestParam(value = "whiteobj_id", required = false) Integer whiteListId,
|
||||||
|
@RequestParam(value = "system_name", required = false) String systemName,
|
||||||
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(value = "creator", required = false) String creator,
|
||||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize) {
|
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize) {
|
||||||
if (page <= 0 || pageSize <= 0) {
|
if (page <= 0 || pageSize <= 0) {
|
||||||
@@ -70,8 +73,8 @@ public class WhiteListController implements WhiteListControllerApi {
|
|||||||
.setData("whiteobj_list", null);
|
.setData("whiteobj_list", null);
|
||||||
}
|
}
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("whiteobj_list", whiteListService.queryWhiteListObject(whiteListName, whiteListId, page, pageSize))
|
.setData("whiteobj_list", whiteListService.queryWhiteListObject(whiteListName, whiteListId, systemName, auditStatus, creator, page, pageSize))
|
||||||
.setData("total_num", whiteListService.queryWhiteListTotalNum(whiteListName, whiteListId));
|
.setData("total_num", whiteListService.queryWhiteListTotalNum(whiteListName, whiteListId, systemName, auditStatus, creator));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -202,7 +205,7 @@ public class WhiteListController implements WhiteListControllerApi {
|
|||||||
@GetMapping("/statistics")
|
@GetMapping("/statistics")
|
||||||
public ResponseResult getWhiteListStatisticsData() {
|
public ResponseResult getWhiteListStatisticsData() {
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("whiteobj_num", whiteListService.queryWhiteListTotalNum(null, null))
|
.setData("whiteobj_num", whiteListService.queryWhiteListTotalNum(null, null, null, null, null))
|
||||||
.setData("whiteobj_audit_num", whiteListService.queryAuditWhiteListTotalNum(
|
.setData("whiteobj_audit_num", whiteListService.queryAuditWhiteListTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.AUDITED.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.AUDITED.getState())
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -101,12 +101,20 @@ public interface WhiteListControllerApi {
|
|||||||
parameters = {
|
parameters = {
|
||||||
@Parameter(name = "whiteobj_name", description = "白名单名称"),
|
@Parameter(name = "whiteobj_name", description = "白名单名称"),
|
||||||
@Parameter(name = "whiteobj_id", description = "白名单ID"),
|
@Parameter(name = "whiteobj_id", description = "白名单ID"),
|
||||||
|
@Parameter(name = "system_name", description = "白名单新建时配置的系统名称"),
|
||||||
|
@Parameter(name = "audit_status", description = "审核状态"),
|
||||||
|
@Parameter(name = "creator", description = "创建人名称"),
|
||||||
|
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "page_size", description = "每页查询个数", example = "10")
|
@Parameter(name = "page_size", description = "每页查询个数", example = "10")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ResponseResult queryWhiteListObject(@RequestParam(value = "whiteobj_name", required = false) String whiteListName,
|
ResponseResult queryWhiteListObject(@RequestParam(value = "whiteobj_name", required = false) String whiteListName,
|
||||||
@RequestParam(value = "whiteobj_id", required = false) Integer whiteListId,
|
@RequestParam(value = "whiteobj_id", required = false) Integer whiteListId,
|
||||||
|
@RequestParam(value = "system_name", required = false) String systemName,
|
||||||
|
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(value = "creator", required = false) String creator,
|
||||||
|
|
||||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize);
|
@RequestParam(value = "page_size", defaultValue = "10") Integer pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ public interface WhiteListMapper {
|
|||||||
void newWhiteListObject(@Param("object") WhiteListObject object);
|
void newWhiteListObject(@Param("object") WhiteListObject object);
|
||||||
|
|
||||||
//分页查询
|
//分页查询
|
||||||
List<WhiteListObject> queryWhiteListObject(String whiteListName, Integer whiteListId, Integer page, Integer pageSize);
|
List<WhiteListObject> queryWhiteListObject(String whiteListName, Integer whiteListId,
|
||||||
|
String systemName, Integer auditStatus, String creator,
|
||||||
|
Integer page, Integer pageSize);
|
||||||
|
|
||||||
//根据主键查询
|
//根据主键查询
|
||||||
WhiteListObject queryWhiteListObjectById(Integer id);
|
WhiteListObject queryWhiteListObjectById(Integer id);
|
||||||
@@ -40,7 +42,8 @@ public interface WhiteListMapper {
|
|||||||
|
|
||||||
List<WhiteListObject> whiteListCommandCheck(@Param("command") FiveTupleWithMask fiveTupleWithMaskInCommand);
|
List<WhiteListObject> whiteListCommandCheck(@Param("command") FiveTupleWithMask fiveTupleWithMaskInCommand);
|
||||||
|
|
||||||
Integer queryWhiteListTotalNum(String whiteListName, Integer whiteListId);
|
Integer queryWhiteListTotalNum(String whiteListName, Integer whiteListId
|
||||||
|
, String systemName, Integer auditStatus, String creator);
|
||||||
|
|
||||||
List<WhiteListObject> whiteListCommandsCheck(List<TaskCommandInfo> taskCommandInfos);
|
List<WhiteListObject> whiteListCommandsCheck(List<TaskCommandInfo> taskCommandInfos);
|
||||||
|
|
||||||
|
|||||||
@@ -113,8 +113,9 @@ public class WhiteListService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<WhiteListObject> queryWhiteListObject(String whiteListName, Integer whiteListId,
|
public List<WhiteListObject> queryWhiteListObject(String whiteListName, Integer whiteListId,
|
||||||
|
String systemName, Integer auditStatus, String creator,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
return whiteListMapper.queryWhiteListObject(whiteListName, whiteListId, page, pageSize);
|
return whiteListMapper.queryWhiteListObject(whiteListName, whiteListId, systemName, auditStatus, creator, page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WhiteListObject queryWhiteListObjectById(Integer id) {
|
public WhiteListObject queryWhiteListObjectById(Integer id) {
|
||||||
@@ -186,8 +187,9 @@ public class WhiteListService {
|
|||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryWhiteListTotalNum(String whiteListName, Integer whiteListId){
|
public Integer queryWhiteListTotalNum(String whiteListName, Integer whiteListId
|
||||||
return whiteListMapper.queryWhiteListTotalNum(whiteListName, whiteListId);
|
, String systemName, Integer auditStatus, String creator){
|
||||||
|
return whiteListMapper.queryWhiteListTotalNum(whiteListName, whiteListId, systemName, auditStatus, creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,13 @@
|
|||||||
<if test="auditStatus != null">
|
<if test="auditStatus != null">
|
||||||
and t_dynamic_rule.audit_status = #{auditStatus}
|
and t_dynamic_rule.audit_status = #{auditStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="eventType != null and eventType !=''">
|
||||||
|
and t_strategy_template.strategy_template_name = #{eventType}
|
||||||
|
</if>
|
||||||
|
<if test="protectLevel != null">
|
||||||
|
and t_dynamic_rule.dynamic_rule_protect_level = #{protectLevel}
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
@@ -250,8 +257,15 @@
|
|||||||
<if test="auditStatus != null">
|
<if test="auditStatus != null">
|
||||||
and t_dynamic_rule.audit_status = #{auditStatus}
|
and t_dynamic_rule.audit_status = #{auditStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="eventType != null and eventType !=''">
|
||||||
|
and t_strategy_template.strategy_template_name = #{eventType}
|
||||||
|
</if>
|
||||||
|
<if test="protectLevel != null">
|
||||||
|
and t_dynamic_rule.dynamic_rule_protect_level = #{protectLevel}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryDynamicRuleByIds"
|
<select id="queryDynamicRuleByIds"
|
||||||
resultMap="dynamicRulePageQueryMap">
|
resultMap="dynamicRulePageQueryMap">
|
||||||
select *
|
select *
|
||||||
@@ -286,11 +300,12 @@
|
|||||||
from t_dynamic_rule
|
from t_dynamic_rule
|
||||||
where dynamic_rule_id = #{dynamicRuleId}
|
where dynamic_rule_id = #{dynamicRuleId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryAuditStatusByIds" resultType="java.lang.Integer">
|
<select id="queryAuditStatusByIds" resultType="java.lang.Integer">
|
||||||
select audit_status
|
select audit_status
|
||||||
from t_dynamic_rule
|
from t_dynamic_rule
|
||||||
where dynamic_rule_id in
|
where dynamic_rule_id in
|
||||||
<foreach collection="idsWithAuditStatusMap" item="id" open="(" separator="," close=")">
|
<foreach collection="idWithAuditStatusBatch" item="id" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -152,9 +152,27 @@
|
|||||||
<if test="static_rule_create_username != null and static_rule_create_username != ''">
|
<if test="static_rule_create_username != null and static_rule_create_username != ''">
|
||||||
AND static_rule_create_username like concat('%', #{static_rule_create_username}, '%')
|
AND static_rule_create_username like concat('%', #{static_rule_create_username}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="ip != null and ip != ''">
|
<if test="sip != null and sip != ''">
|
||||||
AND (static_rule_sip = INET_ATON(#{ip}) or static_rule_msip = INET_ATON(#{ip})
|
AND ((static_rule_msip IS NULL AND static_rule_sip = INET_ATON(#{sip}))
|
||||||
or static_rule_dip = INET_ATON(#{ip}) or static_rule_mdip = INET_ATON(#{ip}))
|
OR (
|
||||||
|
static_rule_msip IS NOT NULL AND ( static_rule_sip & static_rule_msip) =
|
||||||
|
(INET_ATON(#{sip}) & static_rule_msip)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="dip != null and dip != ''">
|
||||||
|
AND ((static_rule_mdip IS NULL AND static_rule_dip = INET_ATON(#{dip}))
|
||||||
|
OR (
|
||||||
|
static_rule_mdip IS NOT NULL AND ( static_rule_dip & static_rule_mdip) =
|
||||||
|
(INET_ATON(#{dip}) & static_rule_mdip)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="sport != null">
|
||||||
|
AND static_rule_sport = #{sport}
|
||||||
|
</if>
|
||||||
|
<if test="dport != null">
|
||||||
|
AND static_rule_dport = #{dport}
|
||||||
</if>
|
</if>
|
||||||
<if test="auditStatus != null">
|
<if test="auditStatus != null">
|
||||||
AND static_rule_audit_status = #{auditStatus}
|
AND static_rule_audit_status = #{auditStatus}
|
||||||
@@ -187,9 +205,27 @@
|
|||||||
<if test="static_rule_create_username != null and static_rule_create_username != ''">
|
<if test="static_rule_create_username != null and static_rule_create_username != ''">
|
||||||
AND static_rule_create_username like concat('%', #{static_rule_create_username}, '%')
|
AND static_rule_create_username like concat('%', #{static_rule_create_username}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="ip != null and ip != ''">
|
<if test="sip != null and sip != ''">
|
||||||
AND (static_rule_sip = INET_ATON(#{ip}) or static_rule_msip = INET_ATON(#{ip})
|
AND ((static_rule_msip IS NULL AND static_rule_sip = INET_ATON(#{sip}))
|
||||||
or static_rule_dip = INET_ATON(#{ip}) or static_rule_mdip = INET_ATON(#{ip}))
|
OR (
|
||||||
|
static_rule_msip IS NOT NULL AND ( static_rule_sip & static_rule_msip) =
|
||||||
|
(INET_ATON(#{sip}) & static_rule_msip)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="dip != null and dip != ''">
|
||||||
|
AND ((static_rule_mdip IS NULL AND static_rule_dip = INET_ATON(#{dip}))
|
||||||
|
OR (
|
||||||
|
static_rule_mdip IS NOT NULL AND ( static_rule_dip & static_rule_mdip) =
|
||||||
|
(INET_ATON(#{dip}) & static_rule_mdip)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="sport != null">
|
||||||
|
AND static_rule_sport = #{sport}
|
||||||
|
</if>
|
||||||
|
<if test="dport != null">
|
||||||
|
AND static_rule_dport = #{dport}
|
||||||
</if>
|
</if>
|
||||||
<if test="auditStatus != null">
|
<if test="auditStatus != null">
|
||||||
AND static_rule_audit_status = #{auditStatus}
|
AND static_rule_audit_status = #{auditStatus}
|
||||||
|
|||||||
@@ -61,7 +61,14 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="queryTasks" resultMap="taskMap">
|
<select id="queryTasks" resultMap="taskMap">
|
||||||
SELECT * FROM t_task
|
SELECT t_task.* FROM t_task
|
||||||
|
<if test="rule_name != null">
|
||||||
|
LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id
|
||||||
|
LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
|
||||||
|
WHERE
|
||||||
|
t_static_rule.static_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
|
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
|
</if>
|
||||||
<where>
|
<where>
|
||||||
<if test="task_status != null">
|
<if test="task_status != null">
|
||||||
AND task_status = #{task_status}
|
AND task_status = #{task_status}
|
||||||
@@ -78,6 +85,19 @@
|
|||||||
<if test="task_audit_status != null">
|
<if test="task_audit_status != null">
|
||||||
AND task_audit_status = #{task_audit_status}
|
AND task_audit_status = #{task_audit_status}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="task_audit_status != null">
|
||||||
|
AND task_audit_status = #{task_audit_status}
|
||||||
|
</if>
|
||||||
|
<if test="task_act != null">
|
||||||
|
AND task_act LIKE CONCAT('%', #{task_act}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="task_auditor != null">
|
||||||
|
AND task_audit_username LIKE CONCAT('%', #{task_auditor}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="task_source != null">
|
||||||
|
AND task_source LIKE CONCAT('%', #{task_source}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page - 1) * page_size}, #{page_size}
|
LIMIT ${(page - 1) * page_size}, #{page_size}
|
||||||
</select>
|
</select>
|
||||||
@@ -315,6 +335,13 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="queryTaskTotalNum" resultType="java.lang.Integer">
|
<select id="queryTaskTotalNum" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*) FROM t_task
|
SELECT COUNT(*) FROM t_task
|
||||||
|
<if test="rule_name != null">
|
||||||
|
LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id
|
||||||
|
LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
|
||||||
|
WHERE
|
||||||
|
t_static_rule.static_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
|
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
|
</if>
|
||||||
<where>
|
<where>
|
||||||
<if test="task_status != null">
|
<if test="task_status != null">
|
||||||
AND task_status = #{task_status}
|
AND task_status = #{task_status}
|
||||||
@@ -331,6 +358,15 @@
|
|||||||
<if test="audit_status != null">
|
<if test="audit_status != null">
|
||||||
AND task_audit_status = #{audit_status}
|
AND task_audit_status = #{audit_status}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="task_act != null">
|
||||||
|
AND task_act LIKE CONCAT('%', #{task_act}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="task_auditor != null">
|
||||||
|
AND task_audit_username LIKE CONCAT('%', #{task_auditor}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="task_source != null">
|
||||||
|
AND task_source LIKE CONCAT('%', #{task_source}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,12 @@
|
|||||||
<if test="template_name != null">
|
<if test="template_name != null">
|
||||||
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
|
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="template_id != null">
|
||||||
|
AND strategy_template_id = #{template_id}
|
||||||
|
</if>
|
||||||
|
<if test="audit_status != null">
|
||||||
|
AND audit_status = #{audit_status}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page - 1) * page_size}, #{page_size}
|
LIMIT ${(page - 1) * page_size}, #{page_size}
|
||||||
</select>
|
</select>
|
||||||
@@ -155,11 +161,11 @@
|
|||||||
<select id="queryAuditTemplateTotalNum" resultType="java.lang.Integer">
|
<select id="queryAuditTemplateTotalNum" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM t_strategy_template
|
FROM t_strategy_template
|
||||||
WHERE audit_state = #{auditState}
|
WHERE audit_status = #{auditState}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryAuditStatusById" resultType="java.lang.Integer">
|
<select id="queryAuditStatusById" resultType="java.lang.Integer">
|
||||||
SELECT audit_state
|
SELECT audit_status
|
||||||
FROM t_strategy_template
|
FROM t_strategy_template
|
||||||
WHERE strategy_template_id = #{id}
|
WHERE strategy_template_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
@@ -178,7 +184,7 @@
|
|||||||
|
|
||||||
<update id="updateAuditStatusById">
|
<update id="updateAuditStatusById">
|
||||||
UPDATE t_strategy_template
|
UPDATE t_strategy_template
|
||||||
SET audit_state = #{auditStatus}
|
SET audit_status = #{auditStatus}
|
||||||
WHERE strategy_template_id = #{id}
|
WHERE strategy_template_id = #{id}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -59,6 +59,15 @@
|
|||||||
<if test="whiteListId != null">
|
<if test="whiteListId != null">
|
||||||
and white_list_id = #{whiteListId}
|
and white_list_id = #{whiteListId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="systemName != null">
|
||||||
|
and white_list_system_name like concat('%', #{systemName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="auditStatus != null">
|
||||||
|
and white_list_audit_status = #{auditStatus}
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
and create_username = #{creator}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
@@ -209,6 +218,15 @@
|
|||||||
<if test="whiteListId != null">
|
<if test="whiteListId != null">
|
||||||
and white_list_id = #{whiteListId}
|
and white_list_id = #{whiteListId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="systemName != null">
|
||||||
|
and white_list_system_name like concat('%', #{systemName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="auditStatus != null">
|
||||||
|
and white_list_audit_status = #{auditStatus}
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
and create_username = #{creator}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class AlertMessageTest {
|
|||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
null, null, 1, 1);
|
null, null, 1, 1);
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
null, null, null,1, 1);
|
null, null, null, null, null,1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("UpdateDynamicRule2");
|
object.setDynamicRuleName("UpdateDynamicRule2");
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class TemplateServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testQueryTemplate() {
|
void testQueryTemplate() {
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
null, null, null,1, 5);
|
null, null, null,null, null,1, 5);
|
||||||
templates.forEach(item -> System.out.println(item)) ;
|
templates.forEach(item -> System.out.println(item)) ;
|
||||||
//// assertEquals(5, templates.size());
|
//// assertEquals(5, templates.size());
|
||||||
// for (Template template : templates) {i
|
// for (Template template : templates) {i
|
||||||
@@ -97,7 +97,7 @@ class TemplateServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testUpdateTemplateSuccess() {
|
void testUpdateTemplateSuccess() {
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
"DDOS", null, null, 1, 1);
|
"DDOS", null, null, null, null,1, 1);
|
||||||
Template testTemplate = templates.get(0);
|
Template testTemplate = templates.get(0);
|
||||||
testTemplate.setTemplateName("洪泛型DDOS攻击-" + LocalDateTime.now());
|
testTemplate.setTemplateName("洪泛型DDOS攻击-" + LocalDateTime.now());
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ class TemplateServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testUpdateTemplateAuditStatus(){
|
void testUpdateTemplateAuditStatus(){
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
null, null, null, 1, 1);
|
null, null, null, null, null,1, 1);
|
||||||
Template testTemplate = templates.get(0);
|
Template testTemplate = templates.get(0);
|
||||||
templateService.updateAuditStatus(testTemplate.getTemplateId(), 2);
|
templateService.updateAuditStatus(testTemplate.getTemplateId(), 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class DynamicRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
null,null,null,null,
|
null,null,null,null,
|
||||||
null,null, 1, 1);
|
null,null, 1, 1);
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
null, null, null, 1, 1);
|
null, null, null, null, null,1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("UpdateDynamicRule2");
|
object.setDynamicRuleName("UpdateDynamicRule2");
|
||||||
@@ -71,7 +71,7 @@ public class DynamicRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
null,
|
null,
|
||||||
1, 1);
|
1, 1);
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
null, null,null, 1, 1);
|
null, null,null, null, null,1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("UpdateDynamicRule2");
|
object.setDynamicRuleName("UpdateDynamicRule2");
|
||||||
@@ -129,24 +129,24 @@ public class DynamicRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testQueryDynamicRuleObject() {
|
void testQueryDynamicRuleObject() {
|
||||||
List<DynamicRuleObject> objects = dynamicRuleService.queryDynamicRuleObject(
|
List<DynamicRuleObject> objects = dynamicRuleService.queryDynamicRuleObject(
|
||||||
null,null,null, null,2,1, 10);
|
null,null,null, null,2,null,null,null,1, 10);
|
||||||
System.out.println(objects);
|
System.out.println(objects);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void testQueryDynamicRuleTotalNum(){
|
void testQueryDynamicRuleTotalNum(){
|
||||||
Integer num = dynamicRuleService.queryDynamicRuleTotalNum(
|
Integer num = dynamicRuleService.queryDynamicRuleTotalNum(
|
||||||
null,null,null,null,null);
|
null,null,null,null,null,null,null,null);
|
||||||
System.out.println(num);
|
System.out.println(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testUpdateDynamicRuleAuditStatusBatch(){
|
void testUpdateDynamicRuleAuditStatusBatch(){
|
||||||
Map<Integer, Integer> map = new HashMap<>();
|
Map<Integer, Integer> map = new HashMap<>();
|
||||||
map.put(101, 1);
|
// map.put(101, 1);
|
||||||
map.put(102, 2);
|
map.put(110, 2);
|
||||||
map.put(103, 2);
|
map.put(112, 2);
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println(dynamicRuleMapper.queryAuditStatusByIds(map));
|
||||||
System.out.println(dynamicRuleService.updateAuditStatusBatch(map));
|
System.out.println(dynamicRuleService.updateAuditStatusBatch(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,13 +99,13 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryStaticRules(){
|
void testQueryStaticRules(){
|
||||||
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(null, null, null, null,2, 1, 10);
|
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(null, null, null, null,null, null, null,2, 1, 10);
|
||||||
System.out.println(staticRuleObjects);
|
System.out.println(staticRuleObjects);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void testUpdateStaticRuleAuditStatusBatch(){
|
void testUpdateStaticRuleAuditStatusBatch(){
|
||||||
Map<Integer, Integer> map = new HashMap<>();
|
Map<Integer, Integer> map = new HashMap<>();
|
||||||
map.put(1325, 0);
|
map.put(1300, 0);
|
||||||
map.put(1326, 1);
|
map.put(1326, 1);
|
||||||
map.put(1328, 1);
|
map.put(1328, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -73,14 +73,14 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
void testNewTaskSuccess() {
|
void testNewTaskSuccess() {
|
||||||
for (int i = 1; i < 10; i++) {
|
for (int i = 1; i < 10; i++) {
|
||||||
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
||||||
null, null, null, null,2, i, 2);
|
null, null, null, null,null, null, null,2, i, 2);
|
||||||
List<Integer> staticRuleIds = new ArrayList<>();
|
List<Integer> staticRuleIds = new ArrayList<>();
|
||||||
staticRuleObjects.forEach(staticRuleObject ->
|
staticRuleObjects.forEach(staticRuleObject ->
|
||||||
staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
||||||
task.setStaticRuleIds(staticRuleIds);
|
task.setStaticRuleIds(staticRuleIds);
|
||||||
|
|
||||||
List<DynamicRuleObject> dynamicRuleObjects = dynamicRuleService.queryDynamicRuleObject(
|
List<DynamicRuleObject> dynamicRuleObjects = dynamicRuleService.queryDynamicRuleObject(
|
||||||
null, null, null, null,null, i, 2
|
null, null, null, null,null, null,null,null,i, 2
|
||||||
);
|
);
|
||||||
List<Integer> dynamicRuleIds = new ArrayList<>();
|
List<Integer> dynamicRuleIds = new ArrayList<>();
|
||||||
dynamicRuleObjects.forEach(dynamicRuleObject ->
|
dynamicRuleObjects.forEach(dynamicRuleObject ->
|
||||||
@@ -107,7 +107,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPageQueryTask(){
|
void testPageQueryTask(){
|
||||||
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, 1, 10);
|
List<Task> tasks = taskService.queryTasks(null, null, null, null, null,null, null, null, null, 1, 10);
|
||||||
System.out.println(tasks);
|
System.out.println(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,14 +120,14 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
task.setTaskName(testName);
|
task.setTaskName(testName);
|
||||||
task.setTaskCreateUsername(testCreateName);
|
task.setTaskCreateUsername(testCreateName);
|
||||||
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
||||||
null, null, null, null, null,1, 5);
|
null, null, null, null, null,null, null, null,1, 5);
|
||||||
List<Integer> staticRuleIds = new ArrayList<>();
|
List<Integer> staticRuleIds = new ArrayList<>();
|
||||||
staticRuleObjects.forEach(staticRuleObject ->
|
staticRuleObjects.forEach(staticRuleObject ->
|
||||||
staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
||||||
task.setStaticRuleIds(staticRuleIds);
|
task.setStaticRuleIds(staticRuleIds);
|
||||||
|
|
||||||
List<DynamicRuleObject> dynamicRuleObjects = dynamicRuleService.queryDynamicRuleObject(
|
List<DynamicRuleObject> dynamicRuleObjects = dynamicRuleService.queryDynamicRuleObject(
|
||||||
null, null, null, null, null,1, 5
|
null, null, null, null, null,null, null, null, 1, 5
|
||||||
);
|
);
|
||||||
List<Integer> dynamicRuleIds = new ArrayList<>();
|
List<Integer> dynamicRuleIds = new ArrayList<>();
|
||||||
dynamicRuleObjects.forEach(dynamicRuleObject ->
|
dynamicRuleObjects.forEach(dynamicRuleObject ->
|
||||||
@@ -142,17 +142,17 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, 1, 10);
|
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 10);
|
||||||
assertEquals(10, tasks.size());
|
assertEquals(10, tasks.size());
|
||||||
|
|
||||||
tasks = taskService.queryTasks(0, null, null, null, null, 1, 10);
|
tasks = taskService.queryTasks(0, null, null, null, null,null, null, null, null, 1, 10);
|
||||||
assertEquals(10, tasks.size());
|
assertEquals(10, tasks.size());
|
||||||
tasks.forEach(task -> assertEquals(0, task.getTaskStatus()));
|
tasks.forEach(task -> assertEquals(0, task.getTaskStatus()));
|
||||||
|
|
||||||
tasks = taskService.queryTasks(null, 0, null, null, null, 1, 10);
|
tasks = taskService.queryTasks(null, 0, null, null, null, null, null, null, null,1, 10);
|
||||||
assertEquals(0, tasks.size());
|
assertEquals(0, tasks.size());
|
||||||
|
|
||||||
tasks = taskService.queryTasks(null, null, testName, null, null, 1, 10);
|
tasks = taskService.queryTasks(null, null, testName, null, null, null, null, null, null,1, 10);
|
||||||
assertEquals(10, tasks.size());
|
assertEquals(10, tasks.size());
|
||||||
tasks.forEach(task -> assertEquals(testName, task.getTaskName()));
|
tasks.forEach(task -> assertEquals(testName, task.getTaskName()));
|
||||||
}
|
}
|
||||||
@@ -160,11 +160,11 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testUpdateTasks() {
|
void testUpdateTasks() {
|
||||||
Task originalTask = taskService.queryTasks(
|
Task originalTask = taskService.queryTasks(
|
||||||
null, null, null, null, null, 1, 1)
|
null, null, null, null, null, null, null, null, null,1, 1)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(
|
||||||
null, null, null, null, null,1, 4
|
null, null, null, null, null,null, null, null,1, 4
|
||||||
);
|
);
|
||||||
List<Integer> staticRuleIds = new ArrayList<>();
|
List<Integer> staticRuleIds = new ArrayList<>();
|
||||||
staticRuleObjects.forEach(staticRuleObject -> staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
staticRuleObjects.forEach(staticRuleObject -> staticRuleIds.add(staticRuleObject.getStaticRuleId()));
|
||||||
@@ -177,7 +177,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDeleteTask() {
|
void testDeleteTask() {
|
||||||
long testNum = taskService.queryTasks(null, null, null, null, null, 1, 10)
|
long testNum = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 10)
|
||||||
.get(0).getTaskId();
|
.get(0).getTaskId();
|
||||||
|
|
||||||
assertTrue(taskService.deleteTask(testNum));
|
assertTrue(taskService.deleteTask(testNum));
|
||||||
@@ -186,7 +186,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testChangeAuditStatus() {
|
void testChangeAuditStatus() {
|
||||||
long testNum = taskService.queryTasks(null, null, null, null, null, 1, 1)
|
long testNum = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 1)
|
||||||
.get(0).getTaskId();
|
.get(0).getTaskId();
|
||||||
|
|
||||||
assertTrue(taskService.changeTaskAuditStatus(testNum, 2));
|
assertTrue(taskService.changeTaskAuditStatus(testNum, 2));
|
||||||
@@ -294,7 +294,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
null, null, 1, 1);
|
null, null, 1, 1);
|
||||||
List<Template> templates = templateService.queryTemplates(
|
List<Template> templates = templateService.queryTemplates(
|
||||||
null, null, null,1, 1);
|
null, null, null,null, null,1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("testStartDynamicTask");
|
object.setDynamicRuleName("testStartDynamicTask");
|
||||||
@@ -332,4 +332,25 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
System.out.println(commandService.queryCommandInfos(taskId, null, null, null, null, 1, 5));
|
System.out.println(commandService.queryCommandInfos(taskId, null, null, null, null, 1, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testUpdateDynamicRuleAuditStatusBatch(){
|
||||||
|
Map<Integer, Integer> map = new HashMap<>();
|
||||||
|
// map.put(101, 1);
|
||||||
|
map.put(43848, 0);
|
||||||
|
map.put(43849,0);
|
||||||
|
|
||||||
|
// System.out.println(dynamicRuleMapper.queryAuditStatusByIds(map));
|
||||||
|
System.out.println(taskService.updateAuditStatusBatch(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testQueryDynamicRuleAuditStatus(){
|
||||||
|
System.out.println(taskService.queryTaskAuditStatus(43848L));
|
||||||
|
Map<Integer, Integer> map = new HashMap<>();
|
||||||
|
map.put(43848, 0);
|
||||||
|
map.put(43849,0);
|
||||||
|
System.out.println(taskService.queryAuditStatusBatch(map));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ class CommandServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void mockCommand() {
|
void mockCommand() {
|
||||||
Task task = taskService.queryTasks(null, null, null, null, null, 1, 1).get(0);
|
Task task = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 1).get(0);
|
||||||
FiveTupleWithMask fiveTupleWithMask = new FiveTupleWithMask();
|
FiveTupleWithMask fiveTupleWithMask = new FiveTupleWithMask();
|
||||||
fiveTupleWithMask.setMaskSourceIP("192.168.155.24");
|
fiveTupleWithMask.setMaskSourceIP("192.168.155.24");
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class CommandServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void createCommands() {
|
void createCommands() {
|
||||||
List<TaskCommandInfo> taskCommandInfos = ListUtils.newArrayListWithExpectedSize(100);
|
List<TaskCommandInfo> taskCommandInfos = ListUtils.newArrayListWithExpectedSize(100);
|
||||||
Task task = taskService.queryTasks(null, null, null, null, null, 1, 1).get(0);
|
Task task = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 1).get(0);
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
int port = i + 1000;
|
int port = i + 1000;
|
||||||
TaskCommandInfo taskCommandInfo = new TaskCommandInfo();
|
TaskCommandInfo taskCommandInfo = new TaskCommandInfo();
|
||||||
@@ -92,7 +92,7 @@ class CommandServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void queryCommandInfos() {
|
void queryCommandInfos() {
|
||||||
Task task = taskService.queryTasks(null, null, null, null, null, 1, 1).get(0);
|
Task task = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 1).get(0);
|
||||||
List<TaskCommandInfo> taskCommandInfos = commandService.queryCommandInfos(task.getTaskId(),
|
List<TaskCommandInfo> taskCommandInfos = commandService.queryCommandInfos(task.getTaskId(),
|
||||||
null, null, null, null,1, 5);
|
null, null, null, null,1, 5);
|
||||||
assertTrue(taskCommandInfos != null && !taskCommandInfos.isEmpty());
|
assertTrue(taskCommandInfos != null && !taskCommandInfos.isEmpty());
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class WhiteListServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
Integer id = staticRuleService.newStaticRuleObject(staticRuleTest);
|
Integer id = staticRuleService.newStaticRuleObject(staticRuleTest);
|
||||||
List<Integer> ruleIds = new ArrayList<>(List.of(id));
|
List<Integer> ruleIds = new ArrayList<>(List.of(id));
|
||||||
List<StaticRuleObject> staticRules= staticRuleService.queryStaticRule(null,null,null,null,null,1,2);
|
List<StaticRuleObject> staticRules= staticRuleService.queryStaticRule(null,null,null,null,null,null, null, null,1,2);
|
||||||
for (StaticRuleObject staticRule : staticRules) {
|
for (StaticRuleObject staticRule : staticRules) {
|
||||||
ruleIds.add(staticRule.getStaticRuleId());
|
ruleIds.add(staticRule.getStaticRuleId());
|
||||||
}
|
}
|
||||||
@@ -128,4 +128,10 @@ class WhiteListServiceTest extends ProtectionApplicationTests {
|
|||||||
whiteListService.newWhiteListObject(whiteListObject);
|
whiteListService.newWhiteListObject(whiteListObject);
|
||||||
System.out.println(whiteListService.whiteListStaticRulesCheck(ruleIds));
|
System.out.println(whiteListService.whiteListStaticRulesCheck(ruleIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testQueryWhiteListObject() {
|
||||||
|
List<WhiteListObject> whiteListObjects = whiteListService.queryWhiteListObject(null, null, null, null, null, 1, 2);
|
||||||
|
System.out.println(whiteListObjects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user