diff --git a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java index 66bdd2fef..9a5f54758 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -1,8 +1,12 @@ package com.nis.web.controller.dashboard; import java.lang.reflect.Type; +import java.net.URISyntaxException; import java.net.URLEncoder; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,6 +16,7 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.http.client.utils.URIBuilder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; @@ -85,11 +90,13 @@ public class DashboardController extends BaseController{ */ @RequestMapping(value="ipActive") @ResponseBody - public List ipActive(){ + public List ipActive(String beginDate,String endDate){ Map fromJsonList = new HashMap(); List list = new ArrayList(); try { - String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE); + String url =Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE; + url = urlAddDate(url, beginDate, endDate); + String string = HttpClientUtil.get(url); Gson gson = new GsonBuilder().create(); fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); logger.debug("活跃IP数据"+fromJsonList); @@ -107,11 +114,13 @@ public class DashboardController extends BaseController{ */ @RequestMapping(value="ipActiveMinuteList") @ResponseBody - public List ipActiveMinuteList(){ + public List ipActiveMinuteList(String beginDate,String endDate){ Map fromJsonList = new HashMap(); List list = new ArrayList(); try { - String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_FIVEMINUTE); + String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_FIVEMINUTE; + url=urlAddDate(url, beginDate, endDate); + String string = HttpClientUtil.get(url); Gson gson = new GsonBuilder().create(); fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); logger.debug("活跃IP1小时,间隔5分钟数据"+fromJsonList); @@ -155,26 +164,50 @@ public class DashboardController extends BaseController{ return gson; } @RequestMapping(value="ipActiveList") - public String ipActiveList( HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes redirectAttributes){ - Map fromJsonList = new HashMap(); - List ipActiveList = new ArrayList(); + public String ipActiveList(@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate,HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes redirectAttributes){ try { - String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_ONEHOUR); - - Gson gson = getIntGson(); - fromJsonList = gson.fromJson(string, new TypeToken>(){}.getType()); - logger.debug("活跃IP1小时"+fromJsonList); - ipActiveList = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken>() {}.getType()) ; + // 默认当前时间一小时 + if(StringUtil.isEmpty(beginDate)||StringUtil.isEmpty(endDate)){ + Calendar cal = Calendar. getInstance (); + cal.setTime(new Date()); + endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + } + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); } catch (Exception e) { e.printStackTrace(); logger.error("活跃IP统计错误"+e); addMessage(redirectAttributes,"error","request_service_failed"); } - model.addAttribute("ipActiveList", ipActiveList); return "/dashboard/trafficIpActiveList"; } - + /** + * 活跃IP TOP10 一小时 间隔5分钟数据 + */ + @RequestMapping(value="ajaxIpActiveList") + @ResponseBody + public List ajaxIpActiveList(String beginDate,String endDate){ + Map fromJsonList = new HashMap(); + List list = new ArrayList(); + try { + String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE_ONEHOUR; + url=urlAddDate(url, beginDate, endDate); + String string = HttpClientUtil.get(url); + Gson gson = getIntGson(); + fromJsonList = gson.fromJson(string, new TypeToken>(){}.getType()); + logger.debug("活跃IP1小时"+fromJsonList); + list = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken>() {}.getType()) ; + + } catch (Exception e) { + e.printStackTrace(); + logger.error("活跃IP数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + } + return list; + } //IP活跃导出 @RequestMapping(value = "export") public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response, @@ -512,7 +545,7 @@ public class DashboardController extends BaseController{ list = (List) fromJsonList.get("data"); //标签集合 // List codeList = CodeDicUtils.getCodeList("webCode"); - List codeList = DictUtils.getDictList("WEBSITE_SERVER"); + List codeList = DictUtils.getDictList("WEBSITE_SERVER");//网站名 //将数字替换为标签文字 if(list!=null&&!list.isEmpty()){ for (Map map : list) { @@ -557,7 +590,7 @@ public class DashboardController extends BaseController{ list = (List) fromJsonList.get("data"); //标签集合 // List codeList2 = CodeDicUtils.getCodeList("webCode");//网站子域名表获取域名domain - List domainList = appCfgService.getDomainDict(new WebsiteDomainTopic()); + List domainList = appCfgService.getDomainDict(new WebsiteDomainTopic());// domain 域名 if(list!=null&&list.size()>0&&domainList!=null&&domainList.size()>0){ for (Map dataMap : list) { for (WebsiteDomainTopic wdt : domainList) { @@ -744,5 +777,27 @@ public class DashboardController extends BaseController{ System.out.println(map2.get("c")); } - + /** + * + * + * url路径时间参数格式化 + * @param url + * @param beginDate + * @param endDate + * @return + * @throws URISyntaxException + */ + public String urlAddDate(String url,String beginDate,String endDate) throws URISyntaxException{ + if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){ + Calendar cal = Calendar. getInstance (); + cal.setTime(new Date()); + endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + } + URIBuilder uriBuilder = new URIBuilder(url); + uriBuilder.addParameter("beginDate",beginDate); + uriBuilder.addParameter("endDate",endDate); + return uriBuilder.toString(); + } } diff --git a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java index 198e86e75..fa44e2a27 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java @@ -1,15 +1,12 @@ package com.nis.web.controller.dashboard; import java.lang.reflect.Type; -import java.math.BigDecimal; import java.net.URISyntaxException; import java.net.URLEncoder; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -38,13 +35,10 @@ import com.google.gson.JsonParseException; import com.google.gson.LongSerializationPolicy; 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.DateUtil; -import com.nis.util.DictUtils; import com.nis.util.StringUtil; import com.nis.util.httpclient.HttpClientUtil; import com.nis.web.controller.BaseController; @@ -346,12 +340,15 @@ public class TrafficStatisticsInfoController extends BaseController { */ @RequestMapping(value="appList") @ResponseBody - public List appList(@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){ + public List appList(@RequestParam(value="appType",required=false)Integer appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){ Map fromJsonList = new HashMap(); List list = new ArrayList(); String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST; try { url=urlAddDate(url,beginDate,endDate); + if(!StringUtil.isEmpty(appType)){ + url=url+"&appType="+appType; + } String string = HttpClientUtil.get(url); Gson gson = new GsonBuilder().create(); fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); @@ -388,100 +385,4 @@ public class TrafficStatisticsInfoController extends BaseController { } return list; } - /** - * 网址类型列表 - */ - @RequestMapping("webTypeList") - public String webTypeList(Model model){ - Calendar cal = Calendar. getInstance (); - cal.setTime(new Date()); - String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 - cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); - String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); - model.addAttribute("beginDate", oneHoursAgo); - model.addAttribute("endDate", now); - return "/dashboard/trafficWebTypeList"; - } - /** - * 网站统计图跟表 - */ - @RequestMapping(value="websiteList") - @ResponseBody - public List websiteList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){ - Map fromJsonList = new HashMap(); - List list = new ArrayList(); - String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST; -// String url = "http://192.168.11.87:8088/galaxy-service/service/log/v1/"+Constants.TRAFFIC_WEBSITELIST; - try { - url=urlAddDate(url,beginDate,endDate); - String string = HttpClientUtil.get(url); - Gson gson = new GsonBuilder().create(); - fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); - logger.debug("website接口数据"+fromJsonList); - list = (ArrayList) fromJsonList.get("data"); - BigDecimal divisor=new BigDecimal(1024*1024*1024); - DecimalFormat df = new DecimalFormat("0.00"); - DecimalFormat dl = new DecimalFormat("0"); - DecimalFormat pf = new DecimalFormat("0.00%"); - Double totalLink=0d; - Double totalGbyte=0d; - Double totalPackets=0d; - for (Object object : list) { - Map m=(Map)object; - Double count=(Double)m.get("count"); - totalGbyte+=count; - totalLink+=(Double)m.get("linkNum"); - totalPackets+=(Double)m.get("packets"); - String format = df.format(count/1024/1024/1024); - m.put("Gbyte", format); - } - List codeList = appCfgService.getDomainDict(new WebsiteDomainTopic()); - Map map = new HashMap(); - for (WebsiteDomainTopic websiteDomainTopic : codeList) { - if(!map.containsKey(websiteDomainTopic.getWebsiteServiceId())){ - map.put(websiteDomainTopic.getId(),websiteDomainTopic.getDomain()); - } - } - for (Object object : list) { - Map m=(Map)object; - Double perLink = ((Double)m.get("linkNum"))/totalLink; - m.put("perLink",pf.format(perLink)); - Double perPackets = ((Double)m.get("packets"))/totalPackets; - m.put("perPackets", pf.format(perPackets)); - Double perGbyte = ((Double)m.get("count"))/totalGbyte; - m.put("perGbyte", pf.format(perGbyte)); - if(map.containsKey(Long.parseLong(dl.format(m.get("webId"))))){ - m.put("website", map.get(Long.parseLong(dl.format(m.get("webId"))))); - } - } - Collections.sort(list, new Comparator() { - - @Override - public int compare(Object o1, Object o2) { - if(o1==null&&o2!=null){ - return 1; - } - if(o1!=null&&o2==null){ - return -1; - } - if(o1==null&&o2==null){ - return 0; - } - Map m1=(Map)o1; - Map m2=(Map)o2; - if((Double)m1.get("count")==(Double)m2.get("count")){ - return 0; - } - int result=((Double)m1.get("count")-(Double)m2.get("count"))>0?-1:1; - return result; - } - }); - } catch (Exception e) { - e.printStackTrace(); - logger.error("网站域名数据获取错误"+e); - list.add(Maps.newHashMap("error","request_service_failed")); - } - return list; - } - } diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index b2a4cf53d..353507165 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1365,7 +1365,7 @@ nas_ip=NAS IP Address framed_ip=Framed IP Address log_user_name=User Name av_tips=The system does not support the index information of audio and video coding in the tail of the audio and video files. The system does not support video with resolution greater than 1080P. -asn_ip_group_delete=\uff08IP configuration under this ASN group will also be deleted.) +asn_ip_group_delete=\uFF08IP configuration under this ASN group will also be deleted.) keyword_log_tips=Deduplicate http body keywords log,for the control status of http body keywords is not ideal, configure the http url of the hit keyword as URL control configuration. conn_record=Connection Records bps=Bps @@ -1392,4 +1392,6 @@ ip_end_num=IP End Num ip_sub=IP Subnet start_ip=Start IP end_ip=End IP -action_detail=Action Detail \ No newline at end of file +action_detail=Action Detail +pass=Pass +live_link=Live Link \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index b586ef7b1..c57915e0f 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1396,4 +1396,6 @@ ip_end_num=IP End Num ip_sub=IP Subnet start_ip=Start IP end_ip=End IP -action_detail=Action Detail \ No newline at end of file +action_detail=Action Detail +pass=Pass +live_link=Live Link \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 0e9b15cc9..3ff37d43f 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1392,4 +1392,6 @@ ip_end_num=IP End Num ip_sub=IP Subnet start_ip=Start IP end_ip=End IP -action_detail=\u52a8\u4f5c\u8be6\u60c5 \ No newline at end of file +action_detail=\u52a8\u4f5c\u8be6\u60c5 +pass=Pass +live_link=Live Link \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp index 21858d0ec..5488022c3 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp @@ -31,7 +31,7 @@
-
+
@@ -45,7 +45,7 @@ 0 bps
-
+
@@ -127,6 +127,29 @@
+
+
+ +
+
+

" + class="tooltips" data-flag="false" data-html="true" data-placement="top"> +

+

0

+
+
+
+
+ +
+
+

" + class="tooltips" data-flag="false" data-html="true" data-placement="top"> +

+

0

+
+
+
@@ -139,6 +162,12 @@
  
+
+ + +
@@ -184,7 +213,7 @@
-   <%-- --%> +   <%-- --%>
@@ -196,7 +225,7 @@
-    +   <%-- --%>
@@ -392,7 +421,7 @@ $(document).ready(function(){ ajaxinfo(); setInterval(function(){ ajaxinfo(); - },30000); + },300000); protocolList();//协议统计 ipActiveList();//活跃IP @@ -413,8 +442,6 @@ $(document).ready(function(){ }); //获取数据info function ajaxinfo(){ -// var c2s = $(".c2sNum").text().trim(); -// var s2c = $(".s2cNum").text().trim(); $.ajax({ url:'${ctx}/dashboard/traffic/info', type : "get" , @@ -452,10 +479,11 @@ function ajaxinfo(){ dataScroll(".numberRun3",Math.round(dropConnNum)); dataScroll(".numberRun5",Math.round(newUniConnNum)); dataScroll(".numberRun6",Math.round(liveConnNum)); + dataScroll(".numberRun7",Math.round(newUniConnNum-rejectNum)); + dataScroll(".numberRun8",Math.round(newUniConnNum-rejectNum-dropConnNum)); //计算带宽进出口流量百分比 -// $("#c2sColor").removeClass(); -// $("#s2cColor").removeClass(); + var inoctetsNum=Math.round(data.inoctetsNum); var inoctetsNumK=inoctetsNum/1024; var inoctetsNumM=inoctetsNumK/1024; @@ -488,24 +516,7 @@ function ajaxinfo(){ bandwidth=parseFloat(inoctetsNum)+parseFloat(outoctetsNum); dataScroll2(".numberRun4",bandwidth); - /* if(data.inoctetsNum!=c2s){ - $(".c2sNum").text(data.c2sNum); - $(".s2cNum").text(100-data.c2sNum); - if(data.c2sNum>c2s){ - //c2s增长 fa fa-arrow-up - $("#c2sColor").addClass("fa fa-arrow-up"); - $("#c2sColor").attr({style:"color:green"}); - $("#s2cColor").addClass("fa fa-arrow-down"); - $("#s2cColor").attr({style:"color:red"}); - } - //c2s下降 - if(data.c2sNum0&&rs[0].error!=null){ top.$.jBox.tip("", ""); @@ -951,7 +967,6 @@ function topicAndDomainList(){ } }); } - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp index 3776ae899..800217ec5 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp @@ -27,7 +27,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/>
@@ -36,7 +36,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'${endDate}'});"/>
diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp index 84091999c..551936bd1 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp @@ -43,16 +43,29 @@ + value="${beginDate}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/> -
-
-
- +
+
+
+
+ value="${endDate}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'${endDate}'});"/> +
+
+
+
+
+ +
+
@@ -127,12 +140,13 @@ function searchList(){ } } function ajaxAppList(start,end){ + var appType=$("#appType").val(); loading(); $.ajax({ url: '${ctx}/dashboard/traffic/appList', type: 'get', dataType: "json", - data:{"beginDate":start,"endDate":end}, + data:{"beginDate":start,"endDate":end,"appType":appType}, async:false, timeout:10000, success:function (data){ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp index b5b3afc37..5c869c885 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp @@ -32,7 +32,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/>
@@ -41,7 +41,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'${endDate}'});"/> diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp index 34d1b8c81..981ae1f22 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp @@ -17,18 +17,45 @@

- +
+ + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+ + +
+
+ +
+
-
- - - - -
+

@@ -54,30 +81,8 @@ - - - - ${entry.ipAddr } - - - - - - - - - - ${entry.c2sByteLen } - ${entry.s2cByteLen } - ${entry.s2cByteLen+entry.c2sByteLen } - ${entry.linkNum } - ${entry.c2sPktNum } - ${entry.s2cPktNum } - ${entry.s2cPktNum+entry.c2sPktNum} - ${entry.statTime } -<%-- --%> - - + + <%--
${page}
--%> @@ -93,9 +98,58 @@ <%-- --%>