1、统计接口,增加已退回的数据
2、增加规则、任务、配置的历史状态变化表查询 3、任务结束后,其选择规则再次使用报错正在使用中问题解决。修改规则审计状态同时,删去used_tasl_id的值 4、任务结束,修改is——delete报错解决,doris要使用unique key 5、分页查询逆序返回
This commit is contained in:
@@ -68,34 +68,42 @@ public class ProtectObject {
|
|||||||
|
|
||||||
@JsonProperty("proobj_create_username")
|
@JsonProperty("proobj_create_username")
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
@Schema(description = "防护对象创建人", example = "xxx")
|
@Schema(description = "防护对象创建人", example = "xxx", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private String protectObjectCreateUsername;
|
private String protectObjectCreateUsername;
|
||||||
|
|
||||||
@JsonProperty("proobj_create_depart")
|
@JsonProperty("proobj_create_depart")
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
@Schema(description = "防护对象创建人处室", example = "xxx")
|
@Schema(description = "防护对象创建人处室", example = "xxx", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private String protectObjectCreateDepart;
|
private String protectObjectCreateDepart;
|
||||||
|
|
||||||
@JsonProperty("proobj_create_userid")
|
@JsonProperty("proobj_create_userid")
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
@Schema(description = "防护对象创建人ID", example = "0")
|
@Schema(description = "防护对象创建人ID", example = "0", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private Integer protectObjectCreateUserId;
|
private Integer protectObjectCreateUserId;
|
||||||
|
|
||||||
@JsonProperty("audit_user_name")
|
@JsonProperty("audit_user_name")
|
||||||
@Schema(description = "审核用户名称", example = "user11")
|
@Schema(description = "审核用户名称", example = "user11", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private String auditUserName;
|
private String auditUserName;
|
||||||
@JsonProperty("audit_user_id")
|
@JsonProperty("audit_user_id")
|
||||||
@Schema(description = "审核用户id", example = "11111")
|
@Schema(description = "审核用户id", example = "11111", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private String auditUserId;
|
private String auditUserId;
|
||||||
@JsonProperty("audit_user_depart")
|
@JsonProperty("audit_user_depart")
|
||||||
@Schema(description = "审核用户部门", example = "部门1")
|
@Schema(description = "审核用户部门", example = "部门1", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private String auditUserDepart;
|
private String auditUserDepart;
|
||||||
|
|
||||||
@JsonProperty("create_time")
|
@JsonProperty("create_time")
|
||||||
@Schema(description = "创建时间", example = "")
|
@Schema(description = "创建时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@JsonProperty("modify_time")
|
@JsonProperty("modify_time")
|
||||||
@Schema(description = "修改时间", example = "")
|
@Schema(description = "修改时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private LocalDateTime modifyTime;
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
@JsonProperty("effecive_time")
|
||||||
|
@Schema(description = "日志表中有效开始时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime effeciveTime;
|
||||||
|
|
||||||
|
@JsonProperty("expire_time")
|
||||||
|
@Schema(description = "日志表中有效结束时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime expireTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import jakarta.validation.constraints.Min;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TemplateNew {
|
public class TemplateNew {
|
||||||
@JsonProperty("template_id")
|
@JsonProperty("template_id")
|
||||||
@@ -117,4 +119,12 @@ public class TemplateNew {
|
|||||||
@JsonProperty("update_time")
|
@JsonProperty("update_time")
|
||||||
@Schema(description = "更新时间", example = "部门1", accessMode = Schema.AccessMode.READ_ONLY)
|
@Schema(description = "更新时间", example = "部门1", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private String updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
|
@JsonProperty("effecive_time")
|
||||||
|
@Schema(description = "日志表中有效开始时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime effeciveTime;
|
||||||
|
|
||||||
|
@JsonProperty("expire_time")
|
||||||
|
@Schema(description = "日志表中到期时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime expireTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.realtime.protection.configuration.entity.rule.dynamicrule;
|
package com.realtime.protection.configuration.entity.rule.dynamicrule;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||||
@@ -97,6 +98,19 @@ public class DynamicRuleObject {
|
|||||||
@Schema(description = "动态规则描述", example = "动态规则描述")
|
@Schema(description = "动态规则描述", example = "动态规则描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@JsonProperty("effecive_time")
|
||||||
|
@Schema(description = "日志表中有效开始时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime effeciveTime;
|
||||||
|
|
||||||
|
@JsonProperty("expire_time")
|
||||||
|
@Schema(description = "日志表中到期时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime expireTime;
|
||||||
|
|
||||||
|
@JsonProperty("used_task_name")
|
||||||
|
@ExcelIgnore
|
||||||
|
@Schema(description = "使用该规则的任务名称", example = "任务1", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private String usedTaskName;
|
||||||
|
|
||||||
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
|
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
|
||||||
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
||||||
throw new IllegalArgumentException("规则《" + this.getDynamicRuleName() + "》原审批状态非法");
|
throw new IllegalArgumentException("规则《" + this.getDynamicRuleName() + "》原审批状态非法");
|
||||||
|
|||||||
@@ -167,6 +167,20 @@ public class StaticRuleObject {
|
|||||||
@Schema(description = "事件类型", example = "DDos")
|
@Schema(description = "事件类型", example = "DDos")
|
||||||
private String eventType;
|
private String eventType;
|
||||||
|
|
||||||
|
@JsonProperty("effecive_time")
|
||||||
|
@ExcelIgnore
|
||||||
|
@Schema(description = "日志表中有效开始时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime effeciveTime;
|
||||||
|
|
||||||
|
@JsonProperty("expire_time")
|
||||||
|
@ExcelIgnore
|
||||||
|
@Schema(description = "日志表中到期时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime expireTime;
|
||||||
|
|
||||||
|
@JsonProperty("used_task_name")
|
||||||
|
@ExcelIgnore
|
||||||
|
@Schema(description = "使用该规则的任务名称", example = "任务1", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private String usedTaskName;
|
||||||
|
|
||||||
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
|
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
|
||||||
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
||||||
|
|||||||
@@ -136,6 +136,13 @@ public class Task {
|
|||||||
accessMode = Schema.AccessMode.READ_ONLY)
|
accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private List<ProtectObject> protectObjects;
|
private List<ProtectObject> protectObjects;
|
||||||
|
|
||||||
|
@JsonProperty("effecive_time")
|
||||||
|
@Schema(description = "日志表中有效开始时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime effeciveTime;
|
||||||
|
|
||||||
|
@JsonProperty("expire_time")
|
||||||
|
@Schema(description = "日志表中到期时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime expireTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,12 @@ public class WhiteListObject {
|
|||||||
@JsonProperty("modify_time")
|
@JsonProperty("modify_time")
|
||||||
@Schema(description = "修改时间", example = "")
|
@Schema(description = "修改时间", example = "")
|
||||||
private LocalDateTime modifyTime;
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
@JsonProperty("effecive_time")
|
||||||
|
@Schema(description = "日志表中有效开始时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime effeciveTime;
|
||||||
|
|
||||||
|
@JsonProperty("expire_time")
|
||||||
|
@Schema(description = "日志表中到期时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private LocalDateTime expireTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,10 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
|
|||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.AUDITED.getState())))
|
AuditStatusEnum.getNumByState(AuditStatusEnum.AUDITED.getState())))
|
||||||
.setData("proobj_undit_num", protectObjectService.queryProtectObjectsTotalNum(null, null, null, null,
|
.setData("proobj_undit_num", protectObjectService.queryProtectObjectsTotalNum(null, null, null, null,
|
||||||
null, null, null, null, null,
|
null, null, null, null, null,
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())));
|
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())))
|
||||||
|
.setData("proobj_returned_num", protectObjectService.queryProtectObjectsTotalNum(null, null, null, null,
|
||||||
|
null, null, null, null, null,
|
||||||
|
AuditStatusEnum.getNumByState(AuditStatusEnum.RETURNED.getState())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -214,4 +217,14 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
|
|||||||
.setData("auditInfo", protectObjectService.queryAuditInfo(id));
|
.setData("auditInfo", protectObjectService.queryAuditInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize) {
|
||||||
|
|
||||||
|
return ResponseResult.ok()
|
||||||
|
.setData("history", protectObjectService.queryHistory(id, page, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,4 +526,9 @@ public interface ProtectObjectControllerApi {
|
|||||||
)
|
)
|
||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,6 @@ public interface ProtectObjectMapper {
|
|||||||
void insertStaticRuleStatusLogBatch(List<Integer> ids);
|
void insertStaticRuleStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,4 +246,8 @@ public class ProtectObjectService {
|
|||||||
protectObjectMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
protectObjectMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
||||||
protectObjectMapper.insertStaticRuleStatusLogBatch(ids);
|
protectObjectMapper.insertStaticRuleStatusLogBatch(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||||
|
return protectObjectMapper.queryHistory(id, page, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.realtime.protection.server.defense.templatenew;
|
package com.realtime.protection.server.defense.templatenew;
|
||||||
|
|
||||||
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
|
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
|
||||||
import com.realtime.protection.configuration.entity.user.UserFull;
|
|
||||||
import com.realtime.protection.configuration.response.ResponseResult;
|
import com.realtime.protection.configuration.response.ResponseResult;
|
||||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||||
import jakarta.servlet.http.HttpSession;
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.Min;
|
import jakarta.validation.constraints.Min;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -151,6 +149,9 @@ public class TemplateController implements TemplateNewCpntrollerApi{
|
|||||||
))
|
))
|
||||||
.setData("template_unaudit_num", templateService.queryAuditTemplateTotalNum(
|
.setData("template_unaudit_num", templateService.queryAuditTemplateTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())
|
||||||
|
))
|
||||||
|
.setData("template_returned_num", templateService.queryAuditTemplateTotalNum(
|
||||||
|
AuditStatusEnum.getNumByState(AuditStatusEnum.RETURNED.getState())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,4 +217,14 @@ public class TemplateController implements TemplateNewCpntrollerApi{
|
|||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("auditInfo", templateService.queryAuditInfo(id));
|
.setData("auditInfo", templateService.queryAuditInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize) {
|
||||||
|
|
||||||
|
return ResponseResult.ok()
|
||||||
|
.setData("history", templateService.queryHistory(id, page, pageSize));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,6 @@ public interface TemplateMapper {
|
|||||||
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
void insertStatusLogBatch(List<Integer> ids);
|
void insertStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
List<TemplateNew> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,4 +355,27 @@ public interface TemplateNewCpntrollerApi {
|
|||||||
)
|
)
|
||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "查询历史变化",
|
||||||
|
description = "查询历史变化,只接收一个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "page", description = "页数", example = "2"),
|
||||||
|
@Parameter(name = "page_size", description = "每页个数", example = "10"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,4 +188,8 @@ public class TemplateService {
|
|||||||
templateMapper.updateStatusLogExpireTimeBatch(ids);
|
templateMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
templateMapper.insertStatusLogBatch(ids);
|
templateMapper.insertStatusLogBatch(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TemplateNew> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||||
|
return templateMapper.queryHistory(id, page, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,6 +236,9 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
|||||||
))
|
))
|
||||||
.setData("dynamic_rule_unaudit_num", dynamicRuleService.queryAuditDynamicRuleTotalNum(
|
.setData("dynamic_rule_unaudit_num", dynamicRuleService.queryAuditDynamicRuleTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())
|
||||||
|
))
|
||||||
|
.setData("dynamic_rule_returned_num", dynamicRuleService.queryAuditDynamicRuleTotalNum(
|
||||||
|
AuditStatusEnum.getNumByState(AuditStatusEnum.RETURNED.getState())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,4 +260,14 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
|||||||
.setData("auditInfo", dynamicRuleService.queryAuditInfo(id));
|
.setData("auditInfo", dynamicRuleService.queryAuditInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize) {
|
||||||
|
|
||||||
|
return ResponseResult.ok()
|
||||||
|
.setData("history", dynamicRuleService.queryHistory(id, page, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -505,4 +505,29 @@ public interface DynamicRuleControllerApi {
|
|||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "查询历史变化",
|
||||||
|
description = "查询历史变化,只接收一个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "page", description = "页数", example = "2"),
|
||||||
|
@Parameter(name = "page_size", description = "每页个数", example = "10"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -73,4 +73,8 @@ public interface DynamicRuleMapper {
|
|||||||
void insertStatusLogBatch(List<Integer> ids);
|
void insertStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
List<DynamicRuleObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||||
|
|
||||||
|
void removeUsedTaskId(Long taskId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,4 +362,7 @@ public class DynamicRuleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<DynamicRuleObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||||
|
return dynamicRuleMapper.queryHistory(id, page, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,7 +279,9 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.AUDITED.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.AUDITED.getState())
|
||||||
))
|
))
|
||||||
.setData("static_rule_unaudit_num", staticRuleService.queryAuditStaticRuleTotalNum(
|
.setData("static_rule_unaudit_num", staticRuleService.queryAuditStaticRuleTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())));
|
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())))
|
||||||
|
.setData("static_rule_returned_num", staticRuleService.queryAuditStaticRuleTotalNum(
|
||||||
|
AuditStatusEnum.getNumByState(AuditStatusEnum.RETURNED.getState())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -301,4 +303,14 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
.setData("auditInfo", staticRuleService.queryAuditInfo(id));
|
.setData("auditInfo", staticRuleService.queryAuditInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize) {
|
||||||
|
|
||||||
|
return ResponseResult.ok()
|
||||||
|
.setData("history", staticRuleService.queryHistory(id, page, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,4 +413,29 @@ public interface StaticRuleControllerApi {
|
|||||||
)
|
)
|
||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "查询历史变化",
|
||||||
|
description = "查询历史变化,只接收一个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "page", description = "页数", example = "2"),
|
||||||
|
@Parameter(name = "page_size", description = "每页个数", example = "10"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,4 +76,8 @@ public interface StaticRuleMapper {
|
|||||||
void insertStaticRuleStatusLogBatch(List<Integer> ids);
|
void insertStaticRuleStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
List<StaticRuleObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||||
|
|
||||||
|
void removeUsedTaskId(Long taskId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -420,4 +420,8 @@ public class StaticRuleService {
|
|||||||
staticRuleMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
staticRuleMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
||||||
staticRuleMapper.insertStaticRuleStatusLogBatch(ids);
|
staticRuleMapper.insertStaticRuleStatusLogBatch(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<StaticRuleObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||||
|
return staticRuleMapper.queryHistory(id, page, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,9 +262,11 @@ public class TaskController implements TaskControllerApi {
|
|||||||
null, 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, null,null,null,null,null))
|
||||||
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(
|
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(AuditStatusEnum.PENDING.getNum()))
|
||||||
AuditStatusEnum.PENDING.getNum()
|
.setData("audited_num", taskService.queryAuditTaskTotalNum(AuditStatusEnum.AUDITED.getNum()))
|
||||||
));
|
.setData("rejected_num", taskService.queryAuditTaskTotalNum(AuditStatusEnum.RETURNED.getNum()))
|
||||||
|
.setData("using_num", taskService.queryAuditTaskTotalNum(AuditStatusEnum.USING.getNum()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -285,5 +287,15 @@ public class TaskController implements TaskControllerApi {
|
|||||||
.setData("auditInfo", taskService.queryAuditInfo(id));
|
.setData("auditInfo", taskService.queryAuditInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public ResponseResult queryHistory(@PathVariable Long id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize) {
|
||||||
|
|
||||||
|
return ResponseResult.ok()
|
||||||
|
.setData("history", taskService.queryHistory(id, page, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -670,4 +670,27 @@ public interface TaskControllerApi {
|
|||||||
)
|
)
|
||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "查询历史变化",
|
||||||
|
description = "查询历史变化,只接收一个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "page", description = "页数", example = "2"),
|
||||||
|
@Parameter(name = "page_size", description = "每页个数", example = "10"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
ResponseResult queryHistory(@PathVariable Long id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,4 +112,6 @@ public interface TaskMapper {
|
|||||||
void insertTaskStatusLogBatch(List<Integer> idWithAuditStatusBatch);
|
void insertTaskStatusLogBatch(List<Integer> idWithAuditStatusBatch);
|
||||||
|
|
||||||
void updateTaskStatusLogExpireTimeBatch(List<Integer> taskIds);
|
void updateTaskStatusLogExpireTimeBatch(List<Integer> taskIds);
|
||||||
|
|
||||||
|
List<Task> queryHistory(Long id, Integer page, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,10 +153,12 @@ public class TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||||
|
insertStaticRuleStatusLog(batchMap);
|
||||||
batchMap.clear();
|
batchMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||||
|
insertStaticRuleStatusLog(batchMap);
|
||||||
batchMap.clear();
|
batchMap.clear();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -214,10 +216,12 @@ public class TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||||
|
insertDynamicRuleStatusLog(batchMap);
|
||||||
batchMap.clear();
|
batchMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||||
|
insertDynamicRuleStatusLog(batchMap);
|
||||||
batchMap.clear();
|
batchMap.clear();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -243,6 +247,8 @@ public class TaskService {
|
|||||||
if (task == null) {
|
if (task == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
List<ProtectObject> protectObjects = taskMapper.queryProtectObjectsByTaskId(task.getTaskId());
|
||||||
|
task.setProtectObjects(protectObjects);
|
||||||
|
|
||||||
task.setStaticRuleIds(taskMapper.queryStaticRuleIdsFromTaskId(task.getTaskId(),
|
task.setStaticRuleIds(taskMapper.queryStaticRuleIdsFromTaskId(task.getTaskId(),
|
||||||
List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum())));
|
List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum())));
|
||||||
@@ -523,4 +529,46 @@ public class TaskService {
|
|||||||
taskMapper.updateTaskStatusLogExpireTimeBatch(taskIds);
|
taskMapper.updateTaskStatusLogExpireTimeBatch(taskIds);
|
||||||
taskMapper.insertTaskStatusLogBatch(taskIds);
|
taskMapper.insertTaskStatusLogBatch(taskIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Task> queryHistory(Long id, Integer page, Integer pageSize) {
|
||||||
|
List<Task> tasks = taskMapper.queryHistory(id, page, pageSize);
|
||||||
|
|
||||||
|
for (Task task : tasks) {
|
||||||
|
if (task == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<ProtectObject> protectObjects = taskMapper.queryProtectObjectsByTaskId(task.getTaskId());
|
||||||
|
task.setProtectObjects(protectObjects);
|
||||||
|
|
||||||
|
task.setStaticRuleIds(taskMapper.queryStaticRuleIdsFromTaskId(task.getTaskId(),
|
||||||
|
List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum())));
|
||||||
|
task.setDynamicRuleIds(taskMapper.queryDynamicRuleIdsFromTaskId(task.getTaskId(),
|
||||||
|
List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum())));
|
||||||
|
}
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeDynamicRuleUsedTaskIdInTask(Long taskId) {
|
||||||
|
dynamicRuleMapper.removeUsedTaskId(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeStaticRuleUsedTaskIdInTask(Long taskId) {
|
||||||
|
staticRuleMapper.removeUsedTaskId(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertStaticRuleStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
ArrayList<Integer> ids = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
staticRuleMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
||||||
|
staticRuleMapper.insertStaticRuleStatusLogBatch(ids);
|
||||||
|
}
|
||||||
|
public void insertDynamicRuleStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
ArrayList<Integer> ids = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
dynamicRuleMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
dynamicRuleMapper.insertStatusLogBatch(ids);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,14 @@ public class StateHandler {
|
|||||||
|
|
||||||
protected Boolean handleFinish(CommandService commandService, TaskService taskService, Long taskId) {
|
protected Boolean handleFinish(CommandService commandService, TaskService taskService, Long taskId) {
|
||||||
commandService.removeCommandsByTaskId(taskId);
|
commandService.removeCommandsByTaskId(taskId);
|
||||||
|
|
||||||
taskService.updateDynamicRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED);
|
taskService.updateDynamicRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED);
|
||||||
|
// 要删去规则的used_task_id,因为在新建时检查了是否有重复使用的规则
|
||||||
|
taskService.removeDynamicRuleUsedTaskIdInTask(taskId);
|
||||||
|
|
||||||
taskService.updateStaticRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED);
|
taskService.updateStaticRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED);
|
||||||
|
taskService.removeStaticRuleUsedTaskIdInTask(taskId);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,9 @@ public class WhiteListController implements WhiteListControllerApi {
|
|||||||
))
|
))
|
||||||
.setData("whiteobj_unaudit_num", whiteListService.queryAuditWhiteListTotalNum(
|
.setData("whiteobj_unaudit_num", whiteListService.queryAuditWhiteListTotalNum(
|
||||||
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())
|
AuditStatusEnum.getNumByState(AuditStatusEnum.PENDING.getState())
|
||||||
|
))
|
||||||
|
.setData("whiteobj_returned_num", whiteListService.queryAuditWhiteListTotalNum(
|
||||||
|
AuditStatusEnum.RETURNED.getNum()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,5 +260,15 @@ public class WhiteListController implements WhiteListControllerApi {
|
|||||||
.setData("auditInfo", whiteListService.queryAuditInfo(id));
|
.setData("auditInfo", whiteListService.queryAuditInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
public ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize) {
|
||||||
|
|
||||||
|
return ResponseResult.ok()
|
||||||
|
.setData("history", whiteListService.queryHistory(id, page, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -375,5 +375,26 @@ public interface WhiteListControllerApi {
|
|||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "查询历史变化",
|
||||||
|
description = "查询历史变化,只接收一个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "page", description = "页数", example = "2"),
|
||||||
|
@Parameter(name = "page_size", description = "每页个数", example = "10"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@GetMapping("/{id}/history")
|
||||||
|
ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
@RequestParam(value = "page_size", required = true) Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,4 +68,6 @@ public interface WhiteListMapper {
|
|||||||
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
void insertStatusLogBatch(List<Integer> ids);
|
void insertStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
List<WhiteListObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,4 +294,8 @@ public class WhiteListService {
|
|||||||
whiteListMapper.updateStatusLogExpireTimeBatch(ids);
|
whiteListMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
whiteListMapper.insertStatusLogBatch(ids);
|
whiteListMapper.insertStatusLogBatch(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<WhiteListObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||||
|
return whiteListMapper.queryHistory(id, page, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,7 @@
|
|||||||
<if test="src_port != null">AND SRC_PORT = #{src_port}</if>
|
<if test="src_port != null">AND SRC_PORT = #{src_port}</if>
|
||||||
<if test="dst_port != null">AND DST_PORT = #{dst_port}</if>
|
<if test="dst_port != null">AND DST_PORT = #{dst_port}</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY CREATE_TIME DESC
|
||||||
LIMIT ${(page-1) * page_num}, #{page_num}
|
LIMIT ${(page-1) * page_num}, #{page_num}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -233,6 +233,11 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
and expire_time is null
|
and expire_time is null
|
||||||
</update>
|
</update>
|
||||||
|
<update id="removeUsedTaskId">
|
||||||
|
update t_dynamic_rule
|
||||||
|
set dynamic_rule_used_task_id = null
|
||||||
|
where dynamic_rule_used_task_id = #{taskId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<resultMap id="dynamicRuleMap"
|
<resultMap id="dynamicRuleMap"
|
||||||
@@ -248,6 +253,8 @@
|
|||||||
<!-- <result column="dynamic_rule_priority" property="dynamicRulePriority"/>-->
|
<!-- <result column="dynamic_rule_priority" property="dynamicRulePriority"/>-->
|
||||||
<!-- <result column="dynamic_rule_frequency" property="dynamicRuleFrequency"/>-->
|
<!-- <result column="dynamic_rule_frequency" property="dynamicRuleFrequency"/>-->
|
||||||
<result column="dynamic_rule_create_user_id" property="dynamicRuleCreateUserId"/>
|
<result column="dynamic_rule_create_user_id" property="dynamicRuleCreateUserId"/>
|
||||||
|
<result column="dynamic_rule_used_task_id" property="dynamicRuleUsedTaskId"/>
|
||||||
|
|
||||||
<result column="dynamic_rule_display_id" property="dynamicRuleDisplayId"/>
|
<result column="dynamic_rule_display_id" property="dynamicRuleDisplayId"/>
|
||||||
<result column="audit_status" property="auditStatus"/>
|
<result column="audit_status" property="auditStatus"/>
|
||||||
<result column="audit_user_id" property="auditUserId"/>
|
<result column="audit_user_id" property="auditUserId"/>
|
||||||
@@ -256,6 +263,8 @@
|
|||||||
<result column="bw_sql" property="bwSql"/>
|
<result column="bw_sql" property="bwSql"/>
|
||||||
<result column="description" property="description"/>
|
<result column="description" property="description"/>
|
||||||
<result column="source_system" property="dynamicRuleSourceSystem"/>
|
<result column="source_system" property="dynamicRuleSourceSystem"/>
|
||||||
|
<result column="used_task_name" property="usedTaskName"/>
|
||||||
|
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@@ -263,6 +272,7 @@
|
|||||||
<id column="dynamic_rule_id" property="dynamicRuleId"/>
|
<id column="dynamic_rule_id" property="dynamicRuleId"/>
|
||||||
<result column="dynamic_rule_name" property="dynamicRuleName"/>
|
<result column="dynamic_rule_name" property="dynamicRuleName"/>
|
||||||
<result column="create_time" property="dynamicRuleCreateTime"/>
|
<result column="create_time" property="dynamicRuleCreateTime"/>
|
||||||
|
<result column="dynamic_rule_create_user_id" property="dynamicRuleCreateUserId"/>
|
||||||
<result column="dynamic_rule_create_username" property="dynamicRuleCreateUsername"/>
|
<result column="dynamic_rule_create_username" property="dynamicRuleCreateUsername"/>
|
||||||
<result column="dynamic_rule_create_depart" property="dynamicRuleCreateDepart"/>
|
<result column="dynamic_rule_create_depart" property="dynamicRuleCreateDepart"/>
|
||||||
<!-- <result column="template_id" property="templateId"/>-->
|
<!-- <result column="template_id" property="templateId"/>-->
|
||||||
@@ -284,6 +294,9 @@
|
|||||||
<result column="bw_sql" property="bwSql"/>
|
<result column="bw_sql" property="bwSql"/>
|
||||||
<result column="description" property="description"/>
|
<result column="description" property="description"/>
|
||||||
|
|
||||||
|
<result column="dynamic_rule_used_task_id" property="dynamicRuleUsedTaskId"/>
|
||||||
|
<result column="used_task_name" property="usedTaskName"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="queryDynamicRuleById" resultMap="dynamicRuleMap">
|
<select id="queryDynamicRuleById" resultMap="dynamicRuleMap">
|
||||||
@@ -308,9 +321,11 @@
|
|||||||
|
|
||||||
<select id="queryDynamicRuleObject"
|
<select id="queryDynamicRuleObject"
|
||||||
resultMap="dynamicRulePageQueryMap">
|
resultMap="dynamicRulePageQueryMap">
|
||||||
select *
|
select *,
|
||||||
|
t_task.task_name as used_task_name
|
||||||
from t_dynamic_rule
|
from t_dynamic_rule
|
||||||
|
left join t_task
|
||||||
|
on t_dynamic_rule.dynamic_rule_used_task_id = t_task.task_id
|
||||||
<where>
|
<where>
|
||||||
<if test="dynamicRuleName != null and dynamicRuleName !=''" >
|
<if test="dynamicRuleName != null and dynamicRuleName !=''" >
|
||||||
t_dynamic_rule.dynamic_rule_name like concat('%', #{dynamicRuleName}, '%')
|
t_dynamic_rule.dynamic_rule_name like concat('%', #{dynamicRuleName}, '%')
|
||||||
@@ -336,6 +351,7 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY dynamic_rule_id DESC
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -445,6 +461,16 @@
|
|||||||
from t_dynamic_rule
|
from t_dynamic_rule
|
||||||
where dynamic_rule_id = #{dynamicRuleId}
|
where dynamic_rule_id = #{dynamicRuleId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryHistory"
|
||||||
|
resultMap="dynamicRulePageQueryMap">
|
||||||
|
select *,
|
||||||
|
t_task.task_name as used_task_name
|
||||||
|
from t_dynamic_rule
|
||||||
|
left join t_task
|
||||||
|
on t_dynamic_rule.dynamic_rule_used_task_id = t_task.task_id
|
||||||
|
where dynamic_rule_id = #{id}
|
||||||
|
ORDER BY effective_time DESC
|
||||||
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -150,6 +150,8 @@
|
|||||||
<result column="create_time" property="createTime"/>
|
<result column="create_time" property="createTime"/>
|
||||||
<result column="modify_time" property="modifyTime"/>
|
<result column="modify_time" property="modifyTime"/>
|
||||||
|
|
||||||
|
<result column="effective_time" property="effeciveTime"/>
|
||||||
|
<result column="expire_time" property="expireTime"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@@ -191,6 +193,7 @@
|
|||||||
AND protect_object_audit_status = #{proobj_audit_status}
|
AND protect_object_audit_status = #{proobj_audit_status}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY protect_object_id DESC
|
||||||
LIMIT ${(page-1) * page_size}, #{page_size}
|
LIMIT ${(page-1) * page_size}, #{page_size}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -270,6 +273,13 @@
|
|||||||
FROM t_protect_object
|
FROM t_protect_object
|
||||||
WHERE protect_object_id = #{proobj_id}
|
WHERE protect_object_id = #{proobj_id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryHistory" resultMap="protectObjectMap">
|
||||||
|
SELECT *
|
||||||
|
FROM t_protect_object_status_log
|
||||||
|
WHERE protect_object_id = #{id}
|
||||||
|
ORDER BY effective_time DESC
|
||||||
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateProtectObject">
|
<update id="updateProtectObject">
|
||||||
UPDATE t_protect_object
|
UPDATE t_protect_object
|
||||||
|
|||||||
@@ -290,6 +290,11 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
AND expire_time IS NULL
|
AND expire_time IS NULL
|
||||||
</update>
|
</update>
|
||||||
|
<update id="removeUsedTaskId">
|
||||||
|
update t_static_rule
|
||||||
|
set static_rule_used_task_id = NULL
|
||||||
|
where static_rule_used_task_id = #{taskId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteStaticRules">
|
<delete id="deleteStaticRules">
|
||||||
delete from t_static_rule
|
delete from t_static_rule
|
||||||
@@ -331,6 +336,10 @@
|
|||||||
|
|
||||||
<result column="static_rule_display_id" property="staticRuleDisplayId"/>
|
<result column="static_rule_display_id" property="staticRuleDisplayId"/>
|
||||||
<result column="event_type" property="eventType"/>
|
<result column="event_type" property="eventType"/>
|
||||||
|
<result column="effective_time" property="effeciveTime"/>
|
||||||
|
<result column="expire_time" property="expireTime"/>
|
||||||
|
<result column="used_task_name" property="usedTaskName"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="queryStaticRule" resultMap="staticRuleMap">
|
<select id="queryStaticRule" resultMap="staticRuleMap">
|
||||||
@@ -338,7 +347,8 @@
|
|||||||
INET_NTOA(static_rule_sip) as static_rule_sip_d,
|
INET_NTOA(static_rule_sip) as static_rule_sip_d,
|
||||||
INET_NTOA(static_rule_msip) as static_rule_msip_d,
|
INET_NTOA(static_rule_msip) as static_rule_msip_d,
|
||||||
INET_NTOA(static_rule_dip) as static_rule_dip_d,
|
INET_NTOA(static_rule_dip) as static_rule_dip_d,
|
||||||
INET_NTOA(static_rule_mdip) as static_rule_mdip_d
|
INET_NTOA(static_rule_mdip) as static_rule_mdip_d,
|
||||||
|
task_name as used_task_name
|
||||||
FROM t_static_rule
|
FROM t_static_rule
|
||||||
left join t_task on t_static_rule.static_rule_used_task_id = t_task.task_id
|
left join t_task on t_static_rule.static_rule_used_task_id = t_task.task_id
|
||||||
<where>
|
<where>
|
||||||
@@ -384,6 +394,7 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY static_rule_id DESC
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -483,4 +494,19 @@
|
|||||||
WHERE static_rule_id = #{id}
|
WHERE static_rule_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryHistory"
|
||||||
|
resultMap="staticRuleMap">
|
||||||
|
SELECT *,
|
||||||
|
INET_NTOA(static_rule_sip) as static_rule_sip_d,
|
||||||
|
INET_NTOA(static_rule_msip) as static_rule_msip_d,
|
||||||
|
INET_NTOA(static_rule_dip) as static_rule_dip_d,
|
||||||
|
INET_NTOA(static_rule_mdip) as static_rule_mdip_d,
|
||||||
|
t_task.task_name as used_task_name
|
||||||
|
FROM t_static_rule_status_log
|
||||||
|
left join t_task on t_static_rule_status_log.static_rule_used_task_id = t_task.task_id
|
||||||
|
WHERE static_rule_id = #{id}
|
||||||
|
ORDER BY effective_time DESC
|
||||||
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -76,6 +76,8 @@
|
|||||||
<result column="template_id" property="templateId"/>
|
<result column="template_id" property="templateId"/>
|
||||||
<result column="template_name" property="templateName"/>
|
<result column="template_name" property="templateName"/>
|
||||||
<result column="source_system" property="sourceSystem"/>
|
<result column="source_system" property="sourceSystem"/>
|
||||||
|
<result column="effective_time" property="effeciveTime"/>
|
||||||
|
<result column="expire_time" property="expireTime"/>
|
||||||
<!--防护对象字段-->
|
<!--防护对象字段-->
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@@ -134,7 +136,7 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
|
order by task_id desc
|
||||||
LIMIT ${(page - 1) * page_size}, #{page_size}
|
LIMIT ${(page - 1) * page_size}, #{page_size}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -647,4 +649,12 @@
|
|||||||
where t_task_protectobject_conn.task_id = #{id}
|
where t_task_protectobject_conn.task_id = #{id}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryHistory" resultMap="taskMap">
|
||||||
|
SELECT *
|
||||||
|
FROM t_task_status_log
|
||||||
|
WHERE task_id = #{id}
|
||||||
|
ORDER BY effective_time DESC
|
||||||
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -278,6 +278,7 @@
|
|||||||
AND protect_level LIKE CONCAT('%', #{protect_level}, '%')
|
AND protect_level LIKE CONCAT('%', #{protect_level}, '%')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY strategy_template_id DESC
|
||||||
LIMIT ${(page - 1) * page_size}, #{page_size}
|
LIMIT ${(page - 1) * page_size}, #{page_size}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -346,5 +347,12 @@
|
|||||||
FROM t_strategy_template_new
|
FROM t_strategy_template_new
|
||||||
WHERE strategy_template_id = #{id}
|
WHERE strategy_template_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryHistory" resultMap="templateMap">
|
||||||
|
SELECT *
|
||||||
|
FROM t_strategy_template_new_status_log
|
||||||
|
WHERE strategy_template_id = #{id}
|
||||||
|
ORDER BY effective_time DESC
|
||||||
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -177,6 +177,7 @@
|
|||||||
and create_username = #{creator}
|
and create_username = #{creator}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by white_list_id desc
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -464,5 +465,13 @@
|
|||||||
from t_white_list
|
from t_white_list
|
||||||
where white_list_id = #{id}
|
where white_list_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryHistory"
|
||||||
|
resultMap="whiteListMap">
|
||||||
|
select *, INET_NTOA(white_list_ip) as white_list_ip_d
|
||||||
|
FROM t_white_list_status_log
|
||||||
|
WHERE white_list_id = #{id}
|
||||||
|
ORDER BY effective_time DESC
|
||||||
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -143,6 +143,12 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
System.out.println(staticRuleService.queryAuditStatusByIds(map));
|
System.out.println(staticRuleService.queryAuditStatusByIds(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testQueryHisttory(){
|
||||||
|
List<StaticRuleObject> lists= staticRuleService.queryHistory(1559, 1, 10);
|
||||||
|
lists.forEach(System.out::println);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.realtime.protection.configuration.entity.task.DynamicTaskInfo;
|
|||||||
import com.realtime.protection.configuration.entity.task.Task;
|
import com.realtime.protection.configuration.entity.task.Task;
|
||||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||||
import com.realtime.protection.configuration.exception.DorisStartException;
|
import com.realtime.protection.configuration.exception.DorisStartException;
|
||||||
|
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||||
import com.realtime.protection.server.command.CommandService;
|
import com.realtime.protection.server.command.CommandService;
|
||||||
import com.realtime.protection.server.defense.object.ProtectObjectService;
|
import com.realtime.protection.server.defense.object.ProtectObjectService;
|
||||||
import com.realtime.protection.server.defense.templatenew.TemplateService;
|
import com.realtime.protection.server.defense.templatenew.TemplateService;
|
||||||
@@ -145,8 +146,8 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, null, null, null, "eee",null,null,null,null,1, 10);
|
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, null, null, null, null,null,null,null,null,1, 10);
|
||||||
assertEquals(1, tasks.size());
|
tasks.forEach(task -> System.out.println(task));
|
||||||
Integer tasksnum = taskService.queryTaskTotalNum(null, null, "", "", null, "", "", "", "上述",null,null,null,null);
|
Integer tasksnum = taskService.queryTaskTotalNum(null, null, "", "", null, "", "", "", "上述",null,null,null,null);
|
||||||
System.out.println(tasksnum);
|
System.out.println(tasksnum);
|
||||||
//
|
//
|
||||||
@@ -379,4 +380,16 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
void testQueryTaskTotalNum(){
|
void testQueryTaskTotalNum(){
|
||||||
System.out.println(taskService.queryTaskTotalNum(null, null, "", "", null, "", "", "", "",null,null,null,null));
|
System.out.println(taskService.queryTaskTotalNum(null, null, "", "", null, "", "", "", "",null,null,null,null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testQueryTaskHistory(){
|
||||||
|
System.out.println(taskService.queryHistory(44058L,1,10));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateStaticRuleAuditStatusInTask(){
|
||||||
|
taskService.updateStaticRuleAuditStatusInTask(44126L, AuditStatusEnum.AUDITED);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,4 +155,12 @@ class WhiteListServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
whiteListService.updateAuditStatusBatch(idsWithAuditStatusMap);
|
whiteListService.updateAuditStatusBatch(idsWithAuditStatusMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testQueryHistory() {
|
||||||
|
whiteListService.queryHistory(1, 1, 2).forEach(
|
||||||
|
System.out::println
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user