diff --git a/src/main/java/com/nis/domain/restful/NtcEntranceReport.java b/src/main/java/com/nis/domain/restful/NtcEntranceReport.java index ee61c45..bcfd202 100644 --- a/src/main/java/com/nis/domain/restful/NtcEntranceReport.java +++ b/src/main/java/com/nis/domain/restful/NtcEntranceReport.java @@ -13,6 +13,8 @@ public class NtcEntranceReport extends NtcReportEntity { protected Integer entranceId; protected String searchEntrance; + + protected String time; /** * @return the entranceId @@ -42,4 +44,13 @@ public class NtcEntranceReport extends NtcReportEntity { public void setSearchEntrance(String searchEntrance) { this.searchEntrance = searchEntrance; } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + } diff --git a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java index d484e53..d97dd14 100644 --- a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -26,7 +26,7 @@ import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DashboardService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; - +@SuppressWarnings("unchecked") @RestController @RequestMapping(value = "${servicePath}/log/v1") @Api(value = "DashboardServiceController", description = "统计分析图表基本服务接口") @@ -61,6 +61,30 @@ public class DashboardServiceController extends BaseRestController { } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "业务总量汇聚实时统计数据检索成功",list, 0); } + /** + * 流量统计info滚动条数据显示 封堵监测回流丢弃详情趋势 + */ + @RequestMapping(value = "ntcActionEntranceReport", method = RequestMethod.GET) + @ApiOperation(value = "根据不同动作统计总量汇聚", httpMethod = "GET", notes = "对应流量统计info滚动条动作类型详情数据显示") + public Map ntcTotalReport(Model model, HttpServletRequest request, HttpServletResponse response,String searchAction) { + + long start = System.currentTimeMillis(); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List resultList = dashboardService.getActionTrans(searchAction); + if (resultList!=null&&resultList.size() > 0) { + list = resultList; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error("动作趋势分析统计数据检索失败"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "动作趋势分析统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "动作趋势分析统计数据检索成功",list, 0); + } /** * 根据ip46,协议tcp,udp查询带宽 */ @@ -123,7 +147,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List ipActiveChart = dashboardService.protocolChart(); - if (ipActiveChart.size() > 0) { + if (ipActiveChart!=null&&ipActiveChart.size() > 0) { String jsonString = JsonMapper.toJsonString(ipActiveChart); list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); } @@ -148,7 +172,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List ipActiveList = dashboardService.getProtocolList(); - if (ipActiveList.size() > 0) { + if (ipActiveList!=null&&ipActiveList.size() > 0) { String jsonString = JsonMapper.toJsonString(ipActiveList); list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); } @@ -176,7 +200,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List ipActiveChart = dashboardService.ipActiveChart(); - if (ipActiveChart.size() > 0) { + if (ipActiveChart!=null&&ipActiveChart.size() > 0) { list = ipActiveChart; } } catch (Exception e) { @@ -200,7 +224,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List ipActiveChart = dashboardService.ipActiveOneHour(); - if (ipActiveChart.size() > 0) { + if (ipActiveChart!=null&&ipActiveChart.size() > 0) { list = ipActiveChart; } } catch (Exception e) { @@ -213,7 +237,7 @@ public class DashboardServiceController extends BaseRestController { return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP统计一个小时的活跃IP检索成功",list, 0); } /** - * 活跃IP TOP10 一小时数据 + * 活跃IP TOP10 一小时间隔五分钟数据 */ @RequestMapping(value = "trafficIpActiveFiveMinute", method = RequestMethod.GET) @ApiOperation(value = "活跃IP最近一个小时的变化趋势统计", httpMethod = "GET", notes = "对最新TOP10的活跃IP,在近一个小时的变化情况进行统计") @@ -224,7 +248,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List ipActiveChart = dashboardService.ipActiveFiveMinute(); - if (ipActiveChart.size() > 0) { + if (ipActiveChart!=null&&ipActiveChart.size() > 0) { list = ipActiveChart; } } catch (Exception e) { @@ -248,7 +272,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List appChart = dashboardService.appChart(); - if (appChart.size() > 0) { + if (appChart!=null&&appChart.size() > 0) { list = appChart; } } catch (Exception e) { @@ -260,6 +284,31 @@ public class DashboardServiceController extends BaseRestController { } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App流量统计数据检索成功",list, 0); } + /** + * App统计详情图与表 + */ + @RequestMapping(value="trafficAppList", method = RequestMethod.GET) + @ApiOperation(value = "App统计占比与报表", httpMethod = "GET", notes = "对应App统计详情占比与报表") + public Map trafficAppList(Model model, HttpServletRequest request, HttpServletResponse response){ + long start = System.currentTimeMillis(); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List appList = dashboardService.getAppList(); + if (appList!=null&&appList.size() > 0) { + String jsonString = JsonMapper.toJsonString(appList); + list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error("App统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App统计图表数据检索成功", + list, 0); + } @RequestMapping(value = "trafficOsList", method = RequestMethod.GET) @ApiOperation(value = "操作系统流量分析统计", httpMethod = "GET", notes = "对应终端用户的操作系统列表显示") public Map trafficOsList(Model model, HttpServletRequest request, HttpServletResponse response) { @@ -268,7 +317,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List osChart = dashboardService.systemList(); - if (osChart.size() > 0) { + if (osChart!=null&&osChart.size() > 0) { list = osChart; } } catch (Exception e) { @@ -289,7 +338,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List osChart = dashboardService.getBrowserBySystem(osType); - if (osChart.size() > 0) { + if (osChart!=null&&osChart.size() > 0) { list=osChart; } } catch (Exception e) { @@ -309,7 +358,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List bsChart = dashboardService.browserList(); - if (bsChart.size() > 0) { + if (bsChart!=null&&bsChart.size() > 0) { list = bsChart; } } catch (Exception e) { @@ -330,7 +379,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List bsChart = dashboardService.getSystemBybrowser(bsType); - if (bsChart.size() > 0) { + if (bsChart!=null&&bsChart.size() > 0) { list = bsChart; } } catch (Exception e) { @@ -352,7 +401,7 @@ public class DashboardServiceController extends BaseRestController { try { // List websiteChart = dashboardService.websiteList(); List websiteChart = dashboardService.getDomainByWebsiteList(); - if (websiteChart.size() > 0) { + if (websiteChart!=null&&websiteChart.size() > 0) { list = websiteChart; } } catch (Exception e) { @@ -373,7 +422,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List websiteChart = dashboardService.getDomainByWebsiteServiceId(websiteServiceId); - if (websiteChart.size() > 0) { + if (websiteChart!=null&&websiteChart.size() > 0) { list = websiteChart; } } catch (Exception e) { @@ -394,7 +443,7 @@ public class DashboardServiceController extends BaseRestController { List list = new ArrayList(); try { List websiteChart = dashboardService.getTopicAndDomainList(); - if (websiteChart.size() > 0) { + if (websiteChart!=null&&websiteChart.size() > 0) { list = websiteChart; } } catch (Exception e) { diff --git a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.java b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.java index 9940e19..f3d3e33 100644 --- a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.java @@ -6,6 +6,7 @@ import java.util.Map; import org.apache.ibatis.annotations.Param; +import com.nis.domain.restful.NtcEntranceReport; import com.nis.domain.restful.dashboard.NtcTotalReport; import com.nis.domain.restful.dashboard.TrafficTransStatistic; import com.nis.web.dao.MyBatisDao; @@ -16,4 +17,7 @@ public interface NtcTotalReportDao { List getTotalReportList(@Param("reportTime") Date reportTime); List getNetFlowPortInfoNew(@Param("statTime") Date statTime); List getBandwidthTrans(@Param("statTime") Date statTime,@Param("addrType") String addrType,@Param("transType") Integer transType); + + Map getEntranceMaxReportTime(); + List getActionTrans(@Param("reportTime") Date reportTime,@Param("entranceId") Integer entranceId,@Param("serviceSql") String serviceSql); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml index b9bf41c..f122204 100644 --- a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml @@ -38,8 +38,8 @@ + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java index d23a133..e640156 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java @@ -13,4 +13,5 @@ public interface TrafficAppStatisticDao { TrafficAppStatistic getMaxStatTime(); List appChart(@Param("statTime")Date statTime); + List getAppList(@Param("statTime")Date statTime); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml index f723bf4..6a8a56c 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml @@ -24,4 +24,12 @@ WHERE app_type !=0 and stat_time = #{statTime} GROUP BY app_type order by count desc limit 0,10 + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml index 4ef50a9..0f6f16c 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml @@ -25,7 +25,7 @@