From 9f8fb675843a4a219759e93531e99340f8c29b1f Mon Sep 17 00:00:00 2001 From: renkaige Date: Mon, 17 Dec 2018 22:48:15 +0600 Subject: [PATCH] =?UTF-8?q?1:=E6=9B=B4=E6=96=B0642=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E7=BB=93=E6=9E=84,=E5=8F=8A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0opTime=E5=AD=97=E6=AE=B5=202:=E4=B8=BA0x401=20=20APP?= =?UTF-8?q?=E8=BD=BD=E8=8D=B7=E7=89=B9=E5=BE=81=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=95=B0=E5=80=BC=E7=B1=BB=E8=A1=A8APP=5FTCP=5FSESSION=5FBYTE?= =?UTF-8?q?=203:=E6=9B=B4=E6=96=B0urlreport=E6=8E=A5=E5=8F=A3=204:?= =?UTF-8?q?=E6=9B=B4=E6=96=B0asnreport=E6=8E=A5=E5=8F=A3=205:=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0iprange=E7=BB=9F=E8=AE=A1=E5=85=A5=E5=BA=93=206:?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E5=85=A5=E5=BA=93=E6=97=B6?= =?UTF-8?q?,=E5=85=88=E6=89=93=E5=8D=B0=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=9C=A8=E5=9B=9E=E6=BB=9A=E4=BA=8B=E5=8A=A1=207:?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E5=85=A5=E5=BA=93=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E7=9A=84=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF=208:?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=80=9A=E8=81=94=E5=85=B3=E7=B3=BBapp=5Flab?= =?UTF-8?q?el=E7=9A=84=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E4=B8=BAvarchar?= =?UTF-8?q?=209:=E6=8F=90=E4=BA=A4=E6=B4=AA=E5=BA=86=E5=8F=91=E6=9D=A5?= =?UTF-8?q?=E7=9A=84trafficIpActiveStatisticDao.xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/domain/restful/NtcAsnRecord.java | 22 +- .../nis/domain/restful/NtcConnRecordLog.java | 8 +- .../nis/domain/restful/NtcIpRangeReport.java | 15 +- .../nis/domain/restful/NtcIpURLReport.java | 46 -- ...{NtcURLReport.java => NtcURLIpReport.java} | 35 +- src/main/java/com/nis/util/Constants.java | 4 + .../restful/ConfigSourcesController.java | 159 ++++--- .../restful/NtcLogSearchController.java | 30 +- .../restful/SingleDimensionReport.java | 10 +- .../java/com/nis/web/dao/DfLogSearchDao.xml | 2 +- .../java/com/nis/web/dao/NtcReportDao.java | 23 +- .../java/com/nis/web/dao/NtcReportDao.xml | 42 +- .../dashboard/TrafficIpActiveStatisticDao.xml | 2 +- .../nis/web/dao/impl/LocalLogJDBCByDruid.java | 8 +- .../com/nis/web/service/LogDataService.java | 73 ++- .../restful/ConfigJedisServiceimpl.java | 16 +- .../web/service/restful/NtcReportService.java | 35 +- .../java/com/nis/web/task/GetIpRangeTask.java | 118 +++-- .../com/nis/web/task/GetIpRangeTask2.java | 423 ------------------ .../applicationConfig-rule.properties | 2 +- .../applicationConfig-parser.xml | 3 +- .../maatXml/applicationConfig-maatRedis.xml | 2 +- src/main/resources/nis.properties | 8 +- 23 files changed, 392 insertions(+), 694 deletions(-) delete mode 100644 src/main/java/com/nis/domain/restful/NtcIpURLReport.java rename src/main/java/com/nis/domain/restful/{NtcURLReport.java => NtcURLIpReport.java} (51%) delete mode 100644 src/main/java/com/nis/web/task/GetIpRangeTask2.java diff --git a/src/main/java/com/nis/domain/restful/NtcAsnRecord.java b/src/main/java/com/nis/domain/restful/NtcAsnRecord.java index 3850f65..3cb29d3 100644 --- a/src/main/java/com/nis/domain/restful/NtcAsnRecord.java +++ b/src/main/java/com/nis/domain/restful/NtcAsnRecord.java @@ -20,11 +20,12 @@ public class NtcAsnRecord implements Serializable { private static final long serialVersionUID = 1L; private String bps; private String pps; - private String sAsn; - private String dAsn; + private String asn; private String searchFoundStartTime;// 开始发现时间 private String searchFoundEndTime;// 结束发现时间 + private String searchAsnType;// 1是d_asn,2是s_asn + public String getBps() { return bps; } @@ -41,20 +42,21 @@ public class NtcAsnRecord implements Serializable { this.pps = pps; } - public String getsAsn() { - return sAsn; + public String getAsn() { + return asn; } - public void setsAsn(String sAsn) { - this.sAsn = sAsn; + public void setAsn(String asn) { + this.asn = asn; } - public String getdAsn() { - return dAsn; + @JsonIgnore + public String getSearchAsnType() { + return searchAsnType; } - public void setdAsn(String dAsn) { - this.dAsn = dAsn; + public void setSearchAsnType(String searchAsnType) { + this.searchAsnType = searchAsnType; } @JsonIgnore diff --git a/src/main/java/com/nis/domain/restful/NtcConnRecordLog.java b/src/main/java/com/nis/domain/restful/NtcConnRecordLog.java index eadac05..56935a5 100644 --- a/src/main/java/com/nis/domain/restful/NtcConnRecordLog.java +++ b/src/main/java/com/nis/domain/restful/NtcConnRecordLog.java @@ -17,9 +17,9 @@ public class NtcConnRecordLog extends LogEntity { /** * */ - private static final long serialVersionUID = 1L; + private static final Long serialVersionUID = 1L; @ApiModelProperty(value = "", required = true) - protected Long appLabel; + protected String appLabel; @ApiModelProperty(value = "", required = true) protected String c2sPktNum; @ApiModelProperty(value = "", required = true) @@ -29,11 +29,11 @@ public class NtcConnRecordLog extends LogEntity { @ApiModelProperty(value = "", required = true) protected String s2cByteNum; - public Long getAppLabel() { + public String getAppLabel() { return appLabel; } - public void setAppLabel(Long appLabel) { + public void setAppLabel(String appLabel) { this.appLabel = appLabel; } diff --git a/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java b/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java index 48842a4..8f4ad3a 100644 --- a/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java +++ b/src/main/java/com/nis/domain/restful/NtcIpRangeReport.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.Maps; import com.nis.domain.Page; -public class NtcIpRangeReport implements Serializable { +public class NtcIpRangeReport implements Serializable { /** * @@ -24,11 +24,11 @@ public class NtcIpRangeReport implements Serializable { private Long ipEndNum; private String ipSub; private String country; + + private Integer areaType; private String searchType; private String searchCountry; - - public String getIpStart() { return ipStart; } @@ -77,6 +77,14 @@ public class NtcIpRangeReport implements Serializable { this.country = country; } + public Integer getAreaType() { + return areaType; + } + + public void setAreaType(Integer areaType) { + this.areaType = areaType; + } + @JsonIgnore public String getSearchType() { return searchType; @@ -95,5 +103,4 @@ public class NtcIpRangeReport implements Serializable { this.searchCountry = searchCountry; } - } diff --git a/src/main/java/com/nis/domain/restful/NtcIpURLReport.java b/src/main/java/com/nis/domain/restful/NtcIpURLReport.java deleted file mode 100644 index 9a25a48..0000000 --- a/src/main/java/com/nis/domain/restful/NtcIpURLReport.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.nis.domain.restful; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.wordnik.swagger.annotations.ApiModelProperty; - -public class NtcIpURLReport implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "日志数量", required = true) - private Long sum; - @ApiModelProperty(value = "ip地址", required = true) - private String ipAddr; - @ApiModelProperty(value = "url", required = true) - private String url; - - public Long getSum() { - return sum; - } - - public void setSum(Long sum) { - this.sum = sum; - } - - public String getIpAddr() { - return ipAddr; - } - - public void setIpAddr(String ipAddr) { - this.ipAddr = ipAddr; - } - - @JsonIgnore - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - -} diff --git a/src/main/java/com/nis/domain/restful/NtcURLReport.java b/src/main/java/com/nis/domain/restful/NtcURLIpReport.java similarity index 51% rename from src/main/java/com/nis/domain/restful/NtcURLReport.java rename to src/main/java/com/nis/domain/restful/NtcURLIpReport.java index 38d2fc4..5d31aa0 100644 --- a/src/main/java/com/nis/domain/restful/NtcURLReport.java +++ b/src/main/java/com/nis/domain/restful/NtcURLIpReport.java @@ -1,11 +1,9 @@ package com.nis.domain.restful; -import java.util.List; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.wordnik.swagger.annotations.ApiModelProperty; -public class NtcURLReport extends NtcReportEntity { +public class NtcURLIpReport extends NtcReportEntity { /** * @@ -13,14 +11,13 @@ public class NtcURLReport extends NtcReportEntity { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "url", required = true) private String url; - @ApiModelProperty(value = "日志数量", required = true) - private Long urlCount; - @ApiModelProperty(value = "ip数量列表", required = true) - private List dataList; - - - private String searchUrl; + @ApiModelProperty(value = "唯一ip的数量", required = true) + private Long ipCount; + @ApiModelProperty(value = "连接数量", required = true) + private Long connCount; + private String searchUrl; + public String getUrl() { return url; } @@ -29,20 +26,20 @@ public class NtcURLReport extends NtcReportEntity { this.url = url; } - public Long getUrlCount() { - return urlCount; + public Long getIpCount() { + return ipCount; } - public void setUrlCount(Long urlCount) { - this.urlCount = urlCount; + public void setIpCount(Long ipCount) { + this.ipCount = ipCount; } - public List getDataList() { - return dataList; + public Long getConnCount() { + return connCount; } - public void setDataList(List dataList) { - this.dataList = dataList; + public void setConnCount(Long connCount) { + this.connCount = connCount; } @JsonIgnore public String getSearchUrl() { @@ -52,7 +49,5 @@ public class NtcURLReport extends NtcReportEntity { public void setSearchUrl(String searchUrl) { this.searchUrl = searchUrl; } - - } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 7489828..a29f6eb 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -207,6 +207,10 @@ public final class Constants { * 样例文件存放目录 */ public static final String MM_SAMPLE_DST_PATH = Configurations.getStringProperty("mmSampleDstPath", "/home/mesasoft/{tableType}/full/{fileName}"); + /** + * ip定位库 + */ + public static final String IPLOCATIONLIBRARYPATH = Configurations.getStringProperty("ipLocationLibraryPath", "/usr/local/ipLocalLibraay/Kazakhstan.mmdb"); /** *是否使用Minio */ diff --git a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java index ad5c56c..113117a 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java @@ -98,17 +98,19 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("Maat 规则存储异常:" + e.getMessage()); - logger.error("Maat 规则存储异常:" + e.getMessage()); + thread.setExceptionInfo("Maat 规则存储异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("Maat 规则存储异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "Maat 规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + "Maat 规则存储异常:" + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "Maat 规则存储异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + "Maat 规则存储异常:" + ExceptionUtil.getExceptionMsg(e), + ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "Maat 规则存储异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "Maat 规则存储异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { @@ -152,17 +154,21 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + e.getMessage()); - logger.error("MAAT规则状态更新时出现异常:" + e.getMessage()); + + thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("MAAT规则状态更新时出现异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "MAAT规则状态更新时出现异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + "MAAT规则状态更新时出现异常:" + ExceptionUtil.getExceptionMsg(e), + ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "MAAT规则状态更新时出现异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + "MAAT规则状态更新时出现异常:" + ExceptionUtil.getExceptionMsg(e), + ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "MAAT规则状态更新时出现异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "MAAT规则状态更新时出现异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { deblocking(requestId); @@ -213,17 +219,18 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("回调规则存储异常:" + e.getMessage()); - logger.error("回调规则存储异常:" + e.getMessage()); + thread.setExceptionInfo("回调规则存储异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("回调规则存储异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, "回调规则存储异常:" + e.getMessage(), - ((RestServiceException) e).getErrorCode()); + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "回调规则存储异常:" + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, "回调规则存储异常:" + e.getMessage(), - ((ServiceRuntimeException) e).getErrorCode()); + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "回调规则存储异常:" + ExceptionUtil.getExceptionMsg(e), ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "回调规则存储异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "回调规则存储异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { deblocking(requestId); @@ -247,17 +254,18 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("回调规则内容更新异常:" + e.getMessage()); - logger.error("回调规则内容更新异常:" + e.getMessage()); + thread.setExceptionInfo("回调规则内容更新异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("回调规则内容更新异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "回调规则内容更新异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + "回调规则内容更新异常:" + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "回调规则内容更新异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + "回调规则内容更新异常:" + ExceptionUtil.getExceptionMsg(e), ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "回调规则内容更新异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "回调规则内容更新异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { deblocking(requestId); @@ -282,17 +290,18 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("回调规则状态更新异常:" + e.getMessage()); - logger.error("回调规则状态更新异常:" + e.getMessage()); + thread.setExceptionInfo("回调规则状态更新异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("回调规则状态更新异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "回调规则状态更新异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + "回调规则状态更新异常:" + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "回调规则状态更新异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + "回调规则状态更新异常:" + ExceptionUtil.getExceptionMsg(e), ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "回调规则状态更新异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "回调规则状态更新异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { deblocking(requestId); @@ -344,24 +353,25 @@ public class ConfigSourcesController extends BaseRestController { } } catch (IOException e) { // TODO Auto-generated catch block - logger.error(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage()); - thread.setExceptionInfo(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage()); + logger.error(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e)); + thread.setExceptionInfo( + RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e)); throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage(), + RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e), RestBusinessCode.FileUploadFailure.getValue()); } catch (Exception e) { // TODO: handle exception - logger.error("文件上传异常:" + e.getMessage()); - thread.setExceptionInfo("文件上传异常:" + e.getMessage()); + logger.error("文件上传异常:" + ExceptionUtil.getExceptionMsg(e)); + thread.setExceptionInfo("文件上传异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, e.getMessage(), - ((RestServiceException) e).getErrorCode()); + throw new RestServiceException(thread, System.currentTimeMillis() - start, + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, e.getMessage(), - ((ServiceRuntimeException) e).getErrorCode()); + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + ExceptionUtil.getExceptionMsg(e), ((ServiceRuntimeException) e).getErrorCode()); } else { - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, e.getMessage(), - RestBusinessCode.FileUploadFailure.getValue()); + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + ExceptionUtil.getExceptionMsg(e), RestBusinessCode.FileUploadFailure.getValue()); } } @@ -415,24 +425,26 @@ public class ConfigSourcesController extends BaseRestController { } } catch (IOException e) { // TODO Auto-generated catch block - logger.error(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage()); - thread.setExceptionInfo(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage()); + logger.error(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e)); + thread.setExceptionInfo( + RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e)); throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage(), + RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e), RestBusinessCode.FileUploadFailure.getValue()); } catch (Exception e) { // TODO: handle exception - logger.error(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage()); - thread.setExceptionInfo(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + e.getMessage()); + logger.error(RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e)); + thread.setExceptionInfo( + RestBusinessCode.FileUploadFailure.getErrorReason() + ":" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, e.getMessage(), - ((RestServiceException) e).getErrorCode()); + throw new RestServiceException(thread, System.currentTimeMillis() - start, + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, e.getMessage(), - ((ServiceRuntimeException) e).getErrorCode()); + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + ExceptionUtil.getExceptionMsg(e), ((ServiceRuntimeException) e).getErrorCode()); } else { - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, e.getMessage(), - RestBusinessCode.FileUploadFailure.getValue()); + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + ExceptionUtil.getExceptionMsg(e), RestBusinessCode.FileUploadFailure.getValue()); } } try { @@ -449,10 +461,12 @@ public class ConfigSourcesController extends BaseRestController { } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); - logger.error(RestBusinessCode.GetFileDigestFailure.getValue() + ":" + e.getMessage() + ",请检查摘要获取工具是否安装成功"); - thread.setExceptionInfo("摘要获取过程中出现异常:" + e.getMessage() + ",请检查摘要获取工具是否安装成功"); - throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - RestBusinessCode.GetFileDigestFailure.getErrorReason() + ":" + e.getMessage() + ",请检查摘要获取工具是否安装成功", + logger.error(RestBusinessCode.GetFileDigestFailure.getValue() + ":" + ExceptionUtil.getExceptionMsg(e) + + ",请检查摘要获取工具是否安装成功"); + thread.setExceptionInfo("摘要获取过程中出现异常:" + ExceptionUtil.getExceptionMsg(e) + ",请检查摘要获取工具是否安装成功"); + throw new ServiceRuntimeException( + thread, System.currentTimeMillis() - start, RestBusinessCode.GetFileDigestFailure.getErrorReason() + + ":" + ExceptionUtil.getExceptionMsg(e) + ",请检查摘要获取工具是否安装成功", RestBusinessCode.GetFileDigestFailure.getValue()); } return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "摘要获取成功", resultObject); @@ -485,17 +499,20 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("Maat 分组复用规则存储异常:" + e.getMessage()); - logger.error("Maat 分组复用规则存储异常:" + e.getMessage()); + thread.setExceptionInfo("Maat 分组复用规则存储异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("Maat 分组复用规则存储异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "Maat 分组复用规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + "Maat 分组复用规则存储异常:" + ExceptionUtil.getExceptionMsg(e), + ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "Maat 分组复用规则存储异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + "Maat 分组复用规则存储异常:" + ExceptionUtil.getExceptionMsg(e), + ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "Maat 分组复用规则存储异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "Maat 分组复用规则存储异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { @@ -535,17 +552,20 @@ public class ConfigSourcesController extends BaseRestController { } } catch (Exception e) { // TODO: handle exception - thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + e.getMessage()); - logger.error("删除MAAT规则分组复用域配置时出现异常:" + e.getMessage()); + thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("删除MAAT规则分组复用域配置时出现异常:" + ExceptionUtil.getExceptionMsg(e)); if (e instanceof RestServiceException) { throw new RestServiceException(thread, System.currentTimeMillis() - start, - "删除MAAT规则分组复用域配置时出现异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + "删除MAAT规则分组复用域配置时出现异常:" + ExceptionUtil.getExceptionMsg(e), + ((RestServiceException) e).getErrorCode()); } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "删除MAAT规则分组复用域配置时出现异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + "删除MAAT规则分组复用域配置时出现异常:" + ExceptionUtil.getExceptionMsg(e), + ((ServiceRuntimeException) e).getErrorCode()); } else { throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, - "删除MAAT规则分组复用域配置时出现异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + "删除MAAT规则分组复用域配置时出现异常:" + ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); } } finally { deblocking(requestId); @@ -563,18 +583,17 @@ public class ConfigSourcesController extends BaseRestController { long start = System.currentTimeMillis(); AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, compileId); - Map map=null; + Map map = null; try { - map=configRedisService.getAllKVByCompileId(compileId); + map = configRedisService.getAllKVByCompileId(compileId); } catch (Exception e) { - thread.setExceptionInfo("根据配置id获取对应的编译,组,域等信息时出现异常:" + e.getMessage()); - logger.error("根据配置id获取对应的编译,组,域等信息时出现异常:" +ExceptionUtil.getExceptionMsg(e)); - throw new RestServiceException("根据配置id获取对应的编译,组,域等信息失败", - RestBusinessCode.ConfigSourceIsNull.getValue()); + thread.setExceptionInfo("根据配置id获取对应的编译,组,域等信息时出现异常:" + ExceptionUtil.getExceptionMsg(e)); + logger.error("根据配置id获取对应的编译,组,域等信息时出现异常:" + ExceptionUtil.getExceptionMsg(e)); + throw new RestServiceException("根据配置id获取对应的编译,组,域等信息失败", RestBusinessCode.ConfigSourceIsNull.getValue()); } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, - "根据配置id获取对应的编译,组,域等信息成功", map); + "根据配置id获取对应的编译,组,域等信息成功", map); } private void validateGroupReuseSource(AuditLogThread thread, long start, GroupReuseSource groupReuseSource) { diff --git a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java index f95ea29..5a8a2dc 100644 --- a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java @@ -734,10 +734,8 @@ public class NtcLogSearchController extends BaseRestController { if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundEndTime())) { sdf.setLenient(false); sdf.parse(ntcConnRecordPercent.getSearchFoundEndTime()); - } else { - throw new RestServiceException("searchFoundEndTime参数不能为空", - RestBusinessCode.param_formate_error.getValue()); } + } catch (ParseException e) { throw new RestServiceException("searchFoundEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); @@ -750,10 +748,7 @@ public class NtcLogSearchController extends BaseRestController { if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundStartTime())) { sdf.setLenient(false); sdf.parse(ntcConnRecordPercent.getSearchFoundStartTime()); - } else { - throw new RestServiceException("searchFoundStartTime参数不能为空", - RestBusinessCode.param_formate_error.getValue()); - } + } } catch (ParseException e) { throw new RestServiceException("searchFoundStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); @@ -801,10 +796,8 @@ public class NtcLogSearchController extends BaseRestController { if (!StringUtil.isBlank(ntcAsnRecord.getSearchFoundEndTime())) { sdf.setLenient(false); sdf.parse(ntcAsnRecord.getSearchFoundEndTime()); - } else { - throw new RestServiceException("searchFoundEndTime参数不能为空", - RestBusinessCode.param_formate_error.getValue()); } + } catch (ParseException e) { throw new RestServiceException("searchFoundEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); @@ -817,10 +810,8 @@ public class NtcLogSearchController extends BaseRestController { if (!StringUtil.isBlank(ntcAsnRecord.getSearchFoundStartTime())) { sdf.setLenient(false); sdf.parse(ntcAsnRecord.getSearchFoundStartTime()); - } else { - throw new RestServiceException("searchFoundStartTime参数不能为空", - RestBusinessCode.param_formate_error.getValue()); } + } catch (ParseException e) { throw new RestServiceException("searchFoundStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); @@ -828,6 +819,19 @@ public class NtcLogSearchController extends BaseRestController { throw new RestServiceException("searchFoundStartTime参数错误", RestBusinessCode.param_formate_error.getValue()); } + try { + if (!StringUtil.isBlank(ntcAsnRecord.getSearchAsnType())) { + Integer.parseInt(ntcAsnRecord.getSearchAsnType()); + }else { + throw new RestServiceException("searchAsnType参数不能为空", + RestBusinessCode.param_formate_error.getValue()); + } + } catch (NumberFormatException e) { + throw new RestServiceException("searchAsnType参数格式错误"+e.getMessage(), RestBusinessCode.param_formate_error.getValue()); + } catch (Exception e) { + throw new RestServiceException("searchAsnType参数错误"+e.getMessage(), RestBusinessCode.param_formate_error.getValue()); + } + logDataService.getNtcAsnRecord(page, ntcAsnRecord); } catch (Exception e) { auditLogThread.setExceptionInfo("ASN通联关系(源,目的)日志检索失败:" + e.getMessage()); 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 2bc2f64..451bba1 100644 --- a/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java +++ b/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java @@ -25,7 +25,7 @@ import com.nis.domain.restful.NtcReportEntity; import com.nis.domain.restful.NtcServiceReport; import com.nis.domain.restful.NtcSrcipDomesticReport; import com.nis.domain.restful.NtcTagReport; -import com.nis.domain.restful.NtcURLReport; +import com.nis.domain.restful.NtcURLIpReport; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; import com.nis.restful.ServiceRuntimeException; @@ -413,7 +413,7 @@ public class SingleDimensionReport extends BaseRestController { @RequestMapping(value = "/ntcURLReport", method = RequestMethod.GET) @ApiOperation(value = "URL统计查询服务", httpMethod = "GET", notes = "URL统计查询服务") - public Map ntcURLReport(Page page, NtcURLReport urlReport, Model model, HttpServletRequest request, + public Map ntcURLReport(Page page, NtcURLIpReport urlReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, @@ -422,16 +422,16 @@ public class SingleDimensionReport extends BaseRestController { Page reportPage = null; try { resetReportTime(urlReport, false); - ntcReportService.queryReportConditionCheck(saveLogThread, start, urlReport, NtcURLReport.class, page); + ntcReportService.queryReportConditionCheck(saveLogThread, start, urlReport, NtcURLIpReport.class, page); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { - orderBy = Page.getOrderBySql(NtcURLReport.class.getSimpleName(), page.getOrderBy()); + orderBy = Page.getOrderBySql(NtcURLIpReport.class.getSimpleName(), page.getOrderBy()); } else { orderBy = "report_time"; } page.setOrderBy(orderBy); reportPage = ntcReportService - .findNtcURLReport(new Page(request, response, NtcURLReport.class), urlReport); + .findNtcURLReport(new Page(request, response, NtcURLIpReport.class), urlReport); } catch (Exception e) { saveLogThread.setExceptionInfo("URL统计查询失败:" + e.getMessage()); logger.error("URL统计查询失败:" + ExceptionUtil.getExceptionMsg(e)); diff --git a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml index ac37fdc..2f4314e 100644 --- a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml +++ b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml @@ -1517,7 +1517,7 @@ - + diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.java b/src/main/java/com/nis/web/dao/NtcReportDao.java index 715f2f1..62c2cd0 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.java +++ b/src/main/java/com/nis/web/dao/NtcReportDao.java @@ -6,14 +6,13 @@ 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; import com.nis.domain.restful.NtcRadiusReport; import com.nis.domain.restful.NtcServiceReport; import com.nis.domain.restful.NtcSrcipDomesticReport; import com.nis.domain.restful.NtcTagReport; -import com.nis.domain.restful.NtcURLReport; +import com.nis.domain.restful.NtcURLIpReport; /** * @@ -26,18 +25,32 @@ import com.nis.domain.restful.NtcURLReport; @MyBatisDao public interface NtcReportDao extends CrudDao { List findNtcPzReport(NtcPzReport pz); + List findNtcServiceReport(NtcServiceReport pz); + List findNtcTagReport(NtcTagReport pz); + List findNtcAttrTypeReport(NtcAttrTypeReport pz); + List findNtcLwhhReport(NtcLwhhReport pz); + List findNtcSrcipDomesticReport(NtcSrcipDomesticReport pz); + List findNtcDestipCountryReport(NtcDestipCountryReport pz); + List findNtcEntranceReport(NtcEntranceReport pz); - List findNtcIpURLReport(NtcURLReport pz); + + List findNtcIpURLReport(NtcURLIpReport pz); + List findAccounList(NtcRadiusReport pz); + List findNasIpList(NtcRadiusReport pz); + List findNtcRadiusReport(NtcRadiusReport pz); - - + List findNtcIpRangeReport(NtcIpRangeReport pz); + + void insertNtcIpRangeBatch(List list); + + void truncateNtcIpRange(); } diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.xml b/src/main/java/com/nis/web/dao/NtcReportDao.xml index 6a4a080..01e053b 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.xml +++ b/src/main/java/com/nis/web/dao/NtcReportDao.xml @@ -71,11 +71,12 @@ property="reportTime" /> - + - - + + + + + + INSERT INTO traffic_ip_identify + (ip_start,ip_end,ip_start_num,ip_end_num,ip_sub,area_type,country) + VALUES + + (#{ipRange.ipStart}, #{ipRange.ipEnd}, + #{ipRange.ipStartNum}, #{ipRange.ipEndNum}, + #{ipRange.ipSub}, #{ipRange.areaType}, + #{ipRange.country}) + + + + + truncate table traffic_ip_identify + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml index 3146156..73c1be4 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml @@ -50,7 +50,7 @@