抗DDOS攻击导出添加日志总量、导出顺序调整
This commit is contained in:
@@ -45,11 +45,11 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
@SerializedName("ipType")
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=44)
|
||||
protected Integer ipType;
|
||||
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=46)
|
||||
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=45)
|
||||
protected Integer ipPattern;
|
||||
@ExcelField(title="client_ip",sort=47)
|
||||
protected String srcIpAddress;
|
||||
@ExcelField(title="ip",sort=45)
|
||||
@ExcelField(title="server_ip",sort=46)
|
||||
protected String destIpAddress;
|
||||
@ExcelField(title="port_pattern",dictType="PORT_PATTERN",sort=48)
|
||||
protected Integer portPattern;
|
||||
|
||||
@@ -11,9 +11,11 @@ package com.nis.domain.configuration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
|
||||
@@ -86,6 +88,10 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
private List<AsnKeywordCfg> asnKeywords;
|
||||
@ExcelField(title="log_total",sort=31)
|
||||
private Long totalLogs;
|
||||
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=20)
|
||||
private Integer isAudit;
|
||||
@ExcelField(title="do_log",dictType="DO_LOG",sort=27)
|
||||
private Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
|
||||
|
||||
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
|
||||
|
||||
@@ -96,8 +102,18 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Integer getDoLog() {
|
||||
return doLog;
|
||||
}
|
||||
public void setDoLog(Integer doLog) {
|
||||
this.doLog = doLog;
|
||||
}
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,23 @@ public class DdosIpCfg extends BaseIpCfg {
|
||||
private Long bpsThreadshold;// 即DDoS攻击保护动作触发阈值,每秒Bit数和每秒包数
|
||||
@ExcelField(title="pps_threadshold",sort=43)
|
||||
private Long ppsThreadshold;
|
||||
|
||||
@ExcelField(title="log_total",sort=32)
|
||||
private Long totalLogs;
|
||||
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=20)
|
||||
private Integer isAudit;
|
||||
|
||||
public Integer getIsAudit() {
|
||||
return isAudit;
|
||||
}
|
||||
public void setIsAudit(Integer isAudit) {
|
||||
this.isAudit = isAudit;
|
||||
}
|
||||
public Long getTotalLogs() {
|
||||
return totalLogs;
|
||||
}
|
||||
public void setTotalLogs(Long totalLogs) {
|
||||
this.totalLogs = totalLogs;
|
||||
}
|
||||
public String getAntiddosProtocol() {
|
||||
return antiddosProtocol;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.nis.web.controller.configuration.manipulation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -159,6 +161,35 @@ public class DdosCfgController extends BaseController {
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
|
||||
StringBuilder compileIds=new StringBuilder(",");//配置ids
|
||||
Set<Integer> set=new HashSet<Integer>();//服务ids
|
||||
for (DdosIpCfg cfg : ipLists) {
|
||||
if(cfg.getIsAudit()!=0){
|
||||
set.add(cfg.getServiceId());
|
||||
compileIds.append(cfg.getCompileId()+",");
|
||||
}else{
|
||||
Map<String,Object> logTotal=new HashMap<String,Object>();
|
||||
logTotal.put("compileId", cfg.getCompileId()+"");
|
||||
logTotal.put("sum",0L);
|
||||
logTotals.add(logTotal);
|
||||
}
|
||||
|
||||
}
|
||||
StringBuilder serviceIds=new StringBuilder(",");
|
||||
for (Integer id : set) {
|
||||
serviceIds.append(id+",");
|
||||
}
|
||||
if(serviceIds.length()>1&&compileIds.length()>1){
|
||||
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||
//获取日志总量
|
||||
if(!com.nis.util.StringUtils.isBlank(serviceIdsStr)&&!com.nis.util.StringUtils.isBlank(compileIdsStr)){
|
||||
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||
logTotals.addAll(logs);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
@@ -169,7 +200,7 @@ public class DdosCfgController extends BaseController {
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",do_log,client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String cfgIndexInfoNoExport = ",client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
@@ -186,6 +217,15 @@ public class DdosCfgController extends BaseController {
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
|
||||
for (DdosIpCfg cfg : ipLists) {
|
||||
for (Map<String,Object> logTotal : logTotals) {
|
||||
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
|
||||
cfg.setTotalLogs((Long)logTotal.get("sum"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
|
||||
Reference in New Issue
Block a user