1、分页查询条件id变为display

2、修改为设置审核状态为pending,删去审核通过才能修改的限制
3、bugfix
This commit is contained in:
PushM
2024-06-10 04:10:18 +08:00
parent 793f835b18
commit 274eecfa79
28 changed files with 80 additions and 70 deletions

View File

@@ -172,6 +172,7 @@ public class StaticRuleObject {
@JsonProperty("event_type")
@ExcelProperty("事件类型")
@ExcelIgnore
@Schema(description = "事件类型", example = "DDos")
private String eventType;

View File

@@ -90,8 +90,7 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
public ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false)
String protectObjectName,
@RequestParam(value = "proobj_id", required = false)
@Min(value = 1, message = "ID值不可小于1")
Integer protectObjectId,
String protectObjectId,
@RequestParam(value = "proobj_systemm_name", required = false)
String protectObjectSystemName,
@RequestParam(value = "proobj_ip_address", required = false)

View File

@@ -178,8 +178,7 @@ public interface ProtectObjectControllerApi {
ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false)
String protectObjectName,
@RequestParam(value = "proobj_id", required = false)
@Min(value = 1, message = "ID值不可小于1")
Integer protectObjectId,
String protectObjectId,
@RequestParam(value = "proobj_systemm_name", required = false)
String protectObjectSystemName,
@RequestParam(value = "proobj_ip_address", required = false)

View File

