1:新增url统计查询的接口

2:新增ASN通联关系(源,目的)查询接口
This commit is contained in:
renkaige
2018-12-16 11:10:25 +06:00
parent e9f838998b
commit 630be99456
11 changed files with 859 additions and 248 deletions

View File

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.NtcAppLog;
import com.nis.domain.restful.NtcAsnRecord;
import com.nis.domain.restful.NtcBgpLog;
import com.nis.domain.restful.NtcCollectRadiusLog;
import com.nis.domain.restful.NtcCollectVoipLog;
@@ -733,7 +734,7 @@ public class NtcLogSearchController extends BaseRestController {
if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundEndTime())) {
sdf.setLenient(false);
sdf.parse(ntcConnRecordPercent.getSearchFoundEndTime());
}else {
} else {
throw new RestServiceException("searchFoundEndTime参数不能为空",
RestBusinessCode.param_formate_error.getValue());
}
@@ -749,7 +750,7 @@ public class NtcLogSearchController extends BaseRestController {
if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundStartTime())) {
sdf.setLenient(false);
sdf.parse(ntcConnRecordPercent.getSearchFoundStartTime());
}else {
} else {
throw new RestServiceException("searchFoundStartTime参数不能为空",
RestBusinessCode.param_formate_error.getValue());
}
@@ -779,4 +780,70 @@ public class NtcLogSearchController extends BaseRestController {
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "通联关系日志百分比检索成功",
ntcConnRecordPercent, 0);
}
@RequestMapping(value = "/ntcAsnRecord", method = RequestMethod.GET)
@ApiOperation(value = "ASN通联关系(源,目的)查询", httpMethod = "GET", notes = "对日志功能“ASN通联关系(源,目的)查询”提供数据基础查询服务")
public Map<String, ?> ntcAsnRecord(Page page, NtcAsnRecord ntcAsnRecord, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
try {
if (StringUtil.isEmpty(ntcAsnRecord.getSearchFoundStartTime())
&& StringUtil.isEmpty(ntcAsnRecord.getSearchFoundEndTime())) {
Map<String, String> map = DateUtils.getLocalTime(null, null, Constants.LOG_LOCAL_TIME, "minute");
ntcAsnRecord.setSearchFoundStartTime(map.get("startTime"));
ntcAsnRecord.setSearchFoundEndTime(map.get("endTime"));
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
if (!StringUtil.isBlank(ntcAsnRecord.getSearchFoundEndTime())) {
sdf.setLenient(false);
sdf.parse(ntcAsnRecord.getSearchFoundEndTime());
} else {
throw new RestServiceException("searchFoundEndTime参数不能为空",
RestBusinessCode.param_formate_error.getValue());
}
} catch (ParseException e) {
throw new RestServiceException("searchFoundEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
throw new RestServiceException("searchFoundEndTime参数错误",
RestBusinessCode.param_formate_error.getValue());
}
try {
if (!StringUtil.isBlank(ntcAsnRecord.getSearchFoundStartTime())) {
sdf.setLenient(false);
sdf.parse(ntcAsnRecord.getSearchFoundStartTime());
} else {
throw new RestServiceException("searchFoundStartTime参数不能为空",
RestBusinessCode.param_formate_error.getValue());
}
} catch (ParseException e) {
throw new RestServiceException("searchFoundStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
throw new RestServiceException("searchFoundStartTime参数错误",
RestBusinessCode.param_formate_error.getValue());
}
logDataService.getNtcAsnRecord(page, ntcAsnRecord);
} catch (Exception e) {
auditLogThread.setExceptionInfo("ASN通联关系(源,目的)日志检索失败:" + e.getMessage());
logger.error("ASN通联关系(源,目的)检索失败:" + ExceptionUtil.getExceptionMsg(e));
if (e instanceof RestServiceException) {
throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start,
"ASN通联关系(源,目的)检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
} else if (e instanceof ServiceRuntimeException) {
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"ASN通联关系(源,目的)检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
} else {
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"ASN通联关系(源,目的)检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "ASN通联关系(源,目的)检索成功",
page, 0);
}
}

View File

@@ -23,6 +23,7 @@ import com.nis.domain.restful.NtcReportEntity;
import com.nis.domain.restful.NtcServiceReport;
import com.nis.domain.restful.NtcSrcipDomesticReport;
import com.nis.domain.restful.NtcTagReport;
import com.nis.domain.restful.NtcURLReport;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
import com.nis.restful.ServiceRuntimeException;
@@ -395,6 +396,69 @@ public class SingleDimensionReport extends BaseRestController {
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "运营商局点统计查询成功", reportPage,
0);
}
@RequestMapping(value = "/ntcURLReport", method = RequestMethod.GET)
@ApiOperation(value = "URL统计查询服务", httpMethod = "GET", notes = "URL统计查询服务")
public Map<String, ?> ntcURLReport(Page page, NtcURLReport urlReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<?> reportPage = null;
try {
resetReportTime(urlReport,false);
ntcReportService.queryReportConditionCheck(saveLogThread, start, urlReport, NtcURLReport.class,
page);
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(NtcURLReport.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "report_time";
}
page.setOrderBy(orderBy);
reportPage = ntcReportService.findNtcURLReport(
new Page<NtcURLReport>(request, response, NtcURLReport.class), urlReport);
} catch (Exception e) {
saveLogThread.setExceptionInfo("URL统计查询失败:"+e.getMessage());
logger.error("URL统计查询失败:"+ExceptionUtil.getExceptionMsg(e));
if (e instanceof RestServiceException) {
throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start,
"URL统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
} else if (e instanceof ServiceRuntimeException) {
throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
"URL统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
} else {
throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
"URL统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "URL统计查询成功", reportPage,
0);
}
@RequestMapping(value = "/ntcRadiusReport", method = RequestMethod.GET)
@ApiOperation(value = "用户行为统计查询服务", httpMethod = "GET", notes = "用户行为统计查询服务基于用户名或接入IP维度聚合")