From 6ee382738a45891933d8dba585520d8d72fba263 Mon Sep 17 00:00:00 2001 From: doufenghu Date: Thu, 19 Jul 2018 10:19:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(all):=E7=BB=86=E8=8A=82=E5=92=8C=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/domain/restful/ConfigSource.java | 2 +- .../com/nis/restful/RestServiceException.java | 7 +- .../com/nis/util/OracleErrorCodeUtil.java | 4 +- .../web/controller/BaseRestController.java | 32 +- .../restful/ConfigFileController.java | 6 +- .../restful/ConfigPzIdController.java | 4 +- .../restful/ConfigSourcesController.java | 90 +- .../restful/DashboardServiceController.java | 21 +- .../restful/DataDictionaryController.java | 18 +- .../restful/DfIpPortUdpController.java | 10 +- .../restful/DfKeyConvertUrlController.java | 4 +- .../restful/DfKeyMailAddController.java | 4 +- .../controller/restful/DmbCkController.java | 10 +- .../controller/restful/DmbPortController.java | 10 +- .../restful/DnsFakeInfoController.java | 10 +- .../restful/DnsFakeIpController.java | 10 +- .../restful/DnsGroupTypeController.java | 12 +- .../DnsResponseStrategyController.java | 14 +- .../restful/EncryptProtoRandomController.java | 10 +- .../controller/restful/FwqInfoController.java | 10 +- .../restful/IntervalTimeSearchController.java | 4 +- .../web/controller/restful/LogController.java | 56 +- .../restful/MaatTestController.java | 6 +- .../restful/ServicesRequestLogController.java | 5 +- .../restful/SystemFunStatusController.java | 6 +- ...uestLogThread.java => AuditLogThread.java} | 868 +++++++++--------- .../com/nis/web/service/BaseLogService.java | 24 +- .../service/restful/ConfigSourcesService.java | 62 +- .../restful/DfKeyConvertUrlService.java | 7 +- .../service/restful/DfKeyMailAddService.java | 4 +- .../service/restful/DnsGroupTypeService.java | 6 +- .../restful/DnsResponseStrategyService.java | 7 +- .../restful/IntervalTimeSearchService.java | 5 +- 33 files changed, 665 insertions(+), 683 deletions(-) rename src/main/java/com/nis/web/service/{SaveRequestLogThread.java => AuditLogThread.java} (86%) diff --git a/src/main/java/com/nis/domain/restful/ConfigSource.java b/src/main/java/com/nis/domain/restful/ConfigSource.java index df2432e..c7597e3 100644 --- a/src/main/java/com/nis/domain/restful/ConfigSource.java +++ b/src/main/java/com/nis/domain/restful/ConfigSource.java @@ -34,7 +34,7 @@ public class ConfigSource extends ConfigCommonSource{ /** * @Title: * @Description: TODO - * @param 入参 + * @param */ public ConfigSource() { this.version = DEFAULT_VERSION; diff --git a/src/main/java/com/nis/restful/RestServiceException.java b/src/main/java/com/nis/restful/RestServiceException.java index 7a2b40c..fa3d26e 100644 --- a/src/main/java/com/nis/restful/RestServiceException.java +++ b/src/main/java/com/nis/restful/RestServiceException.java @@ -1,9 +1,8 @@ package com.nis.restful; +import com.nis.web.service.AuditLogThread; import org.springframework.util.StringUtils; -import com.nis.web.service.SaveRequestLogThread; - public class RestServiceException extends RuntimeException{ private int errorCode; @@ -25,7 +24,7 @@ public class RestServiceException extends RuntimeException{ // super(message); // this.errorCode = 998; //未知错误 // } - public RestServiceException(SaveRequestLogThread thread,long time,String message) { + public RestServiceException(AuditLogThread thread, long time, String message) { super(message); this.errorCode = 998; //未知错误 this.traceCode = thread.getTraceCode(); @@ -42,7 +41,7 @@ public class RestServiceException extends RuntimeException{ super(message); this.errorCode = errorCode; } - public RestServiceException(SaveRequestLogThread thread,long time,String message,int errorCode) { + public RestServiceException(AuditLogThread thread, long time, String message, int errorCode) { super(message); this.errorCode = errorCode; this.traceCode = thread.getTraceCode(); diff --git a/src/main/java/com/nis/util/OracleErrorCodeUtil.java b/src/main/java/com/nis/util/OracleErrorCodeUtil.java index bda4705..10cc84a 100644 --- a/src/main/java/com/nis/util/OracleErrorCodeUtil.java +++ b/src/main/java/com/nis/util/OracleErrorCodeUtil.java @@ -5,7 +5,7 @@ import java.util.Map; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; public class OracleErrorCodeUtil { /** @@ -34,7 +34,7 @@ public class OracleErrorCodeUtil { * 根据错误码抛出对应的异常,case内容为空的时候会按照下个case的异常内容来抛出异常,修改时请注意 */ - public static void throwExceptionInfo(SaveRequestLogThread thread, long time, String errorCode) { + public static void throwExceptionInfo(AuditLogThread thread, long time, String errorCode) { switch (errorCode) { diff --git a/src/main/java/com/nis/web/controller/BaseRestController.java b/src/main/java/com/nis/web/controller/BaseRestController.java index 1808f26..455b899 100644 --- a/src/main/java/com/nis/web/controller/BaseRestController.java +++ b/src/main/java/com/nis/web/controller/BaseRestController.java @@ -17,6 +17,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.log4j.Logger; import org.springframework.http.HttpStatus; @@ -31,7 +32,6 @@ import com.nis.restful.RestResult; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.util.DateUtils; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; /** @@ -63,8 +63,8 @@ public class BaseRestController { * @version V1.0 */ - public Map serviceResponse(SaveRequestLogThread thread, long time, HttpServletRequest request, - HttpServletResponse response, String msg) { + public Map serviceResponse(AuditLogThread thread, long time, HttpServletRequest request, + HttpServletResponse response, String msg) { RestResult restResult = new RestResult(); String requestMethod = request.getMethod(); if (requestMethod.equals(RequestMethod.GET.name())) { @@ -109,8 +109,8 @@ public class BaseRestController { * 2016年8月24日 下午8:40:44 * @version V1.0 */ - public Map serviceResponse(SaveRequestLogThread thread, long time, HttpServletRequest request, - HttpServletResponse response, String msg, Object data) { + public Map serviceResponse(AuditLogThread thread, long time, HttpServletRequest request, + HttpServletResponse response, String msg, Object data) { RestResult restResult = new RestResult(); String requestMethod = request.getMethod(); if (requestMethod.equals(RequestMethod.GET.name())) { @@ -191,8 +191,8 @@ public class BaseRestController { * 2016年8月24日 下午8:40:44 * @version V1.0 */ - public Map compileServiceResponse(SaveRequestLogThread thread, long time, HttpServletRequest request, - HttpServletResponse response, String msg, Object data) { + public Map compileServiceResponse(AuditLogThread thread, long time, HttpServletRequest request, + HttpServletResponse response, String msg, Object data) { RestResult restResult = new RestResult(); String requestMethod = request.getMethod(); if (requestMethod.equals(RequestMethod.GET.name())) { @@ -229,7 +229,7 @@ public class BaseRestController { * @param logSource * @return */ - public Map serviceLogResponse(SaveRequestLogThread auditLogThread, long executedTime, HttpServletRequest request, + public Map serviceLogResponse(AuditLogThread auditLogThread, long executedTime, HttpServletRequest request, String msg, Object data, Integer logSource) { RestResult restResult = new RestResult(); String requestMethod = request.getMethod(); @@ -314,7 +314,7 @@ public class BaseRestController { * @exception @since * 1.0.0 */ - public void checkOpAction(SaveRequestLogThread thread, long time, int opAction, int need) { + public void checkOpAction(AuditLogThread thread, long time, int opAction, int need) { if (need != opAction) { switch (need) { case Constants.OPACTION_POST: @@ -338,7 +338,7 @@ public class BaseRestController { + ",对应的请求方式为" + convertOpAction(opAction) + "!", RestBusinessCode.op_action_error.getValue()); default: - throw new RestServiceException(thread, time, "操作行为错误,未找到对应的服务!", + throw new RestServiceException(thread, time, "操作行为错误,未找到属性opAction对应业务!", RestBusinessCode.op_action_error.getValue()); } } @@ -359,10 +359,10 @@ public class BaseRestController { } } - protected SaveRequestLogThread saveRequestLog(ServicesRequestLogService service, int opAction, - HttpServletRequest request, Object data) { + protected AuditLogThread saveRequestLog(ServicesRequestLogService service, int opAction, + HttpServletRequest request, Object data) { logger.debug("SaveRequestLogThread初始化开始----" + System.currentTimeMillis()); - SaveRequestLogThread thread = SaveRequestLogThread.getNewSaveRequestLogThread(request); + AuditLogThread thread = AuditLogThread.getNewSaveRequestLogThread(request); thread.setService(service); thread.setOpAction(opAction); thread.setTraceCode(sdf.format(new Date())+(Math.round((Math.random()*9+1)*10000)+"")); @@ -381,9 +381,9 @@ public class BaseRestController { } // 文件上传用 - protected SaveRequestLogThread saveRequestLog(ServicesRequestLogService service, int opAction, - HttpServletRequest request, Object data, Object fileInfo) { - SaveRequestLogThread thread = SaveRequestLogThread.getNewSaveRequestLogThread(request); + protected AuditLogThread saveRequestLog(ServicesRequestLogService service, int opAction, + HttpServletRequest request, Object data, Object fileInfo) { + AuditLogThread thread = AuditLogThread.getNewSaveRequestLogThread(request); thread.setService(service); // thread.setContent(fileInfo); thread.setOpAction(opAction); diff --git a/src/main/java/com/nis/web/controller/restful/ConfigFileController.java b/src/main/java/com/nis/web/controller/restful/ConfigFileController.java index 75ffa88..f5bbda9 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigFileController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigFileController.java @@ -13,6 +13,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -27,7 +28,6 @@ import com.nis.util.Constants; import com.nis.util.MD5Utils; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; @@ -63,7 +63,7 @@ public class ConfigFileController extends BaseRestController { "opTime:"+configFile.getOpTime() ); JSONArray fileArray=new JSONArray(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, configFile,fileArray); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, configFile,fileArray); String serviceDir=request.getRealPath("upload"); try { MultipartFile[] files=configFile.getFiles(); @@ -116,7 +116,7 @@ public class ConfigFileController extends BaseRestController { HttpServletResponse response){ long start=System.currentTimeMillis(); JSONObject fileObject=new JSONObject(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, fileObject); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, fileObject); BufferedInputStream bis = null; BufferedOutputStream bos = null; String downLoadPath=null; diff --git a/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java b/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java index 7cc4eaf..70cd792 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigPzIdController.java @@ -15,7 +15,7 @@ import com.nis.domain.restful.ConfigPzIdSource; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.ConfigPzIdService; import com.wordnik.swagger.annotations.ApiOperation; @@ -37,7 +37,7 @@ public class ConfigPzIdController extends BaseRestController { public Map configPzIdSources(ConfigPzIdSource configPzIdSource, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, configPzIdSource); try { diff --git a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java index 6e4a836..83a6c2f 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java @@ -10,6 +10,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; @@ -30,7 +31,6 @@ import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.util.StringUtils; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.fdfs.FastDFSFile; import com.nis.web.service.fdfs.FileManager; @@ -52,7 +52,7 @@ import net.sf.json.JSONObject; // @Scope("prototype") @RestController @RequestMapping("${servicePath}") -@Api(value = "ConfigSourcesController", description = "配置存储服务,包括管控、监测、白名单的控制类") +@Api(value = "ConfigSourcesController", description = "配置规则服务,主要对MAAT规则和回调规则做解析、存储与更新操作") public class ConfigSourcesController extends BaseRestController { @Autowired @@ -65,55 +65,49 @@ public class ConfigSourcesController extends BaseRestController { - - @RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.POST) - @ApiOperation(value = "业务配置存储", httpMethod = "POST", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)存储") - @ApiParam(value = "业务配置数据源", name = "configSource", required = true) - public Map createConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request, + @ApiOperation(value = "MAAT规则存储接口", httpMethod = "POST", response = Map.class, notes = "接收MAAT规则数据,存储到流量处理平台配置线中") + @ApiParam(value = "MAAT规则对象", name = "configSource", required = true) + public Map createMaatConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request, HttpServletResponse response) { CompileVal.setBusinessCode(null); ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, configSource); + StringBuffer sb = new StringBuffer(); if (null != configSource && null != configSource.getConfigCompileList() && configSource.getConfigCompileList().size() > 0) { - int opAction = configSource.getOpAction(); - checkOpAction(thread, System.currentTimeMillis() - start, opAction, 1); + checkOpAction(thread, System.currentTimeMillis() - start, configSource.getOpAction(), Constants.OPACTION_POST); // 验证配置编译数据 validateConfigSource(thread, start, configSource); - Long benginTime = System.currentTimeMillis(); String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb); -// String msg = ""; - if ("error".equals(msg)) { + + if ("error".equals(msg)) { Exception exception = ConfigSourcesService.getMsgList().get(0); throw new RestServiceException(thread, System.currentTimeMillis() - start, - "存储编译配置时出现异常" + exception.getMessage(),CompileVal.getBusinessCode()); + "Maat 规则存储异常" + exception.getMessage(), CompileVal.getBusinessCode()); } - Long endSaveTime = System.currentTimeMillis(); - Long time = (endSaveTime - benginTime) / 1000; - System.out.println("插入数据成功总共需要" + time + "秒"); } else { - thread.setExceptionInfo("编译配置数据不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空", + thread.setExceptionInfo("Maat规则不能为空"); + throw new RestServiceException(thread, System.currentTimeMillis() - start, "Maat规则不能为空", RestBusinessCode.missing_args.getValue()); } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, - "编译配置数据插入成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); + "Maat规则下发成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); } @RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.PUT) - @ApiOperation(value = "业务配置状态更新", httpMethod = "PUT", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)进行配置失效") - @ApiParam(value = "业务配置数据源", name = "configSource", required = true) + @ApiOperation(value = "MAAT规则状态更新接口", httpMethod = "PUT", response = Map.class, notes = "接收Maat规则,对其状态置为失效") + @ApiParam(value = "MAAT规则对象", name = "configSource", required = true) public Map updateConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request, HttpServletResponse response) { CompileVal.setBusinessCode(null); ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, configSource); StringBuffer sb = new StringBuffer(); if (null == configSource.getOpTime()) { @@ -132,29 +126,29 @@ public class ConfigSourcesController extends BaseRestController { if (msg.equals("error")) { Exception exception = ConfigSourcesService.getMsgList().get(0); throw new RestServiceException(thread, System.currentTimeMillis() - start, - "修改编译配置状态时出现异常" + exception.getMessage(),CompileVal.getBusinessCode()); + "MAAT规则状态更新时出现异常" + exception.getMessage(),CompileVal.getBusinessCode()); } // configSourcesService.updateConfigSource(thread, start, // configSource.getConfigCompileList(), // configSource.getOpTime(), sb); } else { - thread.setExceptionInfo("编译配置数据不能为空"); - throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空" + sb.toString(), + thread.setExceptionInfo("Maat规则不能为空"); + throw new RestServiceException(thread, System.currentTimeMillis() - start, "Maat规则不能为空" + sb.toString(), RestBusinessCode.missing_args.getValue()); } return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, - "编译配置修改成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); + "Maat规则状态更新成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); } @RequestMapping(value = "/cfg/v1/configModifySources", method = RequestMethod.PUT) - @ApiOperation(value = "编译配置修改", httpMethod = "PUT", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)存储") - @ApiParam(value = "编译配置修改", name = "configSource", required = true) + @ApiOperation(value = "MAAT规则修改接口", httpMethod = "PUT", response = Map.class, notes = "接收Maat规则,对其规则内容进行修改") + @ApiParam(value = "MAAT规则对象", name = "configSource", required = true) public Map configModifySources(@RequestBody ConfigSource configSource, HttpServletRequest request, HttpServletResponse response) { ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, configSource); StringBuffer sb = new StringBuffer(); if (null != configSource && null != configSource.getConfigCompileList() @@ -269,7 +263,7 @@ public class ConfigSourcesController extends BaseRestController { "修改编译配置数据成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null); } - private void validateConfigSource(SaveRequestLogThread thread, long start, ConfigSource configSource) { + private void validateConfigSource(AuditLogThread thread, long start, ConfigSource configSource) { String errorInfo = ""; List configCompileList = configSource.getConfigCompileList(); @@ -286,8 +280,8 @@ public class ConfigSourcesController extends BaseRestController { } if (configCompileList.size() <= 0) { - errorInfo = "编译配置不能为空"; - } + errorInfo = "Maat规则不能为空"; + } if (!errorInfo.equals("")) { thread.setExceptionInfo(errorInfo); throw new RestServiceException(thread, System.currentTimeMillis() - start, errorInfo, @@ -297,54 +291,54 @@ public class ConfigSourcesController extends BaseRestController { } @RequestMapping(value = "/cfg/v1/commonSources", method = RequestMethod.POST, produces = org.springframework.http.MediaType.APPLICATION_JSON_VALUE) - @ApiOperation(value = "回调配置存储", httpMethod = "POST", response = Map.class, notes = "回调配置存储服务") + @ApiOperation(value = "回调(通用)规则存储接口", httpMethod = "POST", response = Map.class, notes = "接收回调规则数据,格式为结构化行列式JSON,存储到流量处理平台配置线中") public Map createCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request, HttpServletResponse response) { CompileVal.setBusinessCode(null); ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); - StringBuffer sb = new StringBuffer(); - String msg = configSourcesService.saveCommonSources(thread, start, jsonString, sb); + + String msg = configSourcesService.saveCommonSources(thread, start, jsonString); if (msg.equals("error")) { Exception exception = ConfigSourcesService.getMsgList().get(0); throw new RestServiceException(thread, System.currentTimeMillis() - start, - "存储回调配置时出现异常" + exception.getMessage(), CompileVal.getBusinessCode()); + "回调规则存储异常" + exception.getMessage(), CompileVal.getBusinessCode()); } - return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置数据插入成功", + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "回调规则下发成功", Constants.IS_DEBUG ? jsonString : null); } + @RequestMapping(value = "/cfg/v1/commonSources", method = RequestMethod.PUT) - @ApiOperation(value = "回调配置状态修改", httpMethod = "PUT", response = Map.class, notes = "回调配置状态修改服务") - @ApiParam(value = "回调配置状态修改", name = "updateStatConfigSource", required = true) + @ApiOperation(value = "回调规则状态更新接口", httpMethod = "PUT", response = Map.class, notes = "接收回调规则,对其状态置为失效") public Map updateCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request, HttpServletResponse response) { CompileVal.setBusinessCode(null); ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request, jsonString); StringBuffer sb = new StringBuffer(); String msg = configSourcesService.updateCommonSources(thread, start, jsonString, new Date(), sb); if (msg.equals("error")) { Exception exception = ConfigSourcesService.getMsgList().get(0); throw new RestServiceException(thread, System.currentTimeMillis() - start, - "修改回调配置状态时出现异常" + exception.getMessage(), CompileVal.getBusinessCode()); + "回调规则状态更新异常" + exception.getMessage(), CompileVal.getBusinessCode()); } - return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置状态修改成功", + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "回调规则状态更新成功", Constants.IS_DEBUG ? jsonString : null); } @RequestMapping(value = "/cfg/v1/fileUploadSources", method = RequestMethod.POST) - @ApiOperation(value = "样例文件上传服务", httpMethod = "POST", response = Map.class, notes = "样例文件上传服务") + @ApiOperation(value = "样例文件上传服务接口", httpMethod = "POST", response = Map.class, notes = "样例文件上传服务") @ApiParam(value = "样例文件上传服务", name = "MultipartFile", required = true) public Map fileUploadSource(@RequestBody MultipartFile file, HttpServletRequest request, HttpServletResponse response) { ConfigSourcesService.setMsgList(new ArrayList());// 清除上次记录的日志信息 long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); String filePath = ""; try { @@ -402,12 +396,12 @@ public class ConfigSourcesController extends BaseRestController { } @RequestMapping(value = "/cfg/v1/fileDigestSources", method = RequestMethod.POST) - @ApiOperation(value = "文件摘要获取", httpMethod = "POST", response = Map.class, notes = "文件摘要获取") + @ApiOperation(value = "文件摘要获取接口", httpMethod = "POST", response = Map.class, notes = "文件摘要获取") @ApiParam(value = "摘要文件", name = "MultipartFile", required = true) public Map fileDigestSources(@RequestBody MultipartFile file, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, file, null); if (file == null) { thread.setExceptionInfo("请上传获取摘要的文件到file"); diff --git a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java index ed0de04..78f371c 100644 --- a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -11,6 +11,7 @@ import com.nis.util.Constants; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @@ -18,9 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.nis.util.JsonMapper; -import com.nis.web.controller.BaseController; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DashboardService; import com.wordnik.swagger.annotations.Api; @@ -43,7 +42,7 @@ public class DashboardServiceController extends BaseRestController { @ApiOperation(value = "协议统计", httpMethod = "GET", notes = "对应协议统计实时统计查询服务。") public Map trafficProtocol(Model model, HttpServletRequest request, HttpServletResponse response){ long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List ipActiveChart = dashboardService.protocolChart(); @@ -74,7 +73,7 @@ public class DashboardServiceController extends BaseRestController { public Map trafficIpActive(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List ipActiveChart = dashboardService.ipActiveChart(); @@ -100,7 +99,7 @@ public class DashboardServiceController extends BaseRestController { public Map trafficApp(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List appChart = dashboardService.appChart(); @@ -122,7 +121,7 @@ public class DashboardServiceController extends BaseRestController { @ApiOperation(value = "操作系统流量分析统计", httpMethod = "GET", notes = "对应终端用户的操作系统列表显示") public Map trafficOsList(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List osChart = dashboardService.systemList(); @@ -145,7 +144,7 @@ public class DashboardServiceController extends BaseRestController { public Map trafficBrowserChart(Integer osType,Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List osChart = dashboardService.getBrowserBySystem(osType); @@ -167,7 +166,7 @@ public class DashboardServiceController extends BaseRestController { @ApiOperation(value = "浏览器流量分析统计", httpMethod = "GET", notes = "对应终端用户的浏览器列表显示") public Map trafficBsList(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List bsChart = dashboardService.browserList(); @@ -190,7 +189,7 @@ public class DashboardServiceController extends BaseRestController { public Map trafficSystemChart(Integer bsType,Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List bsChart = dashboardService.getSystemBybrowser(bsType); @@ -213,7 +212,7 @@ public class DashboardServiceController extends BaseRestController { public Map trafficWebsiteList(Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List websiteChart = dashboardService.websiteList(); @@ -236,7 +235,7 @@ public class DashboardServiceController extends BaseRestController { public Map trafficWebTypeChart(Integer webId,Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { List websiteChart = dashboardService.getTypeBywebsite(webId); diff --git a/src/main/java/com/nis/web/controller/restful/DataDictionaryController.java b/src/main/java/com/nis/web/controller/restful/DataDictionaryController.java index 41d7d32..3fb74f1 100644 --- a/src/main/java/com/nis/web/controller/restful/DataDictionaryController.java +++ b/src/main/java/com/nis/web/controller/restful/DataDictionaryController.java @@ -6,6 +6,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.ModelMap; @@ -19,7 +20,6 @@ import com.nis.listener.SystemConfigListener; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DataDictionaryService; @@ -36,7 +36,7 @@ public class DataDictionaryController extends BaseRestController { public Map findAllDataDict(DataDictionaryValue dataDictionaryValue, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, dataDictionaryValue); Page page = new Page(); int no = dataDictionaryValue.getPagesNo() == null ? 1 : dataDictionaryValue.getPagesNo(); @@ -56,7 +56,7 @@ public class DataDictionaryController extends BaseRestController { @RequestMapping(value = "/cfg/v1/getAllDictName", method = RequestMethod.GET) public Map getAllDictName(HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); try { return serviceResponse(thread, start, request, response, "编译配置获取成功", @@ -72,7 +72,7 @@ public class DataDictionaryController extends BaseRestController { public Map addDictName(String dataDictId, String addDictName, String dictVal, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); try { String option = ""; @@ -98,7 +98,7 @@ public class DataDictionaryController extends BaseRestController { @RequestMapping(value = "/cfg/v1/delDictVal", method = RequestMethod.POST) public Map delDictVal(String dictValId, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); try { String saveDataDict = dataDictionaryService.delDictVal(dictValId); @@ -116,7 +116,7 @@ public class DataDictionaryController extends BaseRestController { @RequestMapping(value = "/cfg/v1/delDictName", method = RequestMethod.POST) public Map delDictName(String dictNameId, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); try { String saveDataDict = dataDictionaryService.delDictName(dictNameId); @@ -133,7 +133,7 @@ public class DataDictionaryController extends BaseRestController { @RequestMapping(value = "/cfg/v1/getDict", method = RequestMethod.POST) public Map getDict(String dictValId, ModelMap map, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); try { DataDictionaryValue dict = dataDictionaryService.getDict(dictValId); @@ -156,7 +156,7 @@ public class DataDictionaryController extends BaseRestController { @RequestMapping(value = "/cfg/v1/updateDictName", method = RequestMethod.POST) public Map updateDictName(String dictVal, String dictId, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); try { String option = "updateVal"; @@ -175,7 +175,7 @@ public class DataDictionaryController extends BaseRestController { @RequestMapping(value = "/cfg/v1/setDataDictEffective", method = RequestMethod.POST) public Map setDataDictEffective(HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, null); try { Map> allDataDict = dataDictionaryService.getAllDataDict(); diff --git a/src/main/java/com/nis/web/controller/restful/DfIpPortUdpController.java b/src/main/java/com/nis/web/controller/restful/DfIpPortUdpController.java index 786d1ad..6373a16 100644 --- a/src/main/java/com/nis/web/controller/restful/DfIpPortUdpController.java +++ b/src/main/java/com/nis/web/controller/restful/DfIpPortUdpController.java @@ -14,6 +14,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -30,7 +31,6 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DfIpPortUdpService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class DfIpPortUdpController extends BaseRestController { @ApiOperation(value = "保存IP+端口Udp协议G设备封堵配置", httpMethod = "POST", notes = "save ip port udp") public Map saveDfIpPortUdpBatch(@RequestBody DfIpPortUdpSource dfIpPortUdpSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dfIpPortUdpSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dfIpPortUdpSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dfIpPortUdpSource.getOpAction(), Constants.OPACTION_POST); try{ this.chekckData(dfIpPortUdpSource,false); @@ -108,7 +108,7 @@ public class DfIpPortUdpController extends BaseRestController { @ApiOperation(value = "更新IP+端口Udp协议G设备封堵配置", httpMethod = "PUT", notes = "update ip port udp") public Map updateDfIpPortUdpBatch(@RequestBody DfIpPortUdpSource dfIpPortUdpSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dfIpPortUdpSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dfIpPortUdpSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dfIpPortUdpSource.getOpAction(), Constants.OPACTION_PUT); try{ this.chekckData(dfIpPortUdpSource,true); @@ -147,7 +147,7 @@ public class DfIpPortUdpController extends BaseRestController { @ApiOperation(value = "删除IP+端口Udp协议G设备封堵配置", httpMethod = "DELETE", notes = "delete ip port udp") public Map deleteDfIpPortUdp(@PathVariable("cfgId") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ dfIpPortUdpService.removeDfIpPortUdp(id); @@ -185,7 +185,7 @@ public class DfIpPortUdpController extends BaseRestController { @ApiOperation(value = "删除IP+端口Udp协议G设备封堵配置", httpMethod = "DELETE", notes = "delete ip port udp") public Map deleteDfIpPortUdp(@RequestBody DfIpPortUdpSource dfIpPortUdpSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dfIpPortUdpSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dfIpPortUdpSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dfIpPortUdpSource.getOpAction(), Constants.OPACTION_DELETE); try{ dfIpPortUdpService.removeDfIpPortUdpBatch(dfIpPortUdpSource.getDfIpPortUdpList()); diff --git a/src/main/java/com/nis/web/controller/restful/DfKeyConvertUrlController.java b/src/main/java/com/nis/web/controller/restful/DfKeyConvertUrlController.java index 4edf3a7..89efd02 100644 --- a/src/main/java/com/nis/web/controller/restful/DfKeyConvertUrlController.java +++ b/src/main/java/com/nis/web/controller/restful/DfKeyConvertUrlController.java @@ -26,7 +26,7 @@ import com.nis.domain.restful.DfKeyConvertUrl; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DfKeyConvertUrlService; import com.wordnik.swagger.annotations.ApiOperation; @@ -66,7 +66,7 @@ public class DfKeyConvertUrlController extends BaseRestController{ } long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null); //请求参数校验 dfKeyConvertUrlService.queryConditionCheck(thread,start,dfKeyConvertUrl,page); diff --git a/src/main/java/com/nis/web/controller/restful/DfKeyMailAddController.java b/src/main/java/com/nis/web/controller/restful/DfKeyMailAddController.java index 91b7b7c..b496e74 100644 --- a/src/main/java/com/nis/web/controller/restful/DfKeyMailAddController.java +++ b/src/main/java/com/nis/web/controller/restful/DfKeyMailAddController.java @@ -13,6 +13,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; @@ -26,7 +27,6 @@ import com.nis.domain.restful.DfKeyMailAdd; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DfKeyMailAddService; import com.wordnik.swagger.annotations.ApiOperation; @@ -66,7 +66,7 @@ public class DfKeyMailAddController extends BaseRestController { } long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); // 请求参数校验 dfKeyMailAddService.queryConditionCheck(thread, start, dfKeyMailAdd, page); diff --git a/src/main/java/com/nis/web/controller/restful/DmbCkController.java b/src/main/java/com/nis/web/controller/restful/DmbCkController.java index fb1017d..eb63e51 100644 --- a/src/main/java/com/nis/web/controller/restful/DmbCkController.java +++ b/src/main/java/com/nis/web/controller/restful/DmbCkController.java @@ -14,6 +14,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -30,7 +31,6 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DmbCkService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class DmbCkController extends BaseRestController { @ApiOperation(value = "保存运营商信息", httpMethod = "POST", notes = "save provider info") public Map saveDmbCkBatch(@RequestBody DmbCkSource dmbCkSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dmbCkSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dmbCkSource); super.checkOpAction(thread,System.currentTimeMillis()-start, dmbCkSource.getOpAction(), Constants.OPACTION_POST); try{ this.chekckData(dmbCkSource); @@ -108,7 +108,7 @@ public class DmbCkController extends BaseRestController { @ApiOperation(value = "更新运营商信息", httpMethod = "PUT", notes = "update provider info") public Map updateDmbCkBatch(@RequestBody DmbCkSource dmbCkSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dmbCkSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dmbCkSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dmbCkSource.getOpAction(), Constants.OPACTION_PUT); try{ this.chekckData(dmbCkSource); @@ -146,7 +146,7 @@ public class DmbCkController extends BaseRestController { @ApiOperation(value = "删除运营商信息", httpMethod = "DELETE", notes = "delete provider info") public Map deleteDmbCk(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ dmbCkService.removeDmbCk(id); // commonConfigService.saveOrUpdateConfigState("DMB_CK", new Date()); @@ -183,7 +183,7 @@ public class DmbCkController extends BaseRestController { @ApiOperation(value = "删除运营商信息", httpMethod = "DELETE", notes = "delete provider info") public Map deleteDmbCk(@RequestBody DmbCkSource dmbCkSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dmbCkSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dmbCkSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dmbCkSource.getOpAction(), Constants.OPACTION_DELETE); try{ dmbCkService.removeDmbCkBatch(dmbCkSource.getDmbCkList()); diff --git a/src/main/java/com/nis/web/controller/restful/DmbPortController.java b/src/main/java/com/nis/web/controller/restful/DmbPortController.java index e7d71e6..41ecc48 100644 --- a/src/main/java/com/nis/web/controller/restful/DmbPortController.java +++ b/src/main/java/com/nis/web/controller/restful/DmbPortController.java @@ -30,7 +30,7 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DmbPortService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class DmbPortController extends BaseRestController { @ApiOperation(value = "保存运营商端口信息", httpMethod = "POST", notes = "save provider port info") public Map saveDmbPortBatch(@RequestBody DmbPortSource dmbPortSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dmbPortSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dmbPortSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dmbPortSource.getOpAction(), Constants.OPACTION_POST); try{ this.chekckData(dmbPortSource); @@ -108,7 +108,7 @@ public class DmbPortController extends BaseRestController { @ApiOperation(value = "更新运营商端口信息", httpMethod = "PUT", notes = "update provider port info") public Map updateDmbPortBatch(@RequestBody DmbPortSource dmbPortSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dmbPortSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dmbPortSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dmbPortSource.getOpAction(), Constants.OPACTION_PUT); try{ this.chekckData(dmbPortSource); @@ -146,7 +146,7 @@ public class DmbPortController extends BaseRestController { @ApiOperation(value = "删除运营商端口信息", httpMethod = "DELETE", notes = "delete provider port info") public Map deleteDmbPort(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ dmbPortService.removeDmbPort(id); // commonConfigService.saveOrUpdateConfigState("DMB_PORT", new Date()); @@ -183,7 +183,7 @@ public class DmbPortController extends BaseRestController { @ApiOperation(value = "删除运营商端口信息", httpMethod = "DELETE", notes = "delete provider port info") public Map deleteDmbPort(@RequestBody DmbPortSource dmbPortSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dmbPortSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dmbPortSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dmbPortSource.getOpAction(), Constants.OPACTION_DELETE); try{ dmbPortService.removeDmbPortBatch(dmbPortSource.getDmbPortList()); diff --git a/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java b/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java index 08fdcb1..da2e746 100644 --- a/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java +++ b/src/main/java/com/nis/web/controller/restful/DnsFakeInfoController.java @@ -14,6 +14,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -30,7 +31,6 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DnsFakeInfoService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class DnsFakeInfoController extends BaseRestController { @ApiOperation(value = "保存DNS欺骗信息", httpMethod = "POST", notes = "save dns fake info") public Map saveDnsFakeInfoBatch(@RequestBody DnsFakeInfoSource dnsFakeInfoSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsFakeInfoSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsFakeInfoSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeInfoSource.getOpAction(), Constants.OPACTION_POST); try{ if(chekckData(dnsFakeInfoSource,false)){ @@ -111,7 +111,7 @@ public class DnsFakeInfoController extends BaseRestController { @ApiOperation(value = "更新DNS欺骗信息", httpMethod = "PUT", notes = "update dns fake info") public Map updateDnsFakeInfoBatch(@RequestBody DnsFakeInfoSource dnsFakeInfoSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsFakeInfoSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsFakeInfoSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeInfoSource.getOpAction(), Constants.OPACTION_PUT); try{ if(chekckData(dnsFakeInfoSource,true)){ @@ -152,7 +152,7 @@ public class DnsFakeInfoController extends BaseRestController { @ApiOperation(value = "删除DNS欺骗信息", httpMethod = "DELETE", notes = "delete dns fake info") public Map deleteDnsFakeInfo(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ boolean isValid=dnsFakeInfoService.isValid(id); if(!isValid){ @@ -196,7 +196,7 @@ public class DnsFakeInfoController extends BaseRestController { @ApiOperation(value = "删除DNS欺骗信息", httpMethod = "DELETE", notes = "delete dns fake info") public Map deleteDnsFakeInfo(@RequestBody DnsFakeInfoSource dnsFakeInfoSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsFakeInfoSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsFakeInfoSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeInfoSource.getOpAction(), Constants.OPACTION_DELETE); try{ boolean isValid=dnsFakeInfoService.isValid(dnsFakeInfoSource.getDnsFakeInfoList()); diff --git a/src/main/java/com/nis/web/controller/restful/DnsFakeIpController.java b/src/main/java/com/nis/web/controller/restful/DnsFakeIpController.java index e2cd412..013f969 100644 --- a/src/main/java/com/nis/web/controller/restful/DnsFakeIpController.java +++ b/src/main/java/com/nis/web/controller/restful/DnsFakeIpController.java @@ -30,7 +30,7 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DnsFakeIpService; import com.wordnik.swagger.annotations.ApiOperation; @@ -68,7 +68,7 @@ public class DnsFakeIpController extends BaseRestController { @ApiOperation(value = "保存DNS欺骗IP地址", httpMethod = "POST", notes = "save dns fake ip") public Map saveDnsFakeIpBatch(@RequestBody DnsFakeIpSource dnsFakeIpSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsFakeIpSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsFakeIpSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeIpSource.getOpAction(), Constants.OPACTION_POST); try{ if(chekckData(dnsFakeIpSource,false)){ @@ -107,7 +107,7 @@ public class DnsFakeIpController extends BaseRestController { @ApiOperation(value = "更新DNS欺骗IP地址", httpMethod = "PUT", notes = "update dns fake ip") public Map updateDnsFakeIpBatch(@RequestBody DnsFakeIpSource dnsFakeIpSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsFakeIpSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsFakeIpSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeIpSource.getOpAction(), Constants.OPACTION_PUT); try{ if(chekckData(dnsFakeIpSource,true)){ @@ -147,7 +147,7 @@ public class DnsFakeIpController extends BaseRestController { @ApiOperation(value = "删除DNS欺骗IP地址", httpMethod = "DELETE", notes = "delete dns fake ip") public Map deleteDnsFakeIp(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ boolean isValid=dnsFakeIpService.isValid(id); if(!isValid){ @@ -191,7 +191,7 @@ public class DnsFakeIpController extends BaseRestController { @ApiOperation(value = "删除DNS欺骗IP地址", httpMethod = "DELETE", notes = "delete dns fake ip") public Map deleteDnsFakeIp(@RequestBody DnsFakeIpSource dnsFakeIpSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsFakeIpSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsFakeIpSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsFakeIpSource.getOpAction(), Constants.OPACTION_DELETE); try{ boolean isValid=dnsFakeIpService.isValid(dnsFakeIpSource.getDnsFakeIpList()); diff --git a/src/main/java/com/nis/web/controller/restful/DnsGroupTypeController.java b/src/main/java/com/nis/web/controller/restful/DnsGroupTypeController.java index aa3a5de..068da1a 100644 --- a/src/main/java/com/nis/web/controller/restful/DnsGroupTypeController.java +++ b/src/main/java/com/nis/web/controller/restful/DnsGroupTypeController.java @@ -13,6 +13,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -29,7 +30,6 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DnsGroupTypeService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class DnsGroupTypeController extends BaseRestController { @ApiOperation(value = "保存DNS分组类型", httpMethod = "POST", notes = "save dns group type") public Map saveDnsGroupTypeBatch(@RequestBody DnsGroupTypeSource dnsGroupTypeSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsGroupTypeSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsGroupTypeSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsGroupTypeSource.getOpAction(), Constants.OPACTION_POST); try{ // if(chekckData(dnsGroupTypeSource/*,false*/)) @@ -112,7 +112,7 @@ public class DnsGroupTypeController extends BaseRestController { @ApiOperation(value = "更新DNS分组类型", httpMethod = "PUT", notes = "update dns group type") public Map updateDnsGroupTypeBatch(@RequestBody DnsGroupTypeSource dnsGroupTypeSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsGroupTypeSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsGroupTypeSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsGroupTypeSource.getOpAction(), Constants.OPACTION_PUT); try{ // if(chekckData(dnsGroupTypeSource/*,true*/)) @@ -154,7 +154,7 @@ public class DnsGroupTypeController extends BaseRestController { @ApiOperation(value = "删除DNS分组类型", httpMethod = "DELETE", notes = "delete dns group type") public Map deleteDnsGroupType(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ boolean isValid=dnsGroupTypeService.isValid(id); if(!isValid){ @@ -198,7 +198,7 @@ public class DnsGroupTypeController extends BaseRestController { @ApiOperation(value = "删除DNS分组类型", httpMethod = "DELETE", notes = "delete dns group type") public Map deleteDnsGroupType(@RequestBody DnsGroupTypeSource dnsGroupTypeSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsGroupTypeSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsGroupTypeSource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsGroupTypeSource.getOpAction(), Constants.OPACTION_DELETE); try{ boolean isValid=dnsGroupTypeService.isValid(dnsGroupTypeSource.getDnsGroupTypeList()); @@ -234,7 +234,7 @@ public class DnsGroupTypeController extends BaseRestController { * @exception * @since 1.0.0 */ - private void chekckData(SaveRequestLogThread thread,long start,DnsGroupTypeSource entity,int opAction){ + private void chekckData(AuditLogThread thread, long start, DnsGroupTypeSource entity, int opAction){ for(DnsGroupType dnsGroupType :entity.getDnsGroupTypeList()){ if(dnsGroupType.getOpTime()==null) dnsGroupType.setOpTime(entity.getOpTime()); diff --git a/src/main/java/com/nis/web/controller/restful/DnsResponseStrategyController.java b/src/main/java/com/nis/web/controller/restful/DnsResponseStrategyController.java index 75d8829..47f8b32 100644 --- a/src/main/java/com/nis/web/controller/restful/DnsResponseStrategyController.java +++ b/src/main/java/com/nis/web/controller/restful/DnsResponseStrategyController.java @@ -30,7 +30,7 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.DnsResponseStrategyService; import com.wordnik.swagger.annotations.ApiOperation; @@ -69,7 +69,7 @@ public class DnsResponseStrategyController extends BaseRestController { @ApiOperation(value = "保存DNS响应策略", httpMethod = "POST", notes = "save dns response strategy") public Map saveDnsResponseStrategyBatch(@RequestBody DnsResponseStrategySource dnsResponseStrategySource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsResponseStrategySource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, dnsResponseStrategySource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsResponseStrategySource.getOpAction(), Constants.OPACTION_POST); try{ chekckData(thread,start,dnsResponseStrategySource,Constants.OPACTION_POST); @@ -109,7 +109,7 @@ public class DnsResponseStrategyController extends BaseRestController { @ApiOperation(value = "更新DNS响应策略", httpMethod = "PUT", notes = "update dns response strategy") public Map updateDnsResponseStrategyBatch(@RequestBody DnsResponseStrategySource dnsResponseStrategySource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsResponseStrategySource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, dnsResponseStrategySource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsResponseStrategySource.getOpAction(), Constants.OPACTION_PUT); try{ chekckData(thread,start,dnsResponseStrategySource,Constants.OPACTION_PUT); @@ -149,7 +149,7 @@ public class DnsResponseStrategyController extends BaseRestController { @ApiOperation(value = "删除DNS响应策略", httpMethod = "DELETE", notes = "delete dns response strategy") public Map deleteDnsResponseStrategy(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ boolean isValid=dnsResponseStrategyService.isValid(id); if(!isValid){ @@ -192,7 +192,7 @@ public class DnsResponseStrategyController extends BaseRestController { @ApiOperation(value = "删除DNS响应策略", httpMethod = "DELETE", notes = "delete dns response strategy") public Map deleteDnsResponseStrategy(@RequestBody DnsResponseStrategySource dnsResponseStrategySource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsResponseStrategySource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, dnsResponseStrategySource); super.checkOpAction(thread,System.currentTimeMillis()-start,dnsResponseStrategySource.getOpAction(), Constants.OPACTION_DELETE); try{ boolean isValid=dnsResponseStrategyService.isValid(dnsResponseStrategySource.getDnsResponseStrategyList()); @@ -225,7 +225,7 @@ public class DnsResponseStrategyController extends BaseRestController { * @exception * @since 1.0.0 */ - private void chekckData(SaveRequestLogThread thread,long start,DnsResponseStrategySource entity,int opAction){ + private void chekckData(AuditLogThread thread, long start, DnsResponseStrategySource entity, int opAction){ Date now =new Date(); for(DnsResponseStrategy dnsResponseStrategy :entity.getDnsResponseStrategyList()){ @@ -250,7 +250,7 @@ public class DnsResponseStrategyController extends BaseRestController { } } - private void checkReqStrateId(SaveRequestLogThread thread,long start,DnsResponseStrategy dnsResponseStrategy,int opAction){ + private void checkReqStrateId(AuditLogThread thread, long start, DnsResponseStrategy dnsResponseStrategy, int opAction){ //update时可以为空 if(opAction==Constants.OPACTION_PUT&&dnsResponseStrategy.getReqStrateId()==null)return; if(dnsResponseStrategy.getReqStrateId()==null){ diff --git a/src/main/java/com/nis/web/controller/restful/EncryptProtoRandomController.java b/src/main/java/com/nis/web/controller/restful/EncryptProtoRandomController.java index c96cc29..d28fd69 100644 --- a/src/main/java/com/nis/web/controller/restful/EncryptProtoRandomController.java +++ b/src/main/java/com/nis/web/controller/restful/EncryptProtoRandomController.java @@ -14,6 +14,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -30,7 +31,6 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.EncryptProtoRandomService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class EncryptProtoRandomController extends BaseRestController { @ApiOperation(value = "保存加密类协议随机封堵配置", httpMethod = "POST", notes = "save encrypt_proto_random") public Map saveEncryptProtoRandomBatch(@RequestBody EncryptProtoRandomSource encryptProtoRandomSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, encryptProtoRandomSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, encryptProtoRandomSource); super.checkOpAction(thread,System.currentTimeMillis()-start,encryptProtoRandomSource.getOpAction(), Constants.OPACTION_POST); try{ this.chekckData(encryptProtoRandomSource); @@ -108,7 +108,7 @@ public class EncryptProtoRandomController extends BaseRestController { @ApiOperation(value = "更新加密类协议随机封堵配置", httpMethod = "PUT", notes = "update encrypt_proto_random") public Map updateEncryptProtoRandomBatch(@RequestBody EncryptProtoRandomSource encryptProtoRandomSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, encryptProtoRandomSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, encryptProtoRandomSource); super.checkOpAction(thread,System.currentTimeMillis()-start,encryptProtoRandomSource.getOpAction(), Constants.OPACTION_PUT); try{ this.chekckData(encryptProtoRandomSource); @@ -146,7 +146,7 @@ public class EncryptProtoRandomController extends BaseRestController { @ApiOperation(value = "删除加密类协议随机封堵配置", httpMethod = "DELETE", notes = "delete encrypt_proto_random") public Map deleteEncryptProtoRandom(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ encryptProtoRandomService.removeEncryptProtoRandom(id); // commonConfigService.saveOrUpdateConfigState("DMB_CK", new Date()); @@ -183,7 +183,7 @@ public class EncryptProtoRandomController extends BaseRestController { @ApiOperation(value = "删除加密类协议随机封堵配置", httpMethod = "DELETE", notes = "delete encrypt_proto_random") public Map deleteEncryptProtoRandom(@RequestBody EncryptProtoRandomSource encryptProtoRandomSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, encryptProtoRandomSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, encryptProtoRandomSource); super.checkOpAction(thread,System.currentTimeMillis()-start,encryptProtoRandomSource.getOpAction(), Constants.OPACTION_DELETE); try{ encryptProtoRandomService.removeEncryptProtoRandomBatch(encryptProtoRandomSource.getEncryptProtoRandomList()); diff --git a/src/main/java/com/nis/web/controller/restful/FwqInfoController.java b/src/main/java/com/nis/web/controller/restful/FwqInfoController.java index 97de06a..176f3ba 100644 --- a/src/main/java/com/nis/web/controller/restful/FwqInfoController.java +++ b/src/main/java/com/nis/web/controller/restful/FwqInfoController.java @@ -30,7 +30,7 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.FwqInfoService; import com.wordnik.swagger.annotations.ApiOperation; @@ -70,7 +70,7 @@ public class FwqInfoController extends BaseRestController { @ApiOperation(value = "保存服务器信息", httpMethod = "POST", notes = "save server info") public Map saveFwqInfoBatch(@RequestBody FwqInfoSource fwqInfoSource, HttpServletRequest request, HttpServletResponse response) { long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, fwqInfoSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_POST,request, fwqInfoSource); super.checkOpAction(thread,System.currentTimeMillis()-start,fwqInfoSource.getOpAction(), Constants.OPACTION_POST); try{ chekckData(fwqInfoSource); @@ -108,7 +108,7 @@ public class FwqInfoController extends BaseRestController { @ApiOperation(value = "更新服务器信息", httpMethod = "PUT", notes = "update server info") public Map updateFwqInfoBatch(@RequestBody FwqInfoSource fwqInfoSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, fwqInfoSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, fwqInfoSource); super.checkOpAction(thread,System.currentTimeMillis()-start,fwqInfoSource.getOpAction(), Constants.OPACTION_PUT); try{ chekckData(fwqInfoSource); @@ -146,7 +146,7 @@ public class FwqInfoController extends BaseRestController { @ApiOperation(value = "删除服务器信息", httpMethod = "DELETE", notes = "delete server info") public Map deleteFwqInfo(@PathVariable("id") long id, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, id); try{ fwqInfoService.removeFwqInfo(id); // commonConfigService.saveOrUpdateConfigState("FWQ_INFO", new Date()); @@ -183,7 +183,7 @@ public class FwqInfoController extends BaseRestController { @ApiOperation(value = "删除服务器信息", httpMethod = "DELETE", notes = "delete server info") public Map deleteFwqInfo(@RequestBody FwqInfoSource fwqInfoSource, HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, fwqInfoSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_DELETE,request, fwqInfoSource); super.checkOpAction(thread,System.currentTimeMillis()-start,fwqInfoSource.getOpAction(), Constants.OPACTION_DELETE); try{ fwqInfoService.removeFwqInfoBatch(fwqInfoSource.getFwqInfoList()); diff --git a/src/main/java/com/nis/web/controller/restful/IntervalTimeSearchController.java b/src/main/java/com/nis/web/controller/restful/IntervalTimeSearchController.java index b9ecf1f..b66a5a2 100644 --- a/src/main/java/com/nis/web/controller/restful/IntervalTimeSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/IntervalTimeSearchController.java @@ -26,7 +26,7 @@ import com.nis.domain.restful.DjFlowControlStop; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.IntervalTimeSearchService; import com.wordnik.swagger.annotations.ApiOperation; @@ -67,7 +67,7 @@ public class IntervalTimeSearchController extends BaseRestController{ } long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null); //请求参数校验 timeSearchService.queryConditionCheck(thread,start,flowControlStop,page); 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 9e9d203..64ab97f 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -10,6 +10,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @@ -54,7 +55,6 @@ import com.nis.util.HiveJDBC; import com.nis.util.JsonMapper; import com.nis.web.controller.BaseRestController; import com.nis.web.service.HiveSqlService; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.LogTestService; import com.nis.web.service.restful.NtcReportService; @@ -87,7 +87,7 @@ public class LogController extends BaseRestController { public Map ntcIpLogs(Page page, NtcIpLog ntcIpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcIpLogPage = null; try { @@ -152,7 +152,7 @@ public class LogController extends BaseRestController { public Map ntcHttpLogs(Page page, NtcHttpLog ntcHttpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcHttpLogPage = null; @@ -212,7 +212,7 @@ public class LogController extends BaseRestController { public Map ntcDnsLogs(Page page, NtcDnsLog ntcDnsLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcDnsLogPage = null; @@ -272,7 +272,7 @@ public class LogController extends BaseRestController { public Map ntcMailLogs(Page page, NtcMailLog ntcMailLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcMailLogPage = null; @@ -332,7 +332,7 @@ public class LogController extends BaseRestController { public Map ntcSslLogs(Page page, NtcSslLog ntcSslLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcSslLogPage = null; @@ -392,7 +392,7 @@ public class LogController extends BaseRestController { public Map ntcPptpLogs(Page page, NtcPptpLog ntcPptpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcPptpLogPage = null; @@ -451,7 +451,7 @@ public class LogController extends BaseRestController { public Map ntcL2tpLogs(Page page, NtcL2tpLog ntcL2tpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcL2tpLogPage = null; @@ -511,7 +511,7 @@ public class LogController extends BaseRestController { public Map ntcOpenvpnLogs(Page page, NtcOpenvpnLog ntcOpenvpnLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcOpenvpnLogPage = null; @@ -571,7 +571,7 @@ public class LogController extends BaseRestController { public Map ntcIpsecLogs(Page page, NtcIpsecLog ntcIpsecLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcIpsecLogPage = null; @@ -631,7 +631,7 @@ public class LogController extends BaseRestController { public Map ntcSshLogs(Page page, NtcSshLog ntcSshLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcSshLogPage = null; @@ -691,7 +691,7 @@ public class LogController extends BaseRestController { public Map ntcFtpLogs(Page page, NtcFtpLog ntcFtpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcFtpLogPage = null; @@ -749,7 +749,7 @@ public class LogController extends BaseRestController { public Map ntcAppLogs(Page page, NtcAppLog ntcAppLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcAppLogPage = null; @@ -807,7 +807,7 @@ public class LogController extends BaseRestController { public Map ntcDdosLogs(Page page, NtcDdosLog ntcDdosLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcDdosLogPage = null; @@ -865,7 +865,7 @@ public class LogController extends BaseRestController { public Map dkBehaviorLogs(Page page, DkBehaviorLog dkBehaviorLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page logPage = null; @@ -918,7 +918,7 @@ public class LogController extends BaseRestController { public Map mmAvIpLogs(Page page, MmAvIpLog mmAvIpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page logPage = null; @@ -971,7 +971,7 @@ public class LogController extends BaseRestController { public Map mmAvUrlLogs(Page page, MmAvUrlLog mmAvUrlLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page logPage = null; @@ -1024,7 +1024,7 @@ public class LogController extends BaseRestController { public Map mmPicIpLogs(Page page, MmPicIpLog mmPicIpLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page logPage = null; @@ -1077,7 +1077,7 @@ public class LogController extends BaseRestController { public Map mmPicUrlLogs(Page page, MmPicUrlLog mmPicUrlLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page logPage = null; @@ -1131,7 +1131,7 @@ public class LogController extends BaseRestController { public Map mmVoipLogs(Page page, MmVoipLog mmVoipLog, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page logPage = null; @@ -1184,7 +1184,7 @@ public class LogController extends BaseRestController { public Map ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcPzReportPage = null; @@ -1222,7 +1222,7 @@ public class LogController extends BaseRestController { public Map ntcServiceReport(Page page, NtcServiceReport ntcServiceReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; @@ -1258,7 +1258,7 @@ public class LogController extends BaseRestController { public Map ntcTagReport(Page page, NtcTagReport ntcTagReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; @@ -1294,7 +1294,7 @@ public class LogController extends BaseRestController { public Map ntcAttrTypeReport(Page page, NtcAttrTypeReport ntcAttrTypeReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; @@ -1331,7 +1331,7 @@ public class LogController extends BaseRestController { public Map ntcLwhhReport(Page page, NtcLwhhReport ntcLwhhReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; @@ -1369,7 +1369,7 @@ public class LogController extends BaseRestController { public Map ntcSrcipDomesticReport(Page page, NtcSrcipDomesticReport ntcSrcipDomesticReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; @@ -1405,7 +1405,7 @@ public class LogController extends BaseRestController { public Map ntcDestipCountryReport(Page page, NtcDestipCountryReport ntcDestipCountryReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; @@ -1441,7 +1441,7 @@ public class LogController extends BaseRestController { public Map ntcEntranceReport(Page page, NtcEntranceReport ntcEntranceReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page reportPage = null; diff --git a/src/main/java/com/nis/web/controller/restful/MaatTestController.java b/src/main/java/com/nis/web/controller/restful/MaatTestController.java index 5fbb07b..1ebf084 100644 --- a/src/main/java/com/nis/web/controller/restful/MaatTestController.java +++ b/src/main/java/com/nis/web/controller/restful/MaatTestController.java @@ -10,6 +10,7 @@ import java.util.Map; import java.util.UUID; import com.nis.domain.restful.*; +import com.nis.web.service.AuditLogThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -21,7 +22,6 @@ import com.nis.util.ExceptionUtil; import com.nis.util.FileUtils; import com.nis.util.ServiceAndRDBIndexReal; import com.nis.util.StringUtil; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.ConfigRedisService; import com.nis.web.service.restful.ConfigSourcesService; @@ -381,7 +381,7 @@ public class MaatTestController { List list = new ArrayList(); for (int a = 0; a < forCount; a++) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = new SaveRequestLogThread(); + AuditLogThread thread = new AuditLogThread(); StringBuffer sb = new StringBuffer(); List configCompileList = new ArrayList(); for (int i = 0; i < saveCount; i++) { @@ -413,7 +413,7 @@ public class MaatTestController { public String testSaveMaat(@RequestParam(required = true) Integer service, @RequestParam(required = true) Integer saveCount) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = new SaveRequestLogThread(); + AuditLogThread thread = new AuditLogThread(); StringBuffer sb = new StringBuffer(); List configCompileList = new ArrayList(); for (int i = 0; i < saveCount; i++) { diff --git a/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java b/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java index 861a510..09dc319 100644 --- a/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java +++ b/src/main/java/com/nis/web/controller/restful/ServicesRequestLogController.java @@ -11,12 +11,11 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.nis.domain.Page; -import com.nis.domain.ServicesRequestLog; import com.nis.domain.restful.ServicesRequestLogBean; import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; @RestController @@ -31,7 +30,7 @@ public class ServicesRequestLogController extends BaseRestController { Page queryAllCompile = null; long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, log); try { queryAllCompile = servicesRequestLogService diff --git a/src/main/java/com/nis/web/controller/restful/SystemFunStatusController.java b/src/main/java/com/nis/web/controller/restful/SystemFunStatusController.java index d26f08e..3c1716e 100644 --- a/src/main/java/com/nis/web/controller/restful/SystemFunStatusController.java +++ b/src/main/java/com/nis/web/controller/restful/SystemFunStatusController.java @@ -5,6 +5,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; @@ -20,7 +21,6 @@ import com.nis.util.Constants; import com.nis.util.OracleErrorCodeUtil; import com.nis.util.StringUtil; import com.nis.web.controller.BaseRestController; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.SystemFunStatusService; import com.wordnik.swagger.annotations.ApiOperation; @@ -59,7 +59,7 @@ public class SystemFunStatusController extends BaseRestController { HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, systemFunStatusSource); + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, systemFunStatusSource); super.checkOpAction(thread, System.currentTimeMillis() - start, systemFunStatusSource.getOpAction(), Constants.OPACTION_POST); try{ @@ -100,7 +100,7 @@ public class SystemFunStatusController extends BaseRestController { HttpServletRequest request, HttpServletResponse response){ long start=System.currentTimeMillis(); - SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, systemFunStatusSource); + AuditLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_PUT,request, systemFunStatusSource); super.checkOpAction(thread,System.currentTimeMillis()-start,systemFunStatusSource.getOpAction(), Constants.OPACTION_PUT); try{ diff --git a/src/main/java/com/nis/web/service/SaveRequestLogThread.java b/src/main/java/com/nis/web/service/AuditLogThread.java similarity index 86% rename from src/main/java/com/nis/web/service/SaveRequestLogThread.java rename to src/main/java/com/nis/web/service/AuditLogThread.java index a6dbffc..3e5a6b8 100644 --- a/src/main/java/com/nis/web/service/SaveRequestLogThread.java +++ b/src/main/java/com/nis/web/service/AuditLogThread.java @@ -1,435 +1,433 @@ -/** - *@Title: SaveLogThread.java - *@Package com.nis.web.service.logthread - *@Description TODO - *@author dell - *@date 2016年10月14日 下午6:26:41 - *@version 版本号 - */ -package com.nis.web.service; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.util.Date; - -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; - -import org.apache.log4j.Logger; - -import com.nis.datasource.CustomerContextHolder; - -/** - * 审计日志工作线程 - * @ClassName: SaveLogThread.java - * @Description: 用于记录业务操作日志,后期用于审计及相关联调验证工作 - * @author (dell) - * @date 2016年10月14日 下午6:26:41 - * @version V1.0 - */ -public class SaveRequestLogThread implements Runnable { - private Logger logger = Logger.getLogger(SaveRequestLogThread.class); - private ServicesRequestLogService service; - private String remoteAddr; - private String requestURI; - private String queryString; - private String contextPath; - private String operator; - private String version; - private int opAction; - private Date opTime; - private Object content; - private Date requestTime; - private long consumerTime; - private int businessCode; - private String exceptionInfo; - private String traceCode; - /* - * (non-Javadoc) - * - * @see java.lang.Runnable#run() - */ - - @Override - public void run() { - logger.info("线程开始执行!"); - // 新开线程切换数据源,不影响action中的数据源 - CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);// 开启数据源B - // TODO Auto-generated method stub - if (service != null) { - service.saveRequestLog(remoteAddr, requestURI, queryString, contextPath, operator, version, opAction, - opTime, content, requestTime, consumerTime, businessCode, exceptionInfo, traceCode); - } else { - logger.error("service 为空!"); - } - CustomerContextHolder.clearCustomerType(); - } - - public SaveRequestLogThread() { - super(); - } - - /** - * 创建一个新的实例 SaveRequestLogThread. - * - * @param service - * @param requestURI - * @param queryString - * @param contextPath - * @param operator - * @param version - * @param opAction - * @param opTime - * @param content - * @param requestTime - * @param consumerTime - */ - public SaveRequestLogThread(ServicesRequestLogService service, String remoteAddr, String requestURI, - String queryString, String contextPath, String operator, String version, int opAction, Date opTime, - Object content, Date requestTime, long consumerTime, String exceptionInfo) { - super(); - this.service = service; - this.remoteAddr = remoteAddr; - this.requestURI = requestURI; - this.queryString = queryString; - this.contextPath = contextPath; - this.operator = operator; - this.version = version; - this.opAction = opAction; - this.opTime = opTime; - this.content = content; - this.requestTime = requestTime; - this.consumerTime = consumerTime; - this.exceptionInfo = exceptionInfo; - } - - public SaveRequestLogThread(ServicesRequestLogService service, String operator, String version, int opAction, - Date opTime, Object content, Date requestTime, long consumerTime, String exceptionInfo) { - super(); - this.service = service; - this.operator = operator; - this.version = version; - this.opAction = opAction; - this.opTime = opTime; - this.content = content; - this.requestTime = requestTime; - this.consumerTime = consumerTime; - this.exceptionInfo = exceptionInfo; - } - - public static InputStream cloneInputStream(ServletInputStream inputStream) { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int len; - try { - while ((len = inputStream.read(buffer)) > -1) { - byteArrayOutputStream.write(buffer, 0, len); - } - byteArrayOutputStream.flush(); - } catch (IOException e) { - e.printStackTrace(); - } - InputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); - return byteArrayInputStream; - } - - /** - * 获取非get请求的参数 - * @param request - * @return - */ - private static String getBodyString(ServletRequest request) { - StringBuilder sb = new StringBuilder(); - InputStream inputStream = null; - BufferedReader reader = null; - try { - inputStream = cloneInputStream(request.getInputStream()); - reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); - String line = ""; - while ((line = reader.readLine()) != null) { - sb.append(line); - } - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return sb.toString(); - } - - public static SaveRequestLogThread getNewSaveRequestLogThread(HttpServletRequest request) { - SaveRequestLogThread thread = new SaveRequestLogThread(); - thread.setRemoteAddr(request.getRemoteAddr()); - thread.setRequestURI(request.getRequestURI()); - if (request.getMethod().toLowerCase().equals("get")) { - thread.setQueryString(request.getQueryString()); - thread.setContent(request.getQueryString()); - } else { - String contentType = request.getContentType(); - if(!contentType.contains("multipart/form-data")) { - String bodyString = getBodyString(request); - thread.setQueryString(bodyString); - thread.setContent(bodyString); - }else { - //String bodyString = getBodyString(request); - thread.setQueryString("contentTyp="+contentType+",一般是上传文件,此种请求不记录请求内容"); - thread.setContent("contentTyp="+contentType+",一般是上传文件,此种请求不记录请求内容"); - } - } - thread.setContextPath(request.getContextPath()); - thread.setRequestTime(new Date()); - return thread; - } - - /** - * service - * @return service - */ - - public ServicesRequestLogService getService() { - return service; - } - - /** - * @param service the service to set - */ - public void setService(ServicesRequestLogService service) { - this.service = service; - } - - /** - * remoteAddr - * @return remoteAddr - */ - - public String getRemoteAddr() { - return remoteAddr; - } - - /** - * @param remoteAddr the remoteAddr to set - */ - public void setRemoteAddr(String remoteAddr) { - this.remoteAddr = remoteAddr; - } - - /** - * requestURI - * @return requestURI - */ - - public String getRequestURI() { - return requestURI; - } - - /** - * @param requestURI the requestURI to set - */ - public void setRequestURI(String requestURI) { - this.requestURI = requestURI; - } - - /** - * queryString - * @return queryString - */ - - public String getQueryString() { - return queryString; - } - - /** - * @param queryString the queryString to set - */ - public void setQueryString(String queryString) { - this.queryString = queryString; - } - - /** - * contextPath - * @return contextPath - */ - - public String getContextPath() { - return contextPath; - } - - /** - * @param contextPath the contextPath to set - */ - public void setContextPath(String contextPath) { - this.contextPath = contextPath; - } - - /** - * operator - * @return operator - */ - - public String getOperator() { - return operator; - } - - /** - * @param operator the operator to set - */ - public void setOperator(String operator) { - this.operator = operator; - } - - /** - * version - * @return version - */ - - public String getVersion() { - return version; - } - - /** - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * opAction - * @return opAction - */ - - public int getOpAction() { - return opAction; - } - - /** - * @param opAction the opAction to set - */ - public void setOpAction(int opAction) { - this.opAction = opAction; - } - - /** - * opTime - * @return opTime - */ - - public Date getOpTime() { - return opTime; - } - - /** - * @param opTime the opTime to set - */ - public void setOpTime(Date opTime) { - this.opTime = opTime; - } - - /** - * content - * @return content - */ - - public Object getContent() { - return content; - } - - /** - * @param content the content to set - */ - public void setContent(Object content) { - this.content = content; - } - - /** - * requestTime - * @return requestTime - */ - - public Date getRequestTime() { - return requestTime; - } - - /** - * @param requestTime the requestTime to set - */ - public void setRequestTime(Date requestTime) { - this.requestTime = requestTime; - } - - /** - * consumerTime - * @return consumerTime - */ - - public long getConsumerTime() { - return consumerTime; - } - - /** - * @param consumerTime the consumerTime to set - */ - public void setConsumerTime(long consumerTime) { - this.consumerTime = consumerTime; - } - - /** - * businessCode - * @return businessCode - */ - - public int getBusinessCode() { - return businessCode; - } - - /** - * @param businessCode the businessCode to set - */ - public void setBusinessCode(int businessCode) { - this.businessCode = businessCode; - } - - /** - * exceptionInfo - * @return exceptionInfo - */ - - public String getExceptionInfo() { - return exceptionInfo; - } - - /** - * @param exceptionInfo the exceptionInfo to set - */ - public void setExceptionInfo(String exceptionInfo) { - this.exceptionInfo = exceptionInfo; - } - - public String getTraceCode() { - return traceCode; - } - - public void setTraceCode(String traceCode) { - this.traceCode = traceCode; - } - -} +/** + *@Title: SaveLogThread.java + *@Package com.nis.web.service.logthread + *@Description TODO + *@author dell + *@date 2016年10月14日 下午6:26:41 + *@version 版本号 + */ +package com.nis.web.service; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Date; + +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; + +import com.nis.datasource.CustomerContextHolder; + +/** + * 审计日志工作线程 + * @ClassName: SaveLogThread.java + * @Description: 用于记录业务操作日志,后期用于审计及相关联调验证工作 + * @author (dell) + * @date 2016年10月14日 下午6:26:41 + * @version V1.0 + */ +public class AuditLogThread implements Runnable { + private Logger logger = Logger.getLogger(AuditLogThread.class); + private ServicesRequestLogService service; + private String remoteAddr; + private String requestURI; + private String queryString; + private String contextPath; + private String operator; + private String version; + private int opAction; + private Date opTime; + private Object content; + private Date requestTime; + private long consumerTime; + private int businessCode; + private String exceptionInfo; + private String traceCode; + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + + @Override + public void run() { + // 新开线程切换数据源,不影响action中的数据源 + CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_A);// 开启数据源B + if (service != null) { + service.saveRequestLog(remoteAddr, requestURI, queryString, contextPath, operator, version, opAction, + opTime, content, requestTime, consumerTime, businessCode, exceptionInfo, traceCode); + } else { + logger.error("service 为空!"); + } + CustomerContextHolder.clearCustomerType(); + } + + public AuditLogThread() { + super(); + } + + /** + * 创建一个新的实例 AuditLogThread. + * + * @param service + * @param requestURI + * @param queryString + * @param contextPath + * @param operator + * @param version + * @param opAction + * @param opTime + * @param content + * @param requestTime + * @param consumerTime + */ + public AuditLogThread(ServicesRequestLogService service, String remoteAddr, String requestURI, + String queryString, String contextPath, String operator, String version, int opAction, Date opTime, + Object content, Date requestTime, long consumerTime, String exceptionInfo) { + super(); + this.service = service; + this.remoteAddr = remoteAddr; + this.requestURI = requestURI; + this.queryString = queryString; + this.contextPath = contextPath; + this.operator = operator; + this.version = version; + this.opAction = opAction; + this.opTime = opTime; + this.content = content; + this.requestTime = requestTime; + this.consumerTime = consumerTime; + this.exceptionInfo = exceptionInfo; + } + + public AuditLogThread(ServicesRequestLogService service, String operator, String version, int opAction, + Date opTime, Object content, Date requestTime, long consumerTime, String exceptionInfo) { + super(); + this.service = service; + this.operator = operator; + this.version = version; + this.opAction = opAction; + this.opTime = opTime; + this.content = content; + this.requestTime = requestTime; + this.consumerTime = consumerTime; + this.exceptionInfo = exceptionInfo; + } + + public static InputStream cloneInputStream(ServletInputStream inputStream) { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len; + try { + while ((len = inputStream.read(buffer)) > -1) { + byteArrayOutputStream.write(buffer, 0, len); + } + byteArrayOutputStream.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + InputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); + return byteArrayInputStream; + } + + /** + * 获取非get请求的参数 + * @param request + * @return + */ + private static String getBodyString(ServletRequest request) { + StringBuilder sb = new StringBuilder(); + InputStream inputStream = null; + BufferedReader reader = null; + try { + inputStream = cloneInputStream(request.getInputStream()); + reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); + String line = ""; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return sb.toString(); + } + + public static AuditLogThread getNewSaveRequestLogThread(HttpServletRequest request) { + AuditLogThread thread = new AuditLogThread(); + thread.setRemoteAddr(request.getRemoteAddr()); + thread.setRequestURI(request.getRequestURI()); + if (request.getMethod().toLowerCase().equals("get")) { + thread.setQueryString(request.getQueryString()); + thread.setContent(request.getQueryString()); + } else { + String contentType = request.getContentType(); + if(!contentType.contains("multipart/form-data")) { + String bodyString = getBodyString(request); + thread.setQueryString(bodyString); + thread.setContent(bodyString); + }else { + //String bodyString = getBodyString(request); + thread.setQueryString("contentTyp="+contentType+",一般是上传文件,此种请求不记录请求内容"); + thread.setContent("contentTyp="+contentType+",一般是上传文件,此种请求不记录请求内容"); + } + } + thread.setContextPath(request.getContextPath()); + thread.setRequestTime(new Date()); + return thread; + } + + /** + * service + * @return service + */ + + public ServicesRequestLogService getService() { + return service; + } + + /** + * @param service the service to set + */ + public void setService(ServicesRequestLogService service) { + this.service = service; + } + + /** + * remoteAddr + * @return remoteAddr + */ + + public String getRemoteAddr() { + return remoteAddr; + } + + /** + * @param remoteAddr the remoteAddr to set + */ + public void setRemoteAddr(String remoteAddr) { + this.remoteAddr = remoteAddr; + } + + /** + * requestURI + * @return requestURI + */ + + public String getRequestURI() { + return requestURI; + } + + /** + * @param requestURI the requestURI to set + */ + public void setRequestURI(String requestURI) { + this.requestURI = requestURI; + } + + /** + * queryString + * @return queryString + */ + + public String getQueryString() { + return queryString; + } + + /** + * @param queryString the queryString to set + */ + public void setQueryString(String queryString) { + this.queryString = queryString; + } + + /** + * contextPath + * @return contextPath + */ + + public String getContextPath() { + return contextPath; + } + + /** + * @param contextPath the contextPath to set + */ + public void setContextPath(String contextPath) { + this.contextPath = contextPath; + } + + /** + * operator + * @return operator + */ + + public String getOperator() { + return operator; + } + + /** + * @param operator the operator to set + */ + public void setOperator(String operator) { + this.operator = operator; + } + + /** + * version + * @return version + */ + + public String getVersion() { + return version; + } + + /** + * @param version the version to set + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * opAction + * @return opAction + */ + + public int getOpAction() { + return opAction; + } + + /** + * @param opAction the opAction to set + */ + public void setOpAction(int opAction) { + this.opAction = opAction; + } + + /** + * opTime + * @return opTime + */ + + public Date getOpTime() { + return opTime; + } + + /** + * @param opTime the opTime to set + */ + public void setOpTime(Date opTime) { + this.opTime = opTime; + } + + /** + * content + * @return content + */ + + public Object getContent() { + return content; + } + + /** + * @param content the content to set + */ + public void setContent(Object content) { + this.content = content; + } + + /** + * requestTime + * @return requestTime + */ + + public Date getRequestTime() { + return requestTime; + } + + /** + * @param requestTime the requestTime to set + */ + public void setRequestTime(Date requestTime) { + this.requestTime = requestTime; + } + + /** + * consumerTime + * @return consumerTime + */ + + public long getConsumerTime() { + return consumerTime; + } + + /** + * @param consumerTime the consumerTime to set + */ + public void setConsumerTime(long consumerTime) { + this.consumerTime = consumerTime; + } + + /** + * businessCode + * @return businessCode + */ + + public int getBusinessCode() { + return businessCode; + } + + /** + * @param businessCode the businessCode to set + */ + public void setBusinessCode(int businessCode) { + this.businessCode = businessCode; + } + + /** + * exceptionInfo + * @return exceptionInfo + */ + + public String getExceptionInfo() { + return exceptionInfo; + } + + /** + * @param exceptionInfo the exceptionInfo to set + */ + public void setExceptionInfo(String exceptionInfo) { + this.exceptionInfo = exceptionInfo; + } + + public String getTraceCode() { + return traceCode; + } + + public void setTraceCode(String traceCode) { + this.traceCode = traceCode; + } + +} diff --git a/src/main/java/com/nis/web/service/BaseLogService.java b/src/main/java/com/nis/web/service/BaseLogService.java index 9d3a2eb..f1a5817 100644 --- a/src/main/java/com/nis/web/service/BaseLogService.java +++ b/src/main/java/com/nis/web/service/BaseLogService.java @@ -52,7 +52,7 @@ public abstract class BaseLogService { * @exception @since * 1.0.0 */ - public void checkCloumnIsExist(SaveRequestLogThread thread, long start, Class clazz, Page page) throws Exception { + public void checkCloumnIsExist(AuditLogThread thread, long start, Class clazz, Page page) throws Exception { String[] fieldsColoumn = null; String[] orderByColoumn = null; String notExistColumn = ""; @@ -136,8 +136,8 @@ public abstract class BaseLogService { * @param clazz * @param page */ - public void queryConditionCheck(SaveRequestLogThread thread, long start, LogEntity entity, Class clazz, - Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, LogEntity entity, Class clazz, + Page page) { logger.info("请求参数校验开始----" + System.currentTimeMillis()); try { if (!StringUtil.isBlank(entity.getSearchCfgId())) { @@ -252,8 +252,8 @@ public abstract class BaseLogService { * @param clazz * @param page */ - public void queryReportConditionCheck(SaveRequestLogThread thread, long start, NtcReportEntity entity, Class clazz, - Page page) { + public void queryReportConditionCheck(AuditLogThread thread, long start, NtcReportEntity entity, Class clazz, + Page page) { logger.info("实时报表统计查询参数校验开始----" + System.currentTimeMillis()); if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) { logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误"); @@ -316,7 +316,7 @@ public abstract class BaseLogService { * @param condition * @param condName */ - public void checkNumericCondition(SaveRequestLogThread thread, long start,String condition,String condName) { + public void checkNumericCondition(AuditLogThread thread, long start, String condition, String condName) { if (!StringUtil.isEmpty(condition)){ Boolean flag = false; if (condition.contains(",")) { @@ -348,8 +348,8 @@ public abstract class BaseLogService { * @param page * 需要校验的page对象 */ - public void queryConditionCheck(SaveRequestLogThread thread, long start, StatLogEntity entity, Class clazz, - Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, StatLogEntity entity, Class clazz, + Page page) { try { if (!StringUtil.isBlank(entity.getSearchStatStartTime())) { @@ -413,8 +413,8 @@ public abstract class BaseLogService { * * @param entity */ - public void queryConditionCheck(SaveRequestLogThread thread, long start, DfJitLogEntity entity, Class clazz, - Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, DfJitLogEntity entity, Class clazz, + Page page) { try { if (!StringUtil.isBlank(entity.getSearchReportEndTime())) { sdf.parse(entity.getSearchReportEndTime()); @@ -498,8 +498,8 @@ public abstract class BaseLogService { * * @param entity */ - public void queryConditionCheck(SaveRequestLogThread thread, long start, DfReportEntity entity, Class clazz, - Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, DfReportEntity entity, Class clazz, + Page page) { try { if (!StringUtil.isBlank(entity.getSearchReportEndTime())) { sdf.parse(entity.getSearchReportEndTime()); diff --git a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java index 5160a93..c8c7098 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java +++ b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java @@ -19,12 +19,12 @@ import java.util.concurrent.CountDownLatch; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.nis.web.service.AuditLogThread; import net.sf.json.JSONObject; import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; -import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -60,7 +60,6 @@ import com.nis.web.dao.IpRegionDao; import com.nis.web.dao.NumRegionDao; import com.nis.web.dao.StrRegionDao; import com.nis.web.service.BaseService; -import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.SpringContextHolder; /** @@ -118,8 +117,8 @@ public class ConfigSourcesService extends BaseService { * @return * @throws Exception */ - public void updateConfigSource(SaveRequestLogThread thread, long start, - List configSource, Date opTime, StringBuffer sb) { + public void updateConfigSource(AuditLogThread thread, long start, + List configSource, Date opTime, StringBuffer sb) { SqlSessionFactory sqlSessionFactory = SpringContextHolder .getBean(SqlSessionFactory.class); SqlSession batchSqlSession = null; @@ -202,9 +201,9 @@ public class ConfigSourcesService extends BaseService { * @throws Exception */ - public void updateConfigCompile(SaveRequestLogThread thread, long start, - ConfigCompile config, SqlSession batchSqlSession, Date opTime, - StringBuffer sb) throws Exception { + public void updateConfigCompile(AuditLogThread thread, long start, + ConfigCompile config, SqlSession batchSqlSession, Date opTime, + StringBuffer sb) throws Exception { List ipRegionList = config.getIpRegionList(); List strRegionList = config.getStrRegionList(); List numRegionList = config.getNumRegionList(); @@ -295,10 +294,10 @@ public class ConfigSourcesService extends BaseService { * 当前编译下所有的配置分组关系 * @return */ - public void regionUpdate(SaveRequestLogThread thread, long start, - ConfigCompile config, - List queryCompileGroupByPID, - SqlSession batchSqlSession, Date opTime, StringBuffer sb) + public void regionUpdate(AuditLogThread thread, long start, + ConfigCompile config, + List queryCompileGroupByPID, + SqlSession batchSqlSession, Date opTime, StringBuffer sb) throws Exception { Map>> regionMap = getRegionList(thread, System.currentTimeMillis() - start, config, @@ -478,7 +477,7 @@ public class ConfigSourcesService extends BaseService { } public Map>> getRegionList( - SaveRequestLogThread thread, long start, ConfigCompile config, + AuditLogThread thread, long start, ConfigCompile config, List queryCompileGroupByPID, SqlSession batchSqlSession, StringBuffer sb) { Map>> map = new HashMap>>(); @@ -651,7 +650,7 @@ public class ConfigSourcesService extends BaseService { * @param configSource * @throws Exception */ - public void insertConfigSourceData(SaveRequestLogThread thread, + public void insertConfigSourceData(AuditLogThread thread, long _start, List configSource, StringBuffer sb) { SqlSessionFactory sqlSessionFactory = SpringContextHolder .getBean(SqlSessionFactory.class); @@ -717,7 +716,7 @@ public class ConfigSourcesService extends BaseService { * @return * @throws Exception */ - private String insertConfigComLileData(SaveRequestLogThread thread, + private String insertConfigComLileData(AuditLogThread thread, long start, List configCompileList, StringBuffer sb) throws Exception { @@ -1009,8 +1008,8 @@ public class ConfigSourcesService extends BaseService { * @param sb * @return */ - public String saveMaatConfig(SaveRequestLogThread thread, long start, - List configCompileList, StringBuffer sb) { + public String saveMaatConfig(AuditLogThread thread, long start, + List configCompileList, StringBuffer sb) { // List maatConfigList = new ArrayList(); // List serviceList = new ArrayList(); Map> maatMap = new HashMap>(); @@ -1379,8 +1378,8 @@ public class ConfigSourcesService extends BaseService { return dstMap; } - public String updateConfigSources(SaveRequestLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { + public String updateConfigSources(AuditLogThread thread, long start, + List compileList, Date opTime, StringBuffer sb) { Map> compileMap = new HashMap>(); if (null != compileList && compileList.size() > 0) { for (ConfigCompile config : compileList) { @@ -1459,8 +1458,8 @@ public class ConfigSourcesService extends BaseService { return "ok"; } - public String saveByJDBCThread(SaveRequestLogThread thread, long start, - List configCompileList, StringBuffer sb) { + public String saveByJDBCThread(AuditLogThread thread, long start, + List configCompileList, StringBuffer sb) { List groupRelationList = new ArrayList(); Map> strRegionMap = new HashMap>(); Map> strStongRegionMap = new HashMap>(); @@ -1774,8 +1773,8 @@ public class ConfigSourcesService extends BaseService { * @return * @throws Exception */ - public String updateByJDBCThread(SaveRequestLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { + public String updateByJDBCThread(AuditLogThread thread, long start, + List compileList, Date opTime, StringBuffer sb) { List compileAllList = new ArrayList(); List groupRelationAllList = new ArrayList(); Map> strRegionMap = new HashMap>(); @@ -2193,8 +2192,8 @@ public class ConfigSourcesService extends BaseService { * @return * @throws Exception */ - public String updateByJDBCThread12(SaveRequestLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { + public String updateByJDBCThread12(AuditLogThread thread, long start, + List compileList, Date opTime, StringBuffer sb) { List compileAllList = new ArrayList(); List groupRelationAllList = new ArrayList(); Map> strRegionMap = new HashMap>(); @@ -2420,8 +2419,8 @@ public class ConfigSourcesService extends BaseService { * @param sb * @return */ - public String updateByJDBCThread3(SaveRequestLogThread thread, long start, - List compileList, Date opTime, StringBuffer sb) { + public String updateByJDBCThread3(AuditLogThread thread, long start, + List compileList, Date opTime, StringBuffer sb) { List compileAllList = new ArrayList(); if (null != compileList && compileList.size() > 0) { for (ConfigCompile config : compileList) { @@ -2545,7 +2544,7 @@ public class ConfigSourcesService extends BaseService { * @return */ public Map>> getRegionList( - SaveRequestLogThread thread, long start, ConfigCompile config, + AuditLogThread thread, long start, ConfigCompile config, List queryCompileGroupByPID, StringBuffer sb) { Map>> map = new HashMap>>(); Map updateTableMap = new HashMap(); @@ -2724,8 +2723,8 @@ public class ConfigSourcesService extends BaseService { return "ok"; } - public String saveCommonSources(SaveRequestLogThread thread, long start, - String jsonString, StringBuffer sb) { + public String saveCommonSources(AuditLogThread thread, long start, + String jsonString) { CompileVal.setBusinessCode(null); JsonArray jsonObjectList = new JsonParser().parse(jsonString) .getAsJsonArray(); @@ -3026,7 +3025,6 @@ public class ConfigSourcesService extends BaseService { try { configRedisService.saveUnMaatConfig(configMap); } catch (Exception e) { - // TODO: handle exception logger.error(e.getMessage()); CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue()); if (e.getMessage().startsWith("后台错误:")) { @@ -3039,8 +3037,8 @@ public class ConfigSourcesService extends BaseService { return "ok"; } - public String updateCommonSources(SaveRequestLogThread thread, long start, - String jsonString, Date opTime, StringBuffer sb) { + public String updateCommonSources(AuditLogThread thread, long start, + String jsonString, Date opTime, StringBuffer sb) { JsonArray jsonObjectList = null; try { jsonObjectList = new JsonParser().parse(jsonString) diff --git a/src/main/java/com/nis/web/service/restful/DfKeyConvertUrlService.java b/src/main/java/com/nis/web/service/restful/DfKeyConvertUrlService.java index 0d31f9c..1270d33 100644 --- a/src/main/java/com/nis/web/service/restful/DfKeyConvertUrlService.java +++ b/src/main/java/com/nis/web/service/restful/DfKeyConvertUrlService.java @@ -9,15 +9,12 @@ import org.springframework.stereotype.Service; import com.nis.domain.Page; import com.nis.domain.restful.DfKeyConvertUrl; -import com.nis.domain.restful.DfKeyMailAdd; -import com.nis.domain.restful.DjFlowControlStop; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; import com.nis.util.StringUtil; import com.nis.web.dao.DfKeyConvertUrlDao; -import com.nis.web.dao.IntervalTimeSearchDao; import com.nis.web.service.BaseLogService; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; /** * @ClassName: DfKeyConvertUrlService @@ -54,7 +51,7 @@ public class DfKeyConvertUrlService extends BaseLogService { * wx * @param entity */ - public void queryConditionCheck(SaveRequestLogThread thread,long start,DfKeyConvertUrl entity,Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, DfKeyConvertUrl entity, Page page) { try { if (!StringUtil.isBlank(entity.getSearchId())) { diff --git a/src/main/java/com/nis/web/service/restful/DfKeyMailAddService.java b/src/main/java/com/nis/web/service/restful/DfKeyMailAddService.java index 84ba943..d3be51a 100644 --- a/src/main/java/com/nis/web/service/restful/DfKeyMailAddService.java +++ b/src/main/java/com/nis/web/service/restful/DfKeyMailAddService.java @@ -14,7 +14,7 @@ import com.nis.restful.RestServiceException; import com.nis.util.StringUtil; import com.nis.web.dao.DfKeyMailAddDao; import com.nis.web.service.BaseLogService; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; /** * @ClassName: DfKeyMailAddService @@ -43,7 +43,7 @@ public class DfKeyMailAddService extends BaseLogService { /** * 查询条件检查 */ - public void queryConditionCheck(SaveRequestLogThread thread, long start, DfKeyMailAdd entity, Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, DfKeyMailAdd entity, Page page) { try { if (!StringUtil.isBlank(entity.getSearchId())) { Long.parseLong(entity.getSearchId()); diff --git a/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java b/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java index 52a9bb3..a86c7b1 100644 --- a/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java +++ b/src/main/java/com/nis/web/service/restful/DnsGroupTypeService.java @@ -11,6 +11,7 @@ package com.nis.web.service.restful; import java.util.ArrayList; import java.util.List; +import com.nis.web.service.AuditLogThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,7 +22,6 @@ import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.dao.DnsGroupTypeDao; import com.nis.web.service.CrudService; -import com.nis.web.service.SaveRequestLogThread; /** * @ClassName: DnsGroupTypeService.java @@ -41,7 +41,7 @@ public class DnsGroupTypeService extends CrudService entity) { + public void saveDnsGroupTypeBatch(AuditLogThread thread, long start, List entity) { // TODO Auto-generated method stub List idsList=new ArrayList<>(); for(DnsGroupType e:entity){ @@ -55,7 +55,7 @@ public class DnsGroupTypeService extends CrudService entity) { + public void updateDnsGroupTypeBatch(AuditLogThread thread, long start, List entity) { // TODO Auto-generated method stub // List idsList=new ArrayList<>(); // for(DnsGroupType e:entity){ diff --git a/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java b/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java index ca81be5..9619c74 100644 --- a/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java +++ b/src/main/java/com/nis/web/service/restful/DnsResponseStrategyService.java @@ -9,7 +9,6 @@ package com.nis.web.service.restful; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -22,7 +21,7 @@ import com.nis.restful.RestServiceException; import com.nis.util.Constants; import com.nis.web.dao.DnsResponseStrategyDao; import com.nis.web.service.CrudService; -import com.nis.web.service.SaveRequestLogThread; +import com.nis.web.service.AuditLogThread; /** * @ClassName: DnsResponseStrategy.java @@ -64,7 +63,7 @@ public class DnsResponseStrategyService extends CrudService entity) { + public void saveDnsResponseStrategyBatch(AuditLogThread thread, long start, List entity) { // TODO Auto-generated method stub List idsList=new ArrayList<>(); for(DnsResponseStrategy e:entity){ @@ -103,7 +102,7 @@ public class DnsResponseStrategyService extends CrudService entity) { + public void updateDnsResponseStrategyBatch(AuditLogThread thread, long start, List entity) { // List idsList=new ArrayList<>(); // for(DnsResponseStrategy e:entity){ // if(e.getReqStrateId()!=null) diff --git a/src/main/java/com/nis/web/service/restful/IntervalTimeSearchService.java b/src/main/java/com/nis/web/service/restful/IntervalTimeSearchService.java index a6defd0..bf92b7c 100644 --- a/src/main/java/com/nis/web/service/restful/IntervalTimeSearchService.java +++ b/src/main/java/com/nis/web/service/restful/IntervalTimeSearchService.java @@ -3,19 +3,18 @@ package com.nis.web.service.restful; import java.text.ParseException; import java.text.SimpleDateFormat; +import com.nis.web.service.AuditLogThread; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.nis.domain.Page; -import com.nis.domain.restful.DfKeyConvertUrl; import com.nis.domain.restful.DjFlowControlStop; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; import com.nis.util.StringUtil; import com.nis.web.dao.IntervalTimeSearchDao; import com.nis.web.service.BaseLogService; -import com.nis.web.service.SaveRequestLogThread; /** * @ClassName: IntervalTimeSearchService @@ -51,7 +50,7 @@ public class IntervalTimeSearchService extends BaseLogService { * wx * @param entity */ - public void queryConditionCheck(SaveRequestLogThread thread,long start,DjFlowControlStop entity,Page page) { + public void queryConditionCheck(AuditLogThread thread, long start, DjFlowControlStop entity, Page page) { /*try { if (!StringUtil.isBlank(entity.getSearchCfgId())) { Long.parseLong(entity.getSearchCfgId());