package com.jilongda.optometry.aspect;
|
|
|
import com.jilongda.common.exception.TokenException;
|
import com.jilongda.optometry.model.SecUser;
|
import com.jilongda.optometry.utils.LoginInfoUtil;
|
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.stereotype.Component;
|
|
|
@Aspect
|
@Component
|
|
public class StateAspect {
|
@Autowired
|
private LoginInfoUtil loginInfoUtil;
|
@Pointcut("execution(* com.jilongda.applet.controller.*.*(..)) && !execution( * com.jilongda.applet.controller.LoginController.*(..)) && !execution(* com.jilongda.applet.controller.TGoodsController.getConfigById(..))")
|
public void state(){
|
|
}
|
|
@Before("state()")
|
public void isfrozen(){
|
|
SecUser loginUser = loginInfoUtil.getLoginUser();
|
if (loginUser==null){
|
throw new TokenException("当前账号已被删除");
|
}
|
|
if (loginUser.getState()){
|
throw new TokenException("账号已冻结");
|
}
|
|
System.err.println("进入切面");
|
|
}
|
|
|
}
|