diff --git a/src/main/java/com/nis/domain/restful/NtcCollectVoipLog.java b/src/main/java/com/nis/domain/restful/NtcCollectVoipLog.java new file mode 100644 index 0000000..8479133 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NtcCollectVoipLog.java @@ -0,0 +1,429 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * + * @ClassName:NtcCollectVoipLog + * @Description:TODO(这里用一句话描述这个类的作用) + * @author zdx + * @date 2018年11月5日 下午5:50:18 + * @version V1.0 + */ +public class NtcCollectVoipLog implements Serializable{ + + private static final long serialVersionUID = -8215121930207772717L; + + @ApiModelProperty(value = "节目ID", required = true) + protected String pid; + + @ApiModelProperty(value = "发现时间", required = true) + protected Date foundTime; + @ApiModelProperty(value = "接收时间", required = true) + protected Date recvTime; + @ApiModelProperty(value = "处理机IP", required = true) + protected String capIp; + @ApiModelProperty(value = "VOIP协议", required = true) + protected String voipProtocol; + @ApiModelProperty(value = "RTP服务端ip地址", required = true) + protected String rtpDIp; + @ApiModelProperty(value = "RTP客户端ip地址", required = true) + protected String rtpSIp; + @ApiModelProperty(value = "RTP服务端端口", required = true) + protected Integer rtpDPort; + @ApiModelProperty(value = "RTP客户端端口", required = true) + protected Integer rtpSPort; + @ApiModelProperty(value = "主叫VOIP语音文件存放服务器IP", required = true) + protected String fromToStoreIp; + @ApiModelProperty(value = "主叫VOIP语音文件存放服务器URL", required = true) + protected String fromToStoreUrl; + @ApiModelProperty(value = "被叫VOIP语音文件存放服务器IP", required = true) + protected String toFromStoreIp; + @ApiModelProperty(value = "被叫VOIP语音文件存放服务器URL", required = true) + protected String toFromStoreUrl; + @ApiModelProperty(value = "VOIP通话时长(秒)", required = true) + protected String duation; + @ApiModelProperty(value = "SIP服务端ip地址", required = true) + protected String sipDIp; + @ApiModelProperty(value = "SIP客户端ip地址", required = true) + protected String sipSIp; + @ApiModelProperty(value = "SIP服务端端口", required = true) + protected Integer sipDPort; + @ApiModelProperty(value = "SIP客户端端口", required = true) + protected Integer sipSPort; + @ApiModelProperty(value = "SIP会话ID", required = true) + protected String callId; + @ApiModelProperty(value = "SIP请求URI", required = true) + protected String requestUri; + @ApiModelProperty(value = "SIP主叫VOIP账号", required = true) + protected String callingAccount; + @ApiModelProperty(value = "SIP被叫VOIP账号", required = true) + protected String calledAccount; + @ApiModelProperty(value = "SIP相应字段", required = true) + protected String contacts; + @ApiModelProperty(value = "SIP相应字段", required = true) + protected String via; + @ApiModelProperty(value = "SIP相应字段", required = true) + protected String route; + @ApiModelProperty(value = "SIP相应字段", required = true) + protected String recordRoute; + @ApiModelProperty(value = "SIP相应字段", required = true) + protected String userAgent; + @ApiModelProperty(value = "SIP相应字段", required = true) + protected String server; + + protected String searchVoipProtocol;//协议类型 + protected String searchRtpDIp;//RTP服务端ip + protected String searchRtpSIp;//RTP客户端ip + protected String searchSipDIp;//SIP服务端ip + protected String searchDipDIp;//SIP客户端ip + protected String searchCapIp;//处理机IP + protected String searchFoundStartTime;//开始发现时间 + protected String searchFoundEndTime;//结束发现时间 + + public NtcCollectVoipLog(String pid, Date foundTime, Date recvTime, + String capIp, String voipProtocol, String rtpDIp, String rtpSIp, + Integer rtpDPort, Integer rtpSPort, String fromToStoreIp, + String fromToStoreUrl, String toFromStoreIp, String toFromStoreUrl, + String duation, String sipDIp, String sipSIp, Integer sipDPort, + Integer sipSPort, String callId, String requestUri, + String callingAccount, String calledAccount, String contacts, + String via, String route, String recordRoute, String userAgent, + String server) { + super(); + this.pid = pid; + this.foundTime = foundTime; + this.recvTime = recvTime; + this.capIp = capIp; + this.voipProtocol = voipProtocol; + this.rtpDIp = rtpDIp; + this.rtpSIp = rtpSIp; + this.rtpDPort = rtpDPort; + this.rtpSPort = rtpSPort; + this.fromToStoreIp = fromToStoreIp; + this.fromToStoreUrl = fromToStoreUrl; + this.toFromStoreIp = toFromStoreIp; + this.toFromStoreUrl = toFromStoreUrl; + this.duation = duation; + this.sipDIp = sipDIp; + this.sipSIp = sipSIp; + this.sipDPort = sipDPort; + this.sipSPort = sipSPort; + this.callId = callId; + this.requestUri = requestUri; + this.callingAccount = callingAccount; + this.calledAccount = calledAccount; + this.contacts = contacts; + this.via = via; + this.route = route; + this.recordRoute = recordRoute; + this.userAgent = userAgent; + this.server = server; + } + + public NtcCollectVoipLog() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @return the voipProtocol + */ + public String getVoipProtocol() { + return voipProtocol; + } + + /** + * @param voipProtocol + * the voipProtocol to set + */ + public void setVoipProtocol(String voipProtocol) { + this.voipProtocol = voipProtocol; + } + + public String getDuation() { + return duation; + } + + public void setDuation(String duation) { + this.duation = duation; + } + + public String getCallingAccount() { + return callingAccount; + } + + public void setCallingAccount(String callingAccount) { + this.callingAccount = callingAccount; + } + + public String getCalledAccount() { + return calledAccount; + } + + public void setCalledAccount(String calledAccount) { + this.calledAccount = calledAccount; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public Date getFoundTime() { + return foundTime; + } + + public void setFoundTime(Date foundTime) { + this.foundTime = foundTime; + } + + public Date getRecvTime() { + return recvTime; + } + + public void setRecvTime(Date recvTime) { + this.recvTime = recvTime; + } + + public String getCapIp() { + return capIp; + } + + public void setCapIp(String capIp) { + this.capIp = capIp; + } + + public String getRtpDIp() { + return rtpDIp; + } + + public void setRtpDIp(String rtpDIp) { + this.rtpDIp = rtpDIp; + } + + public String getRtpSIp() { + return rtpSIp; + } + + public void setRtpSIp(String rtpSIp) { + this.rtpSIp = rtpSIp; + } + + public Integer getRtpDPort() { + return rtpDPort; + } + + public void setRtpDPort(Integer rtpDPort) { + this.rtpDPort = rtpDPort; + } + + public Integer getRtpSPort() { + return rtpSPort; + } + + public void setRtpSPort(Integer rtpSPort) { + this.rtpSPort = rtpSPort; + } + + public String getFromToStoreIp() { + return fromToStoreIp; + } + + public void setFromToStoreIp(String fromToStoreIp) { + this.fromToStoreIp = fromToStoreIp; + } + + public String getFromToStoreUrl() { + return fromToStoreUrl; + } + + public void setFromToStoreUrl(String fromToStoreUrl) { + this.fromToStoreUrl = fromToStoreUrl; + } + + public String getToFromStoreIp() { + return toFromStoreIp; + } + + public void setToFromStoreIp(String toFromStoreIp) { + this.toFromStoreIp = toFromStoreIp; + } + + public String getToFromStoreUrl() { + return toFromStoreUrl; + } + + public void setToFromStoreUrl(String toFromStoreUrl) { + this.toFromStoreUrl = toFromStoreUrl; + } + + public String getSipDIp() { + return sipDIp; + } + + public void setSipDIp(String sipDIp) { + this.sipDIp = sipDIp; + } + + public String getSipSIp() { + return sipSIp; + } + + public void setSipSIp(String sipSIp) { + this.sipSIp = sipSIp; + } + + public Integer getSipDPort() { + return sipDPort; + } + + public void setSipDPort(Integer sipDPort) { + this.sipDPort = sipDPort; + } + + public Integer getSipSPort() { + return sipSPort; + } + + public void setSipSPort(Integer sipSPort) { + this.sipSPort = sipSPort; + } + + public String getCallId() { + return callId; + } + + public void setCallId(String callId) { + this.callId = callId; + } + + public String getRequestUri() { + return requestUri; + } + + public void setRequestUri(String requestUri) { + this.requestUri = requestUri; + } + + public String getContacts() { + return contacts; + } + + public void setContacts(String contacts) { + this.contacts = contacts; + } + + public String getVia() { + return via; + } + + public void setVia(String via) { + this.via = via; + } + + public String getRoute() { + return route; + } + + public void setRoute(String route) { + this.route = route; + } + + public String getRecordRoute() { + return recordRoute; + } + + public void setRecordRoute(String recordRoute) { + this.recordRoute = recordRoute; + } + + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getServer() { + return server; + } + + public void setServer(String server) { + this.server = server; + } + @JsonIgnore + public String getSearchVoipProtocol() { + return searchVoipProtocol; + } + + public void setSearchVoipProtocol(String searchVoipProtocol) { + this.searchVoipProtocol = searchVoipProtocol; + } + @JsonIgnore + public String getSearchRtpDIp() { + return searchRtpDIp; + } + + public void setSearchRtpDIp(String searchRtpDIp) { + this.searchRtpDIp = searchRtpDIp; + } + @JsonIgnore + public String getSearchRtpSIp() { + return searchRtpSIp; + } + + public void setSearchRtpSIp(String searchRtpSIp) { + this.searchRtpSIp = searchRtpSIp; + } + @JsonIgnore + public String getSearchSipDIp() { + return searchSipDIp; + } + + public void setSearchSipDIp(String searchSipDIp) { + this.searchSipDIp = searchSipDIp; + } + @JsonIgnore + public String getSearchDipDIp() { + return searchDipDIp; + } + + public void setSearchDipDIp(String searchDipDIp) { + this.searchDipDIp = searchDipDIp; + } + @JsonIgnore + public String getSearchCapIp() { + return searchCapIp; + } + + public void setSearchCapIp(String searchCapIp) { + this.searchCapIp = searchCapIp; + } + @JsonIgnore + public String getSearchFoundStartTime() { + return searchFoundStartTime; + } + + public void setSearchFoundStartTime(String searchFoundStartTime) { + this.searchFoundStartTime = searchFoundStartTime; + } + + @JsonIgnore + public String getSearchFoundEndTime() { + return searchFoundEndTime; + } + + public void setSearchFoundEndTime(String searchFoundEndTime) { + this.searchFoundEndTime = searchFoundEndTime; + } +} 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 2bf5889..71f36a3 100644 --- a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java @@ -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 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 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); + } } diff --git a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml index b0fcf26..c673e92 100644 --- a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml +++ b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml @@ -1403,4 +1403,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/BaseLogService.java b/src/main/java/com/nis/web/service/BaseLogService.java index bcd610b..0fc4702 100644 --- a/src/main/java/com/nis/web/service/BaseLogService.java +++ b/src/main/java/com/nis/web/service/BaseLogService.java @@ -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 diff --git a/src/main/resources/applicationLog-clickhouse.properties b/src/main/resources/applicationLog-clickhouse.properties index 2f686b9..9797557 100644 --- a/src/main/resources/applicationLog-clickhouse.properties +++ b/src/main/resources/applicationLog-clickhouse.properties @@ -35,7 +35,7 @@ NtcVoipLogClickHouseTable=TBS_ODS_NTC_VOIP_LOG NtcStreamingMediaLogClickHouseTable=TBS_ODS_NTC_STREAMING_MEDIA_LOG MmFileDigestLogClickHouseTable=TBS_ODS_MM_FILE_DIGEST_LOG NtcKeywordsUrlLogClickHouseTable=TBS_ODS_NTC_KEYWORDS_URL_LOG - +NtcCollectVoipLogClickHouseTable=TBS_ODS_NTC_COLLECT_VOIP_LOG diff --git a/src/main/resources/applicationLog-hive.properties b/src/main/resources/applicationLog-hive.properties index 5ffeebc..1668ad4 100644 --- a/src/main/resources/applicationLog-hive.properties +++ b/src/main/resources/applicationLog-hive.properties @@ -35,7 +35,7 @@ NtcVoipLogHiveTable=NTC_VOIP_LOG NtcStreamingMediaLogHiveTable=NTC_STREAMING_MEDIA_LOG MmFileDigestLogHiveTable=MM_FILE_DIGEST_LOG NtcKeywordsUrlLogHiveTable=NTC_KEYWORDS_URL_LOG - +NtcCollectVoipLogHiveTable=NTC_COLLECT_VOIP_LOG