|
@@ -0,0 +1,118 @@
|
|
|
+//package com.fdkankan.scene.Interceptor;
|
|
|
+//
|
|
|
+//import cn.hutool.core.collection.CollUtil;
|
|
|
+//import cn.hutool.core.util.StrUtil;
|
|
|
+//import com.fdkankan.base.constant.SceneConstant;
|
|
|
+//import com.fdkankan.common.aop.CheckCurrentUser;
|
|
|
+//import com.fdkankan.common.constant.ErrorCode;
|
|
|
+//import com.fdkankan.common.constant.ServerCode;
|
|
|
+//import com.fdkankan.common.exception.BaseRuntimeException;
|
|
|
+//import com.fdkankan.common.exception.BusinessException;
|
|
|
+//import com.fdkankan.common.model.SSOUser;
|
|
|
+//import com.fdkankan.common.user.SSOLoginHelper;
|
|
|
+//import com.fdkankan.common.user.SSOUser;
|
|
|
+//import com.fdkankan.common.util.SSOLoginHelper;
|
|
|
+//import com.fdkankan.common.util.WebUtil;
|
|
|
+//import com.fdkankan.goods.entity.CameraEntity;
|
|
|
+//import com.fdkankan.goods.service.ICameraService;
|
|
|
+//import com.fdkankan.redis.constant.RedisKey;
|
|
|
+//import com.fdkankan.redis.util.RedisUtil;
|
|
|
+//import com.fdkankan.scene.entity.SceneCooperationEntity;
|
|
|
+//import com.fdkankan.scene.entity.SceneProEntity;
|
|
|
+//import com.fdkankan.scene.service.ISceneCooperationService;
|
|
|
+//import com.fdkankan.scene.service.ISceneProService;
|
|
|
+//import java.io.IOException;
|
|
|
+//import java.lang.reflect.Method;
|
|
|
+//import java.util.List;
|
|
|
+//import java.util.Map;
|
|
|
+//import javax.servlet.http.HttpServletRequest;
|
|
|
+//import lombok.extern.log4j.Log4j2;
|
|
|
+//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 tk.mybatis.mapper.entity.Condition;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * 记录注册用户操作记录、异常记录
|
|
|
+// */
|
|
|
+//@Log4j2
|
|
|
+//@Aspect
|
|
|
+//@Component
|
|
|
+//@Order(2)
|
|
|
+//public class CheckCooperationPermitAspect {
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private SSOLoginHelper ssoLoginHelper;
|
|
|
+// @Autowired
|
|
|
+// private RedisUtil redisUtil;
|
|
|
+// @Autowired
|
|
|
+// private
|
|
|
+//
|
|
|
+//
|
|
|
+// @Pointcut("@annotation(com.fdkankan.scene.annotation.CheckCooperationPermit)")
|
|
|
+// public void checkCooperationPermit() {
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 前置通知 用于拦截Controller层记录用户的操作
|
|
|
+// *
|
|
|
+// * @param joinPoint
|
|
|
+// * 切点
|
|
|
+// * @throws IOException
|
|
|
+// */
|
|
|
+// @Before("checkCooperationPermit()")
|
|
|
+// public void doBefore(JoinPoint joinPoint) throws Exception {
|
|
|
+// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
+// // 读取session中的用户
|
|
|
+// SSOUser user = ssoLoginHelper.loginCheck(request.getHeader("token"));
|
|
|
+// Map<String, Object> params = WebUtil.getParams(joinPoint, request);
|
|
|
+// if(CollUtil.isEmpty(params)){
|
|
|
+// throw new BusinessException(ErrorCode.PARAM_REQUIRED);
|
|
|
+// }
|
|
|
+//
|
|
|
+// String num = (String) params.get("num");
|
|
|
+// if(StrUtil.isEmpty(num)){
|
|
|
+// throw new BusinessException(ServerCode.PARAM_REQUIRED, num);
|
|
|
+// }
|
|
|
+//
|
|
|
+// //判断是不是场景原用户
|
|
|
+//
|
|
|
+//
|
|
|
+// String username = redisUtil.hget(RedisKey.SCENE_COOPERATION_NUM_USERNAME, num);
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 获取注解中对方法的描述信息
|
|
|
+// *
|
|
|
+// * @param joinPoint
|
|
|
+// * 切点
|
|
|
+// * @return 方法描述
|
|
|
+// * @throws Exception
|
|
|
+// */
|
|
|
+// public static String getCheckUserMthodDescription(JoinPoint joinPoint) throws Exception {
|
|
|
+// String targetName = joinPoint.getTarget().getClass().getName();
|
|
|
+// String methodName = joinPoint.getSignature().getName();
|
|
|
+// Object[] arguments = joinPoint.getArgs();
|
|
|
+// Class targetClass = Class.forName(targetName);
|
|
|
+// Method[] methods = targetClass.getMethods();
|
|
|
+// String description = "";
|
|
|
+// for (Method method : methods) {
|
|
|
+// if (method.getName().equals(methodName)) {
|
|
|
+// Class[] clazzs = method.getParameterTypes();
|
|
|
+// if (clazzs.length == arguments.length) {
|
|
|
+// description = method.getAnnotation(CheckCurrentUser.class).description();
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return description;
|
|
|
+// }
|
|
|
+//}
|