添加文件传输管理-P2P日志查询接口
This commit is contained in:
17
src/main/java/com/nis/domain/restful/NtcP2pLog.java
Normal file
17
src/main/java/com/nis/domain/restful/NtcP2pLog.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.nis.domain.restful;
|
||||||
|
|
||||||
|
import com.nis.domain.LogEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName:NtcP2pLog
|
||||||
|
* @Description:TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @author (zdx)
|
||||||
|
* @date 2018年8月7日 上午9:23:52
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
public class NtcP2pLog extends LogEntity<NtcP2pLog> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8085222950278735219L;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ import com.nis.domain.restful.NtcIpsecLog;
|
|||||||
import com.nis.domain.restful.NtcL2tpLog;
|
import com.nis.domain.restful.NtcL2tpLog;
|
||||||
import com.nis.domain.restful.NtcMailLog;
|
import com.nis.domain.restful.NtcMailLog;
|
||||||
import com.nis.domain.restful.NtcOpenvpnLog;
|
import com.nis.domain.restful.NtcOpenvpnLog;
|
||||||
|
import com.nis.domain.restful.NtcP2pLog;
|
||||||
import com.nis.domain.restful.NtcPptpLog;
|
import com.nis.domain.restful.NtcPptpLog;
|
||||||
import com.nis.domain.restful.NtcSshLog;
|
import com.nis.domain.restful.NtcSshLog;
|
||||||
import com.nis.domain.restful.NtcSslLog;
|
import com.nis.domain.restful.NtcSslLog;
|
||||||
@@ -840,6 +841,65 @@ public class NtcLogSearchController extends BaseRestController {
|
|||||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功",
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功",
|
||||||
ntcDdosLogPage, 0);
|
ntcDdosLogPage, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/ntcP2pLogs", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "P2P日志查询", httpMethod = "GET", notes = "对应配置为“文件传输管理-P2P”,存储动作为阻断的命中日志。对日志功能“文件传输管理-P2P日志”提供数据基础查询服务")
|
||||||
|
public Map<String, ?> ntcP2pLogs(Page page, NtcP2pLog ntcP2pLog, Model model, HttpServletRequest request,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
||||||
|
request, null);
|
||||||
|
|
||||||
|
Page<NtcP2pLog> ntcP2pLogPage = null;
|
||||||
|
try {
|
||||||
|
resetTime(ntcP2pLog);
|
||||||
|
ntcLogService.queryConditionCheck(auditLogThread, start, ntcP2pLog, NtcP2pLog.class, page);
|
||||||
|
ntcP2pLogPage = new Page<NtcP2pLog>();
|
||||||
|
ntcP2pLogPage.setPageNo(page.getPageNo());
|
||||||
|
ntcP2pLogPage.setPageSize(page.getPageSize());
|
||||||
|
String orderBy = "";
|
||||||
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
||||||
|
orderBy = Page.getOrderBySql(NtcP2pLog.class.getSimpleName(), page.getOrderBy());
|
||||||
|
} else {
|
||||||
|
orderBy = "found_Time";
|
||||||
|
}
|
||||||
|
ResultSet rs = HiveSqlService.getResultSet(page, ntcP2pLog,
|
||||||
|
Configurations.getStringProperty(NtcP2pLog.class.getSimpleName() + "HiveTable", "ntc_p2p_log"),
|
||||||
|
getCol2Col(), orderBy, null);
|
||||||
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcP2pLog.class, "foundTime",
|
||||||
|
"recvTime");
|
||||||
|
if (tableMapping == null) {
|
||||||
|
ntcP2pLogPage.setList(new ArrayList());
|
||||||
|
} else {
|
||||||
|
List list = tableMapping.get("obj");
|
||||||
|
// if (tableMapping.get("obj").size() > page.getPageSize()) {
|
||||||
|
// list = tableMapping.get("obj").subList(0, page.getPageSize());
|
||||||
|
// } else {
|
||||||
|
// list = tableMapping.get("obj").subList(0, tableMapping.get("obj").size());
|
||||||
|
// }
|
||||||
|
if (list.size() > 0) {
|
||||||
|
String jsonString = JsonMapper.toJsonString(list);
|
||||||
|
List<NtcP2pLog> List = (java.util.List<NtcP2pLog>) JsonMapper.fromJsonList(jsonString,
|
||||||
|
NtcP2pLog.class);
|
||||||
|
ntcP2pLogPage.setList(List);
|
||||||
|
ntcP2pLogPage.setCount(List.size());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ntcP2pLogPage.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, "P2P日志检索失败");
|
||||||
|
}
|
||||||
|
throw ((RestServiceException) e);
|
||||||
|
}
|
||||||
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "P2P日志检索成功",
|
||||||
|
ntcP2pLogPage, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*判断开始和结束时间是否为null,如果为null则初始化时间
|
*判断开始和结束时间是否为null,如果为null则初始化时间
|
||||||
|
|||||||
@@ -814,5 +814,25 @@
|
|||||||
<result column="req_body" jdbcType="VARCHAR" property="reqBody" />
|
<result column="req_body" jdbcType="VARCHAR" property="reqBody" />
|
||||||
<result column="resp_body" jdbcType="VARCHAR" property="respBody" />
|
<result column="resp_body" jdbcType="VARCHAR" property="respBody" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<resultMap id="NtcP2pLogMap" type="com.nis.domain.restful.NtcP2pLog">
|
||||||
|
<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" />
|
||||||
|
</resultMap>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -12,6 +12,7 @@ NtcSshLogHiveTable=NTC_SSH_LOG
|
|||||||
NtcFtpLogHiveTable=NTC_FTP_LOG
|
NtcFtpLogHiveTable=NTC_FTP_LOG
|
||||||
NtcAppLogHiveTable=NTC_APP_LOG
|
NtcAppLogHiveTable=NTC_APP_LOG
|
||||||
NtcDdosLogHiveTable=NTC_DDOS_LOG
|
NtcDdosLogHiveTable=NTC_DDOS_LOG
|
||||||
|
NtcP2pLogHiveTable=NTC_P2P_LOG
|
||||||
DkBehaviorLogHiveTable=DK_BEHAVIOR_LOG
|
DkBehaviorLogHiveTable=DK_BEHAVIOR_LOG
|
||||||
MmAvIpLogHiveTable=MM_AV_IP_LOG
|
MmAvIpLogHiveTable=MM_AV_IP_LOG
|
||||||
MmAvUrlLogHiveTable=MM_AV_URL_LOG
|
MmAvUrlLogHiveTable=MM_AV_URL_LOG
|
||||||
|
|||||||
Reference in New Issue
Block a user