|
@@ -4,11 +4,9 @@ import java.io.IOException;
|
|
|
import java.nio.charset.Charset;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -16,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.method.HandlerMethod;
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|
|
-
|
|
|
import com.ym.mec.util.json.JsonUtil;
|
|
|
import com.ym.mec.util.web.WebUtil;
|
|
|
import com.yonge.log.dal.model.AuditLog;
|
|
@@ -68,8 +65,7 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
|
|
|
saveLog(operateName,servletPath,request);
|
|
|
return;
|
|
|
}
|
|
|
- if(servletPath.contains("/task/")
|
|
|
- || servletPath.contains("/import/") ){
|
|
|
+ if(servletPath.contains("/task/") || servletPath.contains("/import/") ){
|
|
|
return;
|
|
|
}
|
|
|
String substring = servletPath.substring(servletPath.lastIndexOf("/") + 1).toLowerCase();
|
|
@@ -82,8 +78,8 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
|
|
|
ignoreLogUrl.add("find");
|
|
|
ignoreLogUrl.add("list");
|
|
|
ignoreLogUrl.add("detail");
|
|
|
- ignoreLogUrl.add("newIndex");
|
|
|
ignoreLogUrl.add("hasIndexErrData");
|
|
|
+ ignoreLogUrl.add("newIndex");
|
|
|
}
|
|
|
for (String e : ignoreLogUrl) {
|
|
|
if(substring.contains(e)){
|
|
@@ -104,22 +100,21 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
|
|
|
auditLog.setService(clientName);
|
|
|
auditLog.setUserIp(WebUtil.getRemoteIp(request));
|
|
|
|
|
|
- Map<String, Object> params = WebUtil.getParameterMap(request);
|
|
|
- if (params == null || params.size() == 0) {
|
|
|
- auditLog.setInputParams(IOUtils.toString(request.getInputStream(), Charset.defaultCharset()));
|
|
|
- } else {
|
|
|
- auditLog.setInputParams(JsonUtil.toJSONString(WebUtil.getParameterMap(request)));
|
|
|
- }
|
|
|
- // 操作人
|
|
|
- auditLog.setUsername(username);
|
|
|
- auditLog.setUserId(userId);
|
|
|
- auditLog.setOperateTime(sdf.format(new Date()));
|
|
|
- auditLogService.insert(auditLog);
|
|
|
+ Map<String, Object> params = WebUtil.getParameterMap(request);
|
|
|
+ if (params == null || params.size() == 0) {
|
|
|
+ auditLog.setInputParams(IOUtils.toString(request.getInputStream(), Charset.defaultCharset()));
|
|
|
+ } else {
|
|
|
+ auditLog.setInputParams(JsonUtil.toJSONString(WebUtil.getParameterMap(request)));
|
|
|
+ }
|
|
|
+ // 操作人
|
|
|
+ auditLog.setUsername(username);
|
|
|
+ auditLog.setUserId(userId);
|
|
|
+ auditLog.setOperateTime(sdf.format(new Date()));
|
|
|
+ auditLogService.insert(auditLog);
|
|
|
}
|
|
|
|
|
|
public void setUsername(String username,Integer userId) {
|
|
|
this.username = username;
|
|
|
this.userId = userId;
|
|
|
}
|
|
|
-
|
|
|
}
|