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 9d2a99198..2e3eed8ec 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -807,4 +807,16 @@ public class DashboardController extends BaseController{ uriBuilder.addParameter("endDate",endDate); return uriBuilder.toString(); } + + @RequestMapping(value="httpStatisticList") + public String httpStatisticList( HttpServletRequest request, HttpServletResponse response, Model model, RedirectAttributes redirectAttributes){ + 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/trafficHttpStatisticList"; + } } 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 7e13e331a..3b68d81ff 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java @@ -38,11 +38,13 @@ 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; @@ -484,4 +486,61 @@ public class TrafficStatisticsInfoController extends BaseController { } return list; } + + /** + * 主题 统计图跟表(目前只有表) + */ + @RequestMapping(value="statisticList") + @ResponseBody + public List statisticList(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_TOPIC_AND_DOMAIN_CHART; + //String url = "http://192.168.11.87:8088/galaxy-service/service/log/v1/"+Constants.TRAFFIC_TOPIC_AND_DOMAIN_CHART; + Map map=new HashMap(); + try { + url=urlAddDate(url,beginDate,endDate); + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + List codeList = DictUtils.getDictList("TOPIC"); + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; + totalLink+=Long.parseLong(lf.format(m.get("linkNum"))); + totalPackets+=Long.parseLong(lf.format(m.get("packets"))); + totalGByte+=Double.parseDouble(lf.format(m.get("count"))); + Double value1=0d; + if(StringUtil.isBlank(m.get("topicId").toString())){ + value1=268435455d; + }else{ + value1 = Double.parseDouble(m.get("topicId").toString()); + } + for (SysDataDictionaryItem code : codeList) { + Double value2 = Double.valueOf(code.getItemCode()); + if(value1.equals(value2)){ + m.put("name",code.getItemValue()); + break; + } + } + } + for(Object object2 : list) { + Map m2=(Map) object2; + m2.put("allLink", totalLink); + m2.put("allPackets",totalPackets); + m2.put("allGByte", totalGByte); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("协议详情数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + } + return list; + } } diff --git a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp index 003005cbe..1a0044dff 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp @@ -215,9 +215,9 @@
-   <%-- --%> - -
+   <%-- --%> +   +
diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp new file mode 100644 index 000000000..97572678a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp @@ -0,0 +1,246 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +主题 + + + + + + + + + +
+ +

+ +

+ +
+ + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+ + +
+
+ +
+
+ +
+ +
+
+
+
+ + + + + + + + + + + + + +
() () ()
+
+
  
+
+
+ + + + + + + \ No newline at end of file