diff --git a/src/main/java/com/nis/domain/restful/dashboard/TrafficAppStatistic.java b/src/main/java/com/nis/domain/restful/dashboard/TrafficAppStatistic.java new file mode 100644 index 0000000..6a03315 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/dashboard/TrafficAppStatistic.java @@ -0,0 +1,85 @@ +package com.nis.domain.restful.dashboard; + +import java.util.Date; + +public class TrafficAppStatistic { + private Integer statId; + + private Integer appType; + + private Integer entranceId; + + private Integer c2sPktNum; + + private Integer s2cPktNum; + + private Integer c2sByteLen; + + private Integer s2cByteLen; + + private Date statTime; + + public Integer getStatId() { + return statId; + } + + public void setStatId(Integer statId) { + this.statId = statId; + } + + public Integer getAppType() { + return appType; + } + + public void setAppType(Integer appType) { + this.appType = appType; + } + + public Integer getEntranceId() { + return entranceId; + } + + public void setEntranceId(Integer entranceId) { + this.entranceId = entranceId; + } + + 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 Date getStatTime() { + return statTime; + } + + public void setStatTime(Date statTime) { + this.statTime = statTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/dashboard/TrafficHttpStatistic.java b/src/main/java/com/nis/domain/restful/dashboard/TrafficHttpStatistic.java new file mode 100644 index 0000000..e928204 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/dashboard/TrafficHttpStatistic.java @@ -0,0 +1,114 @@ +package com.nis.domain.restful.dashboard; + +import java.util.Date; + +public class TrafficHttpStatistic { + private Integer statId; + + private Integer webType; + + private Integer webId; + + private Integer c2sPktNum; + + private Integer s2cPktNum; + + private Integer c2sByteLen; + + private Integer s2cByteLen; + + private Date statTime; + + // 自定义字段 + private Integer count; + private Integer pktNum; + private Integer byteLen; + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public Integer getPktNum() { + return pktNum; + } + + public void setPktNum(Integer pktNum) { + this.pktNum = pktNum; + } + + public Integer getByteLen() { + return byteLen; + } + + public void setByteLen(Integer byteLen) { + this.byteLen = byteLen; + } + + public Integer getStatId() { + return statId; + } + + public void setStatId(Integer statId) { + this.statId = statId; + } + + public Integer getWebType() { + return webType; + } + + public void setWebType(Integer webType) { + this.webType = webType; + } + + public Integer getWebId() { + return webId; + } + + public void setWebId(Integer webId) { + this.webId = webId; + } + + 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 Date getStatTime() { + return statTime; + } + + public void setStatTime(Date statTime) { + this.statTime = statTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/dashboard/TrafficIpActiveStatistic.java b/src/main/java/com/nis/domain/restful/dashboard/TrafficIpActiveStatistic.java new file mode 100644 index 0000000..2f715a3 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/dashboard/TrafficIpActiveStatistic.java @@ -0,0 +1,110 @@ +package com.nis.domain.restful.dashboard; + +import java.util.Date; + +import com.nis.domain.BaseEntity; + +public class TrafficIpActiveStatistic extends BaseEntity { + /** + * + */ + private static final long serialVersionUID = -9198831010652509505L; + + private Integer statId; + + private String ipAddr; + + private Integer areaId; + + private Integer linkNum; + + private Integer c2sPktNum; + + private Integer s2cPktNum; + + private Integer c2sByteLen; + + private Integer s2cByteLen; + + private Date statTime; + + public Integer getStatId() { + return statId; + } + + public void setStatId(Integer statId) { + this.statId = statId; + } + + public String getIpAddr() { + return ipAddr; + } + + public void setIpAddr(String ipAddr) { + this.ipAddr = ipAddr == null ? null : ipAddr.trim(); + } + + public Integer getAreaId() { + return areaId; + } + + public void setAreaId(Integer 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 Date getStatTime() { + return statTime; + } + + public void setStatTime(Date statTime) { + this.statTime = statTime; + } + + @Override + public String toString() { + return "TrafficIpActiveStatistic [statId=" + statId + ", ipAddr=" + ipAddr + ", areaId=" + areaId + ", linkNum=" + + linkNum + ", c2sPktNum=" + c2sPktNum + ", s2cPktNum=" + s2cPktNum + ", c2sByteLen=" + c2sByteLen + + ", s2cByteLen=" + s2cByteLen + ", statTime=" + statTime + "]"; + } + +} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/dashboard/TrafficProtocolStatistic.java b/src/main/java/com/nis/domain/restful/dashboard/TrafficProtocolStatistic.java new file mode 100644 index 0000000..fa1f75b --- /dev/null +++ b/src/main/java/com/nis/domain/restful/dashboard/TrafficProtocolStatistic.java @@ -0,0 +1,85 @@ +package com.nis.domain.restful.dashboard; + +import java.util.Date; + +public class TrafficProtocolStatistic { + private Integer statId; + + private Integer protoType; + + private Integer entranceId; + + private Integer c2sPktNum; + + private Integer s2cPktNum; + + private Integer c2sByteLen; + + private Integer s2cByteLen; + + private Date statTime; + + public Integer getStatId() { + return statId; + } + + public void setStatId(Integer statId) { + this.statId = statId; + } + + public Integer getProtoType() { + return protoType; + } + + public void setProtoType(Integer protoType) { + this.protoType = protoType; + } + + public Integer getEntranceId() { + return entranceId; + } + + public void setEntranceId(Integer entranceId) { + this.entranceId = entranceId; + } + + 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 Date getStatTime() { + return statTime; + } + + public void setStatTime(Date statTime) { + this.statTime = statTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/nis/domain/restful/dashboard/TrafficUaStatistic.java b/src/main/java/com/nis/domain/restful/dashboard/TrafficUaStatistic.java new file mode 100644 index 0000000..34b3a47 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/dashboard/TrafficUaStatistic.java @@ -0,0 +1,123 @@ +package com.nis.domain.restful.dashboard; + +import java.util.Date; + +public class TrafficUaStatistic { + private Integer statId; + + private Integer bsType; + private Integer osType; + + private Integer entranceId; + + private Integer c2sPktNum; + + private Integer s2cPktNum; + + private Integer c2sByteLen; + + private Integer s2cByteLen; + + private Date statTime; + + // 自定义字段 + private Integer count; + private Integer pktNum; + private Integer byteLen; + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public Integer getPktNum() { + return pktNum; + } + + public void setPktNum(Integer pktNum) { + this.pktNum = pktNum; + } + + public Integer getByteLen() { + return byteLen; + } + + public void setByteLen(Integer byteLen) { + this.byteLen = byteLen; + } + + public Integer getOsType() { + return osType; + } + + public void setOsType(Integer osType) { + this.osType = osType; + } + + public Integer getStatId() { + return statId; + } + + public void setStatId(Integer statId) { + this.statId = statId; + } + + public Integer getBsType() { + return bsType; + } + + public void setBsType(Integer bsType) { + this.bsType = bsType; + } + + public Integer getEntranceId() { + return entranceId; + } + + public void setEntranceId(Integer entranceId) { + this.entranceId = entranceId; + } + + 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 Date getStatTime() { + return statTime; + } + + public void setStatTime(Date statTime) { + this.statTime = statTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java new file mode 100644 index 0000000..ed0de04 --- /dev/null +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -0,0 +1,257 @@ +package com.nis.web.controller.restful; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import com.nis.restful.RestServiceException; +import com.nis.util.Constants; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.nis.util.JsonMapper; +import com.nis.web.controller.BaseController; +import com.nis.web.controller.BaseRestController; +import com.nis.web.service.SaveRequestLogThread; +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; + +@RestController +@RequestMapping(value = "${servicePath}/log/v1") +@Api(value = "DashboardServiceController", description = "统计分析图表基本服务接口") +public class DashboardServiceController extends BaseRestController { + + @Autowired + protected ServicesRequestLogService servicesRequestLogService; + @Autowired + public DashboardService dashboardService; + + /** + * 协议统计 + */ + @RequestMapping(value="trafficProtocol", method = RequestMethod.GET) + @ApiOperation(value = "协议统计", httpMethod = "GET", notes = "对应协议统计实时统计查询服务。") + public Map trafficProtocol(Model model, HttpServletRequest request, HttpServletResponse response){ + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List ipActiveChart = dashboardService.protocolChart(); + if (ipActiveChart.size() > 0) { + String jsonString = JsonMapper.toJsonString(ipActiveChart); + list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); + logger.info(list); + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "协议统计图表数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功", + list, 0); + } + + + /** + * 活跃IP TOP10 + */ + @RequestMapping(value = "trafficIpActive", method = RequestMethod.GET) + @ApiOperation(value = "活跃IP统计", httpMethod = "GET", notes = "对应活跃IP实时统计查询服务。") + public Map trafficIpActive(Model model, HttpServletRequest request, HttpServletResponse response) { + + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List ipActiveChart = dashboardService.ipActiveChart(); + if (ipActiveChart.size() > 0) { + list = ipActiveChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP实时统计数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP实时统计数据检索成功",list, 0); + } + /** + * app流量分析 TOP10 + */ + @RequestMapping(value = "trafficApp", method = RequestMethod.GET) + @ApiOperation(value = "app流量分析统计", httpMethod = "GET", notes = "对应app流量分析实时统计查询服务。") + public Map trafficApp(Model model, HttpServletRequest request, HttpServletResponse response) { + + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List appChart = dashboardService.appChart(); + if (appChart.size() > 0) { + list = appChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "App流量统计数据检索失败"); + } + throw ((RestServiceException) e); + } + 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) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List osChart = dashboardService.systemList(); + if (osChart.size() > 0) { + list = osChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "操作系统流量分析统计检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "操作系统流量分析统计检索成功",list, 0); + } + @RequestMapping(value = "trafficBrowserChart", method = RequestMethod.GET) + @ApiOperation(value = "操作系统下浏览器流量分析统计", httpMethod = "GET", notes = "对应终端用户某个操作系统的浏览器分类统计显示") + public Map trafficBrowserChart(Integer osType,Model model, HttpServletRequest request, HttpServletResponse response) { + + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List osChart = dashboardService.getBrowserBySystem(osType); + if (osChart.size() > 0) { + list=osChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "操作系统下浏览器分类统计数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "操作系统下浏览器分类统计数据检索成功",list, 0); + } + @RequestMapping(value = "trafficBsList", method = RequestMethod.GET) + @ApiOperation(value = "浏览器流量分析统计", httpMethod = "GET", notes = "对应终端用户的浏览器列表显示") + public Map trafficBsList(Model model, HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List bsChart = dashboardService.browserList(); + if (bsChart.size() > 0) { + list = bsChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "浏览器流量分析统计数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器流量分析统计数据检索成功",list, 0); + } + @RequestMapping(value = "trafficSystemChart", method = RequestMethod.GET) + @ApiOperation(value = "浏览器下操作系统流量分析统计", httpMethod = "GET", notes = "对应终端用户某个浏览器的操作系统分类统计显示") + public Map trafficSystemChart(Integer bsType,Model model, HttpServletRequest request, HttpServletResponse response) { + + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List bsChart = dashboardService.getSystemBybrowser(bsType); + if (bsChart.size() > 0) { + list = bsChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "浏览器下操作系统流量统计数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器下操作系统流量统计数据检索成功",list, 0); + } + @RequestMapping(value = "trafficWebsiteList", method = RequestMethod.GET) + @ApiOperation(value = "网站流量分析统计", httpMethod = "GET", notes = "对应网站http分类显示") + public Map trafficWebsiteList(Model model, HttpServletRequest request, HttpServletResponse response) { + + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List websiteChart = dashboardService.websiteList(); + if (websiteChart.size() > 0) { + list = websiteChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "网站流量分析统计数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "网站流量分析统计数据检索成功",list, 0); + } + @RequestMapping(value = "trafficWebTypeChart", method = RequestMethod.GET) + @ApiOperation(value = "http网站分类分析统计", httpMethod = "GET", notes = "对应某个网站类型分类统计图") + public Map trafficWebTypeChart(Integer webId,Model model, HttpServletRequest request, HttpServletResponse response) { + + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + List list = new ArrayList(); + try { + List websiteChart = dashboardService.getTypeBywebsite(webId); + if (websiteChart.size() > 0) { + list = websiteChart; + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "http网站分类分析数据检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "http网站分类分析数据检索成功",list, 0); + } +} diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java new file mode 100644 index 0000000..6bef086 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java @@ -0,0 +1,11 @@ +package com.nis.web.dao.dashboard; + +import java.util.List; +import java.util.Map; + +import com.nis.web.dao.MyBatisDao; +@MyBatisDao +public interface TrafficAppStatisticDao { + + List appChart(); +} \ 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 new file mode 100644 index 0000000..159769b --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + stat_id, app_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len, + stat_time + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java new file mode 100644 index 0000000..7689564 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java @@ -0,0 +1,15 @@ +package com.nis.web.dao.dashboard; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; + +import com.nis.domain.restful.dashboard.TrafficHttpStatistic; +import com.nis.web.dao.MyBatisDao; +@MyBatisDao +public interface TrafficHttpStatisticDao { + List websiteList(); + + List getTypeBywebsite(@Param("webId") Integer webId); +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml new file mode 100644 index 0000000..5de9b5c --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len, + stat_time + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java new file mode 100644 index 0000000..3280bb6 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java @@ -0,0 +1,16 @@ +package com.nis.web.dao.dashboard; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic; +import com.nis.web.dao.MyBatisDao; + +@MyBatisDao +public interface TrafficIpActiveStatisticDao { + + List getList(TrafficIpActiveStatistic trafficIpActiveStatistic); + + ArrayList ipActiveChart(); +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml new file mode 100644 index 0000000..c38598f --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + stat_id, ip_addr, area_id, link_num, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len, + stat_time + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java new file mode 100644 index 0000000..474bf52 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java @@ -0,0 +1,11 @@ +package com.nis.web.dao.dashboard; + +import java.util.List; +import java.util.Map; + +import com.nis.web.dao.MyBatisDao; +@MyBatisDao +public interface TrafficProtocolStatisticDao { + + List protocolChart(); +} \ 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 new file mode 100644 index 0000000..23d3880 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + stat_id, proto_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len, + stat_time + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficUaStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficUaStatisticDao.java new file mode 100644 index 0000000..16d6f59 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficUaStatisticDao.java @@ -0,0 +1,20 @@ +package com.nis.web.dao.dashboard; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; + +import com.nis.domain.restful.dashboard.TrafficUaStatistic; +import com.nis.web.dao.MyBatisDao; +@MyBatisDao +public interface TrafficUaStatisticDao { + + List systemList(); + + List getBrowserBySystem(@Param("osType") Integer osType); + + List browserList(); + + List getSystemBybrowser(@Param("bsType") Integer bsType); +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficUaStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficUaStatisticDao.xml new file mode 100644 index 0000000..cd19594 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficUaStatisticDao.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + stat_id, bs_type,os_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len, + stat_time + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/restful/DashboardService.java b/src/main/java/com/nis/web/service/restful/DashboardService.java new file mode 100644 index 0000000..c5cba8c --- /dev/null +++ b/src/main/java/com/nis/web/service/restful/DashboardService.java @@ -0,0 +1,118 @@ +package com.nis.web.service.restful; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.nis.domain.Page; +import com.nis.domain.restful.dashboard.TrafficHttpStatistic; +import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic; +import com.nis.domain.restful.dashboard.TrafficUaStatistic; +import com.nis.web.dao.dashboard.TrafficAppStatisticDao; +import com.nis.web.dao.dashboard.TrafficHttpStatisticDao; +import com.nis.web.dao.dashboard.TrafficIpActiveStatisticDao; +import com.nis.web.dao.dashboard.TrafficProtocolStatisticDao; +import com.nis.web.dao.dashboard.TrafficUaStatisticDao; +import com.nis.web.service.BaseService; + +@Service +public class DashboardService extends BaseService{ + + @Autowired + public TrafficIpActiveStatisticDao trafficIpActiveStatisticDao; + @Autowired + public TrafficProtocolStatisticDao trafficProtocolStatisticDao; + @Autowired + public TrafficAppStatisticDao trafficAppStatisticDao; + @Autowired + public TrafficUaStatisticDao trafficUaStatisticDao; + @Autowired + public TrafficHttpStatisticDao trafficHttpStatisticDao; + + /** + * 分页查询活跃IPtop100 + * @return + */ + public Page getList(Page page,TrafficIpActiveStatistic entry){ + // 设置分页参数 + entry.setPage(page); + // 执行分页查询 + page.setList(trafficIpActiveStatisticDao.getList(entry)); + return page; + } + + public List ipActiveChart(){ + + ArrayList list = trafficIpActiveStatisticDao.ipActiveChart(); + + return list; + } + + public List protocolChart() { + List list = trafficProtocolStatisticDao.protocolChart(); + return list; + } + + public List appChart() { + List list = trafficAppStatisticDao.appChart(); + return list; + } + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List systemList(){ + List result = new ArrayList(); + List list = trafficUaStatisticDao.systemList(); + for (TrafficUaStatistic ua : list) { + Map map = new HashMap(); + map.put("osType",ua.getOsType()); + map.put("count",ua.getCount()); + map.put("pktNum",ua.getPktNum()); + map.put("byteLen",ua.getByteLen()); + result.add(map); + } + return result; + } + public List getBrowserBySystem(Integer osType ){ + List list = trafficUaStatisticDao.getBrowserBySystem(osType); + return list; + } + + public List browserList() { + List result = new ArrayList(); + List list = trafficUaStatisticDao.browserList(); + for (TrafficUaStatistic ua : list) { + Map map = new HashMap(); + map.put("bsType",ua.getBsType()); + map.put("count",ua.getCount()); + map.put("pktNum",ua.getPktNum()); + map.put("byteLen",ua.getByteLen()); + result.add(map); + } + return result; + } + public List getSystemBybrowser(Integer bsType ){ + List list = trafficUaStatisticDao.getSystemBybrowser(bsType); + return list; + } + public List websiteList() { + List result = new ArrayList(); + List list = trafficHttpStatisticDao.websiteList(); + for (TrafficHttpStatistic website : list) { + Map map = new HashMap(); + map.put("webId",website.getWebId()); + map.put("count",website.getCount()); + map.put("pktNum",website.getPktNum()); + map.put("byteLen",website.getByteLen()); + result.add(map); + } + return result; + } + public List getTypeBywebsite(Integer webId ){ + List list = trafficHttpStatisticDao.getTypeBywebsite(webId); + return list; + } +}