From 980ecdf7a8de8ad7a228d81360e66980b48fdb34 Mon Sep 17 00:00:00 2001 From: renkaige Date: Mon, 17 Dec 2018 14:08:03 +0600 Subject: [PATCH 1/5] =?UTF-8?q?1:=E6=96=B0=E5=A2=9E=E4=B8=9A=E5=8A=A1=202:?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/domain/restful/NtcIpRangeReport.java | 99 +++ .../restful/DashboardServiceController.java | 493 ++++++----- .../restful/SingleDimensionReport.java | 318 +++---- .../java/com/nis/web/dao/NtcReportDao.java | 4 + .../java/com/nis/web/dao/NtcReportDao.xml | 29 + .../web/dao/dashboard/NtcTotalReportDao.xml | 2 +- .../dashboard/TrafficHttpStatisticDao.java | 9 +- .../dao/dashboard/TrafficHttpStatisticDao.xml | 26 +- .../nis/web/dao/impl/LocalLogJDBCByDruid.java | 23 + .../web/service/restful/DashboardService.java | 803 +++++++++--------- .../web/service/restful/NtcReportService.java | 9 + .../java/com/nis/web/task/GetIpRangeTask.java | 153 ++++ .../com/nis/web/task/GetIpRangeTask2.java | 423 +++++++++ .../java/com/nis/web/task/IpToLongThread.java | 53 ++ .../applicationConfig-parser.xml | 15 + .../maatXml/applicationConfig-maatRedis.xml | 67 +- 16 files changed, 1683 insertions(+), 843 deletions(-) create mode 100644 src/main/java/com/nis/domain/restful/NtcIpRangeReport.java create mode 100644 src/main/java/com/nis/web/task/GetIpRangeTask.java create mode 100644 src/main/java/com/nis/web/task/GetIpRangeTask2.java create mode 100644 src/main/java/com/nis/web/task/IpToLongThread.java diff --git a/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java b/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java new file mode 100644 index 0000000..48842a4 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java @@ -0,0 +1,99 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.Map; + +import javax.xml.bind.annotation.XmlTransient; + +import org.apache.poi.ss.formula.functions.T; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.collect.Maps; +import com.nis.domain.Page; + +public class NtcIpRangeReport implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + private String ipStart; + private String ipEnd; + private Long ipStartNum; + private Long ipEndNum; + private String ipSub; + private String country; + private String searchType; + private String searchCountry; + + + + public String getIpStart() { + return ipStart; + } + + public void setIpStart(String ipStart) { + this.ipStart = ipStart; + } + + public String getIpEnd() { + return ipEnd; + } + + public void setIpEnd(String ipEnd) { + this.ipEnd = ipEnd; + } + + public Long getIpStartNum() { + return ipStartNum; + } + + public void setIpStartNum(Long ipStartNum) { + this.ipStartNum = ipStartNum; + } + + public Long getIpEndNum() { + return ipEndNum; + } + + public void setIpEndNum(Long ipEndNum) { + this.ipEndNum = ipEndNum; + } + + public String getIpSub() { + return ipSub; + } + + public void setIpSub(String ipSub) { + this.ipSub = ipSub; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + @JsonIgnore + public String getSearchType() { + return searchType; + } + + public void setSearchType(String searchType) { + this.searchType = searchType; + } + + @JsonIgnore + public String getSearchCountry() { + return searchCountry; + } + + public void setSearchCountry(String searchCountry) { + this.searchCountry = searchCountry; + } + + +} 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 06ad51e..e2f1812 100644 --- a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -16,6 +16,7 @@ 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.nis.restful.RestBusinessCode; @@ -32,35 +33,37 @@ 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 = "统计分析图表基本服务接口") public class DashboardServiceController extends BaseRestController { - + @Autowired protected ServicesRequestLogService servicesRequestLogService; @Autowired public DashboardService dashboardService; - + /** * 流量统计info滚动条数据显示 封堵监测回流丢弃 */ @RequestMapping(value = "ntcTotalReport", method = RequestMethod.GET) @ApiOperation(value = "业务总量汇聚", httpMethod = "GET", notes = "对应流量统计info滚动条数据显示") - public Map ntcTotalReport(Model model, HttpServletRequest request, HttpServletResponse response) { + public Map ntcTotalReport(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List resultList = dashboardService.getTotalReportList(); - if (resultList!=null&&resultList.size() > 0) { - list = resultList; + if (resultList != null && resultList.size() > 0) { + list = resultList; } } catch (Exception e) { - auditLogThread.setExceptionInfo("业务总量汇聚实时统计数据检索失败:"+e.getMessage()); - logger.error("业务总量汇聚实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("业务总量汇聚实时统计数据检索失败:" + e.getMessage()); + logger.error("业务总量汇聚实时统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "业务总量汇聚实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -71,35 +74,39 @@ public class DashboardServiceController extends BaseRestController { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, "业务总量汇聚实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } - + } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "业务总量汇聚实时统计数据检索成功",list, 0); + 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,String beginDate,String endDate) { + public Map ntcTotalReport(Model model, HttpServletRequest request, HttpServletResponse response, + String searchAction, String beginDate, String endDate) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - if(StringUtils.isEmpty(beginDate)||StringUtils.isEmpty(endDate)) { - Calendar cal = Calendar. getInstance (); + if (StringUtils.isEmpty(beginDate) || StringUtils.isEmpty(endDate)) { + Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); - endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间 + endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间 cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); - beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime()); + beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime()); } - List resultList = dashboardService.getActionTrans(beginDate,endDate,searchAction); - if (resultList!=null&&resultList.size() > 0) { - list = resultList; + List resultList = dashboardService.getActionTrans(beginDate, endDate, searchAction); + if (resultList != null && resultList.size() > 0) { + list = resultList; } } catch (Exception e) { - auditLogThread.setExceptionInfo("动作趋势分析统计数据检索失败:"+e.getMessage()); - logger.error("动作趋势分析统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("动作趋势分析统计数据检索失败:" + e.getMessage()); + logger.error("动作趋势分析统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "动作趋势分析统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -111,32 +118,36 @@ public class DashboardServiceController extends BaseRestController { "动作趋势分析统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "动作趋势分析统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "动作趋势分析统计数据检索成功", list, + 0); } + /** - * 根据ip46,协议tcp,udp查询带宽 + * 根据ip46,协议tcp,udp查询带宽 */ @RequestMapping(value = "trafficBandwidthTrans", method = RequestMethod.GET) @ApiOperation(value = "带宽根据ip46,协议tcp,udp查询详情", httpMethod = "GET", notes = "对应带宽根据IPv4,6,协议tcp,udp统计数据显示") - public Map trafficBandwidthTrans(String beginDate,String endDate,String addrType,Integer transType,Model model, HttpServletRequest request, HttpServletResponse response) { + public Map trafficBandwidthTrans(String beginDate, String endDate, String addrType, Integer transType, + Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - if(StringUtils.isEmpty(beginDate)||StringUtils.isEmpty(endDate)) { - Calendar cal = Calendar. getInstance (); - cal.setTime(new Date()); - endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间 - cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); - beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime()); + if (StringUtils.isEmpty(beginDate) || StringUtils.isEmpty(endDate)) { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime()); } - List resultList = dashboardService.getBandwidthTrans(addrType, transType,beginDate,endDate); - if (resultList!=null&&resultList.size() > 0) { + List resultList = dashboardService.getBandwidthTrans(addrType, transType, beginDate, endDate); + if (resultList != null && resultList.size() > 0) { list = resultList; } } catch (Exception e) { - auditLogThread.setExceptionInfo("带宽实时统计数据检索失败:"+e.getMessage()); - logger.error("带宽实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("带宽实时统计数据检索失败:" + e.getMessage()); + logger.error("带宽实时统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "带宽实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -148,32 +159,35 @@ public class DashboardServiceController extends BaseRestController { "带宽实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "带宽实时统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "带宽实时统计数据检索成功", list, 0); } + /** - * 根据ip46,协议tcp,udp查询带宽 + * 根据ip46,协议tcp,udp查询带宽 */ @RequestMapping(value = "trafficBandwidthTransTwo", method = RequestMethod.GET) @ApiOperation(value = "带宽根据ip46,协议tcp,udp查询详情", httpMethod = "GET", notes = "对应带宽根据IPv4,6,协议tcp,udp统计数据显示") - public Map trafficBandwidthTransTow(String beginDate,String endDate,String addrType,Integer transType,Model model, HttpServletRequest request, HttpServletResponse response) { + public Map trafficBandwidthTransTow(String beginDate, String endDate, String addrType, Integer transType, + Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - if(StringUtils.isEmpty(beginDate)||StringUtils.isEmpty(endDate)) { - Calendar cal = Calendar. getInstance (); + if (StringUtils.isEmpty(beginDate) || StringUtils.isEmpty(endDate)) { + Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); - endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间 + endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间 cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); - beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime()); + beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime()); } - List resultList = dashboardService.getBandwidthTrans2(addrType, transType,beginDate,endDate); - if (resultList!=null&&resultList.size() > 0) { + List resultList = dashboardService.getBandwidthTrans2(addrType, transType, beginDate, endDate); + if (resultList != null && resultList.size() > 0) { list = resultList; } } catch (Exception e) { - auditLogThread.setExceptionInfo("带宽实时统计数据检索失败:"+e.getMessage()); - logger.error("带宽实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("带宽实时统计数据检索失败:" + e.getMessage()); + logger.error("带宽实时统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "带宽实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -185,27 +199,29 @@ public class DashboardServiceController extends BaseRestController { "带宽实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "带宽实时统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "带宽实时统计数据检索成功", list, 0); } + /** * 流量统计活跃端口统计 */ @RequestMapping(value = "trafficPortActive", method = RequestMethod.GET) @ApiOperation(value = "活跃端口统计", httpMethod = "GET", notes = "对应流量统计活跃端口统计") - public Map trafficPortActive(Model model, HttpServletRequest request, HttpServletResponse response) { - + public Map trafficPortActive(Model model, HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List resultList = dashboardService.getPortActiveList(); - if(resultList!=null&&resultList.size()>0) { - list=resultList; + if (resultList != null && resultList.size() > 0) { + list = resultList; } - + } catch (Exception e) { - auditLogThread.setExceptionInfo("活跃端口实时统计数据检索失败:"+e.getMessage()); - logger.error("活跃端口实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("活跃端口实时统计数据检索失败:" + e.getMessage()); + logger.error("活跃端口实时统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃端口实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -217,28 +233,29 @@ public class DashboardServiceController extends BaseRestController { "活跃端口实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃端口实时统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃端口实时统计数据检索成功", list, + 0); } - - + /** * 协议统计 */ - @RequestMapping(value="trafficProtocol", method = RequestMethod.GET) + @RequestMapping(value = "trafficProtocol", method = RequestMethod.GET) @ApiOperation(value = "协议统计", httpMethod = "GET", notes = "对应协议统计实时统计查询服务。") - public Map trafficProtocol(Model model, HttpServletRequest request, HttpServletResponse response){ + public Map trafficProtocol(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List ipActiveChart = dashboardService.protocolChart(); - if (ipActiveChart!=null&&ipActiveChart.size() > 0) { - String jsonString = JsonMapper.toJsonString(ipActiveChart); - list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); + if (ipActiveChart != null && ipActiveChart.size() > 0) { + String jsonString = JsonMapper.toJsonString(ipActiveChart); + list = (java.util.List) JsonMapper.fromJsonList(jsonString, HashMap.class); } } catch (Exception e) { - auditLogThread.setExceptionInfo("协议统计图表数据检索失败:"+e.getMessage()); - logger.error("协议统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("协议统计图表数据检索失败:" + e.getMessage()); + logger.error("协议统计图表数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "协议统计图表数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -250,27 +267,29 @@ public class DashboardServiceController extends BaseRestController { "协议统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计图表数据检索成功", - list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计图表数据检索成功", list, 0); } + /** * 协议统计详情图与表 */ - @RequestMapping(value="trafficProtocolList", method = RequestMethod.GET) + @RequestMapping(value = "trafficProtocolList", method = RequestMethod.GET) @ApiOperation(value = "协议统计占比与报表", httpMethod = "GET", notes = "对应协议统计详情占比与报表") - public Map trafficProtocolList(String beginDate,String endDate,Model model, HttpServletRequest request, HttpServletResponse response){ + public Map trafficProtocolList(String beginDate, String endDate, Model model, HttpServletRequest request, + HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - List ipActiveList = dashboardService.getProtocolList(beginDate,endDate); - if (ipActiveList!=null&&ipActiveList.size() > 0) { + List ipActiveList = dashboardService.getProtocolList(beginDate, endDate); + if (ipActiveList != null && ipActiveList.size() > 0) { String jsonString = JsonMapper.toJsonString(ipActiveList); - list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); + list = (java.util.List) JsonMapper.fromJsonList(jsonString, HashMap.class); } } catch (Exception e) { - auditLogThread.setExceptionInfo("协议统计占比与报表检索失败:"+e.getMessage()); - logger.error("协议统计占比与报表检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("协议统计占比与报表检索失败:" + e.getMessage()); + logger.error("协议统计占比与报表检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "协议统计占比与报表检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -282,42 +301,43 @@ public class DashboardServiceController extends BaseRestController { "协议统计占比与报表检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计占比与报表检索成功", - list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计占比与报表检索成功", list, + 0); } - - + /** * 活跃IP TOP10 */ @RequestMapping(value = "trafficIpActive", method = RequestMethod.GET) @ApiOperation(value = "活跃IP统计", httpMethod = "GET", notes = "对应活跃IP实时统计查询服务。") - public Map trafficIpActive(String beginDate, String endDate ,Model model, HttpServletRequest request, HttpServletResponse response) { + public Map trafficIpActive(String beginDate, String endDate, Model model, HttpServletRequest request, + HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - Date begin=null; - Date end=null; - if(StringUtils.isEmpty(beginDate)||StringUtils.isEmpty(endDate)) { - Calendar cal = Calendar. getInstance (); + Date begin = null; + Date end = null; + if (StringUtils.isEmpty(beginDate) || StringUtils.isEmpty(endDate)) { + Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); - begin = cal.getTime();//获取到完整的时间 + begin = cal.getTime();// 获取到完整的时间 cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); - end = cal.getTime(); - }else { + end = cal.getTime(); + } else { begin = DateUtils.parseDate(beginDate); end = DateUtils.parseDate(endDate); } - - List ipActiveChart = dashboardService.ipActiveChart(begin,end); - if (ipActiveChart!=null&&ipActiveChart.size() > 0) { - list = ipActiveChart; + + List ipActiveChart = dashboardService.ipActiveChart(begin, end); + if (ipActiveChart != null && ipActiveChart.size() > 0) { + list = ipActiveChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("活跃IP实时统计数据检索失败:"+e.getMessage()); - logger.error("活跃IP实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("活跃IP实时统计数据检索失败:" + e.getMessage()); + logger.error("活跃IP实时统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -329,28 +349,32 @@ public class DashboardServiceController extends BaseRestController { "活跃IP实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP实时统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP实时统计数据检索成功", list, + 0); } + /** * 活跃IP TOP10 一小时数据 */ @RequestMapping(value = "trafficIpActiveOneHour", method = RequestMethod.GET) @ApiOperation(value = "活跃IP统计一个小时的活跃IP", httpMethod = "GET", notes = "对应活跃IP实时统计查询服务。") - public Map trafficIpActiveOneHour(String beginDate, String endDate ,Model model, HttpServletRequest request, HttpServletResponse response) { - + public Map trafficIpActiveOneHour(String beginDate, String endDate, Model model, + HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { Date begin = DateUtils.parseDate(beginDate); Date end = DateUtils.parseDate(endDate); - List ipActiveChart = dashboardService.ipActiveOneHour(begin,end); - if (ipActiveChart!=null&&ipActiveChart.size() > 0) { + List ipActiveChart = dashboardService.ipActiveOneHour(begin, end); + if (ipActiveChart != null && ipActiveChart.size() > 0) { list = ipActiveChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("活跃IP统计一个小时的活跃IP检索失败:"+e.getMessage()); - logger.error("活跃IP统计一个小时的活跃IP检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage()); + logger.error("活跃IP统计一个小时的活跃IP检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -362,32 +386,36 @@ public class DashboardServiceController extends BaseRestController { "活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP统计一个小时的活跃IP检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP统计一个小时的活跃IP检索成功", + list, 0); } + /** * 活跃IP TOP10 一小时间隔五分钟数据 */ @RequestMapping(value = "trafficIpActiveFiveMinute", method = RequestMethod.GET) @ApiOperation(value = "活跃IP最近一个小时的变化趋势统计", httpMethod = "GET", notes = "对最新TOP10的活跃IP,在近一个小时的变化情况进行统计") - public Map trafficIpActiveFiveMinute(String beginDate, String endDate ,Model model, HttpServletRequest request, HttpServletResponse response) { - + public Map trafficIpActiveFiveMinute(String beginDate, String endDate, Model model, + HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - Date begin=null; - Date end=null; - if(!StringUtils.isEmpty(beginDate)&&!StringUtils.isEmpty(endDate)) { - begin=DateUtils.parseDate(beginDate); - end=DateUtils.parseDate(endDate); + Date begin = null; + Date end = null; + if (!StringUtils.isEmpty(beginDate) && !StringUtils.isEmpty(endDate)) { + begin = DateUtils.parseDate(beginDate); + end = DateUtils.parseDate(endDate); } - List ipActiveChart = dashboardService.ipActiveFiveMinute(begin,end); - if (ipActiveChart!=null&&ipActiveChart.size() > 0) { + List ipActiveChart = dashboardService.ipActiveFiveMinute(begin, end); + if (ipActiveChart != null && ipActiveChart.size() > 0) { list = ipActiveChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("活跃IP最近一个小时的变化趋势统计失败:"+e.getMessage()); - logger.error("活跃IP最近一个小时的变化趋势统计失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage()); + logger.error("活跃IP最近一个小时的变化趋势统计失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -399,26 +427,29 @@ public class DashboardServiceController extends BaseRestController { "活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP最近一个小时的变化趋势统计成功",list, 0); + 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(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List appChart = dashboardService.appChart(); - if (appChart!=null&&appChart.size() > 0) { + if (appChart != null && appChart.size() > 0) { list = appChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("App流量统计数据检索失败:"+e.getMessage()); - logger.error("App流量统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("App流量统计数据检索失败:" + e.getMessage()); + logger.error("App流量统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "App流量统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -430,26 +461,30 @@ public class DashboardServiceController extends BaseRestController { "App流量统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App流量统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App流量统计数据检索成功", list, + 0); } + /** * App统计详情图与表 */ - @RequestMapping(value="trafficAppList", method = RequestMethod.GET) + @RequestMapping(value = "trafficAppList", method = RequestMethod.GET) @ApiOperation(value = "App统计占比与报表", httpMethod = "GET", notes = "对应App统计详情占比与报表") - public Map trafficAppList(Integer appType,String beginDate,String endDate,Model model, HttpServletRequest request, HttpServletResponse response){ + public Map trafficAppList(Integer appType, String beginDate, String endDate, Model model, + HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - List appList = dashboardService.getAppList(beginDate,endDate,appType); - if (appList!=null&&appList.size() > 0) { + List appList = dashboardService.getAppList(beginDate, endDate, appType); + if (appList != null && appList.size() > 0) { String jsonString = JsonMapper.toJsonString(appList); - list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); + list = (java.util.List) JsonMapper.fromJsonList(jsonString, HashMap.class); } } catch (Exception e) { - auditLogThread.setExceptionInfo("App统计图表数据检索失败:"+e.getMessage()); - logger.error("App统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("App统计图表数据检索失败:" + e.getMessage()); + logger.error("App统计图表数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "App统计图表数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -461,23 +496,25 @@ public class DashboardServiceController extends BaseRestController { "App统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App统计图表数据检索成功", - list, 0); + 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) { + public Map trafficOsList(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List osChart = dashboardService.systemList(); - if (osChart!=null&&osChart.size() > 0) { + if (osChart != null && osChart.size() > 0) { list = osChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("操作系统流量分析统计检索失败:"+e.getMessage()); - logger.error("操作系统流量分析统计检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("操作系统流量分析统计检索失败:" + e.getMessage()); + logger.error("操作系统流量分析统计检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "操作系统流量分析统计检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -489,23 +526,27 @@ public class DashboardServiceController extends BaseRestController { "操作系统流量分析统计检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "操作系统流量分析统计检索成功",list, 0); + 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) { - + public Map trafficBrowserChart(Integer osType, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List osChart = dashboardService.getBrowserBySystem(osType); - if (osChart!=null&&osChart.size() > 0) { - list=osChart; + if (osChart != null && osChart.size() > 0) { + list = osChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("操作系统下浏览器分类统计数据检索失败:"+e.getMessage()); - logger.error("操作系统下浏览器分类统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("操作系统下浏览器分类统计数据检索失败:" + e.getMessage()); + logger.error("操作系统下浏览器分类统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "操作系统下浏览器分类统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -517,22 +558,25 @@ public class DashboardServiceController extends BaseRestController { "操作系统下浏览器分类统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "操作系统下浏览器分类统计数据检索成功",list, 0); + 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(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List bsChart = dashboardService.browserList(); - if (bsChart!=null&&bsChart.size() > 0) { + if (bsChart != null && bsChart.size() > 0) { list = bsChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("浏览器流量分析统计数据检索失败:"+e.getMessage()); - logger.error("浏览器流量分析统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("浏览器流量分析统计数据检索失败:" + e.getMessage()); + logger.error("浏览器流量分析统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "浏览器流量分析统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -544,23 +588,27 @@ public class DashboardServiceController extends BaseRestController { "浏览器流量分析统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器流量分析统计数据检索成功",list, 0); + 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) { - + public Map trafficSystemChart(Integer bsType, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { List bsChart = dashboardService.getSystemBybrowser(bsType); - if (bsChart!=null&&bsChart.size() > 0) { + if (bsChart != null && bsChart.size() > 0) { list = bsChart; } } catch (Exception e) { - auditLogThread.setExceptionInfo("浏览器下操作系统流量统计数据检索失败:"+e.getMessage()); - logger.error("浏览器下操作系统流量统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("浏览器下操作系统流量统计数据检索失败:" + e.getMessage()); + logger.error("浏览器下操作系统流量统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "浏览器下操作系统流量统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -572,35 +620,33 @@ public class DashboardServiceController extends BaseRestController { "浏览器下操作系统流量统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器下操作系统流量统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器下操作系统流量统计数据检索成功", + list, 0); } + @RequestMapping(value = "trafficWebsiteList", method = RequestMethod.GET) @ApiOperation(value = "网站流量分析统计", httpMethod = "GET", notes = "对应网站http分类显示") - public Map trafficWebsiteList(String beginDate,String endDate,Model model, HttpServletRequest request, HttpServletResponse response) { - + public Map trafficWebsiteList(@RequestParam String beginDate, @RequestParam String endDate, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - if(!StringUtils.isEmpty(beginDate)&&!StringUtils.isEmpty(endDate)) { + if (!StringUtils.isEmpty(beginDate) && !StringUtils.isEmpty(endDate)) { Date begin = DateUtils.parseDate(beginDate); Date end = DateUtils.parseDate(endDate); // 带查询时间查询所有 - List websiteChart = dashboardService.getWebsiteDetails(begin,end); - if (websiteChart!=null&&websiteChart.size() > 0) { - list = websiteChart; - } - }else { - // 不带时间默认top10 - List websiteChart = dashboardService.getWebsiteTop10(); - if (websiteChart!=null&&websiteChart.size() > 0) { + List websiteChart = dashboardService.getWebsiteDetails(begin, end); + if (websiteChart != null && websiteChart.size() > 0) { list = websiteChart; } } - + } catch (Exception e) { - auditLogThread.setExceptionInfo("网站流量分析统计数据检索失败:"+e.getMessage()); - logger.error("网站流量分析统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("网站流量分析统计数据检索失败:" + e.getMessage()); + logger.error("网站流量分析统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "网站流量分析统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -612,35 +658,73 @@ public class DashboardServiceController extends BaseRestController { "网站流量分析统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "网站流量分析统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "网站流量分析统计数据检索成功", list, + 0); } - @RequestMapping(value = "trafficWebTypeChart", method = RequestMethod.GET) - @ApiOperation(value = "HTTP网站分类分析统计", httpMethod = "GET", notes = "对应某个网站类型分类统计图") - public Map trafficWebTypeChart(String beginDate,String endDate,Integer websiteServiceId,Model model, HttpServletRequest request, HttpServletResponse response) { - + + @RequestMapping(value = "trafficWebsiteListNoTime", method = RequestMethod.GET) + @ApiOperation(value = "网站流量分析统计", httpMethod = "GET", notes = "对应网站http分类显示") + public Map trafficWebsiteListNoTime(Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - if(!StringUtils.isEmpty(beginDate)&&!StringUtils.isEmpty(endDate)) { + // 不带时间默认top10 + List websiteChart = dashboardService.getWebsiteTop10(); + if (websiteChart != null && websiteChart.size() > 0) { + list = websiteChart; + } + + } catch (Exception e) { + auditLogThread.setExceptionInfo("网站流量分析统计数据检索失败:" + e.getMessage()); + logger.error("网站流量分析统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "网站流量分析统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "网站流量分析统计数据检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "网站流量分析统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "网站流量分析统计数据检索成功", list, + 0); + } + + @RequestMapping(value = "trafficWebTypeChart", method = RequestMethod.GET) + @ApiOperation(value = "HTTP网站分类分析统计", httpMethod = "GET", notes = "对应某个网站类型分类统计图") + public Map trafficWebTypeChart(String beginDate, String endDate, Integer websiteServiceId, 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 { + if (!StringUtils.isEmpty(beginDate) && !StringUtils.isEmpty(endDate)) { Date begin = DateUtils.parseDate(beginDate); Date end = DateUtils.parseDate(endDate); // 带查询时间查询所有 - List websiteChart = dashboardService.getWebsiteDetailsById(websiteServiceId,begin,end); - if (websiteChart!=null&&websiteChart.size() > 0) { + List websiteChart = dashboardService.getWebsiteDetailsById(websiteServiceId, begin, end); + if (websiteChart != null && websiteChart.size() > 0) { list = websiteChart; } - }else { + } else { // 不带时间默认top10 - List websiteChart = dashboardService.getWebsiteTop10ById(websiteServiceId); - if (websiteChart!=null&&websiteChart.size() > 0) { + List websiteChart = dashboardService.getWebsiteDetailsById(websiteServiceId, null, null); + if (websiteChart != null && websiteChart.size() > 0) { list = websiteChart; } } - + } catch (Exception e) { - auditLogThread.setExceptionInfo("HTTP网站分类分析统计失败:"+e.getMessage()); - logger.error("HTTP网站分类分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("HTTP网站分类分析统计失败:" + e.getMessage()); + logger.error("HTTP网站分类分析统计失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "HTTP网站分类分析统计失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -652,34 +736,38 @@ public class DashboardServiceController extends BaseRestController { "HTTP网站分类分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站分类分析统计成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站分类分析统计成功", list, + 0); } + @RequestMapping(value = "trafficTopicAndDomainChart", method = RequestMethod.GET) @ApiOperation(value = "HTTP网站主题分类分析统计", httpMethod = "GET", notes = "对应某个网站主题类型分类统计图") - public Map trafficTopicAndDomainChart(String beginDate,String endDate,Model model, HttpServletRequest request, HttpServletResponse response) { - + public Map trafficTopicAndDomainChart(String beginDate, String endDate, Model model, + HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); - AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); List list = new ArrayList(); try { - if(!StringUtils.isEmpty(beginDate)&&!StringUtils.isEmpty(endDate)) { + if (!StringUtils.isEmpty(beginDate) && !StringUtils.isEmpty(endDate)) { Date begin = DateUtils.parseDate(beginDate); Date end = DateUtils.parseDate(endDate); // 带查询时间查询所有 - List websiteChart = dashboardService.getTopicDetails(begin,end); - if (websiteChart!=null&&websiteChart.size() > 0) { + List websiteChart = dashboardService.getTopicDetails(begin, end); + if (websiteChart != null && websiteChart.size() > 0) { list = websiteChart; } - }else { + } else { // 不带时间默认top10 List websiteChart = dashboardService.getTopicTop10(); - if (websiteChart!=null&&websiteChart.size() > 0) { + if (websiteChart != null && websiteChart.size() > 0) { list = websiteChart; } } } catch (Exception e) { - auditLogThread.setExceptionInfo("HTTP网站主题分类分析数据检索失败:"+e.getMessage()); - logger.error("HTTP网站主题分类分析数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + auditLogThread.setExceptionInfo("HTTP网站主题分类分析数据检索失败:" + e.getMessage()); + logger.error("HTTP网站主题分类分析数据检索失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "HTTP网站主题分类分析数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -691,6 +779,7 @@ public class DashboardServiceController extends BaseRestController { "HTTP网站主题分类分析数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站主题分类分析数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站主题分类分析数据检索成功", + list, 0); } } diff --git a/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java b/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java index 22bf67a..2bc2f64 100644 --- a/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java +++ b/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java @@ -1,5 +1,6 @@ package com.nis.web.controller.restful; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -16,6 +17,7 @@ import com.nis.domain.Page; import com.nis.domain.restful.NtcAttrTypeReport; import com.nis.domain.restful.NtcDestipCountryReport; import com.nis.domain.restful.NtcEntranceReport; +import com.nis.domain.restful.NtcIpRangeReport; import com.nis.domain.restful.NtcLwhhReport; import com.nis.domain.restful.NtcPzReport; import com.nis.domain.restful.NtcRadiusReport; @@ -36,25 +38,33 @@ import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.NtcReportService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; +import com.zdjizhi.utils.IPUtil; import com.zdjizhi.utils.StringUtil; /** * - *

Title: SingleDimensionReport

- *

Description: 单维度统计查询报表controller

- *

Company: IIE

+ *

+ * Title: SingleDimensionReport + *

+ *

+ * Description: 单维度统计查询报表controller + *

+ *

+ * Company: IIE + *

+ * * @author rkg - * @date 2018年7月24日 + * @date 2018年7月24日 * */ @RestController @RequestMapping("${servicePath}/log/v1") @Api(value = "SingleDimensionReport", description = "单维度统计查询报表controller") public class SingleDimensionReport extends BaseRestController { - + @Autowired protected ServicesRequestLogService servicesRequestLogService; - + @Autowired protected NtcReportService ntcReportService; @@ -63,16 +73,16 @@ public class SingleDimensionReport extends BaseRestController { public Map ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, - request, null); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); Page ntcPzReportPage = null; try { - resetReportTime(ntcPzReport,true); - //验证实时报表 + resetReportTime(ntcPzReport, true); + // 验证实时报表 ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcPzReport, NtcPzReport.class, page); - //验证serachCfgId - ntcReportService.checkNumericCondition(saveLogThread,start,ntcPzReport.getSearchCfgId(),"searchCfgId"); + // 验证serachCfgId + ntcReportService.checkNumericCondition(saveLogThread, start, ntcPzReport.getSearchCfgId(), "searchCfgId"); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcPzReport.class.getSimpleName(), page.getOrderBy()); @@ -80,11 +90,11 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - ntcPzReportPage = ntcReportService.findNtcPzReport(new Page(request, response, NtcPzReport.class), - ntcPzReport); + ntcPzReportPage = ntcReportService + .findNtcPzReport(new Page(request, response, NtcPzReport.class), ntcPzReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("配置日志总量统计失败:"+e.getMessage()); - logger.error("配置日志总量统计失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("配置日志总量统计失败:" + e.getMessage()); + logger.error("配置日志总量统计失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "配置日志总量统计失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -103,16 +113,17 @@ public class SingleDimensionReport extends BaseRestController { @RequestMapping(value = "/ntcServiceReport", method = RequestMethod.GET) @ApiOperation(value = "业务类型统计查询服务", httpMethod = "GET", notes = "业务类型统计查询服务,基于业务类型(service)维度聚合") - public Map ntcServiceReport(Page page, NtcServiceReport ntcServiceReport, Model model, HttpServletRequest request, - HttpServletResponse response) { + public Map ntcServiceReport(Page page, NtcServiceReport ntcServiceReport, Model model, + HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, - request, null); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); Page reportPage = null; try { - resetReportTime(ntcServiceReport,false); - ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcServiceReport, NtcServiceReport.class, page); + resetReportTime(ntcServiceReport, false); + ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcServiceReport, NtcServiceReport.class, + page); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcServiceReport.class.getSimpleName(), page.getOrderBy()); @@ -120,11 +131,11 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - reportPage = ntcReportService.findNtcServiceReport(new Page(request, response, NtcServiceReport.class), - ntcServiceReport); + reportPage = ntcReportService.findNtcServiceReport( + new Page(request, response, NtcServiceReport.class), ntcServiceReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("业务类型统计查询失败:"+e.getMessage()); - logger.error("业务类型统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("业务类型统计查询失败:" + e.getMessage()); + logger.error("业务类型统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "业务类型统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -137,26 +148,24 @@ public class SingleDimensionReport extends BaseRestController { } } - return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "业务类型统计查询成功", - reportPage, 0); + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "业务类型统计查询成功", reportPage, + 0); } - - @RequestMapping(value = "/ntcTagReport", method = RequestMethod.GET) @ApiOperation(value = "标签统计查询服务", httpMethod = "GET", notes = "标签统计查询服务,基于标签与业务类型(service)维度聚合") public Map ntcTagReport(Page page, NtcTagReport ntcTagReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, - request, null); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); Page reportPage = null; try { - resetReportTime(ntcTagReport,false); + resetReportTime(ntcTagReport, false); ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcTagReport, NtcTagReport.class, page); - //验证serachTag - ntcReportService.checkNumericCondition(saveLogThread,start,ntcTagReport.getSearchTag(),"searchTag"); + // 验证serachTag + ntcReportService.checkNumericCondition(saveLogThread, start, ntcTagReport.getSearchTag(), "searchTag"); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcTagReport.class.getSimpleName(), page.getOrderBy()); @@ -164,11 +173,11 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - reportPage = ntcReportService.findNtcTagReport(new Page(request, response, NtcTagReport.class), - ntcTagReport); + reportPage = ntcReportService + .findNtcTagReport(new Page(request, response, NtcTagReport.class), ntcTagReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("标签统计查询失败:"+e.getMessage()); - logger.error("标签统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("标签统计查询失败:" + e.getMessage()); + logger.error("标签统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "标签统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -181,23 +190,26 @@ public class SingleDimensionReport extends BaseRestController { } } - return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "标签统计查询成功", - reportPage, 0); + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "标签统计查询成功", reportPage, + 0); } + @RequestMapping(value = "/ntcAttrTypeReport", method = RequestMethod.GET) @ApiOperation(value = "性质统计查询服务", httpMethod = "GET", notes = "性质统计查询服务,基于性质与业务类型(service)维度聚合") - public Map ntcAttrTypeReport(Page page, NtcAttrTypeReport ntcAttrTypeReport, Model model, HttpServletRequest request, - HttpServletResponse response) { + public Map ntcAttrTypeReport(Page page, NtcAttrTypeReport ntcAttrTypeReport, Model model, + HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, - request, null); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); Page reportPage = null; try { - resetReportTime(ntcAttrTypeReport,false); - ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcAttrTypeReport, NtcAttrTypeReport.class, page); - //验证searchAttrType - ntcReportService.checkNumericCondition(saveLogThread,start,ntcAttrTypeReport.getSearchAttrType(),"searchAttrType"); + resetReportTime(ntcAttrTypeReport, false); + ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcAttrTypeReport, NtcAttrTypeReport.class, + page); + // 验证searchAttrType + ntcReportService.checkNumericCondition(saveLogThread, start, ntcAttrTypeReport.getSearchAttrType(), + "searchAttrType"); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcAttrTypeReport.class.getSimpleName(), page.getOrderBy()); @@ -205,11 +217,11 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - reportPage = ntcReportService.findNtcAttrTypeReport(new Page(request, response, NtcAttrTypeReport.class), - ntcAttrTypeReport); + reportPage = ntcReportService.findNtcAttrTypeReport( + new Page(request, response, NtcAttrTypeReport.class), ntcAttrTypeReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("性质统计查询失败:"+e.getMessage()); - logger.error("性质统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("性质统计查询失败:" + e.getMessage()); + logger.error("性质统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "性质统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -222,25 +234,25 @@ public class SingleDimensionReport extends BaseRestController { } } - return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "性质统计查询成功", - reportPage, 0); + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "性质统计查询成功", reportPage, + 0); } - + @RequestMapping(value = "/ntcLwhhReport", method = RequestMethod.GET) @ApiOperation(value = "来文函号统计查询服务", httpMethod = "GET", notes = "来文函号统计查询服务,基于来文函号与业务类型(service)维度聚合") public Map ntcLwhhReport(Page page, NtcLwhhReport ntcLwhhReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, - request, null); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); Page reportPage = null; try { - resetReportTime(ntcLwhhReport,false); - //验证实时报表 + resetReportTime(ntcLwhhReport, false); + // 验证实时报表 ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcLwhhReport, NtcLwhhReport.class, page); - //验证serachCfgId - ntcReportService.checkNumericCondition(saveLogThread,start,ntcLwhhReport.getSearchLwhh(),"searchLwhh"); + // 验证serachCfgId + ntcReportService.checkNumericCondition(saveLogThread, start, ntcLwhhReport.getSearchLwhh(), "searchLwhh"); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcLwhhReport.class.getSimpleName(), page.getOrderBy()); @@ -248,11 +260,11 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - reportPage = ntcReportService.findNtcLwhhReport(new Page(request, response, NtcLwhhReport.class), - ntcLwhhReport); + reportPage = ntcReportService + .findNtcLwhhReport(new Page(request, response, NtcLwhhReport.class), ntcLwhhReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("来文函号统计查询失败:"+e.getMessage()); - logger.error("来文函号统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("来文函号统计查询失败:" + e.getMessage()); + logger.error("来文函号统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "来文函号统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -265,23 +277,24 @@ public class SingleDimensionReport extends BaseRestController { } } - return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "来文函号统计查询成功", - reportPage, 0); + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "来文函号统计查询成功", reportPage, + 0); } - + @RequestMapping(value = "/ntcSrcipDomesticReport", method = RequestMethod.GET) @ApiOperation(value = "境内源IP统计查询服务", httpMethod = "GET", notes = "境内源IP统计查询服务,基于源IP所属省、市与业务类型(service)维度聚合") - public Map ntcSrcipDomesticReport(Page page, NtcSrcipDomesticReport ntcSrcipDomesticReport, Model model, HttpServletRequest request, - HttpServletResponse response) { + public Map ntcSrcipDomesticReport(Page page, NtcSrcipDomesticReport ntcSrcipDomesticReport, Model model, + HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, - request, null); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); Page reportPage = null; try { - resetReportTime(ntcSrcipDomesticReport,false); - //验证实时报表 - ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcSrcipDomesticReport, NtcSrcipDomesticReport.class, page); + resetReportTime(ntcSrcipDomesticReport, false); + // 验证实时报表 + ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcSrcipDomesticReport, + NtcSrcipDomesticReport.class, page); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcSrcipDomesticReport.class.getSimpleName(), page.getOrderBy()); @@ -289,11 +302,12 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - reportPage = ntcReportService.findNtcSrcipDomesticReport(new Page(request, response, NtcSrcipDomesticReport.class), + reportPage = ntcReportService.findNtcSrcipDomesticReport( + new Page(request, response, NtcSrcipDomesticReport.class), ntcSrcipDomesticReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("境内源IP统计查询失败:"+e.getMessage()); - logger.error("境内源IP统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("境内源IP统计查询失败:" + e.getMessage()); + logger.error("境内源IP统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "境内源IP统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -306,10 +320,10 @@ public class SingleDimensionReport extends BaseRestController { } } - return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "境内源IP统计查询成功", - reportPage, 0); + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "境内源IP统计查询成功", reportPage, + 0); } - + @RequestMapping(value = "/ntcDestipCountryReport", method = RequestMethod.GET) @ApiOperation(value = "各国家目的IP统计查询服务", httpMethod = "GET", notes = "各国家目的IP统计查询服务,基于目的IP所属国家与业务类型(service)维度聚合") public Map ntcDestipCountryReport(Page page, NtcDestipCountryReport ntcDestipCountryReport, Model model, @@ -320,7 +334,7 @@ public class SingleDimensionReport extends BaseRestController { Page reportPage = null; try { - resetReportTime(ntcDestipCountryReport,false); + resetReportTime(ntcDestipCountryReport, false); // 验证实时报表 ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcDestipCountryReport, NtcDestipCountryReport.class, page); @@ -335,8 +349,8 @@ public class SingleDimensionReport extends BaseRestController { new Page(request, response, NtcDestipCountryReport.class), ntcDestipCountryReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("各国家目的IP统计查询失败:"+e.getMessage()); - logger.error("各国家目的IP统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("各国家目的IP统计查询失败:" + e.getMessage()); + logger.error("各国家目的IP统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "各国家目的IP统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -363,7 +377,7 @@ public class SingleDimensionReport extends BaseRestController { Page reportPage = null; try { - resetReportTime(ntcEntranceReport,false); + resetReportTime(ntcEntranceReport, false); ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcEntranceReport, NtcEntranceReport.class, page); // 验证searchEntrance @@ -379,8 +393,8 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcEntranceReport( new Page(request, response, NtcEntranceReport.class), ntcEntranceReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("运营商局点统计查询失败:"+e.getMessage()); - logger.error("运营商局点统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("运营商局点统计查询失败:" + e.getMessage()); + logger.error("运营商局点统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "运营商局点统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -396,35 +410,19 @@ public class SingleDimensionReport extends BaseRestController { return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "运营商局点统计查询成功", reportPage, 0); } - - - - - - - - - - - - - - - @RequestMapping(value = "/ntcURLReport", method = RequestMethod.GET) @ApiOperation(value = "URL统计查询服务", httpMethod = "GET", notes = "URL统计查询服务") - public Map ntcURLReport(Page page, NtcURLReport urlReport, Model model, - HttpServletRequest request, HttpServletResponse response) { + public Map ntcURLReport(Page page, NtcURLReport urlReport, Model model, HttpServletRequest request, + HttpServletResponse response) { long start = System.currentTimeMillis(); AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; try { - resetReportTime(urlReport,false); - ntcReportService.queryReportConditionCheck(saveLogThread, start, urlReport, NtcURLReport.class, - page); + resetReportTime(urlReport, false); + ntcReportService.queryReportConditionCheck(saveLogThread, start, urlReport, NtcURLReport.class, page); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { orderBy = Page.getOrderBySql(NtcURLReport.class.getSimpleName(), page.getOrderBy()); @@ -432,11 +430,11 @@ public class SingleDimensionReport extends BaseRestController { orderBy = "report_time"; } page.setOrderBy(orderBy); - reportPage = ntcReportService.findNtcURLReport( - new Page(request, response, NtcURLReport.class), urlReport); + reportPage = ntcReportService + .findNtcURLReport(new Page(request, response, NtcURLReport.class), urlReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("URL统计查询失败:"+e.getMessage()); - logger.error("URL统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("URL统计查询失败:" + e.getMessage()); + logger.error("URL统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "URL统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -452,30 +450,22 @@ public class SingleDimensionReport extends BaseRestController { return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "URL统计查询成功", reportPage, 0); } - - - - - - - @RequestMapping(value = "/ntcRadiusReport", method = RequestMethod.GET) @ApiOperation(value = "用户行为统计查询服务", httpMethod = "GET", notes = "用户行为统计查询服务,基于用户名或接入IP维度聚合") - public Map ntcRadiusReport(NtcRadiusReport ntcRadiusReport, Model model, - HttpServletRequest request, HttpServletResponse response) { + public Map ntcRadiusReport(NtcRadiusReport ntcRadiusReport, Model model, HttpServletRequest request, + HttpServletResponse response) { long start = System.currentTimeMillis(); AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List dataList = null; try { - - + ntcReportService.checkNtcRadiusReportCondition(saveLogThread, start, ntcRadiusReport); - dataList= ntcReportService.findNtcRadiusReport(ntcRadiusReport); + dataList = ntcReportService.findNtcRadiusReport(ntcRadiusReport); } catch (Exception e) { - saveLogThread.setExceptionInfo("用户行为统计查询失败:"+e.getMessage()); - logger.error("用户行为统计查询失败:"+ExceptionUtil.getExceptionMsg(e)); + saveLogThread.setExceptionInfo("用户行为统计查询失败:" + e.getMessage()); + logger.error("用户行为统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "用户行为统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); @@ -491,39 +481,75 @@ public class SingleDimensionReport extends BaseRestController { return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "用户行为统计查询成功", dataList, 0); } - /** - * @Description: - * @author (zdx) - * @date 2018年7月12日 上午11:01:30 - * @param entity - * @throws Exception - */ - public void resetReportTime(NtcReportEntity entity,Boolean isTotal) throws Exception { - //日志总量统计查询全部 - if ("1".equals(entity.getSearchBusinessType())&&isTotal) { - return ; + + @RequestMapping(value = "/ntcIpRangeReport", method = RequestMethod.GET) + @ApiOperation(value = "ip范围段统计查询服务", httpMethod = "GET", notes = "ip范围段统计查询服务") + public Map ntcIpRangeReport(Page page, NtcIpRangeReport ntcIpRangeReport, Model model, + HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); + try { +// List list=new ArrayList<>(); +// ntcIpRangeReport.setIpStart("192.168.10.121"); +// ntcIpRangeReport.setIpEnd("192.168.10.122"); +// ntcIpRangeReport.setIpEndNum(3232238202l); +// ntcIpRangeReport.setIpStartNum(3232238201l); +// ntcIpRangeReport.setIpSub("255.255.255.252"); +// list.add(ntcIpRangeReport); + page.setList( ntcReportService.findNtcIpRangeReport(ntcIpRangeReport)); + } catch (Exception e) { + saveLogThread.setExceptionInfo("ip范围段统计查询失败:" + e.getMessage()); + logger.error("ip范围段统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start, + "ip范围段统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "ip范围段统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "ip范围段统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } - if (StringUtil.isEmpty(entity.getSearchReportStartTime())&&StringUtil.isEmpty(entity.getSearchReportEndTime())) { - String dateType = "minute"; //默认为分钟 - if (!isTotal){ + + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "ip范围段统计查询成功", page, 0); + } + + /** + * @Description: + * @author (zdx) + * @date 2018年7月12日 上午11:01:30 + * @param entity + * @throws Exception + */ + public void resetReportTime(NtcReportEntity entity, Boolean isTotal) throws Exception { + // 日志总量统计查询全部 + if ("1".equals(entity.getSearchBusinessType()) && isTotal) { + return; + } + if (StringUtil.isEmpty(entity.getSearchReportStartTime()) + && StringUtil.isEmpty(entity.getSearchReportEndTime())) { + String dateType = "minute"; // 默认为分钟 + if (!isTotal) { if (entity.getSearchBusinessType().equals("2")) { dateType = "hour"; - }else if (entity.getSearchBusinessType().equals("3")) { + } else if (entity.getSearchBusinessType().equals("3")) { dateType = "daily"; - }else if (entity.getSearchBusinessType().equals("4")) { + } else if (entity.getSearchBusinessType().equals("4")) { dateType = "month"; } - }else{ + } else { if (entity.getSearchBusinessType().equals("3")) { dateType = "hour"; - }else if (entity.getSearchBusinessType().equals("4")) { + } else if (entity.getSearchBusinessType().equals("4")) { dateType = "daily"; - }else if (entity.getSearchBusinessType().equals("5")) { + } else if (entity.getSearchBusinessType().equals("5")) { dateType = "month"; } } Map map = DateUtils.getLocalTime(entity.getSearchReportStartTime(), - entity.getSearchReportEndTime(), Constants.PZ_REPORT_TIME, dateType); + entity.getSearchReportEndTime(), Constants.PZ_REPORT_TIME, dateType); entity.setSearchReportStartTime(map.get("startTime")); entity.setSearchReportEndTime(map.get("endTime")); } diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.java b/src/main/java/com/nis/web/dao/NtcReportDao.java index 4d550cf..715f2f1 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.java +++ b/src/main/java/com/nis/web/dao/NtcReportDao.java @@ -5,6 +5,7 @@ import java.util.List; import com.nis.domain.restful.NtcAttrTypeReport; import com.nis.domain.restful.NtcDestipCountryReport; import com.nis.domain.restful.NtcEntranceReport; +import com.nis.domain.restful.NtcIpRangeReport; import com.nis.domain.restful.NtcIpURLReport; import com.nis.domain.restful.NtcLwhhReport; import com.nis.domain.restful.NtcPzReport; @@ -36,4 +37,7 @@ public interface NtcReportDao extends CrudDao { List findAccounList(NtcRadiusReport pz); List findNasIpList(NtcRadiusReport pz); List findNtcRadiusReport(NtcRadiusReport pz); + + + List findNtcIpRangeReport(NtcIpRangeReport pz); } diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.xml b/src/main/java/com/nis/web/dao/NtcReportDao.xml index a5394a3..6a4a080 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.xml +++ b/src/main/java/com/nis/web/dao/NtcReportDao.xml @@ -87,6 +87,19 @@ property="reportTime" /> + + + + + + + + + + SERVICE,SUM,REPORT_TIME @@ -835,4 +848,20 @@ ORDER BY REPORT_TIME ASC + + + \ 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 f6c39cd..8dacc0d 100644 --- a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml @@ -72,7 +72,7 @@ - + select web_id webId, + SUM(c2s_byte_len + s2c_byte_len) byteCount, + sum(c2s_pkt_num + s2c_pkt_num) pktCount, + link_num linkNum from traffic_http_statistic t where - = #{statTime} and stat_time< #{endTime} group by t.web_id ]]> + = #{statTime} and stat_time< #{endTime} group by t.web_id,link_num order by byteCount]]> @@ -96,23 +99,6 @@ FROM SELECT distinct id FROM ui_website_domain_topic where website_service_id= #{websiteId} - - - - - - - - - + diff --git a/src/main/java/com/nis/web/service/restful/DashboardService.java b/src/main/java/com/nis/web/service/restful/DashboardService.java index 421cd96..1c170ed 100644 --- a/src/main/java/com/nis/web/service/restful/DashboardService.java +++ b/src/main/java/com/nis/web/service/restful/DashboardService.java @@ -852,14 +852,12 @@ public class DashboardService extends BaseService { Set set = new HashSet<>(); Map> countAndViewMap = new HashMap<>();// 存储count和map的对应关系,后面根据count过滤,获取top10的count - List webIdAndCountList = trafficHttpStatisticDao.getTrafficHttpStatistic(beginDate, endDate);// 获取最近一小时的webid和count的关系 - List prevWebIdAndCountList = trafficHttpStatisticDao.getTrafficHttpStatistic(getBeforeByHourTime(2), + List webIdAndCountList = trafficHttpStatisticDao.getHttpStatisticNoLinkAndPkt(beginDate, endDate);// 获取最近一小时的webid和count的关系 + List prevWebIdAndCountList = trafficHttpStatisticDao.getHttpStatisticNoLinkAndPkt(getBeforeByHourTime(2), beginDate);// 获取最近一小时的webid和count的关系 for (String websiteServiceId : websiteIdAndIdMap.keySet()) {// 遍历上面获取的websiteServiceId和id的对应关系,拼接json Map viewMap = new HashMap<>(); long count = 0l;// 记录当前websiteServiceId所有的count - long linkNum = 0l;// - long packets = 0l;// long prevCount = 0l;// 记录当前websiteServiceId所有的count List idList = websiteIdAndIdMap.get(websiteServiceId);// 根据websiteServiceId获取对应的id for (String id : idList) { @@ -867,17 +865,9 @@ public class DashboardService extends BaseService { String webId = String.valueOf(webIdAndCountMap.get("webId")); if (webId != null && webId.equals(id)) {// 如果webid和id相等则获取count数据并统计 String countStr = String.valueOf(webIdAndCountMap.get("byteCount")); - String linkNumStr = String.valueOf(webIdAndCountMap.get("linkNum")); - String packetsStr = String.valueOf(webIdAndCountMap.get("pktCount")); if (countStr != null) { count += Long.parseLong(countStr);// 将count累加 } - if (linkNumStr != null) { - linkNum += Long.parseLong(linkNumStr);// 将count累加 - } - if (packetsStr != null) { - packets += Long.parseLong(packetsStr);// 将count累加 - } } } for (Map webIdAndCountMap : prevWebIdAndCountList) {// 遍历webid和count @@ -893,8 +883,6 @@ public class DashboardService extends BaseService { } viewMap.put("websiteServiceId", websiteServiceId); viewMap.put("count", count); - viewMap.put("linkNum", linkNum); - viewMap.put("packets", packets); viewMap.put("pktNum", 0); viewMap.put("byteLen", 0); viewMap.put("preCount", prevCount); From 474aa995fdbac2c3da6c37c95e1a89bbd2f5d8d6 Mon Sep 17 00:00:00 2001 From: renkaige Date: Mon, 17 Dec 2018 17:01:17 +0600 Subject: [PATCH 5/5] =?UTF-8?q?1:=E6=96=B0=E5=A2=9E=E4=B8=9A=E5=8A=A1=202:?= =?UTF-8?q?=E4=B8=BAurl=E5=92=8C=E5=85=B3=E9=94=AE=E5=AD=97=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E6=B7=BB=E5=8A=A0url=E5=92=8Cwebsite=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/domain/restful/NtcHttpLog.java | 18 +++++++- .../nis/domain/restful/NtcKeywordsUrlLog.java | 24 ++++++++++ .../com/nis/web/service/LogDataService.java | 2 +- .../applicationConfig-rule.properties | 45 +++++++++++-------- 4 files changed, 69 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/nis/domain/restful/NtcHttpLog.java b/src/main/java/com/nis/domain/restful/NtcHttpLog.java index db712a4..ee83508 100644 --- a/src/main/java/com/nis/domain/restful/NtcHttpLog.java +++ b/src/main/java/com/nis/domain/restful/NtcHttpLog.java @@ -1,5 +1,6 @@ package com.nis.domain.restful; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.nis.domain.LogEntity; import com.wordnik.swagger.annotations.ApiModelProperty; @@ -40,7 +41,8 @@ public class NtcHttpLog extends LogEntity { @ApiModelProperty(value="应答体转储文件KEY", required=true) protected String resBodyKey; - protected String searchUrl; //命中url + protected String searchUrl; //url查询条件 + protected String searchWebsite; //website查询条件 public String getUrl() { return url; } @@ -130,6 +132,8 @@ public class NtcHttpLog extends LogEntity { /** * @return the searchUrl */ + + @JsonIgnore public String getSearchUrl() { return searchUrl; } @@ -140,4 +144,16 @@ public class NtcHttpLog extends LogEntity { public void setSearchUrl(String searchUrl) { this.searchUrl = searchUrl; } + + @JsonIgnore + public String getSearchWebsite() { + return searchWebsite; + } + + public void setSearchWebsite(String searchWebsite) { + this.searchWebsite = searchWebsite; + } + + + } diff --git a/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java b/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java index 6631d65..18655df 100644 --- a/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java +++ b/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java @@ -1,5 +1,6 @@ package com.nis.domain.restful; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.nis.domain.LogEntity; public class NtcKeywordsUrlLog extends LogEntity { @@ -10,6 +11,8 @@ public class NtcKeywordsUrlLog extends LogEntity { private static final long serialVersionUID = 1L; private String url; private String website; + protected String searchUrl; // url查询条件 + protected String searchWebsite; // website查询条件 public String getUrl() { return url; @@ -27,4 +30,25 @@ public class NtcKeywordsUrlLog extends LogEntity { this.website = website; } + @JsonIgnore + public String getSearchUrl() { + return searchUrl; + } + + /** + * @param searchUrl the searchUrl to set + */ + public void setSearchUrl(String searchUrl) { + this.searchUrl = searchUrl; + } + + @JsonIgnore + public String getSearchWebsite() { + return searchWebsite; + } + + public void setSearchWebsite(String searchWebsite) { + this.searchWebsite = searchWebsite; + } + } diff --git a/src/main/java/com/nis/web/service/LogDataService.java b/src/main/java/com/nis/web/service/LogDataService.java index 5dfc99a..9382370 100644 --- a/src/main/java/com/nis/web/service/LogDataService.java +++ b/src/main/java/com/nis/web/service/LogDataService.java @@ -228,7 +228,7 @@ public class LogDataService { String type = filedsType.get(key).trim(); if (type.equals("java.lang.String")) { String field = filedAndColumnMap.get(key).toLowerCase(); - if (field.equals("url")) { + if (field.equals("url")||field.equals("website")) { whereSB.append(" and " + field + " like '" + value.toString().trim() + "%'"); } else { whereSB.append(" and " + field + "='" diff --git a/src/main/resources/applicationConfig-rule.properties b/src/main/resources/applicationConfig-rule.properties index b885a52..bd059af 100644 --- a/src/main/resources/applicationConfig-rule.properties +++ b/src/main/resources/applicationConfig-rule.properties @@ -20,7 +20,7 @@ ##回流 0x60 96 loop ##白名单 0x80 128 whitelist -service=1:128;2:128;5:96;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;27:16;30:16;31:16;32:16;33:16;34:16;35:16;36:16;37:16;38:16;39:16;40:16;66:128;128:1;129:1;130:1;131:1;132:1;133:1;134:1;135:1;136:1;137:1;138:1;139:1;140:1;142:1;143:1;144:1;145:1;146:1;147:1;148:1;149:1;150:1;151:1;152:1;256:128;257:128;258:16;259:16;260:16;267:16;271:16;272:16;273:16;384:1;385:1;386:1;387:1;388:1;395:1;399:1;512:1;513:1;514:64;515:64;517:80;521:128;528:48;544:2;560:80;576:16;592:1;624:128;625:48;750:128;1024:1;1025:1;1026:1;1027:1;1028:1;1029:1;1030:1;1040:32;1041:32;1042:32;1056:64;1057:64;1058:64;1059:64;1060:64;1152:1 +service=1:128;2:128;5:96;6:1;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;27:16;30:16;31:16;32:16;33:16;34:16;35:16;36:16;37:16;38:16;39:16;40:16;66:128;128:1;129:1;130:1;131:1;132:1;133:1;134:1;135:1;136:1;137:1;138:1;139:1;140:1;142:1;143:1;144:1;145:1;146:1;147:1;148:1;149:1;150:1;151:1;152:1;256:128;257:128;258:16;259:16;260:16;267:16;271:16;272:16;273:16;384:1;385:1;386:1;387:1;388:1;395:1;399:1;512:1;513:1;514:64;515:64;517:80;518:48;521:128;528:48;544:2;560:80;576:16;592:1;624:128;625:48;750:128;1024:1;1025:1;1026:1;1027:1;1028:1;1029:1;1030:1;1040:32;1041:32;1042:32;1056:64;1057:64;1058:64;1059:64;1060:64;1152:1 #0x1E 0x8E 有问题:14:NTC_XMPP_REGION,NTC_XMPP_CONT 无表结构 不确定表是不是字符串类 @@ -30,6 +30,9 @@ service=1:128;2:128;5:96;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;2 2=10:WHITE_LIST_COMPILE;11:WHITE_LIST_GROUP;14:WHITE_LIST_DOMAIN,WHITE_LIST_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x05 DDOS流量丢弃 5=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_DDOS_PROTECT_TARGET_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE +#0x05 DDOS流量检测 +6=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_DDOS_PROTECT_TARGET_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE + #0x10 IP地址阻断 16=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x11 HTTP阻断 @@ -167,35 +170,37 @@ service=1:128;2:128;5:96;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;2 399=10:MM_COMPILE;11:MM_GROUP;14:MM_SUBSCRIBE_ID;16:MM_FILE_DIGEST;18:NTC_IP_RANGE #0x200 PXY拦截IP -512=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +512=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x201 PXY拦截域名 -513=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +513=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;14:PXY_INTERCEPT_DOMAIN,PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x202 PXY限速IP -514=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +514=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x203 PXY限速域名 -515=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +515=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;14:PXY_INTERCEPT_DOMAIN,PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x205 基于PXY IP替换 -517=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_PKT_BIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +517=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_PKT_BIN,PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE +#0x206 基于PXY IP地址仿冒 +518=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x209 PXY拦截白名单 -521=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +521=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_DOMAIN,PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x210 PXY HTTP重定向 -528=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CRTL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE +528=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE #0x220 PXY HTTP转发 -544=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CRTL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE +544=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE #0x230 PXY HTTP替换 -560=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_HTTP_RES_BODY,PXY_CRTL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE +560=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_HTTP_RES_BODY,PXY_CTRL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE #0x240 PXY HTTP阻断 -576=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_HTTP_RES_BODY,PXY_CRTL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE +576=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_HTTP_RES_BODY,PXY_CTRL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE #0x250 PXY HTTP监测 -592=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_HTTP_RES_BODY,PXY_CRTL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE +592=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_HTTP_REQ_BODY,PXY_CTRL_HTTP_RES_BODY,PXY_CTRL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR,PXY_CTRL_HTTP_RES_HDR;18:NTC_IP_RANGE #0x270 PXY 缓存策略白名单 -624=10:PXY_CACHE_COMPILE;11:PXY_CACHE_GROUP;14:PXY_CACHE_HTTP_URL,PXY_CACHE_HTTP_COOKIE,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +624=10:PXY_CACHE_COMPILE;11:PXY_CACHE_GROUP;14:PXY_CACHE_HTTP_URL,PXY_CACHE_HTTP_COOKIE,PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x271 PXY 缓存策略重定向 -625=10:PXY_CACHE_COMPILE;11:PXY_CACHE_GROUP;14:PXY_CACHE_HTTP_URL,PXY_CACHE_HTTP_COOKIE,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE +625=10:PXY_CACHE_COMPILE;11:PXY_CACHE_GROUP;14:PXY_CACHE_HTTP_URL,PXY_CACHE_HTTP_COOKIE,PXY_CTRL_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x2EE PXY 白名单 -750=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CRTL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR;18:NTC_IP_RANGE +750=10:PXY_CTRL_COMPILE;11:PXY_CTRL_GROUP;12:PXY_CTRL_IP;14:PXY_CTRL_HTTP_URL,PXY_CTRL_SUBSCRIBE_ID;15:PXY_CTRL_HTTP_REQ_HDR;18:NTC_IP_RANGE #0x300 IP复用策略配置 #768=10:IR_POLICY_COMPILE;11:IR_POLICY_GROUP;12:IR_POLICY_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE @@ -238,7 +243,7 @@ service=1:128;2:128;5:96;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;2 1152=10:APP_COMPILE;11:APP_GROUP;14:APP_TOPIC_DOMAIN,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE #格式:业务类型1:动作;业务类型2:动作 ( 用于验证回调类service与action对应关系 -unMaatService=3:32;4:96;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:16;266:16;268:16;269:16;270:16;274:16;389:1;390:1;391:1;392:1;393:1;394:1;396:1;397:1;398:1;520;608;640;641;834:96;835:80;836:80 +unMaatService=3:32;4:96;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:16;266:16;268:16;269:16;270:16;274:16;389:1;390:1;391:1;392:1;393:1;394:1;396:1;397:1;398:1;520;608;640;641;642;834:96;835:80;836:80 #0x03 IP地址丢弃 3=0:INLINE_IP_CB #0x04 IP地址回流 @@ -308,6 +313,10 @@ unMaatService=3:32;4:96;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:16;266 640=0:PXY_OBJ_TRUSTED_CA_CERT #0x281 PXY证书吊销列表 641=0:PXY_OBJ_TRUSTED_CA_CRL +#0x282 PXY 仿冒地址池 +642=0:PXY_OBJ_SPOOFING_IP_POOL + + #0x342 IP复用静态地址池 834=0:IR_STATIC_NOMINEE_IP @@ -333,7 +342,7 @@ unMaatService=3:32;4:96;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:16;266 #0x402 APP DOMAIN特征发现 1026:2,5; #0x404 APP IP特征 1028:2,5; ########## -serviceDBIndex=1:2,4,5;2:2,4,5;5:2,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4,5;515:4,2,5;517:4,5;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;624:4;625:4;640:4;641:4;750:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2,5;1041:2;1042:2;1056:2,5;1152:2;3:5;4:5;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;834:6;835:6;836:6 +serviceDBIndex=1:2,4,5;2:2,4,5;5:2,5;6:2,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4,5;515:4,2,5;517:4,5;518:4,5;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;624:4;625:4;640:4;641:4;642:4;750:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2,5;1041:2;1042:2;1056:2,5;1152:2;3:5;4:5;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;834:6;835:6;836:6 ##阀门配置在redisdb的序号 tapRedisDb=5 @@ -349,7 +358,7 @@ tapRedisDb=5 #0x205 基于PXY IP替换 517 #0x402 APP DOMAIN特征发现 1026 #0x404 APP IP特征 1028 -maat2Valve=1:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;2:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID +maat2Valve=1:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;2:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;518:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID;6:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID ##记录哪些service可以被分组复用(只有maat类配置可以被分组复用) #业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名