1、AlertMessage入库修复字段和库表不匹配问题,增加display_id
2、command增加display_id 3、规则、任务、配置增加新建时(批量导入除外)、任务运行状态、审核状态改变时的历史记录
This commit is contained in:
@@ -55,7 +55,7 @@ public class AlertMessage {
|
||||
@JsonProperty("c_priority")
|
||||
private Integer c_priority;
|
||||
@JsonProperty("c_time")
|
||||
private LocalDateTime c_time;
|
||||
private Long c_time;
|
||||
@JsonProperty("c_flowid")
|
||||
private String c_flowid;
|
||||
@JsonProperty("c_src_ipv4")
|
||||
@@ -80,8 +80,8 @@ public class AlertMessage {
|
||||
private Integer c_d_tunnel_port;
|
||||
@JsonProperty("c_proto_type")
|
||||
private Integer c_proto_type;
|
||||
@JsonProperty("c_return_info")
|
||||
private String c_return_info;
|
||||
|
||||
|
||||
@JsonProperty("c_s_boundary")
|
||||
private Long c_s_boundary;
|
||||
@JsonProperty("c_s_region")
|
||||
@@ -108,8 +108,8 @@ public class AlertMessage {
|
||||
private String c_d_owner;
|
||||
@JsonProperty("c_ret_file_type")
|
||||
private Integer c_ret_file_type;
|
||||
@JsonProperty("c_ret_filename")
|
||||
private String c_ret_filename;
|
||||
@JsonProperty("c_ret_file_name")
|
||||
private String c_ret_file_name;
|
||||
@JsonProperty("c_ret_file")
|
||||
private String c_ret_file;
|
||||
@JsonProperty("c_url")
|
||||
@@ -134,6 +134,15 @@ public class AlertMessage {
|
||||
private Long c_d_mark4;
|
||||
@JsonProperty("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_time": 1714528212,
|
||||
// "c_flowid": "ca0c192021",
|
||||
|
||||
@@ -115,6 +115,9 @@ public class TaskCommandInfo {
|
||||
@Schema(description = "指令所属任务的运行状态", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer taskStatus;
|
||||
|
||||
@Schema(description = "指令展示id", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String displayId;
|
||||
|
||||
// 复制构造函数
|
||||
public void copyTaskCommandInfo(TaskCommandInfo original) {
|
||||
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.task.FiveTupleWithMask;
|
||||
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.TaskTypeEnum;
|
||||
import com.realtime.protection.server.command.CommandService;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -20,11 +23,13 @@ import java.util.UUID;
|
||||
public class AlertMessageService {
|
||||
private final CommandService commandService;
|
||||
private final AlertMessageMapper alertMessageMapper;
|
||||
private final Counter counter;
|
||||
|
||||
public AlertMessageService(
|
||||
CommandService commandService, AlertMessageMapper alertMessageMapper) {
|
||||
CommandService commandService, AlertMessageMapper alertMessageMapper, Counter counter) {
|
||||
this.commandService = commandService;
|
||||
this.alertMessageMapper = alertMessageMapper;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
@DSTransactional
|
||||
@@ -119,9 +124,17 @@ public class AlertMessageService {
|
||||
String commandUUID = commandService.createCommand(dynamicTaskCommandInfo);
|
||||
|
||||
//alertmessage入库
|
||||
|
||||
alertMessage.setCommandUUID(commandUUID);
|
||||
String alertMessageUUID = UUID.randomUUID().toString();
|
||||
alertMessage.setAlertMessageUUID(alertMessageUUID);
|
||||
alertMessage.setDisplay_id(
|
||||
"GJ-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("alert_message"))
|
||||
|
||||
);
|
||||
alertMessageMapper.insertAlertMessage(alertMessage);
|
||||
}
|
||||
|
||||
@@ -131,6 +144,13 @@ public class AlertMessageService {
|
||||
alertMessage.setCommandUUID(null);
|
||||
String alertMessageUUID = UUID.randomUUID().toString();
|
||||
alertMessage.setAlertMessageUUID(alertMessageUUID);
|
||||
alertMessage.setDisplay_id(
|
||||
"GJ-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("alert_message"))
|
||||
|
||||
);
|
||||
alertMessageMapper.insertAlertMessage(alertMessage);
|
||||
|
||||
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.DSTransactional;
|
||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||
import com.realtime.protection.configuration.utils.Counter;
|
||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
@@ -19,11 +22,13 @@ public class CommandService {
|
||||
|
||||
private final CommandMapper commandMapper;
|
||||
private final SqlSessionWrapper sqlSessionWrapper;
|
||||
private final Counter counter;
|
||||
private static final int BatchSize = 100;
|
||||
|
||||
public CommandService(CommandMapper commandMapper, SqlSessionWrapper sqlSessionWrapper) {
|
||||
public CommandService(CommandMapper commandMapper, SqlSessionWrapper sqlSessionWrapper, Counter counter) {
|
||||
this.commandMapper = commandMapper;
|
||||
this.sqlSessionWrapper = sqlSessionWrapper;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
@DSTransactional
|
||||
@@ -32,6 +37,12 @@ public class CommandService {
|
||||
if (uuid != null) {
|
||||
return uuid;
|
||||
}
|
||||
commandInfo.setDisplayId(
|
||||
"ZL-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("command"))
|
||||
);
|
||||
|
||||
commandInfo.setUUID(UUID.randomUUID().toString());
|
||||
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.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -60,4 +61,12 @@ public interface ProtectObjectMapper {
|
||||
Boolean updateAuditInfo(@Param("ids")List<Integer> ids, @Param("auditInfo")String auditInfo);
|
||||
|
||||
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.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.SqlSessionWrapper;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||
import com.realtime.protection.server.whitelist.WhiteListMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
@@ -45,6 +41,7 @@ public class ProtectObjectService {
|
||||
if (protectObject.getProtectObjectId() == null) {
|
||||
return 0;
|
||||
}
|
||||
insertStaticRuleStatusLog(protectObject.getProtectObjectId());
|
||||
return protectObject.getProtectObjectId();
|
||||
}
|
||||
|
||||
@@ -145,6 +142,7 @@ public class ProtectObjectService {
|
||||
}
|
||||
Boolean success = protectObjectMapper.changeProtectObjectAuditStatus(protectObjectId, auditStatus);
|
||||
|
||||
insertStaticRuleStatusLog(protectObjectId);
|
||||
Integer auditStatusNow = protectObjectMapper.queryProtectObject(protectObjectId).getProtectObjectAuditStatus();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("success", success);
|
||||
@@ -204,10 +202,12 @@ public class ProtectObjectService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -223,4 +223,27 @@ public class ProtectObjectService {
|
||||
public String queryAuditInfo(Integer 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.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -61,4 +62,11 @@ public interface TemplateMapper {
|
||||
|
||||
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;
|
||||
|
||||
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.SqlSessionWrapper;
|
||||
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.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
@@ -41,6 +39,7 @@ public class TemplateService {
|
||||
if (template.getTemplateId() == null) {
|
||||
return 0;
|
||||
}
|
||||
insertStatusLog(template.getTemplateId());
|
||||
return template.getTemplateId();
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ public class TemplateService {
|
||||
throw new IllegalArgumentException("invalid audit status");
|
||||
}
|
||||
Boolean success = templateMapper.updateAuditStatusById(id, auditStatus);
|
||||
|
||||
insertStatusLog(id);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("success", success);
|
||||
resultMap.put("audit_status", auditStatus);
|
||||
@@ -145,10 +144,12 @@ public class TemplateService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -165,4 +166,26 @@ public class TemplateService {
|
||||
public String queryAuditInfo(Integer 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.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -64,4 +65,12 @@ public interface DynamicRuleMapper {
|
||||
@Param("auditUserName")String auditUserName,
|
||||
@Param("auditUserId")String auditUserId,
|
||||
@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.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.SqlSessionWrapper;
|
||||
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.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
@@ -40,7 +38,7 @@ public class DynamicRuleService {
|
||||
);
|
||||
|
||||
dynamicRuleMapper.newDynamicRule(dynamicRule);
|
||||
|
||||
insertStatusLog(dynamicRule.getDynamicRuleId());
|
||||
return dynamicRule.getDynamicRuleId();
|
||||
}
|
||||
|
||||
@@ -205,6 +203,8 @@ public class DynamicRuleService {
|
||||
}
|
||||
Boolean success = dynamicRuleMapper.updateAuditStatusById(id, auditStatus ,auditUserName, auditUserId, auditUserDepart);
|
||||
|
||||
insertStatusLog(id);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("success", success);
|
||||
resultMap.put("audit_status", auditStatus);
|
||||
@@ -250,10 +250,12 @@ public class DynamicRuleService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -309,10 +311,13 @@ public class DynamicRuleService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch, auditUserName, auditUserId, auditUserDepart);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch, auditUserName, auditUserId, auditUserDepart);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -331,4 +336,30 @@ public class DynamicRuleService {
|
||||
public String queryAuditInfo(Integer 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.setStaticRuleCreateDepart(user.getOrgName());
|
||||
}
|
||||
|
||||
//调用service新增
|
||||
staticRuleService.newStaticRuleObject(object);
|
||||
return ResponseResult.ok()
|
||||
|
||||
@@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -37,7 +36,7 @@ public interface StaticRuleMapper {
|
||||
|
||||
void deleteStaticRules(@Param("staticRuleIds") List<Integer> staticRuleBatch);
|
||||
|
||||
void newStaticRules(List<StaticRuleObject> staticRuleBatch);
|
||||
void newStaticRules(List<StaticRuleObject> list);
|
||||
|
||||
Integer queryAuditStatusById(Integer id);
|
||||
|
||||
@@ -69,4 +68,12 @@ public interface StaticRuleMapper {
|
||||
Boolean updateAuditInfo(@Param("ids") List<Integer> ids, @Param("auditInfo") String auditInfo);
|
||||
|
||||
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);
|
||||
|
||||
insertStaticRuleStatusLog(object.getStaticRuleId());
|
||||
|
||||
return object.getStaticRuleId();
|
||||
}
|
||||
|
||||
@@ -210,10 +212,13 @@ public class StaticRuleService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.newStaticRules(StaticRuleBatch);
|
||||
//todo: 批量插入静态规则,mybatis未返回主键id,待解决
|
||||
// insertStaticRuleStatusLog(StaticRuleBatch);
|
||||
StaticRuleBatch.clear();
|
||||
}
|
||||
if (!StaticRuleBatch.isEmpty()) {
|
||||
mapper.newStaticRules(StaticRuleBatch);
|
||||
// insertStaticRuleStatusLog(StaticRuleBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -237,7 +242,8 @@ public class StaticRuleService {
|
||||
throw new IllegalArgumentException("invalid audit status");
|
||||
}
|
||||
Boolean success = staticRuleMapper.updateAuditStatusById(id, auditStatus, auditUserName, auditUserId, auditUserDepart);
|
||||
|
||||
//记录状态历史
|
||||
insertStaticRuleStatusLog(id);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("success", success);
|
||||
resultMap.put("audit_status", auditStatus);
|
||||
@@ -309,11 +315,13 @@ public class StaticRuleService {
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch,
|
||||
auditUserName, auditUserId, auditUserDepart);
|
||||
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusWithAuditorByIdBatch(idWithAuditStatusBatch,
|
||||
auditUserName, auditUserId, auditUserDepart);
|
||||
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -358,10 +366,12 @@ public class StaticRuleService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStaticRuleStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -388,4 +398,26 @@ public class StaticRuleService {
|
||||
public String queryAuditInfo(Integer 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);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ public class TaskService {
|
||||
if (AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(taskAuditStatus))
|
||||
taskMapper.changeTaskAuditStatusWithAudior(taskId, taskAuditStatus, auditUserName, auditUserId, auditUserDepart);
|
||||
else return false;
|
||||
|
||||
insertTaskStatusLog(taskId);
|
||||
return true;
|
||||
}
|
||||
@Transactional
|
||||
@@ -329,6 +329,7 @@ public class TaskService {
|
||||
if (AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(taskAuditStatus))
|
||||
taskMapper.changeTaskAuditStatus(taskId, taskAuditStatus);
|
||||
else return false;
|
||||
insertTaskStatusLog(taskId);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -427,10 +428,13 @@ public class TaskService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
//记录状态日志
|
||||
insertTaskStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertTaskStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -507,4 +511,16 @@ public class TaskService {
|
||||
public String queryAuditInfo(Integer 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(),
|
||||
newState.getClass().getSimpleName()));
|
||||
|
||||
|
||||
// 这里一定是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) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -59,4 +60,12 @@ public interface WhiteListMapper {
|
||||
Boolean updateAuditInfo(@Param("ids")List<Integer> ids, @Param("auditInfo")String auditInfo);
|
||||
|
||||
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.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
@@ -50,6 +47,7 @@ public class WhiteListService {
|
||||
);
|
||||
|
||||
whiteListMapper.newWhiteListObject(object);
|
||||
insertStatusLog(object.getWhiteListId());
|
||||
|
||||
return object.getWhiteListId();
|
||||
}
|
||||
@@ -200,7 +198,7 @@ public class WhiteListService {
|
||||
}
|
||||
|
||||
Boolean success = whiteListMapper.updateWhiteListObjectAuditStatus(id, auditStatus);
|
||||
|
||||
insertStatusLog(id);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("success", success);
|
||||
resultMap.put("audit_status", auditStatus);
|
||||
@@ -253,10 +251,12 @@ public class WhiteListService {
|
||||
}
|
||||
//mapper指的就是外层函数输入的参数,也就是WhiteListMapper
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
idWithAuditStatusBatch.clear();
|
||||
}
|
||||
if (!idWithAuditStatusBatch.isEmpty()) {
|
||||
mapper.updateAuditStatusByIdBatch(idWithAuditStatusBatch);
|
||||
insertStatusLog(idWithAuditStatusBatch);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -272,4 +272,26 @@ public class WhiteListService {
|
||||
public String queryAuditInfo(Integer 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>
|
||||
</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删除-->
|
||||
@@ -129,6 +219,20 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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"
|
||||
|
||||
@@ -33,6 +33,99 @@
|
||||
#{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId})
|
||||
</foreach>
|
||||
</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">
|
||||
<id column="protect_object_id" property="protectObjectId"/>
|
||||
@@ -215,4 +308,18 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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>
|
||||
@@ -25,7 +25,8 @@
|
||||
#{object.auditStatus},
|
||||
#{object.staticRuleDisplayId},#{object.eventType})
|
||||
</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,
|
||||
static_rule_create_username, static_rule_create_depart,
|
||||
static_rule_create_user_id, static_rule_sip, static_rule_msip,
|
||||
@@ -37,7 +38,7 @@
|
||||
static_rule_display_id,event_type
|
||||
)
|
||||
values
|
||||
<foreach collection="staticRuleBatch" item="object" separator=",">
|
||||
<foreach collection="list" item="object" separator=",">
|
||||
(#{object.staticRuleName}, NOW(), #{object.staticRuleCreateUsername},
|
||||
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
||||
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
||||
@@ -49,6 +50,143 @@
|
||||
)
|
||||
</foreach>
|
||||
</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">
|
||||
@@ -138,6 +276,20 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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 from t_static_rule
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
|
||||
<result column="task_create_username" property="taskCreateUsername"/>
|
||||
<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"/>
|
||||
|
||||
@@ -76,15 +83,11 @@
|
||||
|
||||
<select id="queryTasks" resultMap="taskMap">
|
||||
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_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
|
||||
</if>
|
||||
<!-- <if test="event_type != null and event_type != ''">-->
|
||||
<!-- LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id-->
|
||||
<!-- LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id-->
|
||||
<!-- LEFT JOIN t_strategy_template_new ON t_dynamic_rule.template_id = t_strategy_template_new.strategy_template_id-->
|
||||
<!-- </if>-->
|
||||
|
||||
|
||||
<where>
|
||||
<if test="rule_name != null and rule_name != ''">
|
||||
@@ -281,6 +284,20 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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
|
||||
@@ -346,6 +363,119 @@
|
||||
)
|
||||
</foreach>
|
||||
</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 t_task.task_name,
|
||||
@@ -422,13 +552,13 @@
|
||||
</select>
|
||||
<select id="queryTaskTotalNum" resultType="java.lang.Integer">
|
||||
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_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
|
||||
</if>
|
||||
|
||||
<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}, '%')
|
||||
OR t_dynamic_rule.dynamic_rule_name LIKE CONCAT('%', #{rule_name}, '%')
|
||||
|
||||
@@ -21,6 +21,135 @@
|
||||
#{template.description}, #{template.templateDisplayId},
|
||||
#{template.eventType}, #{template.protectLevel})
|
||||
</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 t_strategy_template_new
|
||||
@@ -73,6 +202,21 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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">
|
||||
<id column="strategy_template_id" property="templateId"/>
|
||||
|
||||
@@ -32,6 +32,100 @@
|
||||
0, NOW(), #{object.whiteListDisplayId})
|
||||
</foreach>
|
||||
</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 from t_white_list
|
||||
@@ -138,6 +232,20 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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 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);
|
||||
|
||||
DynamicRuleObject object = new DynamicRuleObject();
|
||||
object.setDynamicRuleName("测试动态任务规则"+n);
|
||||
object.setDynamicRuleName("测试display_id"+n);
|
||||
object.setDescription("动态规则新建测试");
|
||||
object.setDynamicRuleSourceSystem("BW");
|
||||
object.setBwSql("select * from test where event_id = 1");
|
||||
|
||||
@@ -26,7 +26,7 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
staticRuleTest = new StaticRuleObject();
|
||||
staticRuleTest.setStaticRuleName("test_staticrule");
|
||||
staticRuleTest.setStaticRuleName("test_stasticrule");
|
||||
staticRuleTest.setStaticRuleCreateUsername("mh");
|
||||
staticRuleTest.setStaticRuleCreateDepart("mmeess");
|
||||
staticRuleTest.setStaticRuleCreateUserId(2);
|
||||
@@ -64,11 +64,20 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
||||
@Test
|
||||
void testNewStaticRules(){
|
||||
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);
|
||||
}
|
||||
// Boolean success = staticRuleService.newStaticRuleObjects(staticRuleObjects);
|
||||
// assertTrue(success);
|
||||
Boolean success = staticRuleService.newStaticRuleObjects(staticRuleObjects);
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,13 +125,13 @@ public class StaticRuleServiceTest extends ProtectionApplicationTests {
|
||||
}
|
||||
@Test
|
||||
void testUpdateStaticRuleAuditStatusBatch(){
|
||||
// Map<Integer, Integer> map = new HashMap<>();
|
||||
// map.put(1300, 0);
|
||||
// map.put(1326, 1);
|
||||
// map.put(1328, 1);
|
||||
//
|
||||
//
|
||||
// System.out.println(staticRuleService.updateAuditStatusBatch(map));
|
||||
Map<Integer, Integer> map = new HashMap<>();
|
||||
map.put(1398, 2);
|
||||
map.put(1399, 2);
|
||||
map.put(1400, 2);
|
||||
|
||||
|
||||
System.out.println(staticRuleService.updateAuditStatusBatch(map));
|
||||
}
|
||||
@Test
|
||||
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);
|
||||
assertEquals(10, tasks.size());
|
||||
List<Task> tasks = taskService.queryTasks(null, null, null, null, null, null, null, null, "eee",null,null,null,null,1, 10);
|
||||
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);
|
||||
// assertEquals(10, tasks.size());
|
||||
|
||||
Reference in New Issue
Block a user