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")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "防护对象创建人", example = "xxx")
|
||||
@Schema(description = "防护对象创建人", example = "xxx", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String protectObjectCreateUsername;
|
||||
|
||||
@JsonProperty("proobj_create_depart")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "防护对象创建人处室", example = "xxx")
|
||||
@Schema(description = "防护对象创建人处室", example = "xxx", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String protectObjectCreateDepart;
|
||||
|
||||
@JsonProperty("proobj_create_userid")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "防护对象创建人ID", example = "0")
|
||||
@Schema(description = "防护对象创建人ID", example = "0", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer protectObjectCreateUserId;
|
||||
|
||||
@JsonProperty("audit_user_name")
|
||||
@Schema(description = "审核用户名称", example = "user11")
|
||||
@Schema(description = "审核用户名称", example = "user11", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String auditUserName;
|
||||
@JsonProperty("audit_user_id")
|
||||
@Schema(description = "审核用户id", example = "11111")
|
||||
@Schema(description = "审核用户id", example = "11111", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String auditUserId;
|
||||
@JsonProperty("audit_user_depart")
|
||||
@Schema(description = "审核用户部门", example = "部门1")
|
||||
@Schema(description = "审核用户部门", example = "部门1", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String auditUserDepart;
|
||||
|
||||
@JsonProperty("create_time")
|
||||
@Schema(description = "创建时间", example = "")
|
||||
@Schema(description = "创建时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JsonProperty("modify_time")
|
||||
@Schema(description = "修改时间", example = "")
|
||||
@Schema(description = "修改时间", example = "", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
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 lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TemplateNew {
|
||||
@JsonProperty("template_id")
|
||||
@@ -117,4 +119,12 @@ public class TemplateNew {
|
||||
@JsonProperty("update_time")
|
||||
@Schema(description = "更新时间", example = "部门1", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
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;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||
@@ -97,6 +98,19 @@ public class DynamicRuleObject {
|
||||
@Schema(description = "动态规则描述", example = "动态规则描述")
|
||||
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) {
|
||||
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
||||
throw new IllegalArgumentException("规则《" + this.getDynamicRuleName() + "》原审批状态非法");
|
||||
|
||||
@@ -167,6 +167,20 @@ public class StaticRuleObject {
|
||||
@Schema(description = "事件类型", example = "DDos")
|
||||
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) {
|
||||
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
||||
|
||||
@@ -136,6 +136,13 @@ public class Task {
|
||||
accessMode = Schema.AccessMode.READ_ONLY)
|
||||
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")
|
||||
@Schema(description = "修改时间", example = "")
|
||||
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())))
|
||||
.setData("proobj_undit_num", protectObjectService.queryProtectObjectsTotalNum(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));
|
||||
}
|
||||
|
||||
@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}")
|
||||
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 updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
||||
|
||||
List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||
}
|
||||
|
||||
@@ -246,4 +246,8 @@ public class ProtectObjectService {
|
||||
protectObjectMapper.updateStaticRuleStatusLogExpireTimeBatch(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;
|
||||
|
||||
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.utils.enums.audit.AuditStatusEnum;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -151,6 +149,9 @@ public class TemplateController implements TemplateNewCpntrollerApi{
|
||||
))
|
||||
.setData("template_unaudit_num", templateService.queryAuditTemplateTotalNum(
|
||||
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()
|
||||
.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 insertStatusLogBatch(List<Integer> ids);
|
||||
|
||||
List<TemplateNew> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||
}
|
||||
|
||||
@@ -355,4 +355,27 @@ public interface TemplateNewCpntrollerApi {
|
||||
)
|
||||
@GetMapping("/auditInfo/{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.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(
|
||||
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));
|
||||
}
|
||||
|
||||
@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}")
|
||||
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 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())
|
||||
))
|
||||
.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));
|
||||
}
|
||||
|
||||
@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}")
|
||||
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 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.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))
|
||||
.setData("finished_num", taskService.queryTaskTotalNum(StateEnum.FINISHED.getStateNum(), null, null, null, null,
|
||||
null, null, null, null,null,null,null,null))
|
||||
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(
|
||||
AuditStatusEnum.PENDING.getNum()
|
||||
));
|
||||
.setData("unaudit_num", taskService.queryAuditTaskTotalNum(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
|
||||
@@ -285,5 +287,15 @@ public class TaskController implements TaskControllerApi {
|
||||
.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}")
|
||||
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 updateTaskStatusLogExpireTimeBatch(List<Integer> taskIds);
|
||||
|
||||
List<Task> queryHistory(Long id, Integer page, Integer pageSize);
|
||||
}
|
||||
|
||||
@@ -153,10 +153,12 @@ public class TaskService {
|
||||
}
|
||||
|
||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||
insertStaticRuleStatusLog(batchMap);
|
||||
batchMap.clear();
|
||||
}
|
||||
|
||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||
insertStaticRuleStatusLog(batchMap);
|
||||
batchMap.clear();
|
||||
|
||||
return null;
|
||||
@@ -214,10 +216,12 @@ public class TaskService {
|
||||
}
|
||||
|
||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||
insertDynamicRuleStatusLog(batchMap);
|
||||
batchMap.clear();
|
||||
}
|
||||
|
||||
mapper.updateAuditStatusByIdBatch(batchMap);
|
||||
insertDynamicRuleStatusLog(batchMap);
|
||||
batchMap.clear();
|
||||
|
||||
return null;
|
||||
@@ -243,6 +247,8 @@ public class TaskService {
|
||||
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())));
|
||||
@@ -523,4 +529,46 @@ public class TaskService {
|
||||
taskMapper.updateTaskStatusLogExpireTimeBatch(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) {
|
||||
commandService.removeCommandsByTaskId(taskId);
|
||||
|
||||
taskService.updateDynamicRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED);
|
||||
// 要删去规则的used_task_id,因为在新建时检查了是否有重复使用的规则
|
||||
taskService.removeDynamicRuleUsedTaskIdInTask(taskId);
|
||||
|
||||
taskService.updateStaticRuleAuditStatusInTask(taskId, AuditStatusEnum.AUDITED);
|
||||
taskService.removeStaticRuleUsedTaskIdInTask(taskId);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -212,6 +212,9 @@ public class WhiteListController implements WhiteListControllerApi {
|
||||
))
|
||||
.setData("whiteobj_unaudit_num", whiteListService.queryAuditWhiteListTotalNum(
|
||||
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));
|
||||
}
|
||||
|
||||
@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}")
|
||||
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 insertStatusLogBatch(List<Integer> ids);
|
||||
|
||||
List<WhiteListObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||
}
|
||||
|
||||
@@ -294,4 +294,8 @@ public class WhiteListService {
|
||||
whiteListMapper.updateStatusLogExpireTimeBatch(ids);
|
||||
whiteListMapper.insertStatusLogBatch(ids);
|
||||
}
|
||||
|
||||
public List<WhiteListObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||
return whiteListMapper.queryHistory(id, page, pageSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user