|
@@ -1,57 +1,57 @@
|
|
|
-package com.gree.mall.manager.config.aop;
|
|
|
-
|
|
|
-import com.aliyuncs.utils.StringUtils;
|
|
|
-import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
-import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
-import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
-import com.gree.mall.manager.utils.CommonUtils;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.aopalliance.intercept.Joinpoint;
|
|
|
-import org.aspectj.lang.JoinPoint;
|
|
|
-import org.aspectj.lang.annotation.Aspect;
|
|
|
-import org.aspectj.lang.annotation.Before;
|
|
|
-import org.aspectj.lang.annotation.Pointcut;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.core.annotation.Order;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.context.request.RequestContextHolder;
|
|
|
-import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
-@Aspect
|
|
|
-@Component
|
|
|
-@Slf4j
|
|
|
-@Order(2)
|
|
|
-public class OnlyReadAspect {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- CommonLogic commonLogic;
|
|
|
-
|
|
|
- @Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
|
|
|
- public void auth() {}
|
|
|
-
|
|
|
- @Before("auth()")
|
|
|
- public void doBefore(JoinPoint joinPoint){
|
|
|
- start(joinPoint);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void start(JoinPoint joinPoint){
|
|
|
- ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
- HttpServletRequest request = attributes.getRequest();
|
|
|
- String requestURI = request.getRequestURI();
|
|
|
- if(requestURI.indexOf("/admin/") >= 0 || requestURI.equals("/common/upload") || requestURI.contains("/wx/callback")){
|
|
|
- return;
|
|
|
- }
|
|
|
- String userId = CommonUtils.getUserId(request);
|
|
|
- if(StringUtils.isEmpty(userId)){
|
|
|
- return;
|
|
|
- }
|
|
|
- AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
-// if((adminUser.getOnlyRead() || adminUser.getType() == 2)){
|
|
|
-// throw new RemoteServiceException("运营账号暂无权限操作");
|
|
|
+//package com.gree.mall.manager.config.aop;
|
|
|
+//
|
|
|
+//import com.aliyuncs.utils.StringUtils;
|
|
|
+//import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
+//import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
+//import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
+//import com.gree.mall.manager.utils.CommonUtils;
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
+//import org.aopalliance.intercept.Joinpoint;
|
|
|
+//import org.aspectj.lang.JoinPoint;
|
|
|
+//import org.aspectj.lang.annotation.Aspect;
|
|
|
+//import org.aspectj.lang.annotation.Before;
|
|
|
+//import org.aspectj.lang.annotation.Pointcut;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.core.annotation.Order;
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
+//import org.springframework.web.context.request.RequestContextHolder;
|
|
|
+//import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
+//
|
|
|
+//import javax.servlet.http.HttpServletRequest;
|
|
|
+//
|
|
|
+//@Aspect
|
|
|
+//@Component
|
|
|
+//@Slf4j
|
|
|
+//@Order(2)
|
|
|
+//public class OnlyReadAspect {
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// CommonLogic commonLogic;
|
|
|
+//
|
|
|
+// @Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)")
|
|
|
+// public void auth() {}
|
|
|
+//
|
|
|
+// @Before("auth()")
|
|
|
+// public void doBefore(JoinPoint joinPoint){
|
|
|
+// start(joinPoint);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// private void start(JoinPoint joinPoint){
|
|
|
+// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
+// HttpServletRequest request = attributes.getRequest();
|
|
|
+// String requestURI = request.getRequestURI();
|
|
|
+// if(requestURI.indexOf("/admin/") >= 0 || requestURI.equals("/common/upload") || requestURI.contains("/wx/callback")){
|
|
|
+// return;
|
|
|
// }
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+// String userId = CommonUtils.getUserId(request);
|
|
|
+// if(StringUtils.isEmpty(userId)){
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
+//// if((adminUser.getOnlyRead() || adminUser.getType() == 2)){
|
|
|
+//// throw new RemoteServiceException("运营账号暂无权限操作");
|
|
|
+//// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//}
|