【fix sonar】OnlineInterceptor文件
This commit is contained in:
+9
-6
@@ -10,6 +10,7 @@ import com.jero.common.util.SpringContextUtils;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.generater.modules.online.cgform.service.IOnlineBaseAPI;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
@@ -18,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
public class OnlineInterceptor implements HandlerInterceptor {
|
||||
@@ -36,11 +38,14 @@ public class OnlineInterceptor implements HandlerInterceptor {
|
||||
|
||||
boolean bool = handler.getClass().isAssignableFrom(HandlerMethod.class);
|
||||
|
||||
if (bool) {
|
||||
if (!bool) {
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineAuth onlineAuth = ((HandlerMethod) handler).getMethodAnnotation(OnlineAuth.class);
|
||||
|
||||
if (onlineAuth != null) {
|
||||
if(Objects.isNull(onlineAuth)){
|
||||
return true;
|
||||
}
|
||||
log.debug("===== online 菜单访问拦截器 =====");
|
||||
String str1 = request.getRequestURI().substring(request.getContextPath().length());
|
||||
str1 = a(str1);
|
||||
@@ -81,8 +86,6 @@ public class OnlineInterceptor implements HandlerInterceptor {
|
||||
a(response, str2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ public class OnlineInterceptor implements HandlerInterceptor {
|
||||
if ("exportXls".equals(paramString)) {
|
||||
printWriter.print("");
|
||||
} else {
|
||||
Result result = Result.error("无权限访问(操作)");
|
||||
Result<T> result = Result.error("无权限访问(操作)");
|
||||
printWriter.print(JSON.toJSON(result));
|
||||
}
|
||||
} catch (IOException iOException) {
|
||||
|
||||
Reference in New Issue
Block a user