1、AlertMessage入库修复字段和库表不匹配问题,增加display_id
2、command增加display_id 3、规则、任务、配置增加新建时(批量导入除外)、任务运行状态、审核状态改变时的历史记录
This commit is contained in:
@@ -55,7 +55,7 @@ public class AlertMessage {
|
|||||||
@JsonProperty("c_priority")
|
@JsonProperty("c_priority")
|
||||||
private Integer c_priority;
|
private Integer c_priority;
|
||||||
@JsonProperty("c_time")
|
@JsonProperty("c_time")
|
||||||
private LocalDateTime c_time;
|
private Long c_time;
|
||||||
@JsonProperty("c_flowid")
|
@JsonProperty("c_flowid")
|
||||||
private String c_flowid;
|
private String c_flowid;
|
||||||
@JsonProperty("c_src_ipv4")
|
@JsonProperty("c_src_ipv4")
|
||||||
@@ -80,8 +80,8 @@ public class AlertMessage {
|
|||||||
private Integer c_d_tunnel_port;
|
private Integer c_d_tunnel_port;
|
||||||
@JsonProperty("c_proto_type")
|
@JsonProperty("c_proto_type")
|
||||||
private Integer c_proto_type;
|
private Integer c_proto_type;
|
||||||
@JsonProperty("c_return_info")
|
|
||||||
private String c_return_info;
|
|
||||||
@JsonProperty("c_s_boundary")
|
@JsonProperty("c_s_boundary")
|
||||||
private Long c_s_boundary;
|
private Long c_s_boundary;
|
||||||
@JsonProperty("c_s_region")
|
@JsonProperty("c_s_region")
|
||||||
@@ -108,8 +108,8 @@ public class AlertMessage {
|
|||||||
private String c_d_owner;
|
private String c_d_owner;
|
||||||
@JsonProperty("c_ret_file_type")
|
@JsonProperty("c_ret_file_type")
|
||||||
private Integer c_ret_file_type;
|
private Integer c_ret_file_type;
|
||||||
@JsonProperty("c_ret_filename")
|
@JsonProperty("c_ret_file_name")
|
||||||
private String c_ret_filename;
|
private String c_ret_file_name;
|
||||||
@JsonProperty("c_ret_file")
|
@JsonProperty("c_ret_file")
|
||||||
private String c_ret_file;
|
private String c_ret_file;
|
||||||
@JsonProperty("c_url")
|
@JsonProperty("c_url")
|
||||||
@@ -134,6 +134,15 @@ public class AlertMessage {
|
|||||||
private Long c_d_mark4;
|
private Long c_d_mark4;
|
||||||
@JsonProperty("c_d_mark5")
|
@JsonProperty("c_d_mark5")
|
||||||
private Long c_d_mark5;
|
private Long c_d_mark5;
|
||||||
|
|
||||||
|
@JsonProperty("display_id")
|
||||||
|
private String display_id;
|
||||||
|
|
||||||
|
@JsonProperty("c_return_info")
|
||||||
|
private String c_return_info;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// "c_priority": 0,
|
// "c_priority": 0,
|
||||||
// "c_time": 1714528212,
|
// "c_time": 1714528212,
|
||||||
// "c_flowid": "ca0c192021",
|
// "c_flowid": "ca0c192021",
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ public class TaskCommandInfo {
|
|||||||
@Schema(description = "指令所属任务的运行状态", accessMode = Schema.AccessMode.READ_ONLY)
|
@Schema(description = "指令所属任务的运行状态", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private Integer taskStatus;
|
private Integer taskStatus;
|
||||||
|
|
||||||
|
@Schema(description = "指令展示id", accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
|
private String displayId;
|
||||||
|
|
||||||
// 复制构造函数
|
// 复制构造函数
|
||||||
public void copyTaskCommandInfo(TaskCommandInfo original) {
|
public void copyTaskCommandInfo(TaskCommandInfo original) {
|
||||||
this.UUID = original.UUID;
|
this.UUID = original.UUID;
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ import com.realtime.protection.configuration.entity.alert.AlertMessage;
|
|||||||
import com.realtime.protection.configuration.entity.defense.template.ProtectLevel;
|
import com.realtime.protection.configuration.entity.defense.template.ProtectLevel;
|
||||||
import com.realtime.protection.configuration.entity.task.FiveTupleWithMask;
|
import com.realtime.protection.configuration.entity.task.FiveTupleWithMask;
|
||||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||||
|
import com.realtime.protection.configuration.utils.Counter;
|
||||||
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
||||||
import com.realtime.protection.configuration.utils.enums.TaskTypeEnum;
|
import com.realtime.protection.configuration.utils.enums.TaskTypeEnum;
|
||||||
import com.realtime.protection.server.command.CommandService;
|
import com.realtime.protection.server.command.CommandService;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -20,11 +23,13 @@ import java.util.UUID;
|
|||||||
public class AlertMessageService {
|
public class AlertMessageService {
|
||||||
private final CommandService commandService;
|
private final CommandService commandService;
|
||||||
private final AlertMessageMapper alertMessageMapper;
|
private final AlertMessageMapper alertMessageMapper;
|
||||||
|
private final Counter counter;
|
||||||
|
|
||||||
public AlertMessageService(
|
public AlertMessageService(
|
||||||
CommandService commandService, AlertMessageMapper alertMessageMapper) {
|
CommandService commandService, AlertMessageMapper alertMessageMapper, Counter counter) {
|
||||||
this.commandService = commandService;
|
this.commandService = commandService;
|
||||||
this.alertMessageMapper = alertMessageMapper;
|
this.alertMessageMapper = alertMessageMapper;
|
||||||
|
this.counter = counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
@@ -119,9 +124,17 @@ public class AlertMessageService {
|
|||||||
String commandUUID = commandService.createCommand(dynamicTaskCommandInfo);
|
String commandUUID = commandService.createCommand(dynamicTaskCommandInfo);
|
||||||
|
|
||||||
//alertmessage入库
|
//alertmessage入库
|
||||||
|
|
||||||
alertMessage.setCommandUUID(commandUUID);
|
alertMessage.setCommandUUID(commandUUID);
|
||||||
String alertMessageUUID = UUID.randomUUID().toString();
|
String alertMessageUUID = UUID.randomUUID().toString();
|
||||||
alertMessage.setAlertMessageUUID(alertMessageUUID);
|
alertMessage.setAlertMessageUUID(alertMessageUUID);
|
||||||
|
alertMessage.setDisplay_id(
|
||||||
|
"GJ-"
|
||||||
|
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||||
|
+ "-"
|
||||||
|
+ String.format("%06d", counter.generateId("alert_message"))
|
||||||
|
|
||||||
|
);
|
||||||
alertMessageMapper.insertAlertMessage(alertMessage);
|
alertMessageMapper.insertAlertMessage(alertMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +144,13 @@ public class AlertMessageService {
|
|||||||
alertMessage.setCommandUUID(null);
|
alertMessage.setCommandUUID(null);
|
||||||
String alertMessageUUID = UUID.randomUUID().toString();
|
String alertMessageUUID = UUID.randomUUID().toString();
|
||||||
alertMessage.setAlertMessageUUID(alertMessageUUID);
|
alertMessage.setAlertMessageUUID(alertMessageUUID);
|
||||||
|
alertMessage.setDisplay_id(
|
||||||
|
"GJ-"
|
||||||
|
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||||
|
+ "-"
|
||||||
|
+ String.format("%06d", counter.generateId("alert_message"))
|
||||||
|
|
||||||
|
);
|
||||||
alertMessageMapper.insertAlertMessage(alertMessage);
|
alertMessageMapper.insertAlertMessage(alertMessage);
|
||||||
|
|
||||||
return alertMessageUUID;
|
return alertMessageUUID;
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import com.alibaba.excel.util.ListUtils;
|
|||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||||
|
import com.realtime.protection.configuration.utils.Counter;
|
||||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -19,11 +22,13 @@ public class CommandService {
|
|||||||
|
|
||||||
private final CommandMapper commandMapper;
|
private final CommandMapper commandMapper;
|
||||||
private final SqlSessionWrapper sqlSessionWrapper;
|
private final SqlSessionWrapper sqlSessionWrapper;
|
||||||
|
private final Counter counter;
|
||||||
private static final int BatchSize = 100;
|
private static final int BatchSize = 100;
|
||||||
|
|
||||||
public CommandService(CommandMapper commandMapper, SqlSessionWrapper sqlSessionWrapper) {
|
public CommandService(CommandMapper commandMapper, SqlSessionWrapper sqlSessionWrapper, Counter counter) {
|
||||||
this.commandMapper = commandMapper;
|
this.commandMapper = commandMapper;
|
||||||
this.sqlSessionWrapper = sqlSessionWrapper;
|
this.sqlSessionWrapper = sqlSessionWrapper;
|
||||||
|
this.counter = counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
@@ -32,6 +37,12 @@ public class CommandService {
|
|||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
commandInfo.setDisplayId(
|
||||||
|
"ZL-"
|
||||||
|
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||||
|
+ "-"
|
||||||
|
+ String.format("%06d", counter.generateId("command"))
|
||||||
|
);
|
||||||
|
|
||||||
commandInfo.setUUID(UUID.randomUUID().toString());
|
commandInfo.setUUID(UUID.randomUUID().toString());
|
||||||
commandMapper.createCommand(commandInfo);
|
commandMapper.createCommand(commandInfo);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.realtime.protection.configuration.response.ResponseResult;
|
|||||||
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.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -60,4 +61,12 @@ public interface ProtectObjectMapper {
|
|||||||
Boolean updateAuditInfo(@Param("ids")List<Integer> ids, @Param("auditInfo")String auditInfo);
|
Boolean updateAuditInfo(@Param("ids")List<Integer> ids, @Param("auditInfo")String auditInfo);
|
||||||
|
|
||||||
String queryProtectObjectAuditInfo(Integer id);
|
String queryProtectObjectAuditInfo(Integer id);
|
||||||
|
|
||||||
|
void insertStaticRuleStatusLog(Integer id);
|
||||||
|
|
||||||
|
void updateStaticRuleStatusLogExpireTime(Integer id);
|
||||||
|
|
||||||
|
void insertStaticRuleStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,17 @@ package com.realtime.protection.server.defense.object;
|
|||||||
|
|
||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.realtime.protection.configuration.entity.defense.object.ProtectObject;
|
import com.realtime.protection.configuration.entity.defense.object.ProtectObject;
|
||||||
import com.realtime.protection.configuration.response.ResponseResult;
|
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||||
import com.realtime.protection.configuration.utils.Counter;
|
import com.realtime.protection.configuration.utils.Counter;
|
||||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||||
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;
|
||||||
import com.realtime.protection.server.whitelist.WhiteListMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -45,6 +41,7 @@ public class ProtectObjectService {
|
|||||||
if (protectObject.getProtectObjectId() == null) {
|
if (protectObject.getProtectObjectId() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
insertStaticRuleStatusLog(protectObject.getProtectObjectId());
|
||||||
return protectObject.getProtectObjectId();
|
return protectObject.getProtectObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +142,7 @@ public class ProtectObjectService {
|
|||||||
}
|
}
|
||||||
Boolean success = protectObjectMapper.changeProtectObjectAuditStatus(protectObjectId, auditStatus);
|
Boolean success = protectObjectMapper.changeProtectObjectAuditStatus(protectObjectId, auditStatus);
|
||||||
|
|
||||||
|
insertStaticRuleStatusLog(protectObjectId);
|
||||||
Integer auditStatusNow = protectObjectMapper.queryProtectObject(protectObjectId).getProtectObjectAuditStatus();
|
Integer auditStatusNow = protectObjectMapper.queryProtectObject(protectObjectId).getProtectObjectAuditStatus();
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("success", success);
|
resultMap.put("success", success);
|
||||||
@@ -204,10 +202,12 @@ public class ProtectObjectService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -223,4 +223,27 @@ public class ProtectObjectService {
|
|||||||
public String queryAuditInfo(Integer id) {
|
public String queryAuditInfo(Integer id) {
|
||||||
return protectObjectMapper.queryProtectObjectAuditInfo(id);
|
return protectObjectMapper.queryProtectObjectAuditInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertStaticRuleStatusLog(Integer id) {
|
||||||
|
//先把之前的状态日志过期,再插入新的状态日志
|
||||||
|
protectObjectMapper.updateStaticRuleStatusLogExpireTime(id);
|
||||||
|
protectObjectMapper.insertStaticRuleStatusLog(id);
|
||||||
|
}
|
||||||
|
public void insertStaticRuleStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
ArrayList<Integer> ids = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
protectObjectMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
||||||
|
protectObjectMapper.insertStaticRuleStatusLogBatch(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertStaticRuleStatusLog(List<StaticRuleObject> objects) {
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (StaticRuleObject staticRuleObject : objects) {
|
||||||
|
ids.add(staticRuleObject.getStaticRuleId());
|
||||||
|
}
|
||||||
|
|
||||||
|
protectObjectMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
||||||
|
protectObjectMapper.insertStaticRuleStatusLogBatch(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -61,4 +62,11 @@ public interface TemplateMapper {
|
|||||||
|
|
||||||
String queryAuditInfo(Integer id);
|
String queryAuditInfo(Integer id);
|
||||||
|
|
||||||
|
void updateStatusLogExpireTime(Integer id);
|
||||||
|
|
||||||
|
void insertStatusLog(Integer id);
|
||||||
|
|
||||||
|
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
void insertStatusLogBatch(List<Integer> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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.rule.staticrule.StaticRuleObject;
|
||||||
import com.realtime.protection.configuration.utils.Counter;
|
import com.realtime.protection.configuration.utils.Counter;
|
||||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||||
@@ -8,10 +9,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -41,6 +39,7 @@ public class TemplateService {
|
|||||||
if (template.getTemplateId() == null) {
|
if (template.getTemplateId() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
insertStatusLog(template.getTemplateId());
|
||||||
return template.getTemplateId();
|
return template.getTemplateId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +102,7 @@ public class TemplateService {
|
|||||||
throw new IllegalArgumentException("invalid audit status");
|
throw new IllegalArgumentException("invalid audit status");
|
||||||
}
|
}
|
||||||
Boolean success = templateMapper.updateAuditStatusById(id, auditStatus);
|
Boolean success = templateMapper.updateAuditStatusById(id, auditStatus);
|
||||||
|
insertStatusLog(id);
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("success", success);
|
resultMap.put("success", success);
|
||||||
resultMap.put("audit_status", auditStatus);
|
resultMap.put("audit_status", auditStatus);
|
||||||
@@ -145,10 +144,12 @@ public class TemplateService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -165,4 +166,26 @@ public class TemplateService {
|
|||||||
public String queryAuditInfo(Integer id) {
|
public String queryAuditInfo(Integer id) {
|
||||||
return templateMapper.queryAuditInfo(id);
|
return templateMapper.queryAuditInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertStatusLog(Integer id) {
|
||||||
|
templateMapper.updateStatusLogExpireTime(id);
|
||||||
|
templateMapper.insertStatusLog(id);
|
||||||
|
}
|
||||||
|
public void insertStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
ArrayList<Integer> ids = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
templateMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
templateMapper.insertStatusLogBatch(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertStatusLog(List<StaticRuleObject> objects) {
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (StaticRuleObject staticRuleObject : objects) {
|
||||||
|
ids.add(staticRuleObject.getStaticRuleId());
|
||||||
|
}
|
||||||
|
|
||||||
|
templateMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
templateMapper.insertStatusLogBatch(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRule
|
|||||||
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.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -64,4 +65,12 @@ public interface DynamicRuleMapper {
|
|||||||
@Param("auditUserName")String auditUserName,
|
@Param("auditUserName")String auditUserName,
|
||||||
@Param("auditUserId")String auditUserId,
|
@Param("auditUserId")String auditUserId,
|
||||||
@Param("auditUserDepart")String auditUserDepart);
|
@Param("auditUserDepart")String auditUserDepart);
|
||||||
|
|
||||||
|
void insertStatusLog(Integer id);
|
||||||
|
|
||||||
|
void updateStatusLogExpireTime(Integer id);
|
||||||
|
|
||||||
|
void insertStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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.rule.dynamicrule.DynamicRuleObject;
|
import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRuleObject;
|
||||||
|
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||||
import com.realtime.protection.configuration.utils.Counter;
|
import com.realtime.protection.configuration.utils.Counter;
|
||||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||||
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
||||||
@@ -11,10 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -40,7 +38,7 @@ public class DynamicRuleService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
dynamicRuleMapper.newDynamicRule(dynamicRule);
|
dynamicRuleMapper.newDynamicRule(dynamicRule);
|
||||||
|
insertStatusLog(dynamicRule.getDynamicRuleId());
|
||||||
return dynamicRule.getDynamicRuleId();
|
return dynamicRule.getDynamicRuleId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +203,8 @@ public class DynamicRuleService {
|
|||||||
}
|
}
|
||||||
Boolean success = dynamicRuleMapper.updateAuditStatusById(id, auditStatus ,auditUserName, auditUserId, auditUserDepart);
|
Boolean success = dynamicRuleMapper.updateAuditStatusById(id, auditStatus ,auditUserName, auditUserId, auditUserDepart);
|
||||||
|
|
||||||
|
insertStatusLog(id);
|
||||||
|
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("success", success);
|
resultMap.put("success", success);
|
||||||
resultMap.put("audit_status", auditStatus);
|
resultMap.put("audit_status", auditStatus);
|
||||||
@@ -250,10 +250,12 @@ public class DynamicRuleService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -309,10 +311,13 @@ public class DynamicRuleService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch, auditUserName, auditUserId, auditUserDepart);
|
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch, auditUserName, auditUserId, auditUserDepart);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
|
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch, auditUserName, auditUserId, auditUserDepart);
|
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch, auditUserName, auditUserId, auditUserDepart);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -331,4 +336,30 @@ public class DynamicRuleService {
|
|||||||
public String queryAuditInfo(Integer id) {
|
public String queryAuditInfo(Integer id) {
|
||||||
return dynamicRuleMapper.queryAuditInfo(id);
|
return dynamicRuleMapper.queryAuditInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertStatusLog(Integer id) {
|
||||||
|
|
||||||
|
dynamicRuleMapper.updateStatusLogExpireTime(id);
|
||||||
|
dynamicRuleMapper.insertStatusLog(id);
|
||||||
|
}
|
||||||
|
public void insertStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
ArrayList<Integer> ids = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
dynamicRuleMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
dynamicRuleMapper.insertStatusLogBatch(ids);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertSStatusLog(List<StaticRuleObject> objects) {
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (StaticRuleObject staticRuleObject : objects) {
|
||||||
|
ids.add(staticRuleObject.getStaticRuleId());
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamicRuleMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
dynamicRuleMapper.insertStatusLogBatch(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class StaticRuleController implements StaticRuleControllerApi {
|
|||||||
object.setStaticRuleCreateUserId(Integer.valueOf(user.uid));
|
object.setStaticRuleCreateUserId(Integer.valueOf(user.uid));
|
||||||
object.setStaticRuleCreateDepart(user.getOrgName());
|
object.setStaticRuleCreateDepart(user.getOrgName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用service新增
|
//调用service新增
|
||||||
staticRuleService.newStaticRuleObject(object);
|
staticRuleService.newStaticRuleObject(object);
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ 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;
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ public interface StaticRuleMapper {
|
|||||||
|
|
||||||
void deleteStaticRules(@Param("staticRuleIds") List<Integer> staticRuleBatch);
|
void deleteStaticRules(@Param("staticRuleIds") List<Integer> staticRuleBatch);
|
||||||
|
|
||||||
void newStaticRules(List<StaticRuleObject> staticRuleBatch);
|
void newStaticRules(List<StaticRuleObject> list);
|
||||||
|
|
||||||
Integer queryAuditStatusById(Integer id);
|
Integer queryAuditStatusById(Integer id);
|
||||||
|
|
||||||
@@ -69,4 +68,12 @@ public interface StaticRuleMapper {
|
|||||||
Boolean updateAuditInfo(@Param("ids") List<Integer> ids, @Param("auditInfo") String auditInfo);
|
Boolean updateAuditInfo(@Param("ids") List<Integer> ids, @Param("auditInfo") String auditInfo);
|
||||||
|
|
||||||
String queryAuditInfo(Integer id);
|
String queryAuditInfo(Integer id);
|
||||||
|
|
||||||
|
void insertStaticRuleStatusLog(Integer id);
|
||||||
|
|
||||||
|
void updateStaticRuleStatusLogExpireTime(Integer id);
|
||||||
|
|
||||||
|
void insertStaticRuleStatusLogBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ public class StaticRuleService {
|
|||||||
|
|
||||||
staticRuleMapper.newStaticRuleObject(object);
|
staticRuleMapper.newStaticRuleObject(object);
|
||||||
|
|
||||||
|
insertStaticRuleStatusLog(object.getStaticRuleId());
|
||||||
|
|
||||||
return object.getStaticRuleId();
|
return object.getStaticRuleId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,10 +212,13 @@ public class StaticRuleService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.newStaticRules(StaticRuleBatch);
|
mapper.newStaticRules(StaticRuleBatch);
|
||||||
|
//todo: 批量插入静态规则,mybatis未返回主键id,待解决
|
||||||
|
// insertStaticRuleStatusLog(StaticRuleBatch);
|
||||||
StaticRuleBatch.clear();
|
StaticRuleBatch.clear();
|
||||||
}
|
}
|
||||||
if (!StaticRuleBatch.isEmpty()) {
|
if (!StaticRuleBatch.isEmpty()) {
|
||||||
mapper.newStaticRules(StaticRuleBatch);
|
mapper.newStaticRules(StaticRuleBatch);
|
||||||
|
// insertStaticRuleStatusLog(StaticRuleBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -237,7 +242,8 @@ public class StaticRuleService {
|
|||||||
throw new IllegalArgumentException("invalid audit status");
|
throw new IllegalArgumentException("invalid audit status");
|
||||||
}
|
}
|
||||||
Boolean success = staticRuleMapper.updateAuditStatusById(id, auditStatus, auditUserName, auditUserId, auditUserDepart);
|
Boolean success = staticRuleMapper.updateAuditStatusById(id, auditStatus, auditUserName, auditUserId, auditUserDepart);
|
||||||
|
//记录状态历史
|
||||||
|
insertStaticRuleStatusLog(id);
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("success", success);
|
resultMap.put("success", success);
|
||||||
resultMap.put("audit_status", auditStatus);
|
resultMap.put("audit_status", auditStatus);
|
||||||
@@ -309,11 +315,13 @@ public class StaticRuleService {
|
|||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch,
|
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch,
|
||||||
auditUserName, auditUserId, auditUserDepart);
|
auditUserName, auditUserId, auditUserDepart);
|
||||||
|
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch,
|
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch,
|
||||||
auditUserName, auditUserId, auditUserDepart);
|
auditUserName, auditUserId, auditUserDepart);
|
||||||
|
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -358,10 +366,12 @@ public class StaticRuleService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -388,4 +398,26 @@ public class StaticRuleService {
|
|||||||
public String queryAuditInfo(Integer id) {
|
public String queryAuditInfo(Integer id) {
|
||||||
return staticRuleMapper.queryAuditInfo(id);
|
return staticRuleMapper.queryAuditInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertStaticRuleStatusLog(Integer id) {
|
||||||
|
staticRuleMapper.updateStaticRuleStatusLogExpireTime(id);
|
||||||
|
staticRuleMapper.insertStaticRuleStatusLog(id);
|
||||||
|
}
|
||||||
|
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 insertStaticRuleStatusLog(List<StaticRuleObject> objects) {
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (StaticRuleObject staticRuleObject : objects) {
|
||||||
|
ids.add(staticRuleObject.getStaticRuleId());
|
||||||
|
}
|
||||||
|
|
||||||
|
staticRuleMapper.updateStaticRuleStatusLogExpireTimeBatch(ids);
|
||||||
|
staticRuleMapper.insertStaticRuleStatusLogBatch(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,4 +104,12 @@ public interface TaskMapper {
|
|||||||
void deleteTaskProtectObjectConcat(Long taskId);
|
void deleteTaskProtectObjectConcat(Long taskId);
|
||||||
|
|
||||||
List<ProtectObject> queryProtectObjectsByTaskId(Long id);
|
List<ProtectObject> queryProtectObjectsByTaskId(Long id);
|
||||||
|
|
||||||
|
void insertTaskStatusLog(Long taskId);
|
||||||
|
|
||||||
|
void updateTaskStatusLogExpireTime(Long taskId);
|
||||||
|
|
||||||
|
void insertTaskStatusLogBatch(List<Integer> idWithAuditStatusBatch);
|
||||||
|
|
||||||
|
void updateTaskStatusLogExpireTimeBatch(List<Integer> taskIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class TaskService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
insertTaskStatusLog(task.getTaskId());
|
||||||
return task.getTaskId();
|
return task.getTaskId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ public class TaskService {
|
|||||||
if (AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(taskAuditStatus))
|
if (AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(taskAuditStatus))
|
||||||
taskMapper.changeTaskAuditStatusWithAudior(taskId, taskAuditStatus, auditUserName, auditUserId, auditUserDepart);
|
taskMapper.changeTaskAuditStatusWithAudior(taskId, taskAuditStatus, auditUserName, auditUserId, auditUserDepart);
|
||||||
else return false;
|
else return false;
|
||||||
|
insertTaskStatusLog(taskId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -329,6 +329,7 @@ public class TaskService {
|
|||||||
if (AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(taskAuditStatus))
|
if (AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(taskAuditStatus))
|
||||||
taskMapper.changeTaskAuditStatus(taskId, taskAuditStatus);
|
taskMapper.changeTaskAuditStatus(taskId, taskAuditStatus);
|
||||||
else return false;
|
else return false;
|
||||||
|
insertTaskStatusLog(taskId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -427,10 +428,13 @@ public class TaskService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
//记录状态日志
|
||||||
|
insertTaskStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertTaskStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -507,4 +511,16 @@ public class TaskService {
|
|||||||
public String queryAuditInfo(Integer id) {
|
public String queryAuditInfo(Integer id) {
|
||||||
return taskMapper.queryAuditInfo(id);
|
return taskMapper.queryAuditInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertTaskStatusLog(Long taskId) {
|
||||||
|
taskMapper.updateTaskStatusLogExpireTime(taskId);
|
||||||
|
taskMapper.insertTaskStatusLog(taskId);
|
||||||
|
}
|
||||||
|
public void insertTaskStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
ArrayList<Integer> taskIds = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
taskMapper.updateTaskStatusLogExpireTimeBatch(taskIds);
|
||||||
|
taskMapper.insertTaskStatusLogBatch(taskIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,8 +70,15 @@ public class StateChangeService {
|
|||||||
originalState.getClass().getSimpleName(),
|
originalState.getClass().getSimpleName(),
|
||||||
newState.getClass().getSimpleName()));
|
newState.getClass().getSimpleName()));
|
||||||
|
|
||||||
|
|
||||||
// 这里一定是handle成功的状态,我们再进行task status的修改,如果handle失败,要么返回false,要么抛出异常,不会进入此处
|
// 这里一定是handle成功的状态,我们再进行task status的修改,如果handle失败,要么返回false,要么抛出异常,不会进入此处
|
||||||
return taskService.changeTaskStatus(taskId, stateNum);
|
Boolean isChanged = taskService.changeTaskStatus(taskId, stateNum);
|
||||||
|
//记录状态日志
|
||||||
|
if (isChanged) {
|
||||||
|
taskService.insertTaskStatusLog(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean checkState(State originalState, State newState) {
|
private Boolean checkState(State originalState, State newState) {
|
||||||
|
|||||||
@@ -8,6 +8,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.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -59,4 +60,12 @@ public interface WhiteListMapper {
|
|||||||
Boolean updateAuditInfo(@Param("ids")List<Integer> ids, @Param("auditInfo")String auditInfo);
|
Boolean updateAuditInfo(@Param("ids")List<Integer> ids, @Param("auditInfo")String auditInfo);
|
||||||
|
|
||||||
String queryWhiteListObjectAuditInfo(Integer id);
|
String queryWhiteListObjectAuditInfo(Integer id);
|
||||||
|
|
||||||
|
void updateStatusLogExpireTime(Integer id);
|
||||||
|
|
||||||
|
void insertStatusLog(Integer id);
|
||||||
|
|
||||||
|
void updateStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
|
void insertStatusLogBatch(List<Integer> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -50,6 +47,7 @@ public class WhiteListService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
whiteListMapper.newWhiteListObject(object);
|
whiteListMapper.newWhiteListObject(object);
|
||||||
|
insertStatusLog(object.getWhiteListId());
|
||||||
|
|
||||||
return object.getWhiteListId();
|
return object.getWhiteListId();
|
||||||
}
|
}
|
||||||
@@ -200,7 +198,7 @@ public class WhiteListService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Boolean success = whiteListMapper.updateWhiteListObjectAuditStatus(id, auditStatus);
|
Boolean success = whiteListMapper.updateWhiteListObjectAuditStatus(id, auditStatus);
|
||||||
|
insertStatusLog(id);
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("success", success);
|
resultMap.put("success", success);
|
||||||
resultMap.put("audit_status", auditStatus);
|
resultMap.put("audit_status", auditStatus);
|
||||||
@@ -253,10 +251,12 @@ public class WhiteListService {
|
|||||||
}
|
}
|
||||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
idWithAuditStatusBatch.clear();
|
idWithAuditStatusBatch.clear();
|
||||||
}
|
}
|
||||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||||
|
insertStatusLog(idWithAuditStatusBatch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -272,4 +272,26 @@ public class WhiteListService {
|
|||||||
public String queryAuditInfo(Integer id) {
|
public String queryAuditInfo(Integer id) {
|
||||||
return whiteListMapper.queryWhiteListObjectAuditInfo(id);
|
return whiteListMapper.queryWhiteListObjectAuditInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertStatusLog(Integer id) {
|
||||||
|
whiteListMapper.updateStatusLogExpireTime(id);
|
||||||
|
whiteListMapper.insertStatusLog(id);
|
||||||
|
}
|
||||||
|
public void insertStatusLog(Map<Integer, Integer> idWithAuditStatusBatch) {
|
||||||
|
Set<Integer> keys = idWithAuditStatusBatch.keySet();
|
||||||
|
List<Integer> ids = new ArrayList<>(keys);
|
||||||
|
|
||||||
|
whiteListMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
whiteListMapper.insertStatusLogBatch(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertStatusLog(List<StaticRuleObject> objects) {
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (StaticRuleObject staticRuleObject : objects) {
|
||||||
|
ids.add(staticRuleObject.getStaticRuleId());
|
||||||
|
}
|
||||||
|
|
||||||
|
whiteListMapper.updateStatusLogExpireTimeBatch(ids);
|
||||||
|
whiteListMapper.insertStatusLogBatch(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,97 @@
|
|||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertStatusLog">
|
||||||
|
insert into t_dynamic_rule_status_log
|
||||||
|
(
|
||||||
|
dynamic_rule_id,
|
||||||
|
effective_time,expire_time,
|
||||||
|
dynamic_rule_used_task_id,
|
||||||
|
dynamic_rule_name,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
dynamic_rule_create_username,
|
||||||
|
dynamic_rule_create_depart,
|
||||||
|
dynamic_rule_create_user_id,
|
||||||
|
audit_status,
|
||||||
|
dynamic_rule_display_id,
|
||||||
|
dynamic_rule_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
bw_sql,
|
||||||
|
description,
|
||||||
|
source_system
|
||||||
|
)
|
||||||
|
select
|
||||||
|
dynamic_rule_id,
|
||||||
|
NOW(), NULL,
|
||||||
|
dynamic_rule_used_task_id,
|
||||||
|
dynamic_rule_name,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
dynamic_rule_create_username,
|
||||||
|
dynamic_rule_create_depart,
|
||||||
|
dynamic_rule_create_user_id,
|
||||||
|
audit_status,
|
||||||
|
dynamic_rule_display_id,
|
||||||
|
dynamic_rule_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
bw_sql,
|
||||||
|
description,
|
||||||
|
source_system
|
||||||
|
from t_dynamic_rule
|
||||||
|
where dynamic_rule_id = #{id}
|
||||||
|
</insert>
|
||||||
|
<insert id="insertStatusLogBatch">
|
||||||
|
insert into t_dynamic_rule_status_log
|
||||||
|
(
|
||||||
|
dynamic_rule_id,
|
||||||
|
effective_time,expire_time,
|
||||||
|
dynamic_rule_used_task_id,
|
||||||
|
dynamic_rule_name,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
dynamic_rule_create_username,
|
||||||
|
dynamic_rule_create_depart,
|
||||||
|
dynamic_rule_create_user_id,
|
||||||
|
audit_status,
|
||||||
|
dynamic_rule_display_id,
|
||||||
|
dynamic_rule_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
bw_sql,
|
||||||
|
description,
|
||||||
|
source_system
|
||||||
|
)
|
||||||
|
select
|
||||||
|
dynamic_rule_id,
|
||||||
|
NOW() NULL,
|
||||||
|
dynamic_rule_used_task_id,
|
||||||
|
dynamic_rule_name,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
dynamic_rule_create_username,
|
||||||
|
dynamic_rule_create_depart,
|
||||||
|
dynamic_rule_create_user_id,
|
||||||
|
audit_status,
|
||||||
|
dynamic_rule_display_id,
|
||||||
|
dynamic_rule_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
bw_sql,
|
||||||
|
description,
|
||||||
|
source_system
|
||||||
|
from t_dynamic_rule
|
||||||
|
where dynamic_rule_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<!-- join删除-->
|
<!-- join删除-->
|
||||||
@@ -129,6 +219,20 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateStatusLogExpireTime">
|
||||||
|
update t_dynamic_rule_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where dynamic_rule_id = #{id} and expire_time is null
|
||||||
|
</update>
|
||||||
|
<update id="updateStatusLogExpireTimeBatch">
|
||||||
|
update t_dynamic_rule_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where dynamic_rule_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
and expire_time is null
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<resultMap id="dynamicRuleMap"
|
<resultMap id="dynamicRuleMap"
|
||||||
|
|||||||
@@ -33,6 +33,99 @@
|
|||||||
#{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId})
|
#{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertStaticRuleStatusLog">
|
||||||
|
INSERT INTO t_protect_object_status_log(
|
||||||
|
protect_object_id,
|
||||||
|
effective_time,expire_time,
|
||||||
|
protect_object_name,
|
||||||
|
protect_object_system_name,
|
||||||
|
protect_object_ip,
|
||||||
|
protect_object_port,
|
||||||
|
protect_object_url,
|
||||||
|
protect_object_protocol,
|
||||||
|
protect_object_audit_status,
|
||||||
|
protect_object_create_username,
|
||||||
|
protect_object_create_depart,
|
||||||
|
protect_object_create_user_id,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
protect_object_display_id,
|
||||||
|
protect_object_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_deaprt
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
protect_object_id,
|
||||||
|
NOW(), NULL,
|
||||||
|
protect_object_name,
|
||||||
|
protect_object_system_name,
|
||||||
|
protect_object_ip,
|
||||||
|
protect_object_port,
|
||||||
|
protect_object_url,
|
||||||
|
protect_object_protocol,
|
||||||
|
protect_object_audit_status,
|
||||||
|
protect_object_create_username,
|
||||||
|
protect_object_create_depart,
|
||||||
|
protect_object_create_user_id,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
protect_object_display_id,
|
||||||
|
protect_object_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_deaprt
|
||||||
|
FROM t_protect_object
|
||||||
|
WHERE protect_object_id = #{id}
|
||||||
|
</insert>
|
||||||
|
<insert id="insertStaticRuleStatusLogBatch">
|
||||||
|
INSERT INTO t_protect_object_status_log(
|
||||||
|
protect_object_id,
|
||||||
|
effective_time,expire_time,
|
||||||
|
protect_object_name,
|
||||||
|
protect_object_system_name,
|
||||||
|
protect_object_ip,
|
||||||
|
protect_object_port,
|
||||||
|
protect_object_url,
|
||||||
|
protect_object_protocol,
|
||||||
|
protect_object_audit_status,
|
||||||
|
protect_object_create_username,
|
||||||
|
protect_object_create_depart,
|
||||||
|
protect_object_create_user_id,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
protect_object_display_id,
|
||||||
|
protect_object_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_deaprt
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
protect_object_id,
|
||||||
|
NOW(), NULL,
|
||||||
|
protect_object_name,
|
||||||
|
protect_object_system_name,
|
||||||
|
protect_object_ip,
|
||||||
|
protect_object_port,
|
||||||
|
protect_object_url,
|
||||||
|
protect_object_protocol,
|
||||||
|
protect_object_audit_status,
|
||||||
|
protect_object_create_username,
|
||||||
|
protect_object_create_depart,
|
||||||
|
protect_object_create_user_id,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
protect_object_display_id,
|
||||||
|
protect_object_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_deaprt
|
||||||
|
FROM t_protect_object
|
||||||
|
WHERE protect_object_id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<resultMap id="protectObjectMap" type="com.realtime.protection.configuration.entity.defense.object.ProtectObject">
|
<resultMap id="protectObjectMap" type="com.realtime.protection.configuration.entity.defense.object.ProtectObject">
|
||||||
<id column="protect_object_id" property="protectObjectId"/>
|
<id column="protect_object_id" property="protectObjectId"/>
|
||||||
@@ -215,4 +308,18 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateStaticRuleStatusLogExpireTime">
|
||||||
|
UPDATE t_protect_object_status_log
|
||||||
|
SET expire_time = NOW()
|
||||||
|
WHERE protect_object_id = #{id} AND expire_time IS NULL
|
||||||
|
</update>
|
||||||
|
<update id="updateStaticRuleStatusLogExpireTimeBatch">
|
||||||
|
UPDATE t_protect_object_status_log
|
||||||
|
SET expire_time = NOW()
|
||||||
|
WHERE protect_object_id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
AND expire_time IS NULL
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
#{object.auditStatus},
|
#{object.auditStatus},
|
||||||
#{object.staticRuleDisplayId},#{object.eventType})
|
#{object.staticRuleDisplayId},#{object.eventType})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="newStaticRules">
|
<insert id="newStaticRules" useGeneratedKeys="true" keyProperty="staticRuleId"
|
||||||
|
keyColumn="static_rule_id" parameterType="com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject">
|
||||||
insert into t_static_rule(static_rule_name, static_rule_create_time,
|
insert into t_static_rule(static_rule_name, static_rule_create_time,
|
||||||
static_rule_create_username, static_rule_create_depart,
|
static_rule_create_username, static_rule_create_depart,
|
||||||
static_rule_create_user_id, static_rule_sip, static_rule_msip,
|
static_rule_create_user_id, static_rule_sip, static_rule_msip,
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
static_rule_display_id,event_type
|
static_rule_display_id,event_type
|
||||||
)
|
)
|
||||||
values
|
values
|
||||||
<foreach collection="staticRuleBatch" item="object" separator=",">
|
<foreach collection="list" item="object" separator=",">
|
||||||
(#{object.staticRuleName}, NOW(), #{object.staticRuleCreateUsername},
|
(#{object.staticRuleName}, NOW(), #{object.staticRuleCreateUsername},
|
||||||
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
||||||
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
||||||
@@ -49,6 +50,143 @@
|
|||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertStaticRuleStatusLog">
|
||||||
|
insert into t_static_rule_status_log(
|
||||||
|
static_rule_id,
|
||||||
|
static_rule_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
static_rule_create_time,
|
||||||
|
static_rule_create_username,
|
||||||
|
static_rule_audit_status,
|
||||||
|
static_rule_create_depart,
|
||||||
|
static_rule_create_user_id,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
static_rule_used_task_id,
|
||||||
|
static_rule_sip,
|
||||||
|
static_rule_msip,
|
||||||
|
static_rule_sport,
|
||||||
|
static_rule_msport,
|
||||||
|
static_rule_dip,
|
||||||
|
static_rule_mdip,
|
||||||
|
static_rule_dport,
|
||||||
|
static_rule_mdport,
|
||||||
|
static_rule_protocol,
|
||||||
|
static_rule_mprotocol,
|
||||||
|
static_rule_dns,
|
||||||
|
static_rule_url,
|
||||||
|
static_rule_priority,
|
||||||
|
static_rule_frequency,
|
||||||
|
static_rule_modify_time,
|
||||||
|
static_rule_display_id,
|
||||||
|
static_rule_audit_info,
|
||||||
|
event_type
|
||||||
|
)
|
||||||
|
select
|
||||||
|
static_rule_id,
|
||||||
|
static_rule_name,
|
||||||
|
NOW(),NULL,
|
||||||
|
static_rule_create_time,
|
||||||
|
static_rule_create_username,
|
||||||
|
static_rule_audit_status,
|
||||||
|
static_rule_create_depart,
|
||||||
|
static_rule_create_user_id,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
static_rule_used_task_id,
|
||||||
|
static_rule_sip,
|
||||||
|
static_rule_msip,
|
||||||
|
static_rule_sport,
|
||||||
|
static_rule_msport,
|
||||||
|
static_rule_dip,
|
||||||
|
static_rule_mdip,
|
||||||
|
static_rule_dport,
|
||||||
|
static_rule_mdport,
|
||||||
|
static_rule_protocol,
|
||||||
|
static_rule_mprotocol,
|
||||||
|
static_rule_dns,
|
||||||
|
static_rule_url,
|
||||||
|
static_rule_priority,
|
||||||
|
static_rule_frequency,
|
||||||
|
static_rule_modify_time,
|
||||||
|
static_rule_display_id,
|
||||||
|
static_rule_audit_info,
|
||||||
|
event_type
|
||||||
|
from t_static_rule
|
||||||
|
where static_rule_id = #{id}
|
||||||
|
</insert>
|
||||||
|
<insert id="insertStaticRuleStatusLogBatch">
|
||||||
|
insert into t_static_rule_status_log(
|
||||||
|
static_rule_id,
|
||||||
|
static_rule_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
static_rule_create_time,
|
||||||
|
static_rule_create_username,
|
||||||
|
static_rule_audit_status,
|
||||||
|
static_rule_create_depart,
|
||||||
|
static_rule_create_user_id,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
static_rule_used_task_id,
|
||||||
|
static_rule_sip,
|
||||||
|
static_rule_msip,
|
||||||
|
static_rule_sport,
|
||||||
|
static_rule_msport,
|
||||||
|
static_rule_dip,
|
||||||
|
static_rule_mdip,
|
||||||
|
static_rule_dport,
|
||||||
|
static_rule_mdport,
|
||||||
|
static_rule_protocol,
|
||||||
|
static_rule_mprotocol,
|
||||||
|
static_rule_dns,
|
||||||
|
static_rule_url,
|
||||||
|
static_rule_priority,
|
||||||
|
static_rule_frequency,
|
||||||
|
static_rule_modify_time,
|
||||||
|
static_rule_display_id,
|
||||||
|
static_rule_audit_info,
|
||||||
|
event_type
|
||||||
|
)
|
||||||
|
select
|
||||||
|
static_rule_id,
|
||||||
|
static_rule_name,
|
||||||
|
NOW(),NULL,
|
||||||
|
static_rule_create_time,
|
||||||
|
static_rule_create_username,
|
||||||
|
static_rule_audit_status,
|
||||||
|
static_rule_create_depart,
|
||||||
|
static_rule_create_user_id,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart,
|
||||||
|
static_rule_used_task_id,
|
||||||
|
static_rule_sip,
|
||||||
|
static_rule_msip,
|
||||||
|
static_rule_sport,
|
||||||
|
static_rule_msport,
|
||||||
|
static_rule_dip,
|
||||||
|
static_rule_mdip,
|
||||||
|
static_rule_dport,
|
||||||
|
static_rule_mdport,
|
||||||
|
static_rule_protocol,
|
||||||
|
static_rule_mprotocol,
|
||||||
|
static_rule_dns,
|
||||||
|
static_rule_url,
|
||||||
|
static_rule_priority,
|
||||||
|
static_rule_frequency,
|
||||||
|
static_rule_modify_time,
|
||||||
|
static_rule_display_id,
|
||||||
|
static_rule_audit_info,
|
||||||
|
event_type
|
||||||
|
from t_static_rule
|
||||||
|
where static_rule_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateStaticRule">
|
<update id="updateStaticRule">
|
||||||
@@ -138,6 +276,20 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateStaticRuleStatusLogExpireTime">
|
||||||
|
update t_static_rule_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where static_rule_id = #{id} AND expire_time IS NULL
|
||||||
|
</update>
|
||||||
|
<update id="updateStaticRuleStatusLogExpireTimeBatch">
|
||||||
|
update t_static_rule_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where static_rule_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
AND expire_time IS NULL
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteStaticRules">
|
<delete id="deleteStaticRules">
|
||||||
delete from t_static_rule
|
delete from t_static_rule
|
||||||
|
|||||||
@@ -60,6 +60,13 @@
|
|||||||
|
|
||||||
<result column="task_create_username" property="taskCreateUsername"/>
|
<result column="task_create_username" property="taskCreateUsername"/>
|
||||||
<result column="task_create_depart" property="taskCreateDepart"/>
|
<result column="task_create_depart" property="taskCreateDepart"/>
|
||||||
|
<result column="task_create_userid" property="taskCreateUserId"/>
|
||||||
|
<result column="task_create_time" property="taskCreateTime"/>
|
||||||
|
<result column="task_modify_time" property="taskModifyTime"/>
|
||||||
|
<result column="task_audit_username" property="auditUserName"/>
|
||||||
|
<result column="task_audit_userid" property="auditUserId"/>
|
||||||
|
<result column="task_audit_depart" property="auditUserDepart"/>
|
||||||
|
|
||||||
|
|
||||||
<result column="task_display_id" property="taskDisplayId"/>
|
<result column="task_display_id" property="taskDisplayId"/>
|
||||||
|
|
||||||
@@ -76,15 +83,11 @@
|
|||||||
|
|
||||||
<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 rule_name != '' and (event_type == null or event_type == '')">
|
<if test="rule_name != null and rule_name != ''">
|
||||||
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
|
||||||
</if>
|
</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>
|
<where>
|
||||||
<if test="rule_name != null and rule_name != ''">
|
<if test="rule_name != null and rule_name != ''">
|
||||||
@@ -281,6 +284,20 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateTaskStatusLogExpireTime">
|
||||||
|
UPDATE t_task_status_log
|
||||||
|
SET expire_time = NOW()
|
||||||
|
WHERE task_id = #{taskId} AND expire_time IS NULL
|
||||||
|
</update>
|
||||||
|
<update id="updateTaskStatusLogExpireTimeBatch">
|
||||||
|
UPDATE t_task_status_log
|
||||||
|
SET expire_time = NOW()
|
||||||
|
WHERE task_id IN
|
||||||
|
<foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
|
||||||
|
#{taskId}
|
||||||
|
</foreach>
|
||||||
|
AND expire_time IS NULL
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteTask">
|
<delete id="deleteTask">
|
||||||
DELETE
|
DELETE
|
||||||
@@ -346,6 +363,119 @@
|
|||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertTaskStatusLog">
|
||||||
|
INSERT INTO t_task_status_log(task_id,task_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
task_start_time,
|
||||||
|
task_end_time,
|
||||||
|
task_create_time,
|
||||||
|
task_modify_time,
|
||||||
|
task_type,
|
||||||
|
task_act,
|
||||||
|
task_create_username,
|
||||||
|
task_create_depart,
|
||||||
|
task_create_userid,
|
||||||
|
task_status,
|
||||||
|
task_audit_status,
|
||||||
|
task_display_id,
|
||||||
|
task_range,
|
||||||
|
task_audit_username,
|
||||||
|
task_audit_depart,
|
||||||
|
task_audit_userid,
|
||||||
|
task_source,
|
||||||
|
task_audit_info,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
template_id,
|
||||||
|
template_name,
|
||||||
|
source_system
|
||||||
|
)
|
||||||
|
select task_id,task_name,
|
||||||
|
NOW(),NULL,
|
||||||
|
task_start_time,
|
||||||
|
task_end_time,
|
||||||
|
task_create_time,
|
||||||
|
task_modify_time,
|
||||||
|
task_type,
|
||||||
|
task_act,
|
||||||
|
task_create_username,
|
||||||
|
task_create_depart,
|
||||||
|
task_create_userid,
|
||||||
|
task_status,
|
||||||
|
task_audit_status,
|
||||||
|
task_display_id,
|
||||||
|
task_range,
|
||||||
|
task_audit_username,
|
||||||
|
task_audit_depart,
|
||||||
|
task_audit_userid,
|
||||||
|
task_source,
|
||||||
|
task_audit_info,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
template_id,
|
||||||
|
template_name,
|
||||||
|
source_system
|
||||||
|
from t_task
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</insert>
|
||||||
|
<insert id="insertTaskStatusLogBatch">
|
||||||
|
INSERT INTO t_task_status_log(task_id,task_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
task_start_time,
|
||||||
|
task_end_time,
|
||||||
|
task_create_time,
|
||||||
|
task_modify_time,
|
||||||
|
task_type,
|
||||||
|
task_act,
|
||||||
|
task_create_username,
|
||||||
|
task_create_depart,
|
||||||
|
task_create_userid,
|
||||||
|
task_status,
|
||||||
|
task_audit_status,
|
||||||
|
task_display_id,
|
||||||
|
task_range,
|
||||||
|
task_audit_username,
|
||||||
|
task_audit_depart,
|
||||||
|
task_audit_userid,
|
||||||
|
task_source,
|
||||||
|
task_audit_info,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
template_id,
|
||||||
|
template_name,
|
||||||
|
source_system
|
||||||
|
)
|
||||||
|
select task_id,task_name,
|
||||||
|
NOW(),NULL,
|
||||||
|
task_start_time,
|
||||||
|
task_end_time,
|
||||||
|
task_create_time,
|
||||||
|
task_modify_time,
|
||||||
|
task_type,
|
||||||
|
task_act,
|
||||||
|
task_create_username,
|
||||||
|
task_create_depart,
|
||||||
|
task_create_userid,
|
||||||
|
task_status,
|
||||||
|
task_audit_status,
|
||||||
|
task_display_id,
|
||||||
|
task_range,
|
||||||
|
task_audit_username,
|
||||||
|
task_audit_depart,
|
||||||
|
task_audit_userid,
|
||||||
|
task_source,
|
||||||
|
task_audit_info,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
template_id,
|
||||||
|
template_name,
|
||||||
|
source_system
|
||||||
|
from t_task
|
||||||
|
where task_id in
|
||||||
|
<foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
|
||||||
|
#{taskId}
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<select id="getStaticCommandInfos" resultMap="staticCommandMap">
|
<select id="getStaticCommandInfos" resultMap="staticCommandMap">
|
||||||
SELECT t_task.task_name,
|
SELECT t_task.task_name,
|
||||||
@@ -422,13 +552,13 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="queryTaskTotalNum" resultType="java.lang.Integer">
|
<select id="queryTaskTotalNum" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*) FROM t_task
|
SELECT COUNT(*) FROM t_task
|
||||||
<if test="rule_name != null and rule_name != '' and (event_type == null or event_type == '')">
|
<if test="rule_name != null and rule_name != '' ">
|
||||||
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
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<where>
|
<where>
|
||||||
<if test="rule_name != null and task_source != ''">
|
<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}, '%')
|
||||||
|
|||||||
@@ -21,6 +21,135 @@
|
|||||||
#{template.description}, #{template.templateDisplayId},
|
#{template.description}, #{template.templateDisplayId},
|
||||||
#{template.eventType}, #{template.protectLevel})
|
#{template.eventType}, #{template.protectLevel})
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertStatusLog">
|
||||||
|
INSERT INTO t_strategy_template_new_status_log
|
||||||
|
(
|
||||||
|
strategy_template_id,
|
||||||
|
strategy_template_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
strategy_template_description,
|
||||||
|
strategy_template_source_system,
|
||||||
|
strategy_template_create_username,
|
||||||
|
strategy_template_create_depart,
|
||||||
|
strategy_template_create_user_id,
|
||||||
|
has_protect_object_ip,
|
||||||
|
has_protect_object_port,
|
||||||
|
has_protocol,
|
||||||
|
has_url,
|
||||||
|
has_peer_ip,
|
||||||
|
has_peer_port,
|
||||||
|
has_dns,
|
||||||
|
is_protect_object_dst,
|
||||||
|
is_protect_object_src,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
audit_status,
|
||||||
|
strategy_template_display_id,
|
||||||
|
audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
)
|
||||||
|
select
|
||||||
|
strategy_template_id,
|
||||||
|
strategy_template_name,
|
||||||
|
NOW(),NULL,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
strategy_template_description,
|
||||||
|
strategy_template_source_system,
|
||||||
|
strategy_template_create_username,
|
||||||
|
strategy_template_create_depart,
|
||||||
|
strategy_template_create_user_id,
|
||||||
|
has_protect_object_ip,
|
||||||
|
has_protect_object_port,
|
||||||
|
has_protocol,
|
||||||
|
has_url,
|
||||||
|
has_peer_ip,
|
||||||
|
has_peer_port,
|
||||||
|
has_dns,
|
||||||
|
is_protect_object_dst,
|
||||||
|
is_protect_object_src,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
audit_status,
|
||||||
|
strategy_template_display_id,
|
||||||
|
audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
)
|
||||||
|
from t_strategy_template_new
|
||||||
|
where strategy_template_id = #{id}
|
||||||
|
</insert>
|
||||||
|
<insert id="insertStatusLogBatch">
|
||||||
|
INSERT INTO t_strategy_template_new_status_log
|
||||||
|
(
|
||||||
|
strategy_template_id,
|
||||||
|
strategy_template_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
strategy_template_description,
|
||||||
|
strategy_template_source_system,
|
||||||
|
strategy_template_create_username,
|
||||||
|
strategy_template_create_depart,
|
||||||
|
strategy_template_create_user_id,
|
||||||
|
has_protect_object_ip,
|
||||||
|
has_protect_object_port,
|
||||||
|
has_protocol,
|
||||||
|
has_url,
|
||||||
|
has_peer_ip,
|
||||||
|
has_peer_port,
|
||||||
|
has_dns,
|
||||||
|
is_protect_object_dst,
|
||||||
|
is_protect_object_src,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
audit_status,
|
||||||
|
strategy_template_display_id,
|
||||||
|
audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
)
|
||||||
|
select
|
||||||
|
strategy_template_id,
|
||||||
|
strategy_template_name,
|
||||||
|
NOW(),NULL,
|
||||||
|
event_type,
|
||||||
|
protect_level,
|
||||||
|
strategy_template_description,
|
||||||
|
strategy_template_source_system,
|
||||||
|
strategy_template_create_username,
|
||||||
|
strategy_template_create_depart,
|
||||||
|
strategy_template_create_user_id,
|
||||||
|
has_protect_object_ip,
|
||||||
|
has_protect_object_port,
|
||||||
|
has_protocol,
|
||||||
|
has_url,
|
||||||
|
has_peer_ip,
|
||||||
|
has_peer_port,
|
||||||
|
has_dns,
|
||||||
|
is_protect_object_dst,
|
||||||
|
is_protect_object_src,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
audit_status,
|
||||||
|
strategy_template_display_id,
|
||||||
|
audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
)
|
||||||
|
from t_strategy_template_new
|
||||||
|
where strategy_template_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateTemplateInformation">
|
<update id="updateTemplateInformation">
|
||||||
UPDATE t_strategy_template_new
|
UPDATE t_strategy_template_new
|
||||||
@@ -73,6 +202,21 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateStatusLogExpireTime">
|
||||||
|
update t_strategy_template_new_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where strategy_template_id = #{templateId} and expire_time is null
|
||||||
|
</update>
|
||||||
|
<update id="updateStatusLogExpireTimeBatch">
|
||||||
|
update t_strategy_template_new_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where strategy_template_id in
|
||||||
|
<foreach collection="templateIds" item="templateId" open="(" separator="," close=")">
|
||||||
|
#{templateId}
|
||||||
|
</foreach>
|
||||||
|
and expire_time is null
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<resultMap id="templateMap" type="com.realtime.protection.configuration.entity.defense.template.TemplateNew">
|
<resultMap id="templateMap" type="com.realtime.protection.configuration.entity.defense.template.TemplateNew">
|
||||||
<id column="strategy_template_id" property="templateId"/>
|
<id column="strategy_template_id" property="templateId"/>
|
||||||
|
|||||||
@@ -32,6 +32,100 @@
|
|||||||
0, NOW(), #{object.whiteListDisplayId})
|
0, NOW(), #{object.whiteListDisplayId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertStatusLog">
|
||||||
|
insert into t_white_list_status_log(
|
||||||
|
white_list_id,
|
||||||
|
white_list_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
white_list_system_name,
|
||||||
|
white_list_ip,
|
||||||
|
white_list_url,
|
||||||
|
white_list_port,
|
||||||
|
white_list_audit_status,
|
||||||
|
white_list_protocol,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
create_username,
|
||||||
|
white_list_display_id,
|
||||||
|
create_user_department,
|
||||||
|
create_user_id,
|
||||||
|
white_list_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
)
|
||||||
|
select
|
||||||
|
white_list_id,
|
||||||
|
white_list_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
white_list_system_name,
|
||||||
|
white_list_ip,
|
||||||
|
white_list_url,
|
||||||
|
white_list_port,
|
||||||
|
white_list_audit_status,
|
||||||
|
white_list_protocol,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
create_username,
|
||||||
|
white_list_display_id,
|
||||||
|
create_user_department,
|
||||||
|
create_user_id,
|
||||||
|
white_list_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
from t_white_list
|
||||||
|
where white_list_id = #{id}
|
||||||
|
</insert>
|
||||||
|
<insert id="insertStatusLogBatch">
|
||||||
|
insert into t_white_list_status_log(
|
||||||
|
white_list_id,
|
||||||
|
white_list_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
white_list_system_name,
|
||||||
|
white_list_ip,
|
||||||
|
white_list_url,
|
||||||
|
white_list_port,
|
||||||
|
white_list_audit_status,
|
||||||
|
white_list_protocol,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
create_username,
|
||||||
|
white_list_display_id,
|
||||||
|
create_user_department,
|
||||||
|
create_user_id,
|
||||||
|
white_list_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
)
|
||||||
|
select
|
||||||
|
white_list_id,
|
||||||
|
white_list_name,
|
||||||
|
effective_time,expire_time,
|
||||||
|
white_list_system_name,
|
||||||
|
white_list_ip,
|
||||||
|
white_list_url,
|
||||||
|
white_list_port,
|
||||||
|
white_list_audit_status,
|
||||||
|
white_list_protocol,
|
||||||
|
create_time,
|
||||||
|
modify_time,
|
||||||
|
create_username,
|
||||||
|
white_list_display_id,
|
||||||
|
create_user_department,
|
||||||
|
create_user_id,
|
||||||
|
white_list_audit_info,
|
||||||
|
audit_user_name,
|
||||||
|
audit_user_id,
|
||||||
|
audit_user_depart
|
||||||
|
from t_white_list
|
||||||
|
where white_list_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
<delete id="deleteWhiteListObjects">
|
<delete id="deleteWhiteListObjects">
|
||||||
delete from t_white_list
|
delete from t_white_list
|
||||||
@@ -138,6 +232,20 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateStatusLogExpireTime">
|
||||||
|
update t_white_list_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where white_list_id = #{id} and expire_time is null
|
||||||
|
</update>
|
||||||
|
<update id="updateStatusLogExpireTimeBatch">
|
||||||
|
update t_white_list_status_log
|
||||||
|
set expire_time = NOW()
|
||||||
|
where white_list_id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
and expire_time is null
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="existWhiteListObject" resultType="java.lang.String">
|
<select id="existWhiteListObject" resultType="java.lang.String">
|
||||||
select CONCAT(INET_NTOA(white_list_ip)," ", CAST(white_list_port)," ", white_list_url)
|
select CONCAT(INET_NTOA(white_list_ip)," ", CAST(white_list_port)," ", white_list_url)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class AlertMessageTest {
|
|||||||
null, null, null, null, null, null, null, 1, 1);
|
null, null, null, null, null, null, null, 1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("测试动态任务规则"+n);
|
object.setDynamicRuleName("测试display_id"+n);
|
||||||
object.setDescription("动态规则新建测试");
|
object.setDescription("动态规则新建测试");
|
||||||
object.setDynamicRuleSourceSystem("BW");
|
object.setDynamicRuleSourceSystem("BW");
|
||||||
object.setBwSql("select * from test where event_id = 1");
|
object.setBwSql("select * from test where event_id = 1");
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
staticRuleTest = new StaticRuleObject();
|
staticRuleTest = new StaticRuleObject();
|
||||||
staticRuleTest.setStaticRuleName("test_staticrule");
|
staticRuleTest.setStaticRuleName("test_stasticrule");
|
||||||
staticRuleTest.setStaticRuleCreateUsername("mh");
|
staticRuleTest.setStaticRuleCreateUsername("mh");
|
||||||
staticRuleTest.setStaticRuleCreateDepart("mmeess");
|
staticRuleTest.setStaticRuleCreateDepart("mmeess");
|
||||||
staticRuleTest.setStaticRuleCreateUserId(2);
|
staticRuleTest.setStaticRuleCreateUserId(2);
|
||||||
@@ -64,11 +64,20 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void testNewStaticRules(){
|
void testNewStaticRules(){
|
||||||
List<StaticRuleObject> staticRuleObjects = new ArrayList<>();
|
List<StaticRuleObject> staticRuleObjects = new ArrayList<>();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 1; i < 10; i++) {
|
||||||
|
staticRuleTest = new StaticRuleObject();
|
||||||
|
staticRuleTest.setStaticRuleName("test_staticrule"+i);
|
||||||
|
staticRuleTest.setStaticRuleCreateUsername("NSADD管理员");
|
||||||
|
staticRuleTest.setStaticRuleCreateDepart("组织树");
|
||||||
|
staticRuleTest.setStaticRuleCreateUserId(22222222);
|
||||||
|
staticRuleTest.setAuditStatus(0);
|
||||||
|
|
||||||
|
staticRuleTest.setStaticRuleSip("32.2.3."+i);
|
||||||
|
staticRuleTest.setStaticRuleDip(i+".2.3.2");
|
||||||
staticRuleObjects.add(staticRuleTest);
|
staticRuleObjects.add(staticRuleTest);
|
||||||
}
|
}
|
||||||
// Boolean success = staticRuleService.newStaticRuleObjects(staticRuleObjects);
|
Boolean success = staticRuleService.newStaticRuleObjects(staticRuleObjects);
|
||||||
// assertTrue(success);
|
assertTrue(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -116,13 +125,13 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void testUpdateStaticRuleAuditStatusBatch(){
|
void testUpdateStaticRuleAuditStatusBatch(){
|
||||||
// Map<Integer, Integer> map = new HashMap<>();
|
Map<Integer, Integer> map = new HashMap<>();
|
||||||
// map.put(1300, 0);
|
map.put(1398, 2);
|
||||||
// map.put(1326, 1);
|
map.put(1399, 2);
|
||||||
// map.put(1328, 1);
|
map.put(1400, 2);
|
||||||
//
|
|
||||||
//
|
|
||||||
// System.out.println(staticRuleService.updateAuditStatusBatch(map));
|
System.out.println(staticRuleService.updateAuditStatusBatch(map));
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void testQueryAuditStatusByIds(){
|
void testQueryAuditStatusByIds(){
|
||||||
|
|||||||
@@ -145,8 +145,10 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, null, null, null, null,null,null,null,null,1, 10);
|
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, null, null, null, "eee",null,null,null,null,1, 10);
|
||||||
assertEquals(10, tasks.size());
|
assertEquals(1, tasks.size());
|
||||||
|
Integer tasksnum = taskService.queryTaskTotalNum(null, null, "", "", null, "", "", "", "上述",null,null,null,null);
|
||||||
|
System.out.println(tasksnum);
|
||||||
//
|
//
|
||||||
// tasks = taskService.queryTasks(0, null, null, null, null,null, null, null, null, 1, 10);
|
// tasks = taskService.queryTasks(0, null, null, null, null,null, null, null, null, 1, 10);
|
||||||
// assertEquals(10, tasks.size());
|
// assertEquals(10, tasks.size());
|
||||||
|
|||||||
Reference in New Issue
Block a user