IP复用模块添加日志总量、导出顺序
This commit is contained in:
@@ -75,10 +75,18 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
|||||||
protected String organization; //仅用于copy属性使用
|
protected String organization; //仅用于copy属性使用
|
||||||
protected String country; //仅用于copy属性使用
|
protected String country; //仅用于copy属性使用
|
||||||
protected String detail; //仅用于copy属性使用
|
protected String detail; //仅用于copy属性使用
|
||||||
|
@ExcelField(title="log_total",sort=31)
|
||||||
|
private Long totalLogs;
|
||||||
|
|
||||||
public String getOrganization() {
|
public String getOrganization() {
|
||||||
return organization;
|
return organization;
|
||||||
}
|
}
|
||||||
|
public Long getTotalLogs() {
|
||||||
|
return totalLogs;
|
||||||
|
}
|
||||||
|
public void setTotalLogs(Long totalLogs) {
|
||||||
|
this.totalLogs = totalLogs;
|
||||||
|
}
|
||||||
public void setOrganization(String organization) {
|
public void setOrganization(String organization) {
|
||||||
this.organization = organization;
|
this.organization = organization;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class IpReusePolicyCfg extends BaseCfg<IpReusePolicyCfg>{
|
|||||||
private String srcIpAddress;
|
private String srcIpAddress;
|
||||||
private String destIpAddress;
|
private String destIpAddress;
|
||||||
@Expose
|
@Expose
|
||||||
|
@ExcelField(title="cfg_id",sort=0)
|
||||||
@SerializedName("configId")
|
@SerializedName("configId")
|
||||||
private Integer compileId;
|
private Integer compileId;
|
||||||
@Expose
|
@Expose
|
||||||
@@ -47,7 +48,15 @@ public class IpReusePolicyCfg extends BaseCfg<IpReusePolicyCfg>{
|
|||||||
private String areaEffectiveIds ;
|
private String areaEffectiveIds ;
|
||||||
@Expose
|
@Expose
|
||||||
private Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
|
private Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
|
||||||
|
@ExcelField(title="log_total",sort=31)
|
||||||
|
private Long totalLogs;
|
||||||
|
|
||||||
|
public Long getTotalLogs() {
|
||||||
|
return totalLogs;
|
||||||
|
}
|
||||||
|
public void setTotalLogs(Long totalLogs) {
|
||||||
|
this.totalLogs = totalLogs;
|
||||||
|
}
|
||||||
public void setDoLog(Integer doLog) {
|
public void setDoLog(Integer doLog) {
|
||||||
this.doLog = doLog;
|
this.doLog = doLog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,16 @@ package com.nis.web.controller.configuration.manipulation;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -451,6 +454,33 @@ public class IpMultiplexController extends CommonController {
|
|||||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(pageInfo,entity);
|
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(pageInfo,entity);
|
||||||
ipLists = page.getList();
|
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 (IpReusePolicyCfg 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+",");
|
||||||
|
}
|
||||||
|
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||||
|
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||||
|
//获取日志总量
|
||||||
|
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
|
||||||
|
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||||
|
logTotals.addAll(logs);
|
||||||
|
}
|
||||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||||
for (IpReusePolicyCfg ipReusePolicyCfg : ipLists) {
|
for (IpReusePolicyCfg ipReusePolicyCfg : ipLists) {
|
||||||
if(ipReusePolicyCfg.getAddrPoolId()!=null){
|
if(ipReusePolicyCfg.getAddrPoolId()!=null){
|
||||||
@@ -487,6 +517,14 @@ public class IpMultiplexController extends CommonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||||
|
for (IpReusePolicyCfg 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);
|
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||||
|
|
||||||
String timeRange = initTimeMap(entity);
|
String timeRange = initTimeMap(entity);
|
||||||
@@ -529,6 +567,33 @@ public class IpMultiplexController extends CommonController {
|
|||||||
ipLists = page.getList();
|
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 (BaseIpCfg 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+",");
|
||||||
|
}
|
||||||
|
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||||
|
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||||
|
//获取日志总量
|
||||||
|
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
|
||||||
|
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||||
|
logTotals.addAll(logs);
|
||||||
|
}
|
||||||
titleList.add(entity.getMenuNameCode());
|
titleList.add(entity.getMenuNameCode());
|
||||||
classMap.put(entity.getMenuNameCode(), IpReuseDnatPolicyCfg.class);
|
classMap.put(entity.getMenuNameCode(), IpReuseDnatPolicyCfg.class);
|
||||||
String snatNoExport = ",group_name,block_type,direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
String snatNoExport = ",group_name,block_type,direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||||
@@ -548,6 +613,14 @@ public class IpMultiplexController extends CommonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||||
|
for (BaseIpCfg 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);
|
dataMap.put(entity.getMenuNameCode(),ipLists);
|
||||||
|
|
||||||
String timeRange = initTimeMap(entity);
|
String timeRange = initTimeMap(entity);
|
||||||
|
|||||||
Reference in New Issue
Block a user