1、规则查询增加审批人、创建日期查询条件
2、任务查询增加事件类型、创建日期、开始日期查询条件
This commit is contained in:
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -125,17 +126,25 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
|||||||
@RequestParam(value = "event_type", required = false) String eventType,
|
@RequestParam(value = "event_type", required = false) String eventType,
|
||||||
@RequestParam(value = "protect_level", required = false) Integer protectLevel,
|
@RequestParam(value = "protect_level", required = false) Integer protectLevel,
|
||||||
@RequestParam(value = "template_name", required = false) String templateName,
|
@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
|
@RequestParam(name = "auditUserName", required = false) String auditUserName,
|
||||||
|
@RequestParam(name = "createTime", required = false) LocalDate createTime,
|
||||||
|
|
||||||
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
log.info("分页查询动态规则: {}:{}:{}:{}", dynamicRuleName, dynamicRuleId, page, pageSize);
|
// log.info("分页查询动态规则: {}:{}:{}:{}", dynamicRuleName, dynamicRuleId, page, pageSize);
|
||||||
//调用service查询
|
//调用service查询
|
||||||
|
String createDateStr = null;
|
||||||
|
if (createTime != null) {
|
||||||
|
createDateStr = createTime.toString();
|
||||||
|
}
|
||||||
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, eventType, protectLevel, templateName, page, pageSize))
|
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName,
|
||||||
|
auditUserName, createDateStr, page, pageSize))
|
||||||
.setData("total_num", dynamicRuleService.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
.setData("total_num", dynamicRuleService.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
||||||
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName));
|
protectObjectSourceSystem, creator, auditStatus, eventType,
|
||||||
|
protectLevel, templateName, auditUserName, createDateStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
//详情查看?? 就是按id查询吧
|
//详情查看?? 就是按id查询吧
|
||||||
@@ -217,7 +226,8 @@ 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, 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())
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import jakarta.validation.Valid;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -351,7 +352,9 @@ public interface DynamicRuleControllerApi {
|
|||||||
@Parameter(name = "audit_status", description = "审核状态", example = "1"),
|
@Parameter(name = "audit_status", description = "审核状态", example = "1"),
|
||||||
@Parameter(name = "event_type", description = "事件类型", example = "反射型DDOS"),
|
@Parameter(name = "event_type", description = "事件类型", example = "反射型DDOS"),
|
||||||
@Parameter(name = "protect_level", description = "保护级别", example = "1"),
|
@Parameter(name = "protect_level", description = "保护级别", example = "1"),
|
||||||
// @Parameter(name = "template_name", description = "模板名称", example = "test"),
|
@Parameter(name = "auditUserName", description = "审核用户名称", example = "user1"),
|
||||||
|
@Parameter(name = "createTime", description = "创建日期,不跟具体时间吧", example = "2024-04-25"),
|
||||||
|
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "pageSize", description = "每页大小", example = "10")
|
@Parameter(name = "pageSize", description = "每页大小", example = "10")
|
||||||
}
|
}
|
||||||
@@ -364,6 +367,9 @@ public interface DynamicRuleControllerApi {
|
|||||||
@RequestParam(value = "event_type", required = false) String eventType,
|
@RequestParam(value = "event_type", required = false) String eventType,
|
||||||
@RequestParam(value = "protect_level", required = false) Integer protectLevel,
|
@RequestParam(value = "protect_level", required = false) Integer protectLevel,
|
||||||
@RequestParam(value = "template_name", required = false) String templateName,
|
@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
|
@RequestParam(name = "auditUserName", required = false) String auditUserName,
|
||||||
|
@RequestParam(name = "createTime", required = false) LocalDate createTime,
|
||||||
|
|
||||||
@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);
|
||||||
@Operation(
|
@Operation(
|
||||||
|
|||||||
@@ -33,6 +33,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,
|
String eventType, Integer protectLevel, String templateName,
|
||||||
|
String auditUserName, String createDate,
|
||||||
Integer page, Integer pageSize);
|
Integer page, Integer pageSize);
|
||||||
|
|
||||||
void deleteDynamicRuleProtectObjectConcat(Integer dynamicRuleId);
|
void deleteDynamicRuleProtectObjectConcat(Integer dynamicRuleId);
|
||||||
@@ -45,7 +46,8 @@ public interface DynamicRuleMapper {
|
|||||||
|
|
||||||
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);
|
, String eventType, Integer protectLevel, String templateName,
|
||||||
|
String auditUserName, String createDate);
|
||||||
|
|
||||||
List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids);
|
List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.realtime.protection.server.rule.dynamicrule;
|
package com.realtime.protection.server.rule.dynamicrule;
|
||||||
|
|
||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.realtime.protection.configuration.entity.defense.template.Template;
|
|
||||||
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
|
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
|
||||||
import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRuleObject;
|
import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRuleObject;
|
||||||
import com.realtime.protection.configuration.utils.Counter;
|
import com.realtime.protection.configuration.utils.Counter;
|
||||||
@@ -191,16 +190,18 @@ 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,
|
String eventType, Integer protectLevel, String templateName,
|
||||||
|
String auditUserName, String createDate,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
return dynamicRuleMapper.queryDynamicRuleObject(dynamicRuleName, dynamicRuleId,
|
return dynamicRuleMapper.queryDynamicRuleObject(dynamicRuleName, dynamicRuleId,
|
||||||
templateSourceSystem, creator, auditStatus, eventType, protectLevel, templateName, page, pageSize);
|
templateSourceSystem, creator, auditStatus, eventType, protectLevel, templateName, auditUserName, createDate, 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, String eventType, Integer protectLevel, String templateName) {
|
Integer auditStatus, String eventType, Integer protectLevel,
|
||||||
|
String templateName,String auditUserName, String createDate) {
|
||||||
return dynamicRuleMapper.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
return dynamicRuleMapper.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
|
||||||
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName);
|
protectObjectSourceSystem, creator, auditStatus, eventType, protectLevel, templateName,auditUserName, createDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids) {
|
public List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -157,18 +158,26 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
@RequestParam(name = "dip", required = false) String static_rule_dip,
|
@RequestParam(name = "dip", required = false) String static_rule_dip,
|
||||||
@RequestParam(name = "dport", required = false) Integer static_rule_dport,
|
@RequestParam(name = "dport", required = false) Integer static_rule_dport,
|
||||||
@RequestParam(name = "auditStatus", required = false) Integer auditStatus,
|
@RequestParam(name = "auditStatus", required = false) Integer auditStatus,
|
||||||
|
@RequestParam(name = "auditUserName", required = false) String auditUserName,
|
||||||
|
@RequestParam(name = "createTime", required = false) LocalDate createTime,
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
@RequestParam(defaultValue = "1") Integer page,
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize
|
@RequestParam(defaultValue = "10") Integer pageSize
|
||||||
) {
|
) {
|
||||||
log.info("多查询静态规则: {},{},{},{}", static_rule_name, static_rule_id, page, pageSize);
|
// log.info("多查询静态规则: {},{},{},{}", static_rule_name, static_rule_id, page, pageSize);
|
||||||
//调用service新增
|
//调用service新增
|
||||||
|
String createDateStr = null;
|
||||||
|
if (createTime != null) {
|
||||||
|
createDateStr = createTime.toString();
|
||||||
|
}
|
||||||
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_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus, page, pageSize);
|
static_rule_creator, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus,
|
||||||
|
auditUserName, createDateStr, 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_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus));
|
static_rule_creator, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus
|
||||||
|
, auditUserName, createDateStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -258,7 +267,10 @@ 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, null, null, null))
|
.setData("static_rule_num", staticRuleService.queryStaticRuleTotalNum(
|
||||||
|
null, null, 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())
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -211,6 +213,8 @@ public interface StaticRuleControllerApi {
|
|||||||
@Parameter(name = "dip", description = "静态规则ip,匹配目的ip并考虑掩码"),
|
@Parameter(name = "dip", description = "静态规则ip,匹配目的ip并考虑掩码"),
|
||||||
@Parameter(name = "dport", description = "静态规则port,匹配目的port"),
|
@Parameter(name = "dport", description = "静态规则port,匹配目的port"),
|
||||||
@Parameter(name = "auditStatus", description = "静态规则审核状态"),
|
@Parameter(name = "auditStatus", description = "静态规则审核状态"),
|
||||||
|
@Parameter(name = "auditUserName", description = "静态规则审核用户名称"),
|
||||||
|
@Parameter(name = "createTime", description = "静态规则创建时间"),
|
||||||
@Parameter(name = "page", description = "页码"),
|
@Parameter(name = "page", description = "页码"),
|
||||||
@Parameter(name = "pageSize", description = "每页条数")
|
@Parameter(name = "pageSize", description = "每页条数")
|
||||||
}
|
}
|
||||||
@@ -223,6 +227,8 @@ public interface StaticRuleControllerApi {
|
|||||||
@RequestParam(required = false) String static_rule_dip,
|
@RequestParam(required = false) String static_rule_dip,
|
||||||
@RequestParam(required = false) Integer static_rule_dport,
|
@RequestParam(required = false) Integer static_rule_dport,
|
||||||
@RequestParam(required = false) Integer auditStatus,
|
@RequestParam(required = false) Integer auditStatus,
|
||||||
|
@RequestParam(required = false) String auditUserName,
|
||||||
|
@RequestParam(required = false) LocalDate createTime,
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
@RequestParam(defaultValue = "1") Integer page,
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize
|
@RequestParam(defaultValue = "10") Integer pageSize
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Delete;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ 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 sip,
|
String static_rule_create_username, String sip,
|
||||||
Integer sport, String dip, Integer dport,
|
Integer sport, String dip, Integer dport,
|
||||||
Integer auditStatus,
|
Integer auditStatus, String auditUserName, String createDate,
|
||||||
Integer page, Integer pageSize);
|
Integer page, Integer pageSize);
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public interface StaticRuleMapper {
|
|||||||
String static_rule_create_username,
|
String static_rule_create_username,
|
||||||
String sip, Integer sport,
|
String sip, Integer sport,
|
||||||
String dip, Integer dport,
|
String dip, Integer dport,
|
||||||
Integer auditStatus);
|
Integer auditStatus,String auditUserName, String createDate);
|
||||||
|
|
||||||
List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids);
|
List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids);
|
||||||
|
|
||||||
|
|||||||
@@ -180,11 +180,12 @@ public class StaticRuleService {
|
|||||||
String creator,
|
String creator,
|
||||||
String static_rule_sip, Integer static_rule_sport,
|
String static_rule_sip, Integer static_rule_sport,
|
||||||
String static_rule_dip, Integer static_rule_dport,
|
String static_rule_dip, Integer static_rule_dport,
|
||||||
Integer auditStatus,
|
Integer auditStatus, String auditUserName, String createTime,
|
||||||
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, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus, page, pageSize);
|
creator, static_rule_sip, static_rule_sport, static_rule_dip, static_rule_dport, auditStatus,
|
||||||
|
auditUserName, createTime,page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean newStaticRuleObjects(List<StaticRuleObject> staticRuleList) {
|
public Boolean newStaticRuleObjects(List<StaticRuleObject> staticRuleList) {
|
||||||
@@ -260,10 +261,11 @@ public class StaticRuleService {
|
|||||||
String static_rule_creator,
|
String static_rule_creator,
|
||||||
String static_rule_sip, Integer static_rule_sport,
|
String static_rule_sip, Integer static_rule_sport,
|
||||||
String static_rule_dip, Integer static_rule_dport,
|
String static_rule_dip, Integer static_rule_dport,
|
||||||
Integer auditStatus) {
|
Integer auditStatus,
|
||||||
|
String auditUserName, String createTime) {
|
||||||
return staticRuleMapper.queryStaticRuleTotalNum(static_rule_name, static_rule_id,
|
return staticRuleMapper.queryStaticRuleTotalNum(static_rule_name, static_rule_id,
|
||||||
static_rule_creator, static_rule_sip, static_rule_sport,
|
static_rule_creator, static_rule_sip, static_rule_sport,
|
||||||
static_rule_dip, static_rule_dport, auditStatus);
|
static_rule_dip, static_rule_dport, auditStatus, auditUserName, createTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids) {
|
public List<StaticRuleObject> queryStaticRuleByIds(List<Integer> ids) {
|
||||||
@@ -372,8 +374,7 @@ public class StaticRuleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> queryAuditStatusByIds(Map<Integer, Integer> idsWithAuditStatusMap) {
|
public List<Integer> queryAuditStatusByIds(Map<Integer, Integer> idsWithAuditStatusMap) {
|
||||||
List<Integer> originalAuditStatusList = staticRuleMapper.queryAuditStatusByIds(idsWithAuditStatusMap);
|
return staticRuleMapper.queryAuditStatusByIds(idsWithAuditStatusMap);
|
||||||
return originalAuditStatusList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryAuditStaticRuleTotalNum(Integer auditStatus) {
|
public Integer queryAuditStaticRuleTotalNum(Integer auditStatus) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -94,14 +95,28 @@ public class TaskController implements TaskControllerApi {
|
|||||||
@RequestParam(value = "task_auditor", required = false) String taskAuditor,
|
@RequestParam(value = "task_auditor", required = false) String taskAuditor,
|
||||||
@RequestParam(value = "task_source", required = false) String taskSource,
|
@RequestParam(value = "task_source", required = false) String taskSource,
|
||||||
@RequestParam(value = "rule_name", required = false) String ruleName,
|
@RequestParam(value = "rule_name", required = false) String ruleName,
|
||||||
|
@RequestParam(value = "event_type", required = false) String eventType,
|
||||||
|
@RequestParam(value = "create_time", required = false) LocalDate createTime,
|
||||||
|
@RequestParam(value = "start_time", required = false) LocalDate startTime,
|
||||||
|
|
||||||
@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) {
|
||||||
|
|
||||||
|
|
||||||
|
String createDateStr = null , startTimeStr = null;
|
||||||
|
if (createTime != null) {
|
||||||
|
createDateStr = createTime.toString();
|
||||||
|
}
|
||||||
|
if(startTime != null) {
|
||||||
|
startTimeStr = startTime.toString();
|
||||||
|
}
|
||||||
List<Task> tasks = taskService.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
List<Task> tasks = taskService.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
taskAct, taskAuditor, taskSource, ruleName, page, pageSize);
|
taskAct, taskAuditor, taskSource, ruleName,
|
||||||
|
eventType, createDateStr, startTimeStr, 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));
|
taskAct, taskAuditor, taskSource, ruleName,eventType, createDateStr, startTimeStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -239,11 +254,11 @@ public class TaskController implements TaskControllerApi {
|
|||||||
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,
|
||||||
null, null, null, null))
|
null, null, null, null,null,null,null))
|
||||||
.setData("running_num", taskService.queryTaskTotalNum(StateEnum.RUNNING.getStateNum(), null, null, null, null,
|
.setData("running_num", taskService.queryTaskTotalNum(StateEnum.RUNNING.getStateNum(), null, null, null, null,
|
||||||
null, null, null, null))
|
null, null, null, null,null,null,null))
|
||||||
.setData("finished_num", taskService.queryTaskTotalNum(StateEnum.FINISHED.getStateNum(), null, null, null, null,
|
.setData("finished_num", taskService.queryTaskTotalNum(StateEnum.FINISHED.getStateNum(), null, null, null, null,
|
||||||
null, null, null, null))
|
null, null, null, null,null,null,null))
|
||||||
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(
|
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(
|
||||||
AuditStatusEnum.PENDING.getNum()
|
AuditStatusEnum.PENDING.getNum()
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -191,6 +192,10 @@ public interface TaskControllerApi {
|
|||||||
@Parameter(name = "task_auditor", description = "任务审核人名称"),
|
@Parameter(name = "task_auditor", description = "任务审核人名称"),
|
||||||
@Parameter(name = "task_source", description = "任务来源系统"),
|
@Parameter(name = "task_source", description = "任务来源系统"),
|
||||||
@Parameter(name = "rule_name", description = "规则名称"),
|
@Parameter(name = "rule_name", description = "规则名称"),
|
||||||
|
@Parameter(name = "event_type", description = "事件类型"),
|
||||||
|
@Parameter(name = "create_time", description = "任务创建时间",example = "2021-01-01" ),
|
||||||
|
@Parameter(name = "start_time", description = "任务开始时间",example = "2024-04-25" ),
|
||||||
|
|
||||||
@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")
|
||||||
}
|
}
|
||||||
@@ -204,6 +209,10 @@ public interface TaskControllerApi {
|
|||||||
@RequestParam(value = "task_auditor", required = false) String taskAuditor,
|
@RequestParam(value = "task_auditor", required = false) String taskAuditor,
|
||||||
@RequestParam(value = "task_source", required = false) String taskSource,
|
@RequestParam(value = "task_source", required = false) String taskSource,
|
||||||
@RequestParam(value = "rule_name", required = false) String ruleName,
|
@RequestParam(value = "rule_name", required = false) String ruleName,
|
||||||
|
@RequestParam(value = "event_type", required = false) String eventType,
|
||||||
|
@RequestParam(value = "create_time", required = false) LocalDate createTime,
|
||||||
|
@RequestParam(value = "start_time", required = false) LocalDate startTime,
|
||||||
|
|
||||||
@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);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public interface TaskMapper {
|
|||||||
@Param("audit_status") Integer auditStatus,
|
@Param("audit_status") Integer auditStatus,
|
||||||
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
||||||
@Param("task_source")String taskSource, @Param("rule_name")String ruleName,
|
@Param("task_source")String taskSource, @Param("rule_name")String ruleName,
|
||||||
|
@Param("event_type")String eventType,
|
||||||
|
@Param("create_date") String createDateStr,
|
||||||
|
@Param("start_date")String startDateStr,
|
||||||
@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);
|
||||||
@@ -72,7 +75,10 @@ public interface TaskMapper {
|
|||||||
@Param("audit_status") Integer auditStatus,
|
@Param("audit_status") Integer auditStatus,
|
||||||
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
||||||
@Param("task_source")String taskSource, @Param("rule_name")String ruleName,
|
@Param("task_source")String taskSource, @Param("rule_name")String ruleName,
|
||||||
@Param("task_create_time") LocalDateTime taskCreateTime);
|
@Param("task_create_time") LocalDateTime taskCreateTime,
|
||||||
|
@Param("event_type")String eventType,
|
||||||
|
@Param("create_date")String createDate,
|
||||||
|
@Param("start_date")String startDate);
|
||||||
|
|
||||||
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,9 @@ import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValida
|
|||||||
import com.realtime.protection.server.rule.dynamicrule.DynamicRuleMapper;
|
import com.realtime.protection.server.rule.dynamicrule.DynamicRuleMapper;
|
||||||
import com.realtime.protection.server.rule.staticrule.StaticRuleMapper;
|
import com.realtime.protection.server.rule.staticrule.StaticRuleMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -221,10 +218,11 @@ public class TaskService {
|
|||||||
Integer auditStatus,
|
Integer auditStatus,
|
||||||
String taskAct, String taskAuditor,
|
String taskAct, String taskAuditor,
|
||||||
String taskSource, String ruleName,
|
String taskSource, String ruleName,
|
||||||
|
String eventType,String createDateStr, String startDateStr,
|
||||||
Integer page, Integer pageSize) {
|
Integer page, Integer pageSize) {
|
||||||
|
|
||||||
List<Task> tasks = taskMapper.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
List<Task> tasks = taskMapper.queryTasks(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
taskAct, taskAuditor, taskSource, ruleName, page, pageSize);
|
taskAct, taskAuditor, taskSource, ruleName,eventType, createDateStr, startDateStr, page, pageSize);
|
||||||
for (Task task : tasks) {
|
for (Task task : tasks) {
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
continue;
|
continue;
|
||||||
@@ -355,9 +353,10 @@ public class TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
,String taskAct, String taskAuditor, String taskSource, String ruleName) {
|
,String taskAct, String taskAuditor, String taskSource, String ruleName,
|
||||||
|
String eventType, String createDate, String startDate) {
|
||||||
return taskMapper.queryTaskTotalNum(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
return taskMapper.queryTaskTotalNum(taskStatus, taskType, taskName, taskCreator, auditStatus,
|
||||||
taskAct, taskAuditor, taskSource, ruleName,null);
|
taskAct, taskAuditor, taskSource, ruleName,null, eventType, createDate, startDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean updateAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
public Boolean updateAuditStatusBatch(Map<Integer, Integer> idsWithAuditStatusMap) {
|
||||||
|
|||||||
@@ -252,6 +252,12 @@
|
|||||||
<if test="protectLevel != null">
|
<if test="protectLevel != null">
|
||||||
and t_strategy_template_new.protect_level = #{protectLevel}
|
and t_strategy_template_new.protect_level = #{protectLevel}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="auditUserName != null and auditUserName !='' ">
|
||||||
|
AND audit_user_name like concat('%', #{auditUserName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="createDate != null and createDate !=''">
|
||||||
|
AND create_time like concat('%', #{createDate}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
@@ -318,6 +324,12 @@
|
|||||||
<if test="protectLevel != null">
|
<if test="protectLevel != null">
|
||||||
and t_strategy_template_new.protect_level = #{protectLevel}
|
and t_strategy_template_new.protect_level = #{protectLevel}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="auditUserName != null and auditUserName !='' ">
|
||||||
|
AND audit_user_name like concat('%', #{auditUserName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="createDate != null and createDate !=''">
|
||||||
|
AND create_time like concat('%', #{createDate}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,13 @@
|
|||||||
<if test="auditStatus != null">
|
<if test="auditStatus != null">
|
||||||
AND static_rule_audit_status = #{auditStatus}
|
AND static_rule_audit_status = #{auditStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="auditUserName != null and auditUserName !='' ">
|
||||||
|
AND audit_user_name like concat('%', #{auditUserName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="createDate != null and createDate !=''">
|
||||||
|
AND static_rule_create_time like concat('%', #{createDate}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
@@ -271,6 +278,12 @@
|
|||||||
<if test="auditStatus != null">
|
<if test="auditStatus != null">
|
||||||
AND static_rule_audit_status = #{auditStatus}
|
AND static_rule_audit_status = #{auditStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="auditUserName != null and auditUserName !='' ">
|
||||||
|
AND audit_user_name like concat('%', #{auditUserName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="createDate != null and createDate !=''">
|
||||||
|
AND static_rule_create_time like concat('%', #{createDate}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="queryStaticRuleByIds"
|
<select id="queryStaticRuleByIds"
|
||||||
|
|||||||
@@ -65,14 +65,23 @@
|
|||||||
|
|
||||||
<select id="queryTasks" resultMap="taskMap">
|
<select id="queryTasks" resultMap="taskMap">
|
||||||
SELECT t_task.* FROM t_task
|
SELECT t_task.* FROM t_task
|
||||||
<if test="rule_name != null and task_source != ''">
|
<if test="rule_name != null and rule_name != '' and (event_type == null or event_type == '')">
|
||||||
LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id
|
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
|
LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
|
||||||
WHERE
|
</if>
|
||||||
|
<if test="event_type != null and event_type != ''">
|
||||||
|
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
|
||||||
|
LEFT JOIN t_strategy_template_new ON t_dynamic_rule.template_id = t_strategy_template_new.strategy_template_id
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="rule_name != null and rule_name != ''">
|
||||||
|
(
|
||||||
t_static_rule.static_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
t_static_rule.static_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<where>
|
|
||||||
<if test="task_status != null">
|
<if test="task_status != null">
|
||||||
AND task_status = #{task_status}
|
AND task_status = #{task_status}
|
||||||
</if>
|
</if>
|
||||||
@@ -97,6 +106,15 @@
|
|||||||
<if test="task_source != null and task_source != '' ">
|
<if test="task_source != null and task_source != '' ">
|
||||||
AND task_source LIKE CONCAT('%', #{task_source}, '%')
|
AND task_source LIKE CONCAT('%', #{task_source}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="event_type != null and event_type != '' ">
|
||||||
|
AND t_strategy_template_new.event_type LIKE CONCAT('%', #{event_type}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="create_date != null and create_date != '' ">
|
||||||
|
AND task_crate_time LIKE CONCAT('%', #{create_date}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="start_date != null and start_date != '' ">
|
||||||
|
AND task_start_time LIKE CONCAT('%', #{start_date}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
@@ -371,14 +389,23 @@
|
|||||||
</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 and rule_name != '' ">
|
<if test="rule_name != null and rule_name != '' and (event_type == null or event_type == '')">
|
||||||
LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id
|
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
|
LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
|
||||||
WHERE
|
</if>
|
||||||
|
<if test="event_type != null and event_type != ''">
|
||||||
|
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
|
||||||
|
LEFT JOIN t_strategy_template_new ON t_dynamic_rule.template_id = t_strategy_template_new.strategy_template_id
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="rule_name != null and task_source != ''">
|
||||||
|
(
|
||||||
t_static_rule.static_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
t_static_rule.static_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<where>
|
|
||||||
<if test="task_status != null">
|
<if test="task_status != null">
|
||||||
AND task_status = #{task_status}
|
AND task_status = #{task_status}
|
||||||
</if>
|
</if>
|
||||||
@@ -407,6 +434,15 @@
|
|||||||
<if test="task_create_time != null">
|
<if test="task_create_time != null">
|
||||||
AND DATE(#{task_create_time}) = CURRENT_DATE
|
AND DATE(#{task_create_time}) = CURRENT_DATE
|
||||||
</if>
|
</if>
|
||||||
|
<if test="event_type != null and event_type != '' ">
|
||||||
|
AND t_strategy_template_new.event_type LIKE CONCAT('%', #{event_type}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="create_date != null and create_date != '' ">
|
||||||
|
AND task_crate_time LIKE CONCAT('%', #{create_date}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="start_date != null and start_date != '' ">
|
||||||
|
AND task_start_time LIKE CONCAT('%', #{start_date}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -130,13 +130,13 @@ 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,null,null,null,1, 10);
|
null,null,null, null,2,null,null,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,null,null,null,null,null);
|
||||||
System.out.println(num);
|
System.out.println(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryStaticRules(){
|
void testQueryStaticRules(){
|
||||||
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(null, null, null, null,null, null, null,2, 1, 10);
|
List<StaticRuleObject> staticRuleObjects = staticRuleService.queryStaticRule(null, null, null, null,null, null, null,2, null,null,1, 10);
|
||||||
System.out.println(staticRuleObjects);
|
System.out.println(staticRuleObjects);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPageQueryTask(){
|
void testPageQueryTask(){
|
||||||
List<Task> tasks = taskService.queryTasks(null, null, "", "", null,"", null, "", "", 1, 10);
|
List<Task> tasks = taskService.queryTasks(null, null, "", "", null,"", null, "", "", null,null,null,1, 10);
|
||||||
// System.out.println(tasks);
|
// System.out.println(tasks);
|
||||||
tasks.forEach(task -> System.out.println(task));
|
tasks.forEach(task -> System.out.println(task));
|
||||||
}
|
}
|
||||||
@@ -162,11 +162,11 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testUpdateTasks() {
|
void testUpdateTasks() {
|
||||||
Task originalTask = taskService.queryTasks(
|
Task originalTask = taskService.queryTasks(
|
||||||
null, null, null, null, null, null, null, null, null,1, 1)
|
null, null, null, 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,null, null, null,1, 4
|
null, null, 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()));
|
||||||
@@ -179,7 +179,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDeleteTask() {
|
void testDeleteTask() {
|
||||||
long testNum = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 10)
|
long testNum = taskService.queryTasks(null, null, null, 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));
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class CommandServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void mockCommand() {
|
void mockCommand() {
|
||||||
Task task = taskService.queryTasks(null, null, null, null, null, null, null, null, null,1, 1).get(0);
|
Task task = taskService.queryTasks(null, null, null, 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, null, null, null, null,1, 1).get(0);
|
Task task = taskService.queryTasks(null, null, null, 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, null, null, null, null,1, 1).get(0);
|
Task task = taskService.queryTasks(null, null, null, 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());
|
||||||
|
|||||||
Reference in New Issue
Block a user