diff --git a/src/main/java/com/nis/web/controller/BaseRestController.java b/src/main/java/com/nis/web/controller/BaseRestController.java index 0e136c5..53d0889 100644 --- a/src/main/java/com/nis/web/controller/BaseRestController.java +++ b/src/main/java/com/nis/web/controller/BaseRestController.java @@ -326,27 +326,23 @@ public class BaseRestController { if (need != opAction) { switch (need) { case Constants.OPACTION_POST: - throw new RestServiceException(thread, time, - "操作行为错误,您使用的是POST请求,POST请求对应的opAction为" + Constants.OPACTION_POST + ",您请求中的opAction为" + opAction + throw new RestServiceException("操作行为错误,您使用的是POST请求,POST请求对应的opAction为" + Constants.OPACTION_POST + ",您请求中的opAction为" + opAction + ",对应的请求方式为" + convertOpAction(opAction) + "!", RestBusinessCode.op_action_error.getValue()); case Constants.OPACTION_PUT: - throw new RestServiceException(thread, time, - "操作行为错误,您使用的是PUT请求,PUT请求对应的opAction为" + Constants.OPACTION_PUT + ",您请求中的opAction为" + opAction + throw new RestServiceException("操作行为错误,您使用的是PUT请求,PUT请求对应的opAction为" + Constants.OPACTION_PUT + ",您请求中的opAction为" + opAction + ",对应的请求方式为" + convertOpAction(opAction) + "!", RestBusinessCode.op_action_error.getValue()); case Constants.OPACTION_DELETE: - throw new RestServiceException(thread, time, - "操作行为错误,您使用的是DELETE请求,DELETE请求对应的opAction为" + Constants.OPACTION_DELETE + ",您请求中的opAction为" + throw new RestServiceException("操作行为错误,您使用的是DELETE请求,DELETE请求对应的opAction为" + Constants.OPACTION_DELETE + ",您请求中的opAction为" + opAction + ",对应的请求方式为" + convertOpAction(opAction) + "!", RestBusinessCode.op_action_error.getValue()); case Constants.OPACTION_GET: - throw new RestServiceException(thread, time, - "操作行为错误,您使用的是GET请求,GET请求对应的opAction为" + Constants.OPACTION_GET + ",您请求中的opAction为" + opAction + throw new RestServiceException("操作行为错误,您使用的是GET请求,GET请求对应的opAction为" + Constants.OPACTION_GET + ",您请求中的opAction为" + opAction + ",对应的请求方式为" + convertOpAction(opAction) + "!", RestBusinessCode.op_action_error.getValue()); default: - throw new RestServiceException(thread, time, "操作行为错误,未找到属性opAction对应业务!", + throw new RestServiceException("操作行为错误,未找到属性opAction对应业务!", RestBusinessCode.op_action_error.getValue()); } } 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 a897499..3a8f1e3 100644 --- a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.nis.restful.RestBusinessCode; +import com.nis.restful.RestServiceException; import com.nis.restful.ServiceRuntimeException; import com.nis.util.Constants; import com.nis.util.ExceptionUtil; @@ -57,11 +58,19 @@ public class DashboardServiceController extends BaseRestController { list = resultList; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("业务总量汇聚实时统计数据检索失败"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "业务总量汇聚实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -88,11 +97,18 @@ public class DashboardServiceController extends BaseRestController { list = resultList; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("动作趋势分析统计数据检索失败"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "动作趋势分析统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -118,11 +134,18 @@ public class DashboardServiceController extends BaseRestController { list = resultList; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("带宽实时统计数据检索失败"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "带宽实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -148,11 +171,18 @@ public class DashboardServiceController extends BaseRestController { list = resultList; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("带宽实时统计数据检索失败"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "带宽实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -173,11 +203,18 @@ public class DashboardServiceController extends BaseRestController { } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + auditLogThread.setExceptionInfo("活跃端口实时统计数据检索失败:"+e.getMessage()); logger.error("活跃端口实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "活跃端口实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -199,11 +236,18 @@ public class DashboardServiceController extends BaseRestController { list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + auditLogThread.setExceptionInfo("协议统计图表数据检索失败:"+e.getMessage()); logger.error("协议统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "协议统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); @@ -224,13 +268,20 @@ public class DashboardServiceController extends BaseRestController { list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("协议统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "协议统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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, "协议统计图表数据检索成功", + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计占比与报表检索成功", list, 0); } @@ -251,11 +302,18 @@ public class DashboardServiceController extends BaseRestController { list = ipActiveChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + auditLogThread.setExceptionInfo("活跃IP实时统计数据检索失败:"+e.getMessage()); logger.error("活跃IP实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "活跃IP实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP实时统计数据检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP实时统计数据检索成功",list, 0); } @@ -275,11 +333,18 @@ public class DashboardServiceController extends BaseRestController { list = ipActiveChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("活跃IP统计一个小时的活跃IP"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP统计一个小时的活跃IP检索成功",list, 0); } @@ -299,11 +364,18 @@ public class DashboardServiceController extends BaseRestController { list = ipActiveChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("活跃IP最近一个小时的变化趋势统计"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP最近一个小时的变化趋势统计成功",list, 0); } @@ -323,11 +395,18 @@ public class DashboardServiceController extends BaseRestController { list = appChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("App流量分析统计:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "App流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App流量统计数据检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App流量统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App流量统计数据检索成功",list, 0); } @@ -347,11 +426,18 @@ public class DashboardServiceController extends BaseRestController { list = (java.util.List) JsonMapper.fromJsonList(jsonString,HashMap.class); } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + auditLogThread.setExceptionInfo("App统计图表数据检索失败:"+e.getMessage()); logger.error("App统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "App统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "App统计图表数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App统计图表数据检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App统计图表数据检索成功", list, 0); @@ -368,11 +454,18 @@ public class DashboardServiceController extends BaseRestController { list = osChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("操作系统流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "操作系统流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -389,11 +482,18 @@ public class DashboardServiceController extends BaseRestController { list=osChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("操作系统下浏览器流量分析统计失败:"+e); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "操作系统下浏览器流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -409,11 +509,18 @@ public class DashboardServiceController extends BaseRestController { list = bsChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("浏览器流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "浏览器流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -430,11 +537,18 @@ public class DashboardServiceController extends BaseRestController { list = bsChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("浏览器下操作系统流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "浏览器下操作系统流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -452,11 +566,18 @@ public class DashboardServiceController extends BaseRestController { list = websiteChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("网站流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "网站流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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); } @@ -473,11 +594,18 @@ public class DashboardServiceController extends BaseRestController { list = websiteChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("HTTP网站分类分析统计失败:"+e); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "HTTP网站分类分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "HTTP网站分类分析统计失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "HTTP网站分类分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站分类分析统计成功",list, 0); } @@ -494,11 +622,18 @@ public class DashboardServiceController extends BaseRestController { list = websiteChart; } } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("HTTP网站主题分类分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); - throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "HTTP网站分类分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "HTTP网站主题分类分析数据检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "HTTP网站主题分类分析数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站主题分类分析数据检索成功",list, 0); } diff --git a/src/main/java/com/nis/web/controller/restful/LogController.java b/src/main/java/com/nis/web/controller/restful/LogController.java index 5e6ee9b..6296be7 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -67,14 +67,17 @@ public class LogController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, dkBehaviorLog, DkBehaviorLog.class, page); logDataService.getData(page, dkBehaviorLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "行为识别日志检索失败:" + 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, "行为识别日志检索成功", page, 0); @@ -93,14 +96,17 @@ public class LogController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, pxyHttpLog, PxyHttpLog.class, page); logDataService.getData(page, pxyHttpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("PXY HTTP日志检索失败:"+e.getMessage()); + logger.error("PXY HTTP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "PXY HTTP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "PXY HTTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "PXY HTTP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "PXY HTTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PXY HTTP日志检索成功", page, diff --git a/src/main/java/com/nis/web/controller/restful/MmLogSearchController.java b/src/main/java/com/nis/web/controller/restful/MmLogSearchController.java index 4f20975..909a8af 100644 --- a/src/main/java/com/nis/web/controller/restful/MmLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/MmLogSearchController.java @@ -74,14 +74,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmAvIpLog, MmAvIpLog.class, page); logDataService.getData(page, mmAvIpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "音视频IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "音视频IP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "音视频IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频IP日志检索成功", page, 0); @@ -100,14 +103,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmAvUrlLog, MmAvUrlLog.class, page); logDataService.getData(page, mmAvUrlLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("音视频URL日志检索失败:"+e.getMessage()); + logger.error("音视频URL日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "音视频URL日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "音视频URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "音视频URL日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "音视频URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频URL日志检索成功", page, 0); @@ -126,14 +132,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmPicIpLog, MmPicIpLog.class, page); logDataService.getData(page, mmPicIpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "图片IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "图片IP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "图片IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片IP日志检索成功", page, 0); @@ -152,14 +161,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmPicUrlLog, MmPicUrlLog.class, page); logDataService.getData(page, mmPicUrlLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("图片URL日志检索失败:"+e.getMessage()); + logger.error("图片URL日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "图片URL日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "图片URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "图片URL日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "图片URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片URL日志检索成功", page, 0); @@ -180,14 +192,17 @@ public class MmLogSearchController extends BaseRestController { logDataService.getData(page, mmVoipIpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("VoIP IP日志检索失败:"+e.getMessage()); + logger.error("VoIP IP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "VoIP IP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "VoIP IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "VoIP IP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VoIP IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIP IP日志检索成功", page, @@ -235,14 +250,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmSampleAudioLog, MmSampleAudioLog.class, page); logDataService.getData(page, mmSampleAudioLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "音频样例日志检索失败:" + 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, "音频样例日志检索成功", page, 0); @@ -261,14 +279,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmSampleVideoLog, MmSampleVideoLog.class, page); logDataService.getData(page, mmSampleVideoLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "视频样例日志检索失败:" + 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, "视频样例日志检索成功", page, 0); @@ -288,14 +309,17 @@ public class MmLogSearchController extends BaseRestController { page); logDataService.getData(page, mmPornAudioLevelLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "音频色情日志检索失败:" + 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, "音频色情日志检索成功", page, 0); @@ -315,15 +339,19 @@ public class MmLogSearchController extends BaseRestController { page); logDataService.getData(page, mmPornVideoLevelLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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()); - }else{ - throw ((RestServiceException) e); } + } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "视频色情日志检索成功", page, 0); } @@ -341,14 +369,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmSamplePicLog, MmSamplePicLog.class, page); logDataService.getData(page, mmSamplePicLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "图片样例日志检索失败:" + 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, "图片样例日志检索成功", page, 0); @@ -367,14 +398,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmSampleVoipLog, MmSampleVoipLog.class, page); logDataService.getData(page, mmSampleVoipLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("VOIP样例日志检索失败:"+e.getMessage()); + logger.error("VOIP样例日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "VOIP样例日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "VOIP样例日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "VOIP样例日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VOIP样例日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VOIP样例日志检索成功", page, 0); @@ -394,14 +428,17 @@ public class MmLogSearchController extends BaseRestController { MmSpeakerRecognizationLog.class, page); logDataService.getData(page, mmSpeakerRecognizationLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "说话人识别日志检索失败:" + 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, "说话人识别日志检索成功", page, 0); @@ -421,14 +458,17 @@ public class MmLogSearchController extends BaseRestController { page); logDataService.getData(page, mmLogoDetectionLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "台标识别日志检索失败:" + 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, "台标识别日志检索成功", page, 0); @@ -448,14 +488,17 @@ public class MmLogSearchController extends BaseRestController { MmFaceRecognizationLog.class, page); logDataService.getData(page, mmFaceRecognizationLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "人脸识别日志检索失败:" + 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, "人脸识别日志检索成功", page, 0); @@ -474,14 +517,17 @@ public class MmLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, mmFileDigestLog, MmFileDigestLog.class, page); logDataService.getData(page, mmFileDigestLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "文件摘要日志检索失败:" + 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, "文件摘要日志检索成功", page, 0); diff --git a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java index cc3d9ca..fedf948 100644 --- a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java +++ b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java @@ -58,7 +58,7 @@ public class NmsInfoController extends BaseRestController { thread.setContent("NMS系统上报服务器数量为"+trafficNmsServerStatisticList.getTrafficNmsServerList().size()); trafficNmsServerStatisticService.saveNmsInfo(trafficNmsServerStatisticList.getTrafficNmsServerList()); } else { - throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数trafficNmsServerList不能为空", + throw new RestServiceException("参数trafficNmsServerList不能为空", RestBusinessCode.missing_args.getValue()); } @@ -91,7 +91,7 @@ public class NmsInfoController extends BaseRestController { thread.setContent("NMS系统上报的di信息数量为"+nmsDiRuleList.getNmsDiRuleList().size()); nmsDiRuleService.saveNmsDiRuleInfo(nmsDiRuleList.getNmsDiRuleList()); } else { - throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数nmsDiRuleList不能为空", + throw new RestServiceException("参数nmsDiRuleList不能为空", RestBusinessCode.missing_args.getValue()); } } catch (Exception e) { @@ -123,8 +123,7 @@ public class NmsInfoController extends BaseRestController { trafficNetflowPortInfoService .saveTrafficNetflowPortInfo(trafficNetflowPortInfoList.getTrafficNetflowPortInfoList()); } else { - throw new RestServiceException(thread, System.currentTimeMillis() - start, - "参数trafficNetflowPortInfoList不能为空", RestBusinessCode.missing_args.getValue()); + throw new RestServiceException("参数trafficNetflowPortInfoList不能为空", RestBusinessCode.missing_args.getValue()); } } catch (Exception e) { 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 9f88245..635ec4e 100644 --- a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java @@ -78,14 +78,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcIpLog, NtcIpLog.class, page); logDataService.getData(page, ntcIpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "IP地址日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "IP地址日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "IP地址日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -105,18 +108,18 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcHttpLog, NtcHttpLog.class, page); logDataService.getData(page, ntcHttpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "Http日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "Http日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Http日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } - - } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Http日志检索成功", page, 0); @@ -135,14 +138,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcDnsLog, NtcDnsLog.class, page); logDataService.getData(page, ntcDnsLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("Dns日志检索失败:"+e.getMessage()); + logger.error("Dns日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "Dns日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "Dns日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "Dns日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Dns日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -161,18 +167,21 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcMailLog, NtcMailLog.class, page); logDataService.getData(page, ntcMailLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("EMAIL日志检索失败:"+e.getMessage()); + logger.error("EMAIL日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "EMAIL日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "Mail日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "EMAIL日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "EMAIL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "日志检索成功", page, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "EMAIL日志检索成功", page, 0); } @RequestMapping(value = "/ntcSslLogs", method = RequestMethod.GET) @@ -188,14 +197,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcSslLog, NtcSslLog.class, page); logDataService.getData(page, ntcSslLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("SSL日志检索失败:"+e.getMessage()); + logger.error("SSL日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "SSL日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "SSL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "SSL日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "SSL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -215,14 +227,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcPptpLog, NtcPptpLog.class, page); logDataService.getData(page, ntcPptpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("PPTP日志检索失败:"+e.getMessage()); + logger.error("PPTP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "PPTP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "PPTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "PPTP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "PPTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -242,14 +257,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcL2tpLog, NtcL2tpLog.class, page); logDataService.getData(page, ntcL2tpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("L2TP日志检索失败:"+e.getMessage()); + logger.error("L2TP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "L2TP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "L2TP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "L2TP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "L2TP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -269,14 +287,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcOpenvpnLog, NtcOpenvpnLog.class, page); logDataService.getData(page, ntcOpenvpnLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("Openvpn日志检索失败:"+e.getMessage()); + logger.error("Openvpn日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "Openvpn日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "Openvpn日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "Openvpn日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Openvpn日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -297,14 +318,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcIpsecLog, NtcIpsecLog.class, page); logDataService.getData(page, ntcIpsecLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("IPSEC日志检索失败:"+e.getMessage()); + logger.error("IPSEC日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "IPSEC日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "IPSEC日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "IPSEC日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "IPSEC日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -324,14 +348,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcSshLog, NtcSshLog.class, page); logDataService.getData(page, ntcSshLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("SSH日志检索失败:"+e.getMessage()); + logger.error("SSH日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "SSH日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "SSH日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "SSH日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "SSH日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } @@ -353,14 +380,17 @@ public class NtcLogSearchController extends BaseRestController { logDataService.getData(page, ntcFtpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("FTP日志检索失败:"+e.getMessage()); + logger.error("FTP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "FTP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "FTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "FTP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "FTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功", page, 0); @@ -378,14 +408,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcAppLog, NtcAppLog.class, page); logDataService.getData(page, ntcAppLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "App日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "App日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App日志检索成功", page, 0); @@ -404,14 +437,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcDdosLog, NtcDdosLog.class, page); logDataService.getData(page, ntcDdosLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("DDos日志检索失败:"+e.getMessage()); + logger.error("DDos日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "DDos日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "DDos日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "DDos日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "DDos日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功", page, 0); @@ -431,14 +467,17 @@ public class NtcLogSearchController extends BaseRestController { logDataService.getData(page, ntcP2pLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("P2P日志检索失败:"+e.getMessage()); + logger.error("P2P日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "P2P日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "P2P日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "P2P日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "P2P日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "P2P日志检索成功", page, 0); @@ -458,14 +497,17 @@ public class NtcLogSearchController extends BaseRestController { logDataService.getData(page, ntcBgpLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("BGP日志检索失败:"+e.getMessage()); + logger.error("BGP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "BGP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "BGP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "BGP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "BGP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "BGP日志检索成功", page, 0); @@ -484,14 +526,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcVoipLog, NtcVoipLog.class, page); logDataService.getData(page, ntcVoipLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("NTC VoIP日志检索失败:"+e.getMessage()); + logger.error("NTC VoIP日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "NTC VoIP日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "NTC VoIP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "NTC VoIP日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "NTC VoIP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC VoIP日志检索成功", page, @@ -512,14 +557,17 @@ public class NtcLogSearchController extends BaseRestController { page); logDataService.getData(page, ntcStreamMediaLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + 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(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "流媒体协议日志检索失败:" + 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, "流媒体协议日志检索成功", page, 0); @@ -538,14 +586,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start, ntcKeywordsUrlLog, NtcKeywordsUrlLog.class, page); logDataService.getData(page, ntcKeywordsUrlLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("NTC关键字转URL日志检索失败:"+e.getMessage()); + logger.error("NTC关键字转URL日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "NTC关键字转URL日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "NTC关键字转URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "NTC关键字转URL日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "NTC关键字转URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC关键字转URL日志检索成功", page, @@ -572,14 +623,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.collectConditionCheck(auditLogThread, start,ntcCollectVoipLog, NtcCollectVoipLog.class, page); logDataService.getData(page, ntcCollectVoipLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("VoIp泛收日志检索失败:"+e.getMessage()); + logger.error("VoIp泛收日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "VoIp泛收日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "VoIp泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "VoIp泛收日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VoIp泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIp泛收日志检索成功", page, @@ -606,14 +660,17 @@ public class NtcLogSearchController extends BaseRestController { ntcLogService.queryConditionCheck(auditLogThread, start,ntcCollectRadiusLog, NtcCollectRadiusLog.class, page); logDataService.getData(page, ntcCollectRadiusLog); } catch (Exception e) { - e.printStackTrace(); - auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { + auditLogThread.setExceptionInfo("RADIUS泛收日志检索失败:"+e.getMessage()); + logger.error("RADIUS泛收日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "RADIUS泛收日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, - "RADIUS泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); + "RADIUS泛收日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "RADIUS泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "RADIUS泛收日志检索成功", page, 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 e8cece9..2ce9afb 100644 --- a/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java +++ b/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java @@ -28,6 +28,7 @@ import com.nis.restful.RestServiceException; import com.nis.restful.ServiceRuntimeException; import com.nis.util.Constants; import com.nis.util.DateUtils; +import com.nis.util.ExceptionUtil; import com.nis.web.controller.BaseRestController; import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; @@ -81,14 +82,17 @@ public class SingleDimensionReport extends BaseRestController { ntcPzReportPage = ntcReportService.findNtcPzReport(new Page(request, response, NtcPzReport.class), ntcPzReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "配置日志总量统计失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "配置日志总量统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } @@ -118,14 +122,17 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcServiceReport(new Page(request, response, NtcServiceReport.class), ntcServiceReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "业务类型统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "业务类型统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } @@ -159,14 +166,17 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcTagReport(new Page(request, response, NtcTagReport.class), ntcTagReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "标签统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "标签统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } @@ -197,14 +207,17 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcAttrTypeReport(new Page(request, response, NtcAttrTypeReport.class), ntcAttrTypeReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "性质统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "性质统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } @@ -237,14 +250,17 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcLwhhReport(new Page(request, response, NtcLwhhReport.class), ntcLwhhReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "来文函号统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "来文函号统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } @@ -275,14 +291,17 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcSrcipDomesticReport(new Page(request, response, NtcSrcipDomesticReport.class), ntcSrcipDomesticReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); - }else{ - throw ((RestServiceException) e); } } @@ -315,14 +334,17 @@ public class SingleDimensionReport extends BaseRestController { new Page(request, response, NtcDestipCountryReport.class), ntcDestipCountryReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); - }else{ - throw ((RestServiceException) e); } } @@ -356,14 +378,17 @@ public class SingleDimensionReport extends BaseRestController { reportPage = ntcReportService.findNtcEntranceReport( new Page(request, response, NtcEntranceReport.class), ntcEntranceReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "运营商局点统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "运营商局点统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } @@ -385,14 +410,17 @@ public class SingleDimensionReport extends BaseRestController { ntcReportService.checkNtcRadiusReportCondition(saveLogThread, start, ntcRadiusReport); dataList= ntcReportService.findNtcRadiusReport(ntcRadiusReport); } catch (Exception e) { - saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - e.printStackTrace(); - logger.error(e.getMessage()); - if (!(e instanceof RestServiceException)) { + 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()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "用户行为统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, "用户行为统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); - }else{ - throw ((RestServiceException) e); } } diff --git a/src/main/java/com/nis/web/service/BaseLogService.java b/src/main/java/com/nis/web/service/BaseLogService.java index 81a9ea3..fe112cf 100644 --- a/src/main/java/com/nis/web/service/BaseLogService.java +++ b/src/main/java/com/nis/web/service/BaseLogService.java @@ -7,6 +7,8 @@ import com.nis.domain.restful.NtcRadiusReport; import com.nis.domain.restful.NtcReportEntity; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; +import com.nis.restful.ServiceRuntimeException; +import com.nis.util.ExceptionUtil; import com.nis.util.elasticsearch.ElasticsearchSqlDao; import com.zdjizhi.utils.StringUtil; import org.apache.ibatis.mapping.ResultMap; @@ -98,8 +100,7 @@ public abstract class BaseLogService { } if (!StringUtil.isBlank(notExistColumn)) { notExistColumn = notExistColumn.substring(1); - throw new RestServiceException(thread, System.currentTimeMillis() - start, - "fields中" + notExistColumn + "的字段不存在!", RestBusinessCode.param_formate_error.getValue()); + throw new RestServiceException("fields中" + notExistColumn + "的字段不存在!", RestBusinessCode.param_formate_error.getValue()); } } if (orderByColoumn != null) { @@ -117,8 +118,7 @@ public abstract class BaseLogService { } if (!StringUtil.isBlank(notExistColumn)) { notExistColumn = notExistColumn.substring(1); - throw new RestServiceException(thread, System.currentTimeMillis() - start, - "orderBy中" + notExistColumn + "的字段不存在!", RestBusinessCode.param_formate_error.getValue()); + throw new RestServiceException("orderBy中" + notExistColumn + "的字段不存在!", RestBusinessCode.param_formate_error.getValue()); } } @@ -141,14 +141,10 @@ public abstract class BaseLogService { Long.parseLong(entity.getSearchCfgId()); } } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchCfgId参数格式错误", + throw new RestServiceException("searchCfgId参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchCfgId参数错误"); + throw new RestServiceException("searchCfgId参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -156,14 +152,10 @@ public abstract class BaseLogService { Integer.parseInt(entity.getSearchDirection()); } } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "getSearchDirection参数格式错误", + throw new RestServiceException("getSearchDirection参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "getSearchDirection参数错误"); + throw new RestServiceException("getSearchDirection参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -171,14 +163,10 @@ public abstract class BaseLogService { Long.parseLong(entity.getSearchEntranceId()); } } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchEntranceId参数格式错误", + throw new RestServiceException("searchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchEntranceId参数错误"); + throw new RestServiceException("searchEntranceId参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -187,14 +175,10 @@ public abstract class BaseLogService { sdf.parse(entity.getSearchFoundEndTime()); } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundEndTime参数格式错误", + throw new RestServiceException("searchFoundEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundEndTime参数格式格式"); + throw new RestServiceException("searchFoundEndTime参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -203,14 +187,10 @@ public abstract class BaseLogService { sdf.parse(entity.getSearchFoundStartTime()); } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundStartTime参数格式错误", + throw new RestServiceException("searchFoundStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundStartTime参数错误"); + throw new RestServiceException("searchFoundStartTime参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -218,24 +198,17 @@ public abstract class BaseLogService { Integer.parseInt(entity.getSearchService()); } } catch (NumberFormatException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数格式错误", + throw new RestServiceException("searchService参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误"); + throw new RestServiceException("searchService参数错误",RestBusinessCode.param_formate_error.getValue()); } try { checkCloumnIsExist(thread, start, clazz, page); } catch (RestServiceException e) { - logger.error(e); throw e; } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误"); + throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e),RestBusinessCode.service_runtime_error.getValue()); } logger.info("请求参数校验结束----" + System.currentTimeMillis()); @@ -257,14 +230,10 @@ public abstract class BaseLogService { sdf.parse(entity.getSearchFoundEndTime()); } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundEndTime参数格式错误", + throw new RestServiceException("searchFoundEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundEndTime参数格式格式"); + throw new RestServiceException("searchFoundEndTime参数格式格式",RestBusinessCode.param_formate_error.getValue()); } try { @@ -273,25 +242,18 @@ public abstract class BaseLogService { sdf.parse(entity.getSearchFoundStartTime()); } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundStartTime参数格式错误", + throw new RestServiceException("searchFoundStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundStartTime参数错误"); + throw new RestServiceException("searchFoundStartTime参数错误",RestBusinessCode.param_formate_error.getValue()); } try { checkCloumnIsExist(thread, start, clazz, page); } catch (RestServiceException e) { - logger.error(e); throw e; } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误"); + throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e),RestBusinessCode.service_runtime_error.getValue()); } logger.info("请求参数校验结束----" + System.currentTimeMillis()); @@ -311,12 +273,7 @@ public abstract class BaseLogService { Page page) { logger.info("实时报表统计查询参数校验开始----" + System.currentTimeMillis()); if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) { - logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误"); - thread.setExceptionInfo("searchBusinessType参数格式错误"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "searchBusinessType参数格式错误", - RestBusinessCode.param_formate_error.getValue()); + throw new RestServiceException("searchBusinessType参数格式错误",RestBusinessCode.param_formate_error.getValue()); } //searchService checkNumericCondition(thread, start, entity.getSearchService(), "searchService"); @@ -326,14 +283,9 @@ public abstract class BaseLogService { sdf.parse(entity.getSearchReportStartTime()); } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); + throw new RestServiceException("searchReportStartTime参数格式错误",RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数错误"); + throw new RestServiceException("searchReportStartTime参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -341,21 +293,12 @@ public abstract class BaseLogService { sdf.parse(entity.getSearchReportEndTime()); } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式错误", - RestBusinessCode.param_formate_error.getValue()); + throw new RestServiceException("searchReportEndTime参数格式错误",RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数错误"); + throw new RestServiceException("searchReportEndTime参数错误",RestBusinessCode.param_formate_error.getValue()); } if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) { - logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误"); - thread.setExceptionInfo("searchBusinessType参数格式错误"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "searchBusinessType参数格式错误", + throw new RestServiceException("searchBusinessType参数格式错误", RestBusinessCode.param_formate_error.getValue()); } @@ -386,11 +329,7 @@ public abstract class BaseLogService { flag = true; } if (flag) { - logger.error(RestBusinessCode.param_formate_error.getErrorReason()+","+condName+"参数格式错误"); - thread.setExceptionInfo(condName+"参数格式错误"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - condName+"参数格式错误", + throw new RestServiceException(condName+"参数格式错误", RestBusinessCode.param_formate_error.getValue()); } } @@ -406,11 +345,7 @@ public abstract class BaseLogService { public void checkNtcRadiusReportCondition(AuditLogThread thread, long start, NtcRadiusReport entity) { logger.info("用户行为日志统计参数校验开始----" + System.currentTimeMillis()); if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) { - logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误"); - thread.setExceptionInfo("searchBusinessType参数格式错误"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "searchBusinessType参数格式错误", + throw new RestServiceException("searchBusinessType参数格式错误", RestBusinessCode.param_formate_error.getValue()); } @@ -421,14 +356,10 @@ public abstract class BaseLogService { timeCount++; } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数格式错误", + throw new RestServiceException("searchReportStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数错误"); + throw new RestServiceException("searchReportStartTime参数错误",RestBusinessCode.param_formate_error.getValue()); } try { @@ -437,42 +368,26 @@ public abstract class BaseLogService { timeCount++; } } catch (ParseException e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式错误", + throw new RestServiceException("searchReportEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue()); } catch (Exception e) { - thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error(e); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数错误"); + throw new RestServiceException("searchReportEndTime参数错误",RestBusinessCode.param_formate_error.getValue()); } if (timeCount==1) { - logger.error(RestBusinessCode.config_integrity_error.getErrorReason()+",searchReportStartTime和searchReportEndTime参数必须同时填写"); - thread.setExceptionInfo("searchReportStartTime和searchReportEndTime参数必须同时填写"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "searchReportStartTime和searchReportEndTime参数必须同时填写", + throw new RestServiceException("searchReportStartTime和searchReportEndTime参数必须同时填写", RestBusinessCode.config_integrity_error.getValue()); } //根据用户查看IP趋势时(searchBusinessType=2),用户名必需填写 if ("2".equals(entity.getSearchBusinessType())&&StringUtil.isEmpty(entity.getSearchAccount())) { - logger.error(RestBusinessCode.config_integrity_error.getErrorReason()+",searchBusinessType=2时searchAccount参数必须填写"); - thread.setExceptionInfo("searchBusinessType=2时searchAccount参数必须填写"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "searchBusinessType=2时searchAccount参数必须填写", + throw new RestServiceException("searchBusinessType=2时searchAccount参数必须填写", RestBusinessCode.config_integrity_error.getValue()); } //根据用户查看IP趋势时(searchBusinessType=3),用户名必需填写 if ("3".equals(entity.getSearchBusinessType())&&StringUtil.isEmpty(entity.getSearchNasIp())) { - logger.error(RestBusinessCode.config_integrity_error.getErrorReason()+",searchBusinessType=3时searchNasIp参数必须填写"); - thread.setExceptionInfo("searchBusinessType=3时searchNasIp参数必须填写"); - throw new RestServiceException(thread, - System.currentTimeMillis() - start, - "searchBusinessType=3时searchNasIp参数必须填写", + throw new RestServiceException("searchBusinessType=3时searchNasIp参数必须填写", RestBusinessCode.config_integrity_error.getValue()); }