2018-06-10 16:18:34 +08:00
|
|
|
|
package com.nis.web.controller.restful;
|
|
|
|
|
|
|
2018-07-02 16:10:48 +08:00
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
import java.util.List;
|
2018-06-22 10:48:53 +08:00
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
2018-07-02 16:10:48 +08:00
|
|
|
|
import com.nis.domain.LogEntity;
|
2018-06-10 16:18:34 +08:00
|
|
|
|
import com.nis.domain.Page;
|
2018-07-13 12:06:34 +08:00
|
|
|
|
import com.nis.domain.restful.DkBehaviorLog;
|
2018-07-06 09:06:08 +08:00
|
|
|
|
import com.nis.domain.restful.NtcAppLog;
|
2018-07-16 14:36:43 +08:00
|
|
|
|
import com.nis.domain.restful.NtcAttrTypeReport;
|
2018-07-06 09:06:08 +08:00
|
|
|
|
import com.nis.domain.restful.NtcDdosLog;
|
2018-07-16 14:36:43 +08:00
|
|
|
|
import com.nis.domain.restful.NtcDestipCountryReport;
|
2018-06-22 10:48:53 +08:00
|
|
|
|
import com.nis.domain.restful.NtcDnsLog;
|
2018-07-16 14:36:43 +08:00
|
|
|
|
import com.nis.domain.restful.NtcEntranceReport;
|
2018-06-22 10:48:53 +08:00
|
|
|
|
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.NtcL2tpLog;
|
2018-07-16 14:36:43 +08:00
|
|
|
|
import com.nis.domain.restful.NtcLwhhReport;
|
2018-06-22 10:48:53 +08:00
|
|
|
|
import com.nis.domain.restful.NtcMailLog;
|
|
|
|
|
|
import com.nis.domain.restful.NtcOpenvpnLog;
|
|
|
|
|
|
import com.nis.domain.restful.NtcPptpLog;
|
|
|
|
|
|
import com.nis.domain.restful.NtcPzReport;
|
2018-07-12 16:34:17 +08:00
|
|
|
|
import com.nis.domain.restful.NtcReportEntity;
|
2018-07-16 14:36:43 +08:00
|
|
|
|
import com.nis.domain.restful.NtcServiceReport;
|
|
|
|
|
|
import com.nis.domain.restful.NtcSrcipDomesticReport;
|
2018-06-22 10:48:53 +08:00
|
|
|
|
import com.nis.domain.restful.NtcSshLog;
|
|
|
|
|
|
import com.nis.domain.restful.NtcSslLog;
|
2018-07-16 14:36:43 +08:00
|
|
|
|
import com.nis.domain.restful.NtcTagReport;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
import com.nis.restful.RestServiceException;
|
|
|
|
|
|
import com.nis.util.Configurations;
|
2018-06-10 16:18:34 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
import com.nis.util.DateUtils;
|
|
|
|
|
|
import com.nis.util.HiveJDBC;
|
|
|
|
|
|
import com.nis.util.JsonMapper;
|
2018-06-10 16:18:34 +08:00
|
|
|
|
import com.nis.web.controller.BaseRestController;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
import com.nis.web.service.HiveSqlService;
|
2018-06-10 16:18:34 +08:00
|
|
|
|
import com.nis.web.service.SaveRequestLogThread;
|
|
|
|
|
|
import com.nis.web.service.ServicesRequestLogService;
|
|
|
|
|
|
import com.nis.web.service.restful.LogTestService;
|
2018-07-12 16:34:17 +08:00
|
|
|
|
import com.nis.web.service.restful.NtcReportService;
|
2018-06-10 16:18:34 +08:00
|
|
|
|
import com.wordnik.swagger.annotations.Api;
|
|
|
|
|
|
import com.wordnik.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2018-07-02 16:10:48 +08:00
|
|
|
|
*
|
|
|
|
|
|
* <p>Title: LogController</p>
|
|
|
|
|
|
* <p>Description: 日志查询controller</p>
|
|
|
|
|
|
* <p>Company: IIE</p>
|
|
|
|
|
|
* @author rkg
|
|
|
|
|
|
* @date 2018年7月2日
|
|
|
|
|
|
*
|
2018-06-10 16:18:34 +08:00
|
|
|
|
*/
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
@RequestMapping("${servicePath}/log/v1")
|
|
|
|
|
|
@Api(value = "LogController", description = "配置命中日志基本服务接口")
|
2018-07-02 16:10:48 +08:00
|
|
|
|
public class LogController extends BaseRestController {
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
public LogTestService testService;
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
protected ServicesRequestLogService servicesRequestLogService;
|
2018-07-12 16:34:17 +08:00
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
protected NtcReportService ntcReportService;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcIpLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "IP地址日志查询", httpMethod = "GET", notes = "对应配置为IP地址管理,存储动作为阻断与监测的命中日志。对日志功能IP地址提供数据基础查询服务")
|
|
|
|
|
|
public Map<String, ?> ntcIpLogs(Page page, NtcIpLog ntcIpLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
Page<NtcIpLog> ntcIpLogPage = null;
|
|
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcIpLog);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcIpLog, NtcIpLog.class, page);
|
|
|
|
|
|
ntcIpLogPage = new Page<NtcIpLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcIpLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcIpLogPage.setPageSize(page.getPageSize());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
2018-07-02 18:12:47 +08:00
|
|
|
|
orderBy = Page.getOrderBySql(NtcIpLog.class.getSimpleName(), page.getOrderBy());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "found_Time";
|
|
|
|
|
|
}
|
|
|
|
|
|
ResultSet rs = HiveSqlService.getResultSet(page, ntcIpLog,
|
|
|
|
|
|
Configurations.getStringProperty(NtcIpLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"),
|
|
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcIpLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcIpLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
List list = new ArrayList();
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 16:10:48 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcIpLog> List = (java.util.List<NtcIpLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcIpLog.class);
|
|
|
|
|
|
ntcIpLogPage.setList(List);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
ntcIpLogPage.setCount(List.size());
|
2018-07-05 13:42:37 +08:00
|
|
|
|
// ntcIpLogPage
|
|
|
|
|
|
// .setCount(
|
|
|
|
|
|
// HiveSqlService.getHivePageCount(ntcIpLog, null,
|
|
|
|
|
|
// Configurations.getStringProperty(
|
|
|
|
|
|
// NtcIpLog.class.getSimpleName() + "HiveTable", "ntc_ip_log"),
|
|
|
|
|
|
// getCol2Col(), null));
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcIpLogPage.setList(new ArrayList());
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcIpLogPage.setCount(0l);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
2018-07-02 18:12:47 +08:00
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "IP地址日志检索失败");
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功",
|
|
|
|
|
|
ntcIpLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcHttpLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "HTTP日志查询", httpMethod = "GET", notes = "对应配置为“网站管理-HTTP”,存储动作为阻断与监测的命中日志。对日志功能“网站管理-HTTP”提供数据基础查询服务")
|
|
|
|
|
|
public Map<String, ?> ntcHttpLogs(Page page, NtcHttpLog ntcHttpLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcHttpLog> ntcHttpLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcHttpLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcHttpLog, NtcHttpLog.class, page);
|
|
|
|
|
|
ntcHttpLogPage = new Page<NtcHttpLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcHttpLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcHttpLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcHttpLog.class.getSimpleName() + "HiveTable", "ntc_http_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcHttpLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcHttpLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcHttpLog> List = (java.util.List<NtcHttpLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcHttpLog.class);
|
|
|
|
|
|
ntcHttpLogPage.setList(List);
|
|
|
|
|
|
ntcHttpLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcHttpLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Http日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Http日志检索成功",
|
|
|
|
|
|
ntcHttpLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcDnsLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "DNS日志查询", httpMethod = "GET", notes = "对应配置为“网站管理-DNS”,存储动作为阻断与监测的命中日志。对日志功能“网站管理-DNS”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcDnsLogs(Page page, NtcDnsLog ntcDnsLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcDnsLog> ntcDnsLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcDnsLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcDnsLog, NtcDnsLog.class, page);
|
|
|
|
|
|
ntcDnsLogPage = new Page<NtcDnsLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcDnsLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcDnsLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcDnsLog.class.getSimpleName() + "HiveTable", "ntc_dns_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcDnsLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcDnsLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcDnsLog> List = (java.util.List<NtcDnsLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcDnsLog.class);
|
|
|
|
|
|
ntcDnsLogPage.setList(List);
|
|
|
|
|
|
ntcDnsLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcDnsLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Dns日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Dns日志检索成功",
|
|
|
|
|
|
ntcDnsLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcMailLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "EMAIL日志查询", httpMethod = "GET", notes = "对应配置为“邮件管理”,存储动作为阻断与监测的命中日志。对日志功能“邮件管理”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcMailLogs(Page page, NtcMailLog ntcMailLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcMailLog> ntcMailLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcMailLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcMailLog, NtcMailLog.class, page);
|
|
|
|
|
|
ntcMailLogPage = new Page<NtcMailLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcMailLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcMailLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcMailLog.class.getSimpleName() + "HiveTable", "ntc_mail_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcMailLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcMailLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcMailLog> List = (java.util.List<NtcMailLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcMailLog.class);
|
|
|
|
|
|
ntcMailLogPage.setList(List);
|
|
|
|
|
|
ntcMailLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcMailLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Mail日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Mail日志检索成功",
|
|
|
|
|
|
ntcMailLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcSslLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "SSL日志查询", httpMethod = "GET", notes = "对应配置为“网站管理-SSL”,存储动作为阻断与监测的命中日志。对日志功能“网站管理-SSL”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcSslLogs(Page page, NtcSslLog ntcSslLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcSslLog> ntcSslLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcSslLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcSslLog, NtcSslLog.class, page);
|
|
|
|
|
|
ntcSslLogPage = new Page<NtcSslLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcSslLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcSslLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcSslLog.class.getSimpleName() + "HiveTable", "ntc_ssl_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcSslLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcSslLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcSslLog> List = (java.util.List<NtcSslLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcSslLog.class);
|
|
|
|
|
|
ntcSslLogPage.setList(List);
|
|
|
|
|
|
ntcSslLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcSslLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "SSL日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSL日志检索成功",
|
|
|
|
|
|
ntcSslLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcPptpLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "PPTP日志查询", httpMethod = "GET", notes = "对应配置为“隧道管理-PPTP”,存储动作为阻断与监测的命中日志。对日志功能“隧道管理-PPTP”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcPptpLogs(Page page, NtcPptpLog ntcPptpLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcPptpLog> ntcPptpLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcPptpLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcPptpLog, NtcPptpLog.class, page);
|
|
|
|
|
|
ntcPptpLogPage = new Page<NtcPptpLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcPptpLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcPptpLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcPptpLog.class.getSimpleName() + "HiveTable", "ntc_pptp_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcPptpLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcPptpLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcPptpLog> List = (java.util.List<NtcPptpLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcPptpLog.class);
|
|
|
|
|
|
ntcPptpLogPage.setList(List);
|
|
|
|
|
|
ntcPptpLogPage.setCount(List.size());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ntcPptpLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "PPTP日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PPTP日志检索成功",
|
|
|
|
|
|
ntcPptpLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcL2tpLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "L2TP日志查询", httpMethod = "GET", notes = "对应配置为“隧道管理-L2TP”,存储动作为阻断与监测的命中日志。对日志功能“隧道管理- L2TP”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcL2tpLogs(Page page, NtcL2tpLog ntcL2tpLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcL2tpLog> ntcL2tpLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcL2tpLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcL2tpLog, NtcL2tpLog.class, page);
|
|
|
|
|
|
ntcL2tpLogPage = new Page<NtcL2tpLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcL2tpLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcL2tpLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcL2tpLog.class.getSimpleName() + "HiveTable", "ntc_l2tp_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcL2tpLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcL2tpLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcL2tpLog> List = (java.util.List<NtcL2tpLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcL2tpLog.class);
|
|
|
|
|
|
ntcL2tpLogPage.setList(List);
|
|
|
|
|
|
ntcL2tpLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcL2tpLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "L2TP日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "L2TP日志检索成功",
|
|
|
|
|
|
ntcL2tpLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcOpenvpnLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "OPENVPN日志查询", httpMethod = "GET", notes = "对应配置为“隧道管理-OPENVPN”,存储动作为阻断与监测的命中日志。对日志功能“隧道管理- OPENVPN”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcOpenvpnLogs(Page page, NtcOpenvpnLog ntcOpenvpnLog, Model model,
|
|
|
|
|
|
HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcOpenvpnLog> ntcOpenvpnLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcOpenvpnLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcOpenvpnLog, NtcOpenvpnLog.class, page);
|
|
|
|
|
|
ntcOpenvpnLogPage = new Page<NtcOpenvpnLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcOpenvpnLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcOpenvpnLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcOpenvpnLog.class.getSimpleName() + "HiveTable", "ntc_openvpn_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcOpenvpnLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcOpenvpnLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcOpenvpnLog> List = (java.util.List<NtcOpenvpnLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcOpenvpnLog.class);
|
|
|
|
|
|
ntcOpenvpnLogPage.setList(List);
|
|
|
|
|
|
ntcOpenvpnLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcOpenvpnLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "Openvpn日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "Openvpn日志检索成功",
|
|
|
|
|
|
ntcOpenvpnLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcIpsecLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "IPSEC日志查询", httpMethod = "GET", notes = "对应配置为“隧道管理-IPSEC”,存储动作为监测的命中日志。对日志功能“隧道管理- IPSEC”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcIpsecLogs(Page page, NtcIpsecLog ntcIpsecLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcIpsecLog> ntcIpsecLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcIpsecLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcIpsecLog, NtcIpsecLog.class, page);
|
|
|
|
|
|
ntcIpsecLogPage = new Page<NtcIpsecLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcIpsecLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcIpsecLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcIpsecLog.class.getSimpleName() + "HiveTable", "ntc_ipsec_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcIpsecLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcIpsecLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcIpsecLog> List = (java.util.List<NtcIpsecLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcIpsecLog.class);
|
|
|
|
|
|
ntcIpsecLogPage.setList(List);
|
|
|
|
|
|
ntcIpsecLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcIpsecLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "IPSEC日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IPSEC日志检索成功",
|
|
|
|
|
|
ntcIpsecLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcSshLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "SSH日志查询", httpMethod = "GET", notes = "对应配置为“隧道管理-SSH”,存储动作为阻断与监测的命中日志。对日志功能“隧道管理- SSH”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcSshLogs(Page page, NtcSshLog ntcSshLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcSshLog> ntcSshLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcSshLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcSshLog, NtcSshLog.class, page);
|
|
|
|
|
|
ntcSshLogPage = new Page<NtcSshLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcSshLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcSshLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcSshLog.class.getSimpleName() + "HiveTable", "ntc_ssh_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcSshLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcSshLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcSshLog> List = (java.util.List<NtcSshLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcSshLog.class);
|
|
|
|
|
|
ntcSshLogPage.setList(List);
|
|
|
|
|
|
ntcSshLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcSshLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "SSH日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "SSH日志检索成功",
|
|
|
|
|
|
ntcSshLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcFtpLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "FTP日志查询", httpMethod = "GET", notes = "对应配置为“文件传输-FTP”,存储动作为阻断与监测的命中日志。对日志功能“文件传输-FTP”提供数据基础查询服务。")
|
|
|
|
|
|
public Map<String, ?> ntcFtpLogs(Page page, NtcFtpLog ntcFtpLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<NtcFtpLog> ntcFtpLogPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-05 13:42:37 +08:00
|
|
|
|
resetTime(ntcFtpLog);
|
2018-07-02 18:12:47 +08:00
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcFtpLog, NtcFtpLog.class, page);
|
|
|
|
|
|
ntcFtpLogPage = new Page<NtcFtpLog>();
|
2018-07-05 13:42:37 +08:00
|
|
|
|
ntcFtpLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcFtpLogPage.setPageSize(page.getPageSize());
|
2018-07-02 18:12:47 +08:00
|
|
|
|
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,
|
2018-07-06 09:06:08 +08:00
|
|
|
|
Configurations.getStringProperty(NtcFtpLog.class.getSimpleName() + "HiveTable", "ntc_ftp_log"),
|
2018-07-02 18:12:47 +08:00
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcFtpLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcFtpLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-02 18:12:47 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcFtpLog> List = (java.util.List<NtcFtpLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcFtpLog.class);
|
|
|
|
|
|
ntcFtpLogPage.setList(List);
|
|
|
|
|
|
ntcFtpLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcFtpLogPage.setList(new ArrayList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-02 18:12:47 +08:00
|
|
|
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
logger.error(e);
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "FTP日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功",
|
|
|
|
|
|
ntcFtpLogPage, 0);
|
|
|
|
|
|
}
|
2018-07-06 09:06:08 +08:00
|
|
|
|
@RequestMapping(value = "/ntcAppLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "App日志查询", httpMethod = "GET", notes = "对应配置为“App管理”,存储动作为阻断与监测的命中日志。对日志功能“APP策略日志”提供数据基础查询服务")
|
|
|
|
|
|
public Map<String, ?> ntcAppLogs(Page page, NtcAppLog ntcAppLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<NtcAppLog> ntcAppLogPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetTime(ntcAppLog);
|
|
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcAppLog, NtcAppLog.class, page);
|
|
|
|
|
|
ntcAppLogPage = new Page<NtcAppLog>();
|
|
|
|
|
|
ntcAppLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcAppLogPage.setPageSize(page.getPageSize());
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcAppLog.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "found_Time";
|
|
|
|
|
|
}
|
|
|
|
|
|
ResultSet rs = HiveSqlService.getResultSet(page, ntcAppLog,
|
|
|
|
|
|
Configurations.getStringProperty(NtcAppLog.class.getSimpleName() + "HiveTable", "ntc_app_log"),
|
|
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcAppLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcAppLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-06 09:06:08 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcAppLog> List = (java.util.List<NtcAppLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcAppLog.class);
|
|
|
|
|
|
ntcAppLogPage.setList(List);
|
|
|
|
|
|
ntcAppLogPage.setCount(List.size());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
|
2018-07-06 09:06:08 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
ntcAppLogPage.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, "App日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "App日志检索成功",
|
|
|
|
|
|
ntcAppLogPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/ntcDdosLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "DDos日志查询", httpMethod = "GET", notes = "对应配置为“DDOS日志监控”,存储动作为丢弃的命中日志。对日志功能“DDOS日志监控”提供数据基础查询服务")
|
|
|
|
|
|
public Map<String, ?> ntcDdosLogs(Page page, NtcDdosLog ntcDdosLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<NtcDdosLog> ntcDdosLogPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetTime(ntcDdosLog);
|
|
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, ntcDdosLog, NtcDdosLog.class, page);
|
|
|
|
|
|
ntcDdosLogPage = new Page<NtcDdosLog>();
|
|
|
|
|
|
ntcDdosLogPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
ntcDdosLogPage.setPageSize(page.getPageSize());
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcDdosLog.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "found_Time";
|
|
|
|
|
|
}
|
|
|
|
|
|
ResultSet rs = HiveSqlService.getResultSet(page, ntcDdosLog,
|
|
|
|
|
|
Configurations.getStringProperty(NtcDdosLog.class.getSimpleName() + "HiveTable", "ntc_ddos_log"),
|
|
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, NtcDdosLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
ntcDdosLogPage.setList(new ArrayList());
|
|
|
|
|
|
} else {
|
2018-07-06 18:07:16 +08:00
|
|
|
|
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());
|
|
|
|
|
|
// }
|
2018-07-06 09:06:08 +08:00
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
String jsonString = JsonMapper.toJsonString(list);
|
|
|
|
|
|
List<NtcDdosLog> List = (java.util.List<NtcDdosLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcDdosLog.class);
|
|
|
|
|
|
ntcDdosLogPage.setList(List);
|
|
|
|
|
|
ntcDdosLogPage.setCount(List.size());
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ntcDdosLogPage.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, "DDos日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功",
|
|
|
|
|
|
ntcDdosLogPage, 0);
|
|
|
|
|
|
}
|
2018-07-13 12:06:34 +08:00
|
|
|
|
@RequestMapping(value = "/dkBehaviorLogs", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "行为识别日志查询", httpMethod = "GET", notes = "对日志功能“行为识别”提供数据基础查询服务")
|
|
|
|
|
|
public Map<String, ?> dkBehaviorLogs(Page page, DkBehaviorLog dkBehaviorLog, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<DkBehaviorLog> logPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetTime(dkBehaviorLog);
|
|
|
|
|
|
testService.queryConditionCheck(auditLogThread, start, dkBehaviorLog, DkBehaviorLog.class, page);
|
|
|
|
|
|
logPage = new Page<DkBehaviorLog>();
|
|
|
|
|
|
logPage.setPageNo(page.getPageNo());
|
|
|
|
|
|
logPage.setPageSize(page.getPageSize());
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(DkBehaviorLog.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "found_Time";
|
|
|
|
|
|
}
|
|
|
|
|
|
ResultSet rs = HiveSqlService.getResultSet(page, dkBehaviorLog,
|
|
|
|
|
|
Configurations.getStringProperty(DkBehaviorLog.class.getSimpleName() + "HiveTable", "DK_BEHAVIOR_LOG"),
|
|
|
|
|
|
getCol2Col(), orderBy, null);
|
|
|
|
|
|
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, DkBehaviorLog.class, "foundTime",
|
|
|
|
|
|
"recvTime");
|
|
|
|
|
|
if (tableMapping == null) {
|
|
|
|
|
|
logPage.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<DkBehaviorLog> List = (java.util.List<DkBehaviorLog>) JsonMapper.fromJsonList(jsonString,
|
|
|
|
|
|
NtcDdosLog.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, "行为识别日志检索失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "行为识别日志检索成功",
|
|
|
|
|
|
logPage, 0);
|
|
|
|
|
|
}
|
2018-07-02 16:10:48 +08:00
|
|
|
|
@RequestMapping(value = "/ntcPzReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "配置日志总量统计", httpMethod = "GET", notes = "配置命中日志数量实时统计报表,对外提供多种数据表现形式,具体可应用于界面配置命中总量业务、配置报表业务等")
|
|
|
|
|
|
public Map<String, ?> ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
2018-07-12 16:34:17 +08:00
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
2018-07-02 16:10:48 +08:00
|
|
|
|
request, null);
|
|
|
|
|
|
|
2018-07-02 18:12:47 +08:00
|
|
|
|
Page<?> ntcPzReportPage = null;
|
2018-07-02 16:10:48 +08:00
|
|
|
|
try {
|
2018-07-12 16:34:17 +08:00
|
|
|
|
resetReportTime(ntcPzReport);
|
|
|
|
|
|
//验证实时报表
|
2018-07-16 14:36:43 +08:00
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcPzReport, NtcPzReport.class, page);
|
2018-07-12 16:34:17 +08:00
|
|
|
|
//验证serachCfgId
|
|
|
|
|
|
ntcReportService.checkNumericCondition(saveLogThread,start,ntcPzReport.getSearchCfgId(),"searchCfgId");
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcPzReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
ntcPzReportPage = ntcReportService.findNtcPzReport(new Page<NtcPzReport>(request, response, NtcPzReport.class),
|
2018-07-02 16:10:48 +08:00
|
|
|
|
ntcPzReport);
|
|
|
|
|
|
} catch (Exception e) {
|
2018-07-12 16:34:17 +08:00
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
2018-07-02 16:10:48 +08:00
|
|
|
|
e.printStackTrace();
|
2018-07-12 16:34:17 +08:00
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "配置日志总量统计失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
2018-07-02 16:10:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-07-12 16:34:17 +08:00
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "配置日志总量统计成功",
|
2018-07-02 16:10:48 +08:00
|
|
|
|
ntcPzReportPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-07-16 14:36:43 +08:00
|
|
|
|
@RequestMapping(value = "/ntcServiceReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "业务类型统计查询服务", httpMethod = "GET", notes = "业务类型统计查询服务,基于业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcServiceReport(Page page, NtcServiceReport ntcServiceReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcServiceReport);
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcServiceReport, NtcServiceReport.class, page);
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcServiceReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcServiceReport(new Page<NtcServiceReport>(request, response, NtcServiceReport.class),
|
|
|
|
|
|
ntcServiceReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "业务类型统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "业务类型统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcTagReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "标签统计查询服务", httpMethod = "GET", notes = "标签统计查询服务,基于标签与业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcTagReport(Page page, NtcTagReport ntcTagReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcTagReport);
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcTagReport, NtcTagReport.class, page);
|
|
|
|
|
|
//验证serachTag
|
|
|
|
|
|
ntcReportService.checkNumericCondition(saveLogThread,start,ntcTagReport.getSearchTag(),"searchTag");
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcTagReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcTagReport(new Page<NtcTagReport>(request, response, NtcTagReport.class),
|
|
|
|
|
|
ntcTagReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "标签统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "标签统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/ntcAttrTypeReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "性质统计查询服务", httpMethod = "GET", notes = "性质统计查询服务,基于性质与业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcAttrTypeReport(Page page, NtcAttrTypeReport ntcAttrTypeReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcAttrTypeReport);
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcAttrTypeReport, NtcAttrTypeReport.class, page);
|
|
|
|
|
|
//验证searchAttrType
|
|
|
|
|
|
ntcReportService.checkNumericCondition(saveLogThread,start,ntcAttrTypeReport.getSearchAttrType(),"searchAttrType");
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcAttrTypeReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcAttrTypeReport(new Page<NtcAttrTypeReport>(request, response, NtcAttrTypeReport.class),
|
|
|
|
|
|
ntcAttrTypeReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "性质统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "性质统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
2018-07-06 18:07:16 +08:00
|
|
|
|
|
2018-07-16 14:36:43 +08:00
|
|
|
|
@RequestMapping(value = "/ntcLwhhReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "来文函号统计查询服务", httpMethod = "GET", notes = "来文函号统计查询服务,基于来文函号与业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcLwhhReport(Page page, NtcLwhhReport ntcLwhhReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcLwhhReport);
|
|
|
|
|
|
//验证实时报表
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcLwhhReport, NtcLwhhReport.class, page);
|
|
|
|
|
|
//验证serachCfgId
|
|
|
|
|
|
ntcReportService.checkNumericCondition(saveLogThread,start,ntcLwhhReport.getSearchLwhh(),"searchLwhh");
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcLwhhReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcLwhhReport(new Page<NtcLwhhReport>(request, response, NtcLwhhReport.class),
|
|
|
|
|
|
ntcLwhhReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "来文函号统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "来文函号统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcSrcipDomesticReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "境内源IP统计查询服务", httpMethod = "GET", notes = "境内源IP统计查询服务,基于源IP所属省、市与业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcSrcipDomesticReport(Page page, NtcSrcipDomesticReport ntcSrcipDomesticReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcSrcipDomesticReport);
|
|
|
|
|
|
//验证实时报表
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcSrcipDomesticReport, NtcSrcipDomesticReport.class, page);
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcSrcipDomesticReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcSrcipDomesticReport(new Page<NtcSrcipDomesticReport>(request, response, NtcSrcipDomesticReport.class),
|
|
|
|
|
|
ntcSrcipDomesticReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "境内源IP统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "境内源IP统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcDestipCountryReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "各国家目的IP统计查询服务", httpMethod = "GET", notes = "各国家目的IP统计查询服务,基于目的IP所属国家与业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcDestipCountryReport(Page page, NtcDestipCountryReport ntcDestipCountryReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcDestipCountryReport);
|
|
|
|
|
|
//验证实时报表
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcDestipCountryReport, NtcDestipCountryReport.class, page);
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcDestipCountryReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcDestipCountryReport(new Page<NtcDestipCountryReport>(request, response, NtcDestipCountryReport.class),
|
|
|
|
|
|
ntcDestipCountryReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "各国家目的IP统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "各国家目的IP统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/ntcEntranceReport", method = RequestMethod.GET)
|
|
|
|
|
|
@ApiOperation(value = "运营商局点统计查询服务", httpMethod = "GET", notes = "运营商局点统计查询服务,基于出入口与业务类型(service)维度聚合")
|
|
|
|
|
|
public Map<String, ?> ntcEntranceReport(Page page, NtcEntranceReport ntcEntranceReport, Model model, HttpServletRequest request,
|
|
|
|
|
|
HttpServletResponse response) {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
|
|
|
|
|
|
request, null);
|
|
|
|
|
|
|
|
|
|
|
|
Page<?> reportPage = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
resetReportTime(ntcEntranceReport);
|
|
|
|
|
|
ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcEntranceReport, NtcEntranceReport.class, page);
|
|
|
|
|
|
//验证searchEntrance
|
|
|
|
|
|
ntcReportService.checkNumericCondition(saveLogThread,start,ntcEntranceReport.getSearchEntrance(),"searchEntrance");
|
|
|
|
|
|
String orderBy = "";
|
|
|
|
|
|
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
|
|
|
|
|
|
orderBy = Page.getOrderBySql(NtcEntranceReport.class.getSimpleName(), page.getOrderBy());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
orderBy = "report_time";
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setOrderBy(orderBy);
|
|
|
|
|
|
reportPage = ntcReportService.findNtcEntranceReport(new Page<NtcEntranceReport>(request, response, NtcEntranceReport.class),
|
|
|
|
|
|
ntcEntranceReport);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
|
if (!(e instanceof RestServiceException)) {
|
|
|
|
|
|
e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "运营商局点统计查询失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
throw ((RestServiceException) e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "运营商局点统计查询成功",
|
|
|
|
|
|
reportPage, 0);
|
|
|
|
|
|
}
|
2018-07-12 16:34:17 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @Description:
|
|
|
|
|
|
* @author (zdx)
|
|
|
|
|
|
* @date 2018年7月12日 上午11:01:30
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void resetReportTime(NtcReportEntity<?> entity) throws Exception {
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchReportStartTime(),
|
|
|
|
|
|
entity.getSearchReportEndTime(), Constants.PZ_REPORT_TIME, "minute");
|
|
|
|
|
|
entity.setSearchReportStartTime(map.get("startTime"));
|
|
|
|
|
|
entity.setSearchReportEndTime(map.get("endTime"));
|
|
|
|
|
|
}
|
2018-07-06 18:07:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
2018-07-02 16:10:48 +08:00
|
|
|
|
/**
|
|
|
|
|
|
*判断开始和结束时间是否为null,如果为null则初始化时间
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void resetTime(LogEntity<?> entity) throws Exception {
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchFoundStartTime(),
|
|
|
|
|
|
entity.getSearchFoundEndTime(), Constants.LOG_LOCAL_TIME, "log");
|
|
|
|
|
|
entity.setSearchFoundStartTime(map.get("startTime"));
|
|
|
|
|
|
entity.setSearchFoundEndTime(map.get("endTime"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 将searchFoundStartTime,searchFoundEndTime与foundTime进行关联
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Map<String, Map<String, String>> getCol2Col() {
|
|
|
|
|
|
Map<String, Map<String, String>> col2col = new HashMap<String, Map<String, String>>();
|
|
|
|
|
|
Map<String, String> startMap = new HashMap<String, String>();
|
|
|
|
|
|
startMap.put("start", "foundTime");
|
|
|
|
|
|
col2col.put("searchFoundStartTime", startMap);
|
|
|
|
|
|
Map<String, String> endMap = new HashMap<String, String>();
|
|
|
|
|
|
endMap.put("end", "foundTime");
|
|
|
|
|
|
col2col.put("searchFoundEndTime", endMap);
|
|
|
|
|
|
return col2col;
|
|
|
|
|
|
}
|
2018-06-12 10:03:32 +08:00
|
|
|
|
|
2018-06-10 16:18:34 +08:00
|
|
|
|
}
|