1:新增如下业务

0x28 网页关键字阻断
0x98 网页关键字监测
0x42邮件账号白名单
2:添加NTC_KEYWORDS_URL_LOG日志表查询接口
This commit is contained in:
renkaige
2018-10-25 11:47:14 +08:00
parent d7b8c53a88
commit f3a7a3f1e1
7 changed files with 134 additions and 8 deletions

View File

@@ -0,0 +1,30 @@
package com.nis.domain.restful;
import com.nis.domain.LogEntity;
public class NtcKeywordsUrlLog extends LogEntity<NtcKeywordsUrlLog> {
/**
*
*/
private static final long serialVersionUID = 1L;
private String url;
private String website;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
}

View File

@@ -8,7 +8,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zdjizhi.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,6 +24,7 @@ import com.nis.domain.restful.NtcFtpLog;
import com.nis.domain.restful.NtcHttpLog;
import com.nis.domain.restful.NtcIpLog;
import com.nis.domain.restful.NtcIpsecLog;
import com.nis.domain.restful.NtcKeywordsUrlLog;
import com.nis.domain.restful.NtcL2tpLog;
import com.nis.domain.restful.NtcMailLog;
import com.nis.domain.restful.NtcOpenvpnLog;
@@ -35,11 +35,10 @@ import com.nis.domain.restful.NtcSslLog;
import com.nis.domain.restful.NtcStreamingMediaLog;
import com.nis.domain.restful.NtcVoipLog;
import com.nis.restful.RestServiceException;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogJDBCByDruid;
import com.nis.util.JsonMapper;
import com.nis.util.LogJDBCByDruid;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.AuditLogThread;
import com.nis.web.service.HiveSqlService;
@@ -47,6 +46,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
@@ -1079,6 +1079,60 @@ public class NtcLogSearchController extends BaseRestController {
logPage, 0);
}
@RequestMapping(value = "/ntcKeywordsUrlLogs", method = RequestMethod.GET)
@ApiOperation(value = "NTC关键字转URL日志查询", httpMethod = "GET", notes = "对日志功能“NTC关键字转URL日志”提供数据基础查询服务")
public Map<String, ?> ntcKeywordsUrlLogs(Page page, NtcKeywordsUrlLog ntcKeywordsUrlLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<NtcStreamingMediaLog> logPage = null;
try {
resetTime(ntcKeywordsUrlLog);
ntcLogService.queryConditionCheck(auditLogThread, start, ntcKeywordsUrlLog, NtcKeywordsUrlLog.class, page);
logPage = new Page<NtcStreamingMediaLog>();
logPage.setPageNo(page.getPageNo());
logPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(NtcStreamingMediaLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
String sql = HiveSqlService.getSql(page, ntcKeywordsUrlLog,
getTableName(NtcKeywordsUrlLog.class.getSimpleName() + "HiveTable", "NTC_KEYWORDS_URL_LOG"),
getCol2Col(), orderBy, null);
Map<String, List<Object>> tableMapping = new LogJDBCByDruid().tableMapping(page, null, sql, NtcStreamingMediaLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<NtcStreamingMediaLog> List = (java.util.List<NtcStreamingMediaLog>) JsonMapper.fromJsonList(jsonString,
NtcStreamingMediaLog.class);
logPage.setList(List);
logPage.setCount(List.size());
} else {
logPage.setList(new ArrayList());
}
}
} 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, "NTC关键字转URL日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC关键字转URL日志检索成功",
logPage, 0);
}
/**
*判断开始和结束时间是否为null,如果为null则初始化时间
* @param entity

View File

@@ -1229,4 +1229,34 @@
<result column="fd_type" jdbcType="INTEGER" property="fdType" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
</resultMap>
<resultMap id="NtcKeywordsUrlLogMap" type="com.nis.domain.restful.NtcKeywordsUrlLog">
<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="url" jdbcType="VARCHAR" property="url" />
<result column="website" jdbcType="VARCHAR" property="website" />
</resultMap>
</mapper>