diff --git a/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java b/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java index 31c5db8..ca83e87 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java @@ -5,14 +5,13 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.nis.domain.restful.ConfigPzIdSource; -import com.nis.restful.RestServiceException; +import com.nis.restful.ServiceRuntimeException; import com.nis.util.Constants; import com.nis.util.ExceptionUtil; import com.nis.web.controller.BaseRestController; @@ -47,7 +46,7 @@ public class ConfigPzIdController extends BaseRestController { e.printStackTrace(); thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "配置ID获取失败"); + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, "配置ID获取失败"); } return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "配置ID获取成功", configPzIdSource); 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 dff371a..b979af3 100644 --- a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -6,21 +6,22 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic; -import com.nis.restful.RestServiceException; -import com.nis.util.Constants; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.nis.web.service.AuditLogThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import com.nis.restful.RestBusinessCode; +import com.nis.restful.ServiceRuntimeException; +import com.nis.util.Constants; +import com.nis.util.ExceptionUtil; import com.nis.util.JsonMapper; import com.nis.web.controller.BaseRestController; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DashboardService; import com.wordnik.swagger.annotations.Api; @@ -54,11 +55,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "业务总量汇聚实时统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("业务总量汇聚实时统计数据检索失败"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "业务总量汇聚实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "业务总量汇聚实时统计数据检索成功",list, 0); } @@ -81,11 +80,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃端口实时统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("活跃端口实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃端口实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃端口实时统计数据检索成功",list, 0); } @@ -109,13 +106,11 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "协议统计图表数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("协议统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "协议统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功", + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计图表数据检索成功", list, 0); } @@ -138,11 +133,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP实时统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("活跃IP实时统计数据检索失败:"+ExceptionUtil.getExceptionMsg(e)); + 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); } @@ -164,19 +157,17 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP实时统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("活跃IP统计一个小时的活跃IP"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP实时统计数据检索成功",list, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP统计一个小时的活跃IP检索成功",list, 0); } /** * 活跃IP TOP10 一小时数据 */ @RequestMapping(value = "trafficIpActiveFiveMinute", method = RequestMethod.GET) - @ApiOperation(value = "活跃IP统计最近五分钟TOP10在近一个小时间隔五分钟的活跃IP数据", httpMethod = "GET", notes = "对应活跃IP实时统计查询服务。") + @ApiOperation(value = "活跃IP最近一个小时的变化趋势统计", httpMethod = "GET", notes = "对最新TOP10的活跃IP,在近一个小时的变化情况进行统计") public Map trafficIpActiveFiveMinute(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); @@ -190,19 +181,17 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "活跃IP实时统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("活跃IP最近一个小时的变化趋势统计"+ExceptionUtil.getExceptionMsg(e)); + 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); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "活跃IP最近一个小时的变化趋势统计成功",list, 0); } /** * app应用流量分析 TOP10 */ @RequestMapping(value = "trafficApp", method = RequestMethod.GET) - @ApiOperation(value = "app流量分析统计", httpMethod = "GET", notes = "对应app流量分析实时统计查询服务。") + @ApiOperation(value = "App流量分析统计", httpMethod = "GET", notes = "对应app流量分析实时统计查询服务。") public Map trafficApp(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); @@ -216,11 +205,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "App流量统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("App流量分析统计:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App流量统计数据检索成功",list, 0); } @@ -238,11 +225,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "操作系统流量分析统计检索失败"); - } - throw ((RestServiceException) e); + logger.error("操作系统流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "操作系统流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "操作系统流量分析统计检索成功",list, 0); } @@ -261,11 +246,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "操作系统下浏览器分类统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("操作系统下浏览器流量分析统计失败:"+e); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "操作系统下浏览器流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "操作系统下浏览器分类统计数据检索成功",list, 0); } @@ -283,11 +266,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "浏览器流量分析统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("浏览器流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "浏览器流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器流量分析统计数据检索成功",list, 0); } @@ -306,11 +287,9 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "浏览器下操作系统流量统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("浏览器下操作系统流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "浏览器下操作系统流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "浏览器下操作系统流量统计数据检索成功",list, 0); } @@ -330,16 +309,14 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "网站流量分析统计数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("网站流量分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "网站流量分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "网站流量分析统计数据检索成功",list, 0); } @RequestMapping(value = "trafficWebTypeChart", method = RequestMethod.GET) - @ApiOperation(value = "http网站分类分析统计", httpMethod = "GET", notes = "对应某个网站类型分类统计图") + @ApiOperation(value = "HTTP网站分类分析统计", httpMethod = "GET", notes = "对应某个网站类型分类统计图") public Map trafficWebTypeChart(Integer websiteServiceId,Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); @@ -353,16 +330,14 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "http网站分类分析数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("HTTP网站分类分析统计失败:"+e); + 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); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站分类分析统计成功",list, 0); } @RequestMapping(value = "trafficTopicAndDomainChart", method = RequestMethod.GET) - @ApiOperation(value = "http网站主题分类分析统计", httpMethod = "GET", notes = "对应某个网站主题类型分类统计图") + @ApiOperation(value = "HTTP网站主题分类分析统计", httpMethod = "GET", notes = "对应某个网站主题类型分类统计图") public Map trafficTopicAndDomainChart(Integer websiteServiceId,Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); @@ -376,12 +351,10 @@ public class DashboardServiceController extends BaseRestController { } catch (Exception e) { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); - logger.error("流量统计接口服务错误"+e); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "http网站主题分类分析数据检索失败"); - } - throw ((RestServiceException) e); + logger.error("HTTP网站主题分类分析统计失败:"+ExceptionUtil.getExceptionMsg(e)); + 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); + 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 5d5dce6..5e6ee9b 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -14,7 +14,9 @@ import org.springframework.web.bind.annotation.RestController; import com.nis.domain.Page; import com.nis.domain.restful.DkBehaviorLog; import com.nis.domain.restful.PxyHttpLog; +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; import com.nis.web.controller.BaseRestController; @@ -69,9 +71,11 @@ public class LogController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "行为识别日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "行为识别日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "行为识别日志检索成功", page, 0); } @@ -93,9 +97,11 @@ public class LogController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "PXY HTTP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "PXY HTTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PXY HTTP日志检索成功", page, 0); 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 d7ba247..4f20975 100644 --- a/src/main/java/com/nis/web/controller/restful/MmLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/MmLogSearchController.java @@ -28,7 +28,9 @@ import com.nis.domain.restful.MmSampleVoipLog; import com.nis.domain.restful.MmSpeakerRecognizationLog; import com.nis.domain.restful.MmVoipAccountLog; import com.nis.domain.restful.MmVoipIpLog; +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; import com.nis.web.controller.BaseRestController; @@ -76,9 +78,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音视频IP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "音视频IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频IP日志检索成功", page, 0); } @@ -100,9 +104,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音视频URL日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "音视频URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频URL日志检索成功", page, 0); } @@ -124,9 +130,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片IP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "图片IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片IP日志检索成功", page, 0); } @@ -148,9 +156,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片URL日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "图片URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片URL日志检索成功", page, 0); } @@ -174,9 +184,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VoIP IP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VoIP IP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIP IP日志检索成功", page, 0); @@ -200,9 +212,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VoIP Account日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VoIP Account日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIP Account日志检索成功", page, 0); @@ -225,9 +239,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音频样例日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "音频样例日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音频样例日志检索成功", page, 0); } @@ -249,9 +265,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "视频样例日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "视频样例日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "视频样例日志检索成功", page, 0); } @@ -274,9 +292,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音频色情日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "音频色情日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音频色情日志检索成功", page, 0); } @@ -299,9 +319,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "视频色情日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "视频色情日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "视频色情日志检索成功", page, 0); } @@ -323,9 +345,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片样例日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "图片样例日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片样例日志检索成功", page, 0); } @@ -347,9 +371,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VOIP样例日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VOIP样例日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VOIP样例日志检索成功", page, 0); } @@ -372,9 +398,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "说话人识别日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "说话人识别日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "说话人识别日志检索成功", page, 0); } @@ -397,9 +425,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "台标识别日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "台标识别日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "台标识别日志检索成功", page, 0); } @@ -422,9 +452,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "人脸识别日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "人脸识别日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "人脸识别日志检索成功", page, 0); } @@ -446,9 +478,11 @@ public class MmLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "文件摘要日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "文件摘要日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } 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 f08207d..06c5fdb 100644 --- a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java +++ b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java @@ -16,7 +16,9 @@ import com.nis.domain.restful.TrafficNetflowPortInfoList; import com.nis.domain.restful.TrafficNmsServerStatisticList; 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; import com.nis.web.controller.BaseRestController; import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; @@ -60,8 +62,14 @@ public class NmsInfoController extends BaseRestController { } } catch (Exception e) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, "上报服务器状态信息异常:" + e.getMessage(), - RestBusinessCode.unknow_error.getValue()); + logger.error("上报服务器状态信息异常:" + ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw (RestServiceException) e; + } else { + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, "上报服务器状态信息异常:" + e.getMessage(), + RestBusinessCode.unknow_error.getValue()); + } + } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报服务器状态信息成功", Constants.IS_DEBUG ? trafficNmsServerStatisticList : null); @@ -84,8 +92,13 @@ public class NmsInfoController extends BaseRestController { RestBusinessCode.missing_args.getValue()); } } catch (Exception e) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, + logger.error("上报NmsDiRule信息异常:" + ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw (RestServiceException) e; + } else { + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, "上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue()); + } } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报NmsDiRule信息成功", Constants.IS_DEBUG ? nmsDiRuleList : null); @@ -111,8 +124,12 @@ public class NmsInfoController extends BaseRestController { } } catch (Exception e) { - throw new RestServiceException(thread, System.currentTimeMillis() - start, + if (e instanceof RestServiceException) { + throw (RestServiceException) e; + } else { + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, "上报trafficNetflowPort信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue()); + } } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报trafficNetflowPort信息成功", Constants.IS_DEBUG ? trafficNetflowPortInfoList : null); 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 9b65ef3..b57499a 100644 --- a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java @@ -31,7 +31,9 @@ import com.nis.domain.restful.NtcSshLog; import com.nis.domain.restful.NtcSslLog; import com.nis.domain.restful.NtcStreamingMediaLog; import com.nis.domain.restful.NtcVoipLog; +import com.nis.restful.RestBusinessCode; 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; @@ -79,9 +81,12 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "IP地址日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "IP地址日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); + } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功", page, 0); } @@ -102,10 +107,15 @@ public class NtcLogSearchController extends BaseRestController { e.printStackTrace(); auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); + if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Http日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Http日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); + + } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Http日志检索成功", page, 0); @@ -128,9 +138,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Dns日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Dns日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Dns日志检索成功", page, 0); @@ -152,12 +164,14 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Mail日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Mail日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Mail日志检索成功", page, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "日志检索成功", page, 0); } @RequestMapping(value = "/ntcSslLogs", method = RequestMethod.GET) @@ -177,9 +191,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "SSL日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "SSL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSL日志检索成功", page, 0); @@ -202,9 +218,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "PPTP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "PPTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PPTP日志检索成功", page, 0); @@ -227,9 +245,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "L2TP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "L2TP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "L2TP日志检索成功", page, 0); @@ -252,9 +272,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Openvpn日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Openvpn日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Openvpn日志检索成功", page, @@ -278,9 +300,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "IPSEC日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "IPSEC日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IPSEC日志检索成功", page, 0); @@ -303,9 +327,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "SSH日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "SSH日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSH日志检索成功", page, 0); @@ -330,9 +356,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "FTP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "FTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功", page, 0); } @@ -353,9 +381,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "App日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "App日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App日志检索成功", page, 0); } @@ -377,9 +407,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "DDos日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "DDos日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功", page, 0); } @@ -402,9 +434,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "P2P日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "P2P日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "P2P日志检索成功", page, 0); } @@ -427,9 +461,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "BGP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "BGP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "BGP日志检索成功", page, 0); } @@ -451,9 +487,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "NTC VoIP日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "NTC VoIP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC VoIP日志检索成功", page, 0); @@ -477,9 +515,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "流媒体协议日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "流媒体协议日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "流媒体协议日志检索成功", page, 0); } @@ -501,9 +541,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "NTC关键字转URL日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "NTC关键字转URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC关键字转URL日志检索成功", page, 0); @@ -533,9 +575,11 @@ public class NtcLogSearchController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(ExceptionUtil.getExceptionMsg(e)); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VoIp泛收日志检索失败"); + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "VoIp泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIp泛收日志检索成功", page, 0); diff --git a/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java b/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java index 6e14590..24e7c05 100644 --- a/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java +++ b/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java @@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.RestController; import com.nis.domain.Page; import com.nis.domain.restful.ServicesRequestLogBean; -import com.nis.restful.RestServiceException; +import com.nis.restful.RestBusinessCode; +import com.nis.restful.ServiceRuntimeException; import com.nis.util.Constants; import com.nis.util.ExceptionUtil; import com.nis.web.controller.BaseRestController; @@ -40,10 +41,8 @@ public class ServicesRequestLogController extends BaseRestController { thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); e.printStackTrace(); logger.error(ExceptionUtil.getExceptionMsg(e)); - if (!(e instanceof RestServiceException)) { - e = new RestServiceException(thread, System.currentTimeMillis() - start, "获取系统操作日志失败"); - } - throw ((RestServiceException) e); + throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, + "获取系统操作日志失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); } return testServiceResponse( System.currentTimeMillis() - start, request, response, "获取系统操作日志成功", 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 e8b5cc6..e8cece9 100644 --- a/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java +++ b/src/main/java/com/nis/web/controller/restful/SingleDimensionReport.java @@ -23,7 +23,9 @@ import com.nis.domain.restful.NtcReportEntity; import com.nis.domain.restful.NtcServiceReport; import com.nis.domain.restful.NtcSrcipDomesticReport; import com.nis.domain.restful.NtcTagReport; +import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; +import com.nis.restful.ServiceRuntimeException; import com.nis.util.Constants; import com.nis.util.DateUtils; import com.nis.web.controller.BaseRestController; @@ -32,7 +34,6 @@ import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.NtcReportService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; -import com.zdjizhi.utils.DateUtil; import com.zdjizhi.utils.StringUtil; /** @@ -84,9 +85,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "配置日志总量统计失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "配置日志总量统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "配置日志总量统计成功", @@ -119,9 +122,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "业务类型统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "业务类型统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "业务类型统计查询成功", @@ -158,9 +163,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "标签统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "标签统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "标签统计查询成功", @@ -194,9 +201,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "性质统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "性质统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "性质统计查询成功", @@ -232,9 +241,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "来文函号统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "来文函号统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "来文函号统计查询成功", @@ -268,18 +279,17 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "境内源IP统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "境内源IP统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "境内源IP统计查询成功", reportPage, 0); } - - - @RequestMapping(value = "/ntcDestipCountryReport", method = RequestMethod.GET) @ApiOperation(value = "各国家目的IP统计查询服务", httpMethod = "GET", notes = "各国家目的IP统计查询服务,基于目的IP所属国家与业务类型(service)维度聚合") public Map ntcDestipCountryReport(Page page, NtcDestipCountryReport ntcDestipCountryReport, Model model, @@ -309,9 +319,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "各国家目的IP统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "各国家目的IP统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "各国家目的IP统计查询成功", @@ -348,9 +360,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "运营商局点统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "运营商局点统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "运营商局点统计查询成功", reportPage, @@ -375,9 +389,11 @@ public class SingleDimensionReport extends BaseRestController { e.printStackTrace(); logger.error(e.getMessage()); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "用户行为统计查询失败"); + throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start, + "用户行为统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + }else{ + throw ((RestServiceException) e); } - throw ((RestServiceException) e); } return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "用户行为统计查询成功", dataList,