细化日志查询接口的异常处理:数据验证未通过等客户端原因引起的异常归为RestServiceException(status=400);在服务程序运行过程中发生的内容异常归为ServiceRuntimeException(status=500)

This commit is contained in:
zhangdongxu
2018-11-29 11:48:32 +08:00
parent 50aca2d2df
commit fcea7ed13e
8 changed files with 280 additions and 192 deletions

View File

@@ -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);

View File

@@ -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, "协议统计图表数据检索失败");
logger.error("协议统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e));
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"协议统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
throw ((RestServiceException) e);
}
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实时统计数据检索失败");
logger.error("活跃IP统计一个小时的活跃IP"+ExceptionUtil.getExceptionMsg(e));
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"活跃IP统计一个小时的活跃IP检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
throw ((RestServiceException) e);
}
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<String,?> 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实时统计数据检索失败");
logger.error("活跃IP最近一个小时的变化趋势统计"+ExceptionUtil.getExceptionMsg(e));
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"活跃IP最近一个小时的变化趋势统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
throw ((RestServiceException) e);
}
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<String, ?> 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<String, ?> 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网站分类分析数据检索失败");
logger.error("HTTP网站分类分析统计失败"+e);
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"HTTP网站分类分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
throw ((RestServiceException) e);
}
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<String, ?> 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网站主题分类分析数据检索失败");
logger.error("HTTP网站主题分类分析统计失败"+ExceptionUtil.getExceptionMsg(e));
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"HTTP网站分类分析统计失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "http网站主题分类分析数据检索成功",list, 0);
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "HTTP网站主题分类分析数据检索成功",list, 0);
}
}

View File

@@ -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,10 +71,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "行为识别日志检索成功", page, 0);
}
@@ -93,10 +97,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PXY HTTP日志检索成功", page,
0);
}

View File

@@ -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,10 +78,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频IP日志检索成功", page, 0);
}
@@ -100,10 +104,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频URL日志检索成功", page, 0);
}
@@ -124,10 +130,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片IP日志检索成功", page, 0);
}
@@ -148,10 +156,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片URL日志检索成功", page, 0);
}
@@ -174,10 +184,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIP IP日志检索成功", page,
0);
}
@@ -200,10 +212,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIP Account日志检索成功",
page, 0);
}
@@ -225,10 +239,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音频样例日志检索成功", page, 0);
}
@@ -249,10 +265,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "视频样例日志检索成功", page, 0);
}
@@ -274,10 +292,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音频色情日志检索成功", page, 0);
}
@@ -299,10 +319,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "视频色情日志检索成功", page, 0);
}
@@ -323,10 +345,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片样例日志检索成功", page, 0);
}
@@ -347,10 +371,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VOIP样例日志检索成功", page, 0);
}
@@ -372,10 +398,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "说话人识别日志检索成功", page, 0);
}
@@ -397,10 +425,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "台标识别日志检索成功", page, 0);
}
@@ -422,10 +452,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "人脸识别日志检索成功", page, 0);
}
@@ -446,10 +478,12 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "文件摘要日志检索成功", page, 0);
}

View File

@@ -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,9 +62,15 @@ public class NmsInfoController extends BaseRestController {
}
} catch (Exception e) {
throw new RestServiceException(thread, System.currentTimeMillis() - start, "上报服务器状态信息异常:" + e.getMessage(),
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,9 +92,14 @@ 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,9 +124,13 @@ 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);
}

View File

@@ -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,10 +81,13 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功", page, 0);
}
@@ -102,12 +107,17 @@ 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);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Http日志检索成功", page, 0);
}
@@ -128,10 +138,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, "Dns日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"Dns日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
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);
}
}
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,10 +191,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, "SSL日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"SSL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSL日志检索成功", page, 0);
}
@@ -202,10 +218,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, "PPTP日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"PPTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PPTP日志检索成功", page, 0);
}
@@ -227,10 +245,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, "L2TP日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"L2TP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "L2TP日志检索成功", page, 0);
}
@@ -252,10 +272,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, "Openvpn日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"Openvpn日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Openvpn日志检索成功", page,
0);
@@ -278,10 +300,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, "IPSEC日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"IPSEC日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IPSEC日志检索成功", page, 0);
}
@@ -303,10 +327,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, "SSH日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"SSH日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSH日志检索成功", page, 0);
}
@@ -330,10 +356,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, "FTP日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"FTP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功", page, 0);
}
@@ -353,10 +381,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, "App日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"App日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App日志检索成功", page, 0);
}
@@ -377,10 +407,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, "DDos日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"DDos日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功", page, 0);
}
@@ -402,10 +434,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, "P2P日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"P2P日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "P2P日志检索成功", page, 0);
}
@@ -427,10 +461,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, "BGP日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"BGP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "BGP日志检索成功", page, 0);
}
@@ -451,10 +487,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, "NTC VoIP日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"NTC VoIP日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC VoIP日志检索成功", page,
0);
}
@@ -477,10 +515,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, "流媒体协议日志检索失败");
}
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);
}
@@ -501,10 +541,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, "NTC关键字转URL日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"NTC关键字转URL日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC关键字转URL日志检索成功", page,
0);
}
@@ -533,10 +575,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, "VoIp泛收日志检索失败");
}
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"VoIp泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}else{
throw ((RestServiceException) e);
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIp泛收日志检索成功", page,
0);
}

View File

@@ -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, "获取系统操作日志成功",

View File

@@ -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,10 +85,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "配置日志总量统计成功",
ntcPzReportPage, 0);
@@ -119,10 +122,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "业务类型统计查询成功",
reportPage, 0);
@@ -158,10 +163,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "标签统计查询成功",
reportPage, 0);
@@ -194,10 +201,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "性质统计查询成功",
reportPage, 0);
@@ -232,10 +241,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "来文函号统计查询成功",
reportPage, 0);
@@ -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);
}
}
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<String, ?> ntcDestipCountryReport(Page page, NtcDestipCountryReport ntcDestipCountryReport, Model model,
@@ -309,10 +319,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "各国家目的IP统计查询成功",
reportPage, 0);
@@ -348,10 +360,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "运营商局点统计查询成功", reportPage,
0);
@@ -375,10 +389,12 @@ 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);
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "用户行为统计查询成功", dataList,
0);