diff --git a/src/main/java/com/nis/domain/LogEntity.java b/src/main/java/com/nis/domain/LogEntity.java index a73907d..1b2c9a6 100644 --- a/src/main/java/com/nis/domain/LogEntity.java +++ b/src/main/java/com/nis/domain/LogEntity.java @@ -75,16 +75,16 @@ public abstract class LogEntity implements Serializable { @ApiModelProperty(value = "用户自定义域", required = true) private String userRegion; - protected String searchCfgId; - protected String searchTransProto; - protected String searchDIp; - protected String searchSIp; - protected String searchDirection; - protected String searchService; - protected String searchEntranceId; - protected String searchCapIp; - protected String searchFoundStartTime; - protected String searchFoundEndTime; + protected String searchCfgId;//配置id + protected String searchTransProto;//协议类型 + protected String searchDIp;//服务端ip地址 + protected String searchSIp;//客户端ip地址 + protected String searchDirection;//传输方向 + protected String searchService;//业务类型 + protected String searchEntranceId;//出入口编号 + protected String searchCapIp;//处理机IP + protected String searchFoundStartTime;//开始发现时间 + protected String searchFoundEndTime;//结束发现时间 /** * 当前实体分页对象 diff --git a/src/main/java/com/nis/web/controller/restful/LogController.java b/src/main/java/com/nis/web/controller/restful/LogController.java index 1566187..3d8443b 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -37,7 +37,6 @@ import com.nis.util.DateUtils; import com.nis.util.HiveJDBC; import com.nis.util.JsonMapper; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.BaseLogService; import com.nis.web.service.HiveSqlService; import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; @@ -76,7 +75,7 @@ public class LogController extends BaseRestController { ntcIpLogPage = new Page(); String orderBy = ""; if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { - orderBy = page.getOrderBySql(NtcIpLog.class.getSimpleName(), page.getOrderBy()); + orderBy = Page.getOrderBySql(NtcIpLog.class.getSimpleName(), page.getOrderBy()); } else { orderBy = "found_Time"; } @@ -99,6 +98,7 @@ public class LogController extends BaseRestController { List List = (java.util.List) JsonMapper.fromJsonList(jsonString, NtcIpLog.class); ntcIpLogPage.setList(List); + ntcIpLogPage.setCount(List.size()); } else { ntcIpLogPage.setList(new ArrayList()); @@ -109,7 +109,7 @@ public class LogController extends BaseRestController { auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); logger.error(e); if (!(e instanceof RestServiceException)) { - e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "HTTP协议请求日志检索失败"); + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "IP地址日志检索失败"); } throw ((RestServiceException) e); } @@ -125,13 +125,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcHttpLogPage = new Page<>(); + Page ntcHttpLogPage = null; try { - ntcHttpLogPage = testService.findNtcHttpLogPage(new Page(request, response, NtcHttpLog.class), - ntcHttpLog); + testService.queryConditionCheck(auditLogThread, start, ntcHttpLog, NtcHttpLog.class, page); + ntcHttpLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcHttpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcHttpLog, + Configurations.getStringProperty(NtcHttpLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcHttpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcHttpLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcHttpLog.class); + ntcHttpLogPage.setList(List); + ntcHttpLogPage.setCount(List.size()); + } else { + ntcHttpLogPage.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, "Http日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Http日志检索成功", @@ -146,13 +182,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcDnsLogPage = new Page<>(); + Page ntcDnsLogPage = null; try { - ntcDnsLogPage = testService.findNtcDnsLogPage(new Page(request, response, NtcDnsLog.class), - ntcDnsLog); + testService.queryConditionCheck(auditLogThread, start, ntcDnsLog, NtcDnsLog.class, page); + ntcDnsLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcDnsLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcDnsLog, + Configurations.getStringProperty(NtcDnsLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcDnsLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcDnsLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcDnsLog.class); + ntcDnsLogPage.setList(List); + ntcDnsLogPage.setCount(List.size()); + } else { + ntcDnsLogPage.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, "Dns日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Dns日志检索成功", @@ -167,13 +239,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcMailLogPage = new Page<>(); + Page ntcMailLogPage = null; try { - ntcMailLogPage = testService.findNtcMailLogPage(new Page(request, response, NtcMailLog.class), - ntcMailLog); + testService.queryConditionCheck(auditLogThread, start, ntcMailLog, NtcMailLog.class, page); + ntcMailLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcMailLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcMailLog, + Configurations.getStringProperty(NtcMailLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcMailLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcMailLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcMailLog.class); + ntcMailLogPage.setList(List); + ntcMailLogPage.setCount(List.size()); + } else { + ntcMailLogPage.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, "Mail日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Mail日志检索成功", @@ -188,13 +296,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcSslLogPage = new Page<>(); + Page ntcSslLogPage = null; try { - ntcSslLogPage = testService.findNtcSslLogPage(new Page(request, response, NtcSslLog.class), - ntcSslLog); + testService.queryConditionCheck(auditLogThread, start, ntcSslLog, NtcSslLog.class, page); + ntcSslLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcSslLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcSslLog, + Configurations.getStringProperty(NtcSslLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcSslLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcSslLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcSslLog.class); + ntcSslLogPage.setList(List); + ntcSslLogPage.setCount(List.size()); + } else { + ntcSslLogPage.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, "SSL日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSL日志检索成功", @@ -209,13 +353,48 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcPptpLogPage = new Page<>(); + Page ntcPptpLogPage = null; try { - ntcPptpLogPage = testService.findNtcPptpLogPage(new Page(request, response, NtcPptpLog.class), - ntcPptpLog); - + testService.queryConditionCheck(auditLogThread, start, ntcPptpLog, NtcPptpLog.class, page); + ntcPptpLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcPptpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcPptpLog, + Configurations.getStringProperty(NtcPptpLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcPptpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcPptpLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcPptpLog.class); + ntcPptpLogPage.setList(List); + ntcPptpLogPage.setCount(List.size()); + } else { + ntcPptpLogPage.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, "PPTP日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PPTP日志检索成功", @@ -230,13 +409,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcL2tpLogPage = new Page<>(); + Page ntcL2tpLogPage = null; try { - ntcL2tpLogPage = testService.findNtcL2tpLogPage(new Page(request, response, NtcL2tpLog.class), - ntcL2tpLog); + testService.queryConditionCheck(auditLogThread, start, ntcL2tpLog, NtcL2tpLog.class, page); + ntcL2tpLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcL2tpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcL2tpLog, + Configurations.getStringProperty(NtcL2tpLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcL2tpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcL2tpLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcL2tpLog.class); + ntcL2tpLogPage.setList(List); + ntcL2tpLogPage.setCount(List.size()); + } else { + ntcL2tpLogPage.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, "L2TP日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "L2TP日志检索成功", @@ -251,13 +466,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcOpenvpnLogPage = new Page<>(); + Page ntcOpenvpnLogPage = null; try { - ntcOpenvpnLogPage = testService.findNtcOpenvpnLogPage( - new Page(request, response, NtcOpenvpnLog.class), ntcOpenvpnLog); + testService.queryConditionCheck(auditLogThread, start, ntcOpenvpnLog, NtcOpenvpnLog.class, page); + ntcOpenvpnLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcOpenvpnLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcOpenvpnLog, + Configurations.getStringProperty(NtcOpenvpnLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcOpenvpnLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcOpenvpnLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcOpenvpnLog.class); + ntcOpenvpnLogPage.setList(List); + ntcOpenvpnLogPage.setCount(List.size()); + } else { + ntcOpenvpnLogPage.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, "Openvpn日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Openvpn日志检索成功", @@ -272,13 +523,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcIpsecLogPage = new Page<>(); + Page ntcIpsecLogPage = null; try { - ntcIpsecLogPage = testService - .findNtcIpsecLogPage(new Page(request, response, NtcIpsecLog.class), ntcIpsecLog); + testService.queryConditionCheck(auditLogThread, start, ntcIpsecLog, NtcIpsecLog.class, page); + ntcIpsecLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcIpsecLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcIpsecLog, + Configurations.getStringProperty(NtcIpsecLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcIpsecLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcIpsecLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcIpsecLog.class); + ntcIpsecLogPage.setList(List); + ntcIpsecLogPage.setCount(List.size()); + } else { + ntcIpsecLogPage.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, "IPSEC日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IPSEC日志检索成功", @@ -293,13 +580,49 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcSshLogPage = new Page<>(); + Page ntcSshLogPage = null; try { - ntcSshLogPage = testService.findNtcSshLogPage(new Page(request, response, NtcSshLog.class), - ntcSshLog); + testService.queryConditionCheck(auditLogThread, start, ntcSshLog, NtcSshLog.class, page); + ntcSshLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcSshLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcSshLog, + Configurations.getStringProperty(NtcSshLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcSshLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcSshLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcSshLog.class); + ntcSshLogPage.setList(List); + ntcSshLogPage.setCount(List.size()); + } else { + ntcSshLogPage.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, "SSH日志检索失败"); + } + throw ((RestServiceException) e); } return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSH日志检索成功", @@ -314,15 +637,50 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcFtpLogPage = new Page<>(); + Page ntcFtpLogPage = null; try { - ntcFtpLogPage = testService.findNtcFtpLogPage(new Page(request, response, NtcSshLog.class), - ntcFtpLog); + testService.queryConditionCheck(auditLogThread, start, ntcFtpLog, NtcFtpLog.class, page); + ntcFtpLogPage = new Page(); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcFtpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, ntcFtpLog, + Configurations.getStringProperty(NtcFtpLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcFtpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + ntcFtpLogPage.setList(new ArrayList()); + } else { + List list = new ArrayList(); + 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 List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcFtpLog.class); + ntcFtpLogPage.setList(List); + ntcFtpLogPage.setCount(List.size()); + } else { + ntcFtpLogPage.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, "FTP日志检索失败"); + } + throw ((RestServiceException) e); } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功", ntcFtpLogPage, 0); } @@ -335,7 +693,7 @@ public class LogController extends BaseRestController { SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); - Page ntcPzReportPage = new Page<>(); + Page ntcPzReportPage = null; try { ntcPzReportPage = testService.findNtcPzReport(new Page(request, response, NtcPzReport.class), ntcPzReport); diff --git a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml index 0ed5cfc..c6ba3e9 100644 --- a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml +++ b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml @@ -40,10 +40,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 1c09e6f..8385f14 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -62,7 +62,7 @@ bonecp.hive.statementsCacheSize=100 ##################################################################################################################################### #redis.host=10.0.6.228 redis.host=10.0.6.249 -redis.port=6380 +redis.port=6379 redis.pass= redis.maxIdle=5 redis.maxTotal=250 diff --git a/src/main/resources/redis.properties b/src/main/resources/redis.properties deleted file mode 100644 index 9a6f198..0000000 --- a/src/main/resources/redis.properties +++ /dev/null @@ -1,10 +0,0 @@ -##################################################################################################################################### -##redis连接 -##################################################################################################################################### -redis.host=10.0.6.228 -redis.port=6379 -redis.pass= -redis.maxIdle=10 -redis.maxTotal=15 -redis.maxWaitMillis=1000 -redis.testOnBorrow=true diff --git a/src/main/resources/table.properties b/src/main/resources/table.properties index 27fef91..476fc6f 100644 --- a/src/main/resources/table.properties +++ b/src/main/resources/table.properties @@ -1,16 +1,15 @@ #由于数据中心hive日志表的表名会变动,所以本系统中将日志的表名提取到配置文件中方便后期修改,key是bean的名称+HiveTable,value是hive的实际表名 NtcIpLogHiveTable=NTC_IP_LOG NtcHttpLogHiveTable=NTC_HTTP_LOG - - - - - - - - - - +NtcDnsLogHiveTable=NTC_DNS_LOG +NtcMailLogHiveTable=NTC_MAIL_LOG +NtcSslLogHiveTable=NTC_SSL_LOG +NtcPptpLogHiveTable=NTC_PPTP_LOG +NtcL2tpLogHiveTable=NTC_L2TP_LOG +NtcOpenvpnLogHiveTable=NTC_OPENVPN_LOG +NtcIpsecLogHiveTable=NTC_IPSEC_LOG +NtcSshLogHiveTable=NTC_SSH_LOG +NtcFtpLogHiveTable=NTC_FTP_LOG