eureka
tanghc 4 years ago
parent 8aeb6c16bf
commit 842f3a2ae5
  1. 6
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/interceptor/ServiceContextInterceptor.java

@ -40,11 +40,15 @@ public class ServiceContextInterceptor extends HandlerInterceptorAdapter {
if (handler instanceof HandlerMethod) { if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler; HandlerMethod handlerMethod = (HandlerMethod) handler;
Open open = handlerMethod.getMethodAnnotation(Open.class); Open open = handlerMethod.getMethodAnnotation(Open.class);
if (open != null && handlerMethod.getMethodParameters().length == 0) { if (open != null && getArrayLength(handlerMethod.getMethodParameters()) == 0) {
JSONObject requestParams = OpenUtil.getRequestParams(request); JSONObject requestParams = OpenUtil.getRequestParams(request);
OpenContextImpl openContext = new OpenContextImpl(requestParams); OpenContextImpl openContext = new OpenContextImpl(requestParams);
context.setOpenContext(openContext); context.setOpenContext(openContext);
} }
} }
} }
private static <T> int getArrayLength(T[] arr) {
return arr == null ? 0 : arr.length;
}
} }

Loading…
Cancel
Save