diff options
| author | shangguanyanfei <[email protected]> | 2019-01-17 11:09:04 +0800 |
|---|---|---|
| committer | shangguanyanfei <[email protected]> | 2019-01-17 11:09:04 +0800 |
| commit | 579ca529b57590811cb62e62110d24846c80a887 (patch) | |
| tree | ffcede7930580258b86e9f09c2d750889c573831 | |
| parent | 3bf82d68eb93683763fb2eb3002c3960966310ad (diff) | |
日志检索-ssl泛收接口修改 和 http泛收接口
9 files changed, 568 insertions, 3 deletions
diff --git a/src/main/java/com/nis/domain/restful/NtcHttpRecordLog.java b/src/main/java/com/nis/domain/restful/NtcHttpRecordLog.java new file mode 100644 index 0000000..5c958b4 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NtcHttpRecordLog.java @@ -0,0 +1,140 @@ +package com.nis.domain.restful; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * + */ +public class NtcHttpRecordLog extends LogEntity { + + private static final long serialVersionUID = 2553033624540656138L; + + @ApiModelProperty(value="url地址", required=true) + protected String url; + @ApiModelProperty(value="", required=true) + protected Integer httpSeq; + @ApiModelProperty(value="", required=true) + protected Integer proxyFlag; + @ApiModelProperty(value="", required=true) + protected Integer isn; + @ApiModelProperty(value="入口页面", required=true) + protected String referer; + + protected String searchUrl; //url查询条件 + + protected String searchDeviceId; //串联设备编号查询条件 + protected String searchDPort; //目的端口查询条件 + protected String searchSPort; //源端口查询条件 + protected String searchReferer; //入口页面查询条件 + + protected Long foundStartTime;//开始发现时间(时间戳类型) + protected Long foundEndTime;//结束发现时间(时间戳类型) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + public Integer getHttpSeq() { + return httpSeq; + } + + public void setHttpSeq(Integer httpSeq) { + this.httpSeq = httpSeq; + } + + public Integer getProxyFlag() { + return proxyFlag; + } + + public void setProxyFlag(Integer proxyFlag) { + this.proxyFlag = proxyFlag; + } + + public Integer getIsn() { + return isn; + } + + public void setIsn(Integer isn) { + this.isn = isn; + } + + public String getReferer() { + return referer; + } + + public void setReferer(String referer) { + this.referer = referer; + } + + /** + * @return the searchUrl + */ + + @JsonIgnore + public String getSearchUrl() { + return searchUrl; + } + + /** + * @param searchUrl the searchUrl to set + */ + public void setSearchUrl(String searchUrl) { + this.searchUrl = searchUrl; + } + @JsonIgnore + public String getSearchDeviceId() { + return searchDeviceId; + } + + public void setSearchDeviceId(String searchDeviceId) { + this.searchDeviceId = searchDeviceId; + } + @JsonIgnore + public String getSearchDPort() { + return searchDPort; + } + + public void setSearchDPort(String searchDPort) { + this.searchDPort = searchDPort; + } + @JsonIgnore + public String getSearchSPort() { + return searchSPort; + } + + public void setSearchSPort(String searchSPort) { + this.searchSPort = searchSPort; + } + @JsonIgnore + public String getSearchReferer() { + return searchReferer; + } + + public void setSearchReferer(String searchReferer) { + this.searchReferer = searchReferer; + } + @JsonIgnore + public Long getFoundStartTime() { + return foundStartTime; + } + + public void setFoundStartTime(Long foundStartTime) { + this.foundStartTime = foundStartTime; + } + @JsonIgnore + public Long getFoundEndTime() { + return foundEndTime; + } + + public void setFoundEndTime(Long foundEndTime) { + this.foundEndTime = foundEndTime; + } + + +} diff --git a/src/main/java/com/nis/domain/restful/NtcSslRecordLog.java b/src/main/java/com/nis/domain/restful/NtcSslRecordLog.java index c889104..dbb69bf 100644 --- a/src/main/java/com/nis/domain/restful/NtcSslRecordLog.java +++ b/src/main/java/com/nis/domain/restful/NtcSslRecordLog.java @@ -27,6 +27,8 @@ public class NtcSslRecordLog extends LogEntity { @ApiModelProperty(value="SNI", required=true) protected String searchSni ; + protected Long foundStartTime;//开始发现时间(时间戳类型) + protected Long foundEndTime;//结束发现时间(时间戳类型) public String getVersion() { return version; @@ -74,4 +76,22 @@ public class NtcSslRecordLog extends LogEntity { public String getSearchSni() { return searchSni; } + @JsonIgnore + public Long getFoundStartTime() { + return foundStartTime; + } + + public void setFoundStartTime(Long foundStartTime) { + this.foundStartTime = foundStartTime; + } + @JsonIgnore + public Long getFoundEndTime() { + return foundEndTime; + } + + public void setFoundEndTime(Long foundEndTime) { + this.foundEndTime = foundEndTime; + } + + } 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 00af934..22a9960 100644 --- a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import com.nis.datasource.CustomerContextHolder; import com.nis.domain.Page; import com.nis.domain.restful.NtcAppLog; import com.nis.domain.restful.NtcBgpLog; @@ -24,6 +25,7 @@ import com.nis.domain.restful.NtcDdosLog; import com.nis.domain.restful.NtcDnsLog; import com.nis.domain.restful.NtcFtpLog; import com.nis.domain.restful.NtcHttpLog; +import com.nis.domain.restful.NtcHttpRecordLog; import com.nis.domain.restful.NtcIpLog; import com.nis.domain.restful.NtcIpsecLog; import com.nis.domain.restful.NtcKeywordsUrlLog; @@ -47,6 +49,8 @@ import com.nis.util.ExceptionUtil; import com.nis.web.controller.BaseRestController; import com.nis.web.service.AuditLogThread; import com.nis.web.service.LogDataService; +import com.nis.web.service.NtcHttpRecordLogsService; +import com.nis.web.service.NtcSslRecordLogsService; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.NtcLogService; import com.wordnik.swagger.annotations.Api; @@ -66,8 +70,14 @@ import com.zdjizhi.utils.StringUtil; public class NtcLogSearchController extends BaseRestController { @Autowired protected ServicesRequestLogService servicesRequestLogService; + + @Autowired + protected NtcSslRecordLogsService ntcSslRecordLogsService;//ssl泛收 @Autowired + protected NtcHttpRecordLogsService ntcHttpRecordLogsService;//http泛收 + + @Autowired protected NtcLogService ntcLogService; @Autowired private LogDataService logDataService; @@ -878,11 +888,15 @@ public class NtcLogSearchController extends BaseRestController { long start = System.currentTimeMillis(); AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - + Page<?> pages= new Page<>(); try { resetTime(ntcSslRecordLog); ntcLogService.queryConditionCheck(auditLogThread, start, ntcSslRecordLog, NtcSslRecordLog.class, page); - logDataService.getData(page, ntcSslRecordLog); +// logDataService.getData(page, ntcSslRecordLog); + //将数据源切换到本地clickhouse + CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B); + pages=ntcSslRecordLogsService.getNtcSslRecordLogsList(page, ntcSslRecordLog); + CustomerContextHolder.clearCustomerType(); } catch (Exception e) { auditLogThread.setExceptionInfo("SSL泛收日志检索失败:" + e.getMessage()); logger.error("SSL泛收日志检索失败:" + ExceptionUtil.getExceptionMsg(e)); @@ -898,6 +912,40 @@ public class NtcLogSearchController extends BaseRestController { } } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSL泛收日志检索成功", page, 0); + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSL泛收日志检索成功", pages, 0); + } + + @RequestMapping(value = "/ntcHttpRecordLogs", method = RequestMethod.GET) + @ApiOperation(value = "HTTP泛收日志查询", httpMethod = "GET", notes = "对应配置为“网站管理-HTTP”,存储动作为阻断与监测的命中日志。对日志功能“网站管理-HTTP”提供数据基础查询服务") + public Map<String, ?> ntcHttpRecordLogs(Page page, NtcHttpRecordLog ntcHttpRecordLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); + Page<?> pages= new Page<>(); + try { + resetTime(ntcHttpRecordLog); + ntcLogService.queryConditionCheck(auditLogThread, start, ntcHttpRecordLog, NtcHttpRecordLog.class, page); +// logDataService.getData(page, ntcHttpRecordLog); + //将数据源切换到本地clickhouse + CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B); + pages=ntcHttpRecordLogsService.getNtcHttpRecordLogsList(page, ntcHttpRecordLog); + CustomerContextHolder.clearCustomerType(); + } catch (Exception e) { + auditLogThread.setExceptionInfo("Http泛收日志检索失败:" + e.getMessage()); + logger.error("Http泛收日志检索失败:" + ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "Http泛收日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Http泛收日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "Http泛收日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } + } + + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Http泛收日志检索成功", pages, 0); } } diff --git a/src/main/java/com/nis/web/dao/NtcHttpRecordLogsDao.java b/src/main/java/com/nis/web/dao/NtcHttpRecordLogsDao.java new file mode 100644 index 0000000..5dc48fb --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcHttpRecordLogsDao.java @@ -0,0 +1,12 @@ +package com.nis.web.dao;
+
+import java.util.List;
+
+import com.nis.domain.restful.NtcHttpRecordLog;
+
+@MyBatisDao
+public interface NtcHttpRecordLogsDao {
+
+ //http泛收 查询
+ List<NtcHttpRecordLog> findNtcHttpRecordLogList(NtcHttpRecordLog obj);
+}
diff --git a/src/main/java/com/nis/web/dao/NtcHttpRecordLogsDao.xml b/src/main/java/com/nis/web/dao/NtcHttpRecordLogsDao.xml new file mode 100644 index 0000000..0fe6974 --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcHttpRecordLogsDao.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.nis.web.dao.NtcHttpRecordLogsDao">
+ <resultMap id="NtcHttpRecordLogMaps" type="com.nis.domain.restful.NtcHttpRecordLog">
+ <result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
+ <result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
+ <result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
+ <result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
+ <result column="addr_type" jdbcType="INTEGER" property="addrType" />
+ <result column="d_ip" jdbcType="VARCHAR" property="dIp" />
+ <result column="s_ip" jdbcType="VARCHAR" property="sIp" />
+ <result column="d_port" jdbcType="VARCHAR" property="dPort" />
+ <result column="s_port" jdbcType="VARCHAR" property="sPort" />
+ <result column="service" jdbcType="INTEGER" property="service" />
+ <result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
+ <result column="device_id" jdbcType="INTEGER" property="deviceId" />
+ <result column="direction" jdbcType="INTEGER" property="direction" />
+ <result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
+ <result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
+ <result column="addr_list" jdbcType="VARCHAR" property="addrList" />
+ <result column="user_region" jdbcType="VARCHAR" property="userRegion" />
+ <result column="server_locate" jdbcType="VARCHAR" property="serverLocate" />
+ <result column="client_locate" jdbcType="VARCHAR" property="clientLocate" />
+ <result column="s_asn" jdbcType="VARCHAR" property="sAsn" />
+ <result column="d_asn" jdbcType="VARCHAR" property="dAsn" />
+ <result column="s_subscribe_id" jdbcType="VARCHAR" property="sSubscribeId" />
+ <result column="d_subscribe_id" jdbcType="VARCHAR" property="dSubscribeId" />
+ <result column="scene_file" jdbcType="VARCHAR" property="sceneFile" />
+ <result column="link_id" jdbcType="BIGINT" property="linkId" />
+ <result column="encap_type" jdbcType="INTEGER" property="encapType" />
+ <result column="inner_smac" jdbcType="VARCHAR" property="innerSmac" />
+ <result column="inner_dmac" jdbcType="VARCHAR" property="innerDmac" />
+
+ <result column="url" jdbcType="VARCHAR" property="url" />
+ <result column="referer" jdbcType="VARCHAR" property="referer" />
+ </resultMap>
+
+
+ <select id="findNtcHttpRecordLogList" parameterType="com.nis.domain.restful.NtcHttpRecordLog" resultMap="NtcHttpRecordLogMaps">
+ select found_time,d_ip,s_ip,d_port,s_port,entrance_id,device_id,url,referer
+
+ from tbs_ods_ntc_collect_http_log
+ <where>
+ <if test="foundStartTime !=null and foundStartTime !=''">
+ and found_time >= #{foundStartTime}
+ </if>
+ <if test="foundEndTime !=null and foundEndTime !=''">
+ and found_time < #{foundEndTime}
+ </if>
+ <if test="searchDIp !=null and searchDIp !=''">
+ and d_ip = #{searchDIp}
+ </if>
+ <if test="searchSIp !=null and searchSIp !=''">
+ and s_ip = #{searchSIp}
+ </if>
+ <if test="searchEntranceId !=null and searchEntranceId !=''">
+ and entrance_id = #{entranceId}
+ </if>
+ <if test="searchUrl !=null and searchUrl !=''">
+ and url LIKE concat(concat('%',#{searchUrl}),'%')
+ </if>
+ <if test="searchReferer !=null and searchReferer !=''">
+ and referer = #{searchReferer}
+ </if>
+ <if test="searchDeviceId !=null and searchDeviceId !=''">
+ and device_id = #{deviceId}
+ </if>
+ <if test="searchDPort !=null and searchDPort !=''">
+ and d_port = #{dPort}
+ </if>
+ <if test="searchSPort !=null and searchSPort !=''">
+ and s_port = #{sPort}
+ </if>
+ </where>
+ <choose>
+ <when test="page !=null and page.orderBy !=null and page.orderBy !=''">
+ ORDER BY ${page.orderBy}
+ </when>
+ <otherwise>
+ ORDER BY found_time DESC
+ </otherwise>
+ </choose>
+
+ </select>
+
+</mapper>
\ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/NtcSslRecordLogsDao.java b/src/main/java/com/nis/web/dao/NtcSslRecordLogsDao.java new file mode 100644 index 0000000..5dcb93f --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcSslRecordLogsDao.java @@ -0,0 +1,12 @@ +package com.nis.web.dao;
+
+import java.util.List;
+
+import com.nis.domain.restful.NtcSslRecordLog;
+
+@MyBatisDao
+public interface NtcSslRecordLogsDao {
+
+ //ssl泛收 查询
+ List<NtcSslRecordLog> findNtcSslRecordLogList(NtcSslRecordLog obj);
+}
diff --git a/src/main/java/com/nis/web/dao/NtcSslRecordLogsDao.xml b/src/main/java/com/nis/web/dao/NtcSslRecordLogsDao.xml new file mode 100644 index 0000000..1ca8f84 --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcSslRecordLogsDao.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.nis.web.dao.NtcSslRecordLogsDao">
+ <resultMap id="NtcSslRecordLogMaps" type="com.nis.domain.restful.NtcSslRecordLog">
+ <result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
+ <result column="found_time" jdbcType="TIMESTAMP" property="foundTime" />
+ <result column="recv_time" jdbcType="TIMESTAMP" property="recvTime" />
+ <result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
+ <result column="addr_type" jdbcType="INTEGER" property="addrType" />
+ <result column="d_ip" jdbcType="VARCHAR" property="dIp" />
+ <result column="s_ip" jdbcType="VARCHAR" property="sIp" />
+ <result column="d_port" jdbcType="VARCHAR" property="dPort" />
+ <result column="s_port" jdbcType="VARCHAR" property="sPort" />
+ <result column="service" jdbcType="INTEGER" property="service" />
+ <result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
+ <result column="device_id" jdbcType="INTEGER" property="deviceId" />
+ <result column="direction" jdbcType="INTEGER" property="direction" />
+ <result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
+ <result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
+ <result column="addr_list" jdbcType="VARCHAR" property="addrList" />
+ <result column="user_region" jdbcType="VARCHAR" property="userRegion" />
+ <result column="server_locate" jdbcType="VARCHAR" property="serverLocate" />
+ <result column="client_locate" jdbcType="VARCHAR" property="clientLocate" />
+ <result column="s_asn" jdbcType="VARCHAR" property="sAsn" />
+ <result column="d_asn" jdbcType="VARCHAR" property="dAsn" />
+ <result column="s_subscribe_id" jdbcType="VARCHAR" property="sSubscribeId" />
+ <result column="d_subscribe_id" jdbcType="VARCHAR" property="dSubscribeId" />
+ <result column="scene_file" jdbcType="VARCHAR" property="sceneFile" />
+ <result column="link_id" jdbcType="BIGINT" property="linkId" />
+ <result column="encap_type" jdbcType="INTEGER" property="encapType" />
+ <result column="inner_smac" jdbcType="VARCHAR" property="innerSmac" />
+ <result column="inner_dmac" jdbcType="VARCHAR" property="innerDmac" />
+
+ <result column="version" jdbcType="VARCHAR" property="version" />
+ <result column="sni" jdbcType="VARCHAR" property="sni" />
+ <result column="san" jdbcType="VARCHAR" property="san" />
+ <result column="cn" jdbcType="VARCHAR" property="cn" />
+ </resultMap>
+
+
+ <select id="findNtcSslRecordLogList" parameterType="com.nis.domain.restful.NtcSslRecordLog" resultMap="NtcSslRecordLogMaps">
+ select cfg_id,found_time,recv_time,trans_proto,addr_type,d_ip,s_ip,d_port,s_port,service,entrance_id,
+ device_id,direction,stream_dir,cap_ip,addr_list,user_region,server_locate,client_locate,s_asn,
+ d_asn,s_subscribe_id,d_subscribe_id,scene_file,link_id,encap_type,encap_type,inner_smac,inner_dmac,
+ version,sni,san,cn
+ from tbs_ods_ntc_collect_ssl_log
+ <where>
+ <if test="foundStartTime !=null and foundStartTime !=''">
+ and found_time >= #{foundStartTime}
+ </if>
+ <if test="foundEndTime !=null and foundEndTime !=''">
+ and found_time < #{foundEndTime}
+ </if>
+ <if test="searchCfgId !=null and searchCfgId !=''">
+ and cfg_id = #{cfgId}
+ </if>
+ <if test="searchTransProto !=null and searchTransProto !=''">
+ and trans_proto = #{searchTransProto}
+ </if>
+ <if test="searchDIp !=null and searchDIp !=''">
+ and d_ip = #{searchDIp}
+ </if>
+ <if test="searchSIp !=null and searchSIp !=''">
+ and s_ip = #{searchSIp}
+ </if>
+ <if test="searchDirection !=null and searchDirection !=''">
+ and direction = #{searchDirection}
+ </if>
+ <if test="searchService !=null and searchService !=''">
+ and service = #{searchService}
+ </if>
+ <if test="searchEntranceId !=null and searchEntranceId !=''">
+ and entrance_id = #{entranceId}
+ </if>
+ <if test="searchCapIp !=null and searchCapIp !=''">
+ and cap_ip = #{searchCapIp}
+ </if>
+ <if test="searchSAsn !=null and searchSAsn !=''">
+ and s_asn = #{searchSAsn}
+ </if>
+ <if test="searchDAsn !=null and searchDAsn !=''">
+ and d_asn = #{searchDAsn}
+ </if>
+ <if test="searchServerLocate !=null and searchServerLocate !=''">
+ and server_locate = #{searchServerLocate}
+ </if>
+ <if test="searchClientLocate !=null and searchClientLocate !=''">
+ and client_locate = #{searchClientLocate}
+ </if>
+ <if test="searchSSubscribeId !=null and searchSSubscribeId !=''">
+ and s_subscribe_id = #{searchSSubscribeId}
+ </if>
+ <if test="searchDSubscribeId !=null and searchDSubscribeId !=''">
+ and d_subscribe_id = #{searchDSubscribeId}
+ </if>
+ <if test="searchSni !=null and searchSni !=''">
+ and sni = #{searchSni}
+ </if>
+ </where>
+ <choose>
+ <when test="page !=null and page.orderBy !=null and page.orderBy !=''">
+ ORDER BY ${page.orderBy}
+ </when>
+ <otherwise>
+ ORDER BY found_time DESC
+ </otherwise>
+ </choose>
+
+ </select>
+
+
+
+</mapper>
\ No newline at end of file diff --git a/src/main/java/com/nis/web/service/NtcHttpRecordLogsService.java b/src/main/java/com/nis/web/service/NtcHttpRecordLogsService.java new file mode 100644 index 0000000..acd2703 --- /dev/null +++ b/src/main/java/com/nis/web/service/NtcHttpRecordLogsService.java @@ -0,0 +1,73 @@ +package com.nis.web.service;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.nis.domain.Page;
+import com.nis.domain.restful.NtcHttpRecordLog;
+import com.nis.restful.RestBusinessCode;
+import com.nis.restful.RestServiceException;
+import com.nis.web.dao.NtcHttpRecordLogsDao;
+import com.zdjizhi.utils.StringUtil;
+
+@Service
+public class NtcHttpRecordLogsService extends BaseService{
+
+ @Autowired
+ protected NtcHttpRecordLogsDao ntcHttpRecordLogsDao;
+ private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ //查询 http泛收 日志数据
+ public Page<?> getNtcHttpRecordLogsList(Page page ,NtcHttpRecordLog entity) {
+ //把String类型的时间 转换成 时间戳类型
+ if (!StringUtil.isBlank(entity.getSearchFoundStartTime())) {
+ try {
+ entity.setFoundStartTime(sdf.parse(entity.getSearchFoundStartTime().trim()).getTime() / 1000);
+ } catch (Exception e) {
+ throw new RestServiceException("searchFoundStartTime参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
+ try {
+ entity.setFoundEndTime(sdf.parse(entity.getSearchFoundEndTime().trim()).getTime() / 1000);
+ } catch (Exception e) {
+ throw new RestServiceException("searchFoundEndTime参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchEntranceId())) {
+ try {
+ entity.setEntranceId(Long.valueOf(entity.getSearchEntranceId()));
+ } catch (Exception e) {
+ throw new RestServiceException("searchEntranceId参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchDeviceId())) {
+ try {
+ entity.setDeviceId(Integer.valueOf(entity.getSearchDeviceId()));
+ } catch (Exception e) {
+ throw new RestServiceException("searchDeviceId参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchDPort())) {
+ try {
+ entity.setdPort(Integer.valueOf(entity.getSearchDPort()));
+ } catch (Exception e) {
+ throw new RestServiceException("searchDPort参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchSPort())) {
+ try {
+ entity.setsPort(Integer.valueOf(entity.getSearchSPort()));
+ } catch (Exception e) {
+ throw new RestServiceException("searchSPort参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ entity.setPage(page);
+ List<NtcHttpRecordLog> findNtcHttpRecordLogList = ntcHttpRecordLogsDao.findNtcHttpRecordLogList(entity);
+ page.setList(findNtcHttpRecordLogList);
+ return page;
+ }
+}
diff --git a/src/main/java/com/nis/web/service/NtcSslRecordLogsService.java b/src/main/java/com/nis/web/service/NtcSslRecordLogsService.java new file mode 100644 index 0000000..8dab62b --- /dev/null +++ b/src/main/java/com/nis/web/service/NtcSslRecordLogsService.java @@ -0,0 +1,61 @@ +package com.nis.web.service;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.nis.domain.Page;
+import com.nis.domain.restful.NtcSslRecordLog;
+import com.nis.restful.RestBusinessCode;
+import com.nis.restful.RestServiceException;
+import com.nis.web.dao.NtcSslRecordLogsDao;
+import com.zdjizhi.utils.StringUtil;
+
+@Service
+public class NtcSslRecordLogsService extends BaseService{
+
+ @Autowired
+ protected NtcSslRecordLogsDao ntcSslRecordLogsDao;
+ private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ //查询 ssl泛收 日志数据
+ public Page<?> getNtcSslRecordLogsList(Page page ,NtcSslRecordLog entity) throws Exception{
+ //把String类型的时间 转换成 时间戳类型
+ if (!StringUtil.isBlank(entity.getSearchFoundStartTime())) {
+ try {
+ entity.setFoundStartTime(sdf.parse(entity.getSearchFoundStartTime().trim()).getTime() / 1000);
+ } catch (Exception e) {
+ throw new RestServiceException("searchFoundStartTime参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
+ try {
+ entity.setFoundEndTime(sdf.parse(entity.getSearchFoundEndTime().trim()).getTime() / 1000);
+ } catch (Exception e) {
+ throw new RestServiceException("searchFoundEndTime参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchCfgId())) {
+ try {
+ entity.setCfgId(Long.valueOf(entity.getSearchCfgId()));
+ } catch (Exception e) {
+ throw new RestServiceException("searchCfgId参数错误", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ if (!StringUtil.isBlank(entity.getSearchEntranceId())) {
+ try {
+ entity.setEntranceId(Long.valueOf(entity.getSearchEntranceId()));
+ } catch (Exception e) {
+ throw new RestServiceException("searchEntranceId", RestBusinessCode.param_formate_error.getValue());
+ }
+ }
+ entity.setPage(page);
+ List<NtcSslRecordLog> findNtcSslRecordLogList = ntcSslRecordLogsDao.findNtcSslRecordLogList(entity);
+ page.setList(findNtcSslRecordLogList);
+ return page;
+ }
+
+
+}
|