@@ -28,7 +28,7 @@ public interface ProtectObjectMapper {
Integer queryProtectObjectsTotalNum(@Param("proobj_name") String protectObjectName,
@Param("proobj_id") Integer protectObjectId,
@Param("proobj_id") String protectObjectId,
@Param("proobj_system_name") String protectObjectSystemName,
@Param("proobj_ip") String protectObjectIPAddress,
@Param("proobj_port_min") Integer protectObjectPortMin,
@@ -39,7 +39,7 @@ public interface ProtectObjectMapper {
@Param("proobj_audit_status") Integer protectObjectAuditStatus);
List<ProtectObject> queryProtectObjects(@Param("proobj_name") String protectObjectName,
@Param("proobj_id") Integer protectObjectId,
@Param("proobj_id") String protectObjectId,
@Param("proobj_system_name") String protectObjectSystemName,
@Param("proobj_ip") String protectObjectIPAddress,
@Param("proobj_port_min") Integer protectObjectPortMin,

View File

@@ -76,7 +76,7 @@ public class ProtectObjectService {
return sqlSessionWrapper.startBatchSession(ProtectObjectMapper.class, newProtectObjectFunction, protectObjectList);
}
public List<ProtectObject> queryProtectObjects(String protectObjectName, Integer protectObjectId,
public List<ProtectObject> queryProtectObjects(String protectObjectName, String protectObjectId,
String protectObjectSystemName, String protectObjectIPAddress,
Integer protectObjectPortMin, Integer protectObjectPortMax,
String protectObjectURL, String protectObjectProtocol,
@@ -94,11 +94,11 @@ public class ProtectObjectService {
}
public Boolean updateProtectObject(ProtectObject protectObject) {
if (!protectObjectMapper.queryProtectObject(protectObject.getProtectObjectId())
.getProtectObjectAuditStatus()
.equals(AuditStatusEnum.AUDITED.getNum())) {
return false;
}
// if (!protectObjectMapper.queryProtectObject(protectObject.getProtectObjectId())
// .getProtectObjectAuditStatus()
// .equals(AuditStatusEnum.AUDITED.getNum())) {
// return false;
// }
protectObject.setProtectObjectAuditStatus(AuditStatusEnum.PENDING.getNum());
@@ -174,7 +174,7 @@ public class ProtectObjectService {
return resultMap;
}
public Integer queryProtectObjectsTotalNum(String protectObjectName, Integer protectObjectId,
public Integer queryProtectObjectsTotalNum(String protectObjectName, String protectObjectId,
String protectObjectSystemName, String protectObjectIPAddress,
Integer protectObjectPortMin, Integer protectObjectPortMax,
String protectObjectURL, String protectObjectProtocol,

View File

@@ -59,7 +59,7 @@ public class TemplateController implements TemplateNewCpntrollerApi{
public ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
@RequestParam(value = "source_system", required = false) String sourceSystem,
@RequestParam(value = "create_user_name", required = false) String createUserName,
@RequestParam(value = "template_id", required = false) Integer templateId,
@RequestParam(value = "template_id", required = false) String templateId,
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
@RequestParam(value = "event_type", required = false) String eventType,
@RequestParam(value = "protect_level", required = false) Integer protectLevel,

View File

@@ -16,7 +16,7 @@ public interface TemplateMapper {
List<TemplateNew> queryTemplates(@Param("template_name") String templateName,
@Param("source_system") String sourceSystem,
@Param("create_username") String createUsername,
@Param("template_id")Integer templateId,
@Param("template_id")String templateId,
@Param("audit_status")Integer auditStatus,
@Param("event_type")String eventType,
@Param("protect_level")Integer protectLevel,
@@ -34,7 +34,7 @@ public interface TemplateMapper {
Integer queryTemplateTotalNum(@Param("template_name") String templateName,
@Param("source_system") String sourceSystem,
@Param("create_username") String createUsername,
@Param("template_id")Integer templateId,
@Param("template_id")String templateId,
@Param("audit_status")Integer auditStatus,
@Param("event_type")String eventType,
@Param("protect_level")Integer protectLevel

View File

@@ -94,7 +94,7 @@ public interface TemplateNewCpntrollerApi {
ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
@RequestParam(value = "source_system", required = false) String sourceSystem,
@RequestParam(value = "create_user_name", required = false) String createUserName,
@RequestParam(value = "template_id", required = false) Integer templateId,
@RequestParam(value = "template_id", required = false) String templateId,
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
@RequestParam(value = "event_type", required = false) String eventType,
@RequestParam(value = "protect_level", required = false) Integer protectLevel,

View File

@@ -4,6 +4,7 @@ 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.AuditStatusEnum;
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
@@ -49,7 +50,7 @@ public class TemplateService {
}
public List<TemplateNew> queryTemplates(String templateName, String sourceSystem, String createUserName,
Integer templateId, Integer auditStatus,
String templateId, Integer auditStatus,
String eventType, Integer protectLevel,
Integer page, Integer pageSize) {
return templateMapper.queryTemplates(templateName, sourceSystem, createUserName,
@@ -58,6 +59,7 @@ public class TemplateService {
public Boolean updateTemplate(Integer templateId, TemplateNew template) {
template.setTemplateId(templateId);
template.setAuditStatus(String.valueOf(AuditStatusEnum.PENDING.getNum()));
return templateMapper.updateTemplateInformation(template);
}
@@ -74,7 +76,7 @@ public class TemplateService {
public Integer queryTemplateTotalNum(
String templateName, String sourceSystem, String createUserName,
Integer templateId, Integer auditStatus,
String templateId, Integer auditStatus,
String eventType, Integer protectLevel) {
return templateMapper.queryTemplateTotalNum(templateName, sourceSystem, createUserName,
templateId,auditStatus,eventType, protectLevel );

View File

@@ -120,7 +120,7 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
@Override
@GetMapping("/query")
public ResponseResult queryDynamicRuleObject(@RequestParam(value = "name", required = false) String dynamicRuleName,
@RequestParam(value = "id", required = false) Integer dynamicRuleId,
@RequestParam(value = "id", required = false) String dynamicRuleId,
@RequestParam(value = "source_system", required = false) String protectObjectSourceSystem,
@RequestParam(value = "creator", required = false) String creator,
@RequestParam(value = "audit_status", required = false) Integer auditStatus,

View File

@@ -360,7 +360,7 @@ public interface DynamicRuleControllerApi {
}
)
ResponseResult queryDynamicRuleObject(@RequestParam(value = "name", required = false) String dynamicRuleName,
@RequestParam(value = "id", required = false) Integer dynamicRuleId,
@RequestParam(value = "id", required = false) String dynamicRuleId,
@RequestParam(value = "source_system", required = false) String protectObjectSourceSystem,
@RequestParam(value = "creator", required = false) String creator,
@RequestParam(value = "audit_status", required = false) Integer auditStatus,

View File

@@ -27,7 +27,7 @@ public interface DynamicRuleMapper {
void deleteDynamicRules(List<Integer> dynamicRuleIds);
List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, Integer dynamicRuleId,
List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, String dynamicRuleId,
String sourceSystem, String creator, Integer auditStatus,
String eventType, Integer protectLevel, String templateName,
String auditUserName, String createDate,
@@ -35,7 +35,7 @@ public interface DynamicRuleMapper {
boolean queryProtectObjectById(Integer protectObjectId);
Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
Integer queryDynamicRuleTotalNum(String dynamicRuleName, String dynamicRuleId,
String sourceSystem, String creator, Integer auditStatus
, String eventType, Integer protectLevel, String templateName,
String auditUserName, String createDate);

View File

@@ -6,6 +6,7 @@ import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleOb
import com.realtime.protection.configuration.utils.Counter;
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
import com.realtime.protection.configuration.utils.enums.StateEnum;
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -115,7 +116,7 @@ public class DynamicRuleService {
//更新DynamicRule
// dynamicRuleMapper
dynamicRuleObject.setAuditStatus(AuditStatusEnum.PENDING.getNum());
Boolean idValid = dynamicRuleMapper.updateDynamicRuleObject(dynamicRuleId, dynamicRuleObject);
if (!idValid) {
throw new IllegalArgumentException("动态规则id无效");
@@ -129,6 +130,7 @@ public class DynamicRuleService {
if (!ProtectObjIdValid) {
throw new IllegalArgumentException("防护对象id无效");
}
*/
return idValid;
@@ -178,7 +180,7 @@ public class DynamicRuleService {
//分页查询基础的动态规则,暂时不返回关联的保护对象
public List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, Integer dynamicRuleId,
public List<DynamicRuleObject> queryDynamicRuleObject(String dynamicRuleName, String dynamicRuleId,
String templateSourceSystem,String creator,Integer auditStatus,
String eventType, Integer protectLevel, String templateName,
String auditUserName, String createDate,
@@ -187,7 +189,7 @@ public class DynamicRuleService {
templateSourceSystem, creator, auditStatus, eventType, protectLevel, templateName, auditUserName, createDate, page, pageSize);
}
public Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
public Integer queryDynamicRuleTotalNum(String dynamicRuleName, String dynamicRuleId,
String protectObjectSourceSystem, String creator,
Integer auditStatus, String eventType, Integer protectLevel,
String templateName,String auditUserName, String createDate) {

View File

@@ -152,7 +152,7 @@ public class StaticRuleController implements StaticRuleControllerApi {
@Override
@GetMapping("/query")
public ResponseResult queryStaticRule(@RequestParam(name = "name", required = false) String static_rule_name,
@RequestParam(name = "id", required = false) Integer static_rule_id,
@RequestParam(name = "id", required = false) String static_rule_id,
@RequestParam(name = "creator", required = false) String static_rule_creator,
@RequestParam(name = "sip", required = false) String static_rule_sip,
@RequestParam(name = "sport", required = false) Integer static_rule_sport,

View File

@@ -220,7 +220,7 @@ public interface StaticRuleControllerApi {
}
)
ResponseResult queryStaticRule(@RequestParam(required = false) String static_rule_name,
@RequestParam(required = false) Integer static_rule_id,
@RequestParam(required = false) String static_rule_id,
@RequestParam(required = false) String static_rule_creator,
@RequestParam(required = false) String static_rule_sip,
@RequestParam(required = false) Integer static_rule_sport,

View File

@@ -27,7 +27,7 @@ public interface StaticRuleMapper {
StaticRuleObject queryStaticRuleById(Integer id);
//多页查询静态规则
List<StaticRuleObject> queryStaticRule(String static_rule_name, Integer static_rule_id,
List<StaticRuleObject> queryStaticRule(String static_rule_name, String static_rule_id,
String static_rule_create_username, String sip,
Integer sport, String dip, Integer dport,
Integer auditStatus, String auditUserName, String createDate,
@@ -46,7 +46,7 @@ public interface StaticRuleMapper {
String auditUserDepart);
Boolean updateAuditStatusById(Integer id, Integer auditStatus);
Integer queryStaticRuleTotalNum(String static_rule_name, Integer static_rule_id,
Integer queryStaticRuleTotalNum(String static_rule_name, String static_rule_id,
String static_rule_create_username,
String sip, Integer sport,
String dip, Integer dport,

View File

@@ -182,7 +182,7 @@ public class StaticRuleService {
分页查询
*/
public List<StaticRuleObject> queryStaticRule(
String static_rule_name, Integer static_rule_id,
String static_rule_name, String static_rule_id,
String creator,
String static_rule_sip, Integer static_rule_sport,
String static_rule_dip, Integer static_rule_dport,
@@ -267,7 +267,7 @@ public class StaticRuleService {
staticRuleMapper.deleteStaticRuleById(id);
}
public Integer queryStaticRuleTotalNum(String static_rule_name, Integer static_rule_id,
public Integer queryStaticRuleTotalNum(String static_rule_name, String static_rule_id,
String static_rule_creator,
String static_rule_sip, Integer static_rule_sport,
String static_rule_dip, Integer static_rule_dport,

View File

@@ -81,7 +81,7 @@ public class WhiteListController implements WhiteListControllerApi {
@Override
@GetMapping("/query")
public ResponseResult queryWhiteListObject(@RequestParam(value = "whiteobj_name", required = false) String whiteListName,
@RequestParam(value = "whiteobj_id", required = false) Integer whiteListId,
@RequestParam(value = "whiteobj_id", required = false) String whiteListId,
@RequestParam(value = "system_name", required = false) String systemName,
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
@RequestParam(value = "creator", required = false) String creator,

View File

@@ -112,7 +112,7 @@ public interface WhiteListControllerApi {
}
)
ResponseResult queryWhiteListObject(@RequestParam(value = "whiteobj_name", required = false) String whiteListName,
@RequestParam(value = "whiteobj_id", required = false) Integer whiteListId,
@RequestParam(value = "whiteobj_id", required = false) String whiteListId,
@RequestParam(value = "system_name", required = false) String systemName,
@RequestParam(value = "audit_status", required = false) Integer auditStatus,
@RequestParam(value = "creator", required = false) String creator,

View File

@@ -19,7 +19,7 @@ public interface WhiteListMapper {
void newWhiteListObject(@Param("object") WhiteListObject object);
//分页查询
List<WhiteListObject> queryWhiteListObject(String whiteListName, Integer whiteListId,
List<WhiteListObject> queryWhiteListObject(String whiteListName, String whiteListId,
String systemName, Integer auditStatus, String creator,
Integer page, Integer pageSize);
@@ -46,7 +46,7 @@ public interface WhiteListMapper {
List<WhiteListObject> whiteListCommandCheck(@Param("command") FiveTupleWithMask fiveTupleWithMaskInCommand);
Integer queryWhiteListTotalNum(String whiteListName, Integer whiteListId
Integer queryWhiteListTotalNum(String whiteListName, String whiteListId
, String systemName, Integer auditStatus, String creator);
List<WhiteListObject> whiteListCommandsCheck(List<TaskCommandInfo> taskCommandInfos);

View File

@@ -126,16 +126,16 @@ public class WhiteListService {
if (auditStatus == null) {
throw new IllegalArgumentException("无法找到白名单 " + id + ", 可能该白名单不存在");
}
if (!whiteListMapper.queryWhiteListObjectAuditStuatusById(id).equals(AuditStatusEnum.AUDITED.getNum())) {
throw new IllegalStateException("无法修改白名单信息,因为其并未处于" + AuditStatusEnum.AUDITED + "状态");
}
// if (!whiteListMapper.queryWhiteListObjectAuditStuatusById(id).equals(AuditStatusEnum.AUDITED.getNum())) {
// throw new IllegalStateException("无法修改白名单信息,因为其并未处于" + AuditStatusEnum.AUDITED + "状态");
// }
object.setWhiteListAuditStatus(AuditStatusEnum.PENDING.getNum());
return whiteListMapper.updateWhiteListObject(id, object);
}
public List<WhiteListObject> queryWhiteListObject(String whiteListName, Integer whiteListId,
public List<WhiteListObject> queryWhiteListObject(String whiteListName, String whiteListId,
String systemName, Integer auditStatus, String creator,
Integer page, Integer pageSize) {
return whiteListMapper.queryWhiteListObject(whiteListName, whiteListId, systemName, auditStatus, creator, page, pageSize);
@@ -214,7 +214,7 @@ public class WhiteListService {
return resultMap;
}
public Integer queryWhiteListTotalNum(String whiteListName, Integer whiteListId
public Integer queryWhiteListTotalNum(String whiteListName, String whiteListId
, String systemName, Integer auditStatus, String creator){
return whiteListMapper.queryWhiteListTotalNum(whiteListName, whiteListId, systemName, auditStatus, creator);
}