添加VoIp泛收日志查询接口

This commit is contained in:
zhangdongxu
2018-11-06 17:41:06 +08:00
parent bbf34d95c6
commit b06fdf715f
6 changed files with 553 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.NtcAppLog;
import com.nis.domain.restful.NtcBgpLog;
import com.nis.domain.restful.NtcCollectVoipLog;
import com.nis.domain.restful.NtcDdosLog;
import com.nis.domain.restful.NtcDnsLog;
import com.nis.domain.restful.NtcFtpLog;
@@ -32,6 +33,7 @@ import com.nis.domain.restful.NtcStreamingMediaLog;
import com.nis.domain.restful.NtcVoipLog;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.AuditLogThread;
import com.nis.web.service.LogDataService;
@@ -39,6 +41,7 @@ import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.NtcLogService;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.zdjizhi.utils.StringUtil;
/**
* @ClassName:NtcLogSearchController
@@ -505,5 +508,35 @@ public class NtcLogSearchController extends BaseRestController {
0);
}
@RequestMapping(value = "/ntcCollectVoipLogs", method = RequestMethod.GET)
@ApiOperation(value = "VoIp泛收日志查询", httpMethod = "GET", notes = "对日志功能“VoIp泛收日志查询”提供数据基础查询服务")
public Map<String, ?> ntcCollectVoipLogs(Page page, NtcCollectVoipLog ntcCollectVoipLog, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
try {
if (StringUtil.isEmpty(ntcCollectVoipLog.getSearchFoundStartTime())
&& StringUtil.isEmpty(ntcCollectVoipLog.getSearchFoundEndTime())) {
Map<String, String> map = DateUtils.getLocalTime(null,
null, Constants.LOG_LOCAL_TIME, "minute");
ntcCollectVoipLog.setSearchFoundStartTime(map.get("startTime"));
ntcCollectVoipLog.setSearchFoundEndTime(map.get("endTime"));
}
ntcLogService.collectConditionCheck(auditLogThread, start,ntcCollectVoipLog, NtcCollectVoipLog.class, page);
logDataService.getData(page, ntcCollectVoipLog);
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VoIp泛收日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VoIp泛收日志检索成功", page,
0);
}
}

View File

@@ -1403,4 +1403,34 @@
<result column="website" jdbcType="VARCHAR" property="website" />
</resultMap>
<resultMap id="NtcCollectVoipLogMap" type="com.nis.domain.restful.NtcCollectVoipLog">
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="voip_rotocol" jdbcType="VARCHAR" property="voipProtocol" />
<result column="rtp_d_ip" jdbcType="VARCHAR" property="rtpDIp" />
<result column="rtp_s_ip" jdbcType="VARCHAR" property="rtpSIp" />
<result column="rtp_d_port" jdbcType="VARCHAR" property="rtpDPort" />
<result column="rtp_s_port" jdbcType="VARCHAR" property="rtpSPort" />
<result column="from_to_store_ip" jdbcType="VARCHAR" property="fromToStoreIp" />
<result column="from_to_store_url" jdbcType="VARCHAR" property="fromToStoreUrl" />
<result column="to_from_store_ip" jdbcType="VARCHAR" property="toFromStoreIp" />
<result column="to_from_store_url" jdbcType="VARCHAR" property="toFromStoreUrl" />
<result column="duation" jdbcType="VARCHAR" property="duation" />
<result column="sip_d_ip" jdbcType="VARCHAR" property="sipDIp" />
<result column="sip_s_ip" jdbcType="VARCHAR" property="sipSIp" />
<result column="sip_d_port" jdbcType="INTEGER" property="sipDPort" />
<result column="sip_s_port" jdbcType="INTEGER" property="sipSPort" />
<result column="call_id" jdbcType="VARCHAR" property="callId" />
<result column="request_uri" jdbcType="VARCHAR" property="requestUri" />
<result column="calling_account" jdbcType="VARCHAR" property="callingAccount" />
<result column="called_account" jdbcType="VARCHAR" property="calledAccount" />
<result column="contacts" jdbcType="VARCHAR" property="contacts" />
<result column="route" jdbcType="VARCHAR" property="route" />
<result column="record_route" jdbcType="VARCHAR" property="recordRoute" />
<result column="user_agent" jdbcType="VARCHAR" property="userAgent" />
<result column="server" jdbcType="VARCHAR" property="server" />
</resultMap>
</mapper>

View File

@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.NtcCollectVoipLog;
import com.nis.domain.restful.NtcReportEntity;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
@@ -239,6 +240,62 @@ public abstract class BaseLogService {
}
logger.info("请求参数校验结束----" + System.currentTimeMillis());
}
/**
* 验证日志查询条件格式是否正确
* @param thread
* @param start
* @param entity
* @param clazz
* @param page
*/
public void collectConditionCheck(AuditLogThread thread, long start, NtcCollectVoipLog entity, Class clazz,
Page page) {
logger.info("请求参数校验开始----" + System.currentTimeMillis());
try {
if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
sdf.setLenient(false);
sdf.parse(entity.getSearchFoundEndTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundEndTime参数格式格式");
}
try {
if (!StringUtil.isBlank(entity.getSearchFoundStartTime())) {
sdf.setLenient(false);
sdf.parse(entity.getSearchFoundStartTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchFoundStartTime参数错误");
}
try {
checkCloumnIsExist(thread, start, clazz, page);
} catch (RestServiceException e) {
logger.error(e);
throw e;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
}
logger.info("请求参数校验结束----" + System.currentTimeMillis());
}
/**
*
@@ -340,6 +397,8 @@ public abstract class BaseLogService {
}
}
/**
*
* @Title: getJedisKey