流量统计中活跃IP一小时最大值列表增加导出Excel,修改行为日志列表闪烁问题

This commit is contained in:
zhanghongqing
2018-11-27 13:52:11 +08:00
parent 5618531c6d
commit f01dbff621
5 changed files with 142 additions and 78 deletions

View File

@@ -0,0 +1,82 @@
package com.nis.domain.dashboard;
import com.nis.util.excel.ExcelField;
public class TrafficIpActiveStatistic{
Integer id;
@ExcelField(title="IP",sort=10)
String ipAddr;
@ExcelField(title="Area",sort=20)
String areaId;
@ExcelField(title="Number",sort=30)
Integer linkNum;
@ExcelField(title="C2S(Pkt)",sort=40)
Integer c2sPktNum;
@ExcelField(title="S2C(Pkt)",sort=50)
Integer s2cPktNum;
@ExcelField(title="C2S(Byte)",sort=60)
Integer c2sByteLen;
@ExcelField(title="S2C(Byte)",sort=70)
Integer s2cByteLen;
@ExcelField(title="Time",sort=80)
String statTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStatTime() {
return statTime;
}
public void setStatTime(String statTime) {
this.statTime = statTime;
}
public TrafficIpActiveStatistic(){
super();
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public Integer getLinkNum() {
return linkNum;
}
public void setLinkNum(Integer linkNum) {
this.linkNum = linkNum;
}
public Integer getC2sPktNum() {
return c2sPktNum;
}
public void setC2sPktNum(Integer c2sPktNum) {
this.c2sPktNum = c2sPktNum;
}
public Integer getS2cPktNum() {
return s2cPktNum;
}
public void setS2cPktNum(Integer s2cPktNum) {
this.s2cPktNum = s2cPktNum;
}
public Integer getC2sByteLen() {
return c2sByteLen;
}
public void setC2sByteLen(Integer c2sByteLen) {
this.c2sByteLen = c2sByteLen;
}
public Integer getS2cByteLen() {
return s2cByteLen;
}
public void setS2cByteLen(Integer s2cByteLen) {
this.s2cByteLen = s2cByteLen;
}
}

View File

@@ -1,10 +1,12 @@
package com.nis.web.controller.dashboard;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
@@ -30,10 +32,13 @@ import com.google.gson.reflect.TypeToken;
import com.nis.domain.PageLog;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.configuration.WebsiteDomainTopic;
import com.nis.domain.dashboard.TrafficIpActiveStatistic;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
@@ -171,7 +176,48 @@ public class DashboardController extends BaseController{
return "/dashboard/trafficIpActiveList";
}
//IP活跃导出
@RequestMapping(value = "export")
public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("entry")TrafficIpActiveStatistic entity,String ids,RedirectAttributes redirectAttributes){
try {
//export data info
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap=new HashMap<String, String>();
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<TrafficIpActiveStatistic> ipActiveList = new ArrayList<TrafficIpActiveStatistic>();
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_ONEHOUR);
Gson gson = getIntGson();
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
ipActiveList = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken<List<TrafficIpActiveStatistic>>() {}.getType()) ;
titleList.add("traffic_ipactive_hour_max");
classMap.put(null, TrafficIpActiveStatistic.class);
String cfgIndexInfoNoExport=",id,";
noExportMap.put("traffic_ipactive_hour_max",cfgIndexInfoNoExport);
dataMap.put(null, ipActiveList);
// 获取国际化配置
Properties msgProp = getMsgProp();
Map<Object, Object> map = new HashMap<Object, Object>();
String fileName = "IP-Active-Hour-Max" + "-" + DateUtils.getDate("yyyyMMddHHmmss")
+ ".xlsx";
new ExportExcel("", TrafficIpActiveStatistic.class, 1).setDataList(msgProp,ipActiveList,new HashMap())
.write(request,response, fileName).dispose();
} catch (Exception e) {
e.printStackTrace();
logger.error("IPActive export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
// return "/dashboard/trafficIpActiveList";
}
/**
* 协议统计
*/
@@ -668,78 +714,7 @@ public class DashboardController extends BaseController{
model.addAttribute("chartMap",list);
return "/dashboard/trafficWebTypeList";
}
public class TrafficIpActiveStatistic{
Integer id=1;
String ipAddr="10.1.1.2";
String areaId="1045";
Integer linkNum=3121;
Integer c2sPktNum=1352;
Integer s2cPktNum=2234;
Integer c2sByteLen=31;
Integer s2cByteLen=23323;
String statTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStatTime() {
return statTime;
}
public void setStatTime(String statTime) {
this.statTime = statTime;
}
public TrafficIpActiveStatistic(){
super();
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public Integer getLinkNum() {
return linkNum;
}
public void setLinkNum(Integer linkNum) {
this.linkNum = linkNum;
}
public Integer getC2sPktNum() {
return c2sPktNum;
}
public void setC2sPktNum(Integer c2sPktNum) {
this.c2sPktNum = c2sPktNum;
}
public Integer getS2cPktNum() {
return s2cPktNum;
}
public void setS2cPktNum(Integer s2cPktNum) {
this.s2cPktNum = s2cPktNum;
}
public Integer getC2sByteLen() {
return c2sByteLen;
}
public void setC2sByteLen(Integer c2sByteLen) {
this.c2sByteLen = c2sByteLen;
}
public Integer getS2cByteLen() {
return s2cByteLen;
}
public void setS2cByteLen(Integer s2cByteLen) {
this.s2cByteLen = s2cByteLen;
}
}
public static void main(String[] args) {
Map<String, Object> map = new HashMap<String, Object>();

View File

@@ -33,6 +33,11 @@
<h3 class="page-title">
<spring:message code="traffic_ipactive_hour_max"></spring:message>
</h3>
<div class="pull-right">
<button type="button" onClick="javascript:window.location='${ctx}/dashboard/export'" class="btn btn-default"><i class="fa fa-download"> <spring:message code="export"/></i></button>
</div>
<br>
<br>
<div class="" align="center">
<table id="contentTable"class="table table-striped table-bordered table-condensed text-nowrap">
<thead>

View File

@@ -80,13 +80,14 @@
<%-- <label for="exception"><input id="exception"
name="exception" type="checkbox"
${sysLog.exception eq '1'?' checked':''} value="1" /><spring:message code="log_exception" /></label> --%>
<button type="submit" class="btn blue form-control"><i class="fa fa-search"></i><spring:message code="search" /></button>
<button type="submit" class="btn blue form-control"><i class="fa fa-search"></i> <spring:message code="search" /></button>
</div>
</div>
</form:form>
</div>
<sys:message content="${message}" />
<div class="table-responsive">
<div class="">
<br/>
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
<thead>
<tr>

View File

@@ -65,8 +65,8 @@
onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" />
</div>
<div class="pull-left">
<label for="exception"><input id="exception" name="exception" type="checkbox" ${sysLog.exception eq '1'?' checked':''} value="1" /><spring:message code="log_exception" /></label>
<button type="submit" class="btn blue form-control"><i class="fa fa-search"></i><spring:message code="search" /></button>
<label for="exception"><input id="exception" name="exception" type="checkbox" ${sysLog.exception eq '1'?' checked':''} value="1" /> <spring:message code="log_exception" /></label>
<button type="submit" class="btn blue form-control"><i class="fa fa-search"></i> <spring:message code="search" /></button>
</div>
@@ -74,7 +74,8 @@
</form:form>
</div>
<sys:message content="${message}" />
<div class="table-responsive">
<div class="">
<br/>
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
<thead>
<tr>