1、接口date类型去掉时区,并将日期格式设置为yyyy-MM-dd HH:mm:ss;
2、添加配置日志总量统计服务接口示例; 3、为DNS响应策略配置(service=65)和DNS欺骗地址(service=65)添加配置文件;
This commit is contained in:
@@ -11,6 +11,8 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigSource;
|
||||
@@ -44,8 +45,6 @@ import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
import com.wordnik.swagger.annotations.ApiParam;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @ClassName: ConfigSourcesController
|
||||
* @Description: 配置存储服务
|
||||
@@ -339,6 +338,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
validateConfigSource(thread, start, configSource);
|
||||
Long benginTime = System.currentTimeMillis();
|
||||
String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
|
||||
// String msg = "";
|
||||
if ("error".equals(msg)) {
|
||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
@@ -635,7 +635,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
}
|
||||
JSONObject jsonObj = new JSONObject();
|
||||
// jsonObj.put("accessUrl", filePath.substring(filePath.indexOf("group")));
|
||||
jsonObj.put("accessUrl", "filePath");
|
||||
jsonObj.put("accessUrl", filePath);
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "文件上传成功", jsonObj);
|
||||
}
|
||||
|
||||
@@ -647,7 +647,6 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
file, null);
|
||||
// JSONArray fileArray=new JSONArray();
|
||||
if (file == null) {
|
||||
thread.setExceptionInfo("请上传获取摘要的文件到file");
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请上传获取摘要的文件到file参数",
|
||||
@@ -681,21 +680,24 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
// resultObject.put("path", filePath.substring(filePath.indexOf("group")));
|
||||
resultObject.put("path", filePath);
|
||||
}
|
||||
|
||||
String tempFilePath = request.getRealPath(File.separator) + "upload" + File.separator
|
||||
+ (new Date()).getTime() + file.getOriginalFilename();
|
||||
file.transferTo(new File(tempFilePath));
|
||||
System.out.println("------------" + tempFilePath);
|
||||
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
|
||||
resultObject.put("digest", digestStr);
|
||||
resultObject.put("rawLen", file.getSize());
|
||||
FileUtils.deleteFile(tempFilePath);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("文件上传过程中出现异常");
|
||||
thread.setExceptionInfo("文件上传过程中出现异常");
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "文件上传过程中出现异常",
|
||||
RestBusinessCode.unknow_error.getValue());
|
||||
}
|
||||
try {
|
||||
String tempFilePath = request.getRealPath(File.separator) + "upload" + File.separator
|
||||
+ (new Date()).getTime() + file.getOriginalFilename();
|
||||
file.transferTo(new File(tempFilePath));
|
||||
//System.out.println("------------" + tempFilePath);
|
||||
System.out.println("摘要获取开始:---------------");
|
||||
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
|
||||
System.out.println("摘要获取结束:---------------:"+digestStr);
|
||||
resultObject.put("digest", digestStr);
|
||||
resultObject.put("rawLen", file.getSize());
|
||||
FileUtils.deleteFile(tempFilePath);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
package com.nis.web.controller.restful;
|
||||
|
||||
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;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.*;
|
||||
import com.nis.domain.restful.NtcDnsLog;
|
||||
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;
|
||||
import com.nis.domain.restful.NtcMailLog;
|
||||
import com.nis.domain.restful.NtcOpenvpnLog;
|
||||
import com.nis.domain.restful.NtcPptpLog;
|
||||
import com.nis.domain.restful.NtcPzReport;
|
||||
import com.nis.domain.restful.NtcSshLog;
|
||||
import com.nis.domain.restful.NtcSslLog;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseRestController;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
@@ -9,15 +31,6 @@ import com.nis.web.service.ServicesRequestLogService;
|
||||
import com.nis.web.service.restful.LogTestService;
|
||||
import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by darnell on 2018/6/10.
|
||||
@@ -112,7 +125,7 @@ public class LogController extends BaseRestController{
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/ntcSSLLogs", method = RequestMethod.GET)
|
||||
@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();
|
||||
@@ -251,7 +264,21 @@ public class LogController extends BaseRestController{
|
||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功", ntcFtpLogPage, 0);
|
||||
}
|
||||
|
||||
@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();
|
||||
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
|
||||
Page<?> ntcPzReportPage = new Page<>();
|
||||
try {
|
||||
ntcPzReportPage = testService.findNtcPzReport(new Page<NtcPzReport>(request, response,NtcPzReport.class), ntcPzReport);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "配置总量统计成功", ntcPzReportPage, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user