活跃IP TOP10近一小时内最大值导出数据为空修复

This commit is contained in:
wangxin
2018-12-18 17:28:58 +06:00
parent 1cdaa9b19b
commit 14f4dd325c
3 changed files with 38 additions and 16 deletions

View File

@@ -1,26 +1,43 @@
package com.nis.domain.dashboard; package com.nis.domain.dashboard;
import java.math.BigInteger;
import com.nis.util.excel.ExcelField; import com.nis.util.excel.ExcelField;
public class TrafficIpActiveStatistic{ public class TrafficIpActiveStatistic{
Integer id; Integer id;
@ExcelField(title="IP",sort=10) @ExcelField(title="IP",sort=10,type=1)
String ipAddr; String ipAddr;
@ExcelField(title="Area",sort=20) @ExcelField(title="Area",dictType="ENTRANCE",sort=20,type=1)
String areaId; String areaId;
@ExcelField(title="Number",sort=30) @ExcelField(title="Link Times",sort=52,type=1)
Long linkNum; Long linkNum;
@ExcelField(title="C2S(Pkt)",sort=40) @ExcelField(title="C2S(Pkt)",sort=60,type=1)
Long c2sPktNum; Long c2sPktNum;
@ExcelField(title="S2C(Pkt)",sort=50) @ExcelField(title="S2C(Pkt)",sort=70,type=1)
Long s2cPktNum; Long s2cPktNum;
@ExcelField(title="C2S(Byte)",sort=60) @ExcelField(title="C2S(Byte)",sort=40,type=1)
Long c2sByteLen; Long c2sByteLen;
@ExcelField(title="S2C(Byte)",sort=70) @ExcelField(title="S2C(Byte)",sort=50,type=1)
Long s2cByteLen; Long s2cByteLen;
@ExcelField(title="Time",sort=80) @ExcelField(title="Statistic Time",sort=80,type=1)
String statTime; String statTime;
private String _byte;
private String _packet;
@ExcelField(title="Byte",sort=51,type=1)
public String get_byte() {
return BigInteger.valueOf(this.getC2sByteLen()).add(BigInteger.valueOf(this.getS2cByteLen())).toString();
}
public void set_byte(String _byte) {
this._byte = _byte;
}
@ExcelField(title="Packet",sort=71,type=1)
public String get_packet() {
return BigInteger.valueOf(this.getC2sPktNum()).add(BigInteger.valueOf(this.s2cPktNum)).toString();
}
public void set_packet(String _packet) {
this._packet = _packet;
}
public Integer getId() { public Integer getId() {
return id; return id;
} }

View File

@@ -47,6 +47,8 @@ import com.nis.util.excel.ExportExcel;
import com.nis.util.httpclient.HttpClientUtil; import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController; import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult; import com.nis.web.dao.dashboard.codedic.CodeResult;
import antlr.StringUtils;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Controller @Controller
@RequestMapping(value = "${adminPath}/dashboard") @RequestMapping(value = "${adminPath}/dashboard")
@@ -218,7 +220,7 @@ public class DashboardController extends BaseController{
//IP活跃导出 //IP活跃导出
@RequestMapping(value = "export") @RequestMapping(value = "export")
public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response, public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("entry")TrafficIpActiveStatistic entity,String ids,RedirectAttributes redirectAttributes){ @ModelAttribute("entry")TrafficIpActiveStatistic entity,String ids,String beginDate,String endDate,RedirectAttributes redirectAttributes){
try { try {
//export data info //export data info
List<String> titleList=new ArrayList<String>(); List<String> titleList=new ArrayList<String>();
@@ -227,7 +229,11 @@ public class DashboardController extends BaseController{
Map<String, String> noExportMap=new HashMap<String, String>(); Map<String, String> noExportMap=new HashMap<String, String>();
Map<String, Object> fromJsonList = new HashMap<String, Object>(); Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<TrafficIpActiveStatistic> ipActiveList = new ArrayList<TrafficIpActiveStatistic>(); List<TrafficIpActiveStatistic> ipActiveList = new ArrayList<TrafficIpActiveStatistic>();
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_ONEHOUR); String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_ONEHOUR;
if(org.apache.commons.lang3.StringUtils.isNotBlank(beginDate)&&org.apache.commons.lang3.StringUtils.isNotBlank(endDate)) {
url=urlAddDate(url, beginDate, endDate);
}
String string = HttpClientUtil.get(url);
Gson gson = getIntGson(); Gson gson = getIntGson();
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType()); fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());

View File

@@ -61,7 +61,7 @@
<spring:message code="traffic_ipactive_hour_max"></spring:message> <spring:message code="traffic_ipactive_hour_max"></spring:message>
</h3> </h3>
<div class="pull-right"> <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> <button type="button" onClick="return _export('${ctx}/dashboard/export');" class="btn btn-default"><i class="fa fa-download"> <spring:message code="export"/></i></button>
</div> </div>
<br> <br>
<br> <br>
@@ -130,9 +130,6 @@ function searchList(){
} }
} }
function checkDate(start,end){ function checkDate(start,end){
if(getDate(start)-getDate(end)>0){ if(getDate(start)-getDate(end)>0){
alert("结束时间不能小于开始时间!"); alert("结束时间不能小于开始时间!");
@@ -147,7 +144,9 @@ function getDate(date){
} }
return dateReturn; return dateReturn;
} }
function _export(url){
window.location=url+"?beginDate="+$("#beginDateh").val()+"&endDate="+$("#endDateh").val();
}