|
@@ -9,6 +9,7 @@ import com.dk.mnls_mp.model.pojo.basic.User;
|
|
|
import com.dk.mnls_mp.infrastructure.util.JWTHelper;
|
|
import com.dk.mnls_mp.infrastructure.util.JWTHelper;
|
|
|
import com.dongke.base.exceptionHandler.ResponseResultUtil;
|
|
import com.dongke.base.exceptionHandler.ResponseResultUtil;
|
|
|
import com.dongke.base.exceptionHandler.ResponseResultVO;
|
|
import com.dongke.base.exceptionHandler.ResponseResultVO;
|
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
import org.aspectj.lang.annotation.*;
|
|
import org.aspectj.lang.annotation.*;
|
|
|
import org.aspectj.lang.reflect.MethodSignature;
|
|
import org.aspectj.lang.reflect.MethodSignature;
|
|
@@ -118,27 +119,30 @@ public class HttpRequestAspect {
|
|
|
//厂家获取token的时候 也不进行校验
|
|
//厂家获取token的时候 也不进行校验
|
|
|
if (!requestURI.endsWith("/login") && met.equals("POST")
|
|
if (!requestURI.endsWith("/login") && met.equals("POST")
|
|
|
&& !requestURI.endsWith("/FactoryGetToken") && met.equals("POST")) {
|
|
&& !requestURI.endsWith("/FactoryGetToken") && met.equals("POST")) {
|
|
|
|
|
+ if(StringUtils.isEmpty(Authorization)){
|
|
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.HAS_NOT_TOKEN.getCode(),ResponseCodeEnum.HAS_NOT_TOKEN.getMessage());
|
|
|
|
|
+ }
|
|
|
// 3.1 还原用户信息,拉取权限
|
|
// 3.1 还原用户信息,拉取权限
|
|
|
User user = JWTHelper.verify(Authorization);
|
|
User user = JWTHelper.verify(Authorization);
|
|
|
// 3.2 还原失败,返回错误信息
|
|
// 3.2 还原失败,返回错误信息
|
|
|
if (user == null) {
|
|
if (user == null) {
|
|
|
- return ResponseResultUtil.error(ResponseCodeEnum.TOKEN_OVERDUE);
|
|
|
|
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.TOKEN_OVERDUE.getCode(),ResponseCodeEnum.TOKEN_OVERDUE.getMessage());
|
|
|
}
|
|
}
|
|
|
// 3.3 获取数据库中用户相关信息
|
|
// 3.3 获取数据库中用户相关信息
|
|
|
User dbUser = userMapper.getUserByUserId(user.getUserid());
|
|
User dbUser = userMapper.getUserByUserId(user.getUserid());
|
|
|
// 3.4 校验用户是否已经停用
|
|
// 3.4 校验用户是否已经停用
|
|
|
if (dbUser.getValueflag() == 0) {
|
|
if (dbUser.getValueflag() == 0) {
|
|
|
- return ResponseResultUtil.error(ResponseCodeEnum.USER_IIS_STOP);
|
|
|
|
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.USER_IIS_STOP.getCode(),ResponseCodeEnum.USER_IIS_STOP.getMessage());
|
|
|
}
|
|
}
|
|
|
// 3.5 校验是否已经更换了密码
|
|
// 3.5 校验是否已经更换了密码
|
|
|
if (!dbUser.getPassword().toUpperCase().equals(user.getPassword().toUpperCase())) {
|
|
if (!dbUser.getPassword().toUpperCase().equals(user.getPassword().toUpperCase())) {
|
|
|
- return ResponseResultUtil.error(ResponseCodeEnum.USER_PASSWORD_CHANGE);
|
|
|
|
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.USER_PASSWORD_CHANGE.getCode(),ResponseCodeEnum.USER_PASSWORD_CHANGE.getMessage());
|
|
|
}
|
|
}
|
|
|
// 3.6 如果需要校验权限,则获取用户对应功能列表
|
|
// 3.6 如果需要校验权限,则获取用户对应功能列表
|
|
|
if (needCheck) {
|
|
if (needCheck) {
|
|
|
functionList = userMapper.getFunctionByUserId(dbUser.getUserid());
|
|
functionList = userMapper.getFunctionByUserId(dbUser.getUserid());
|
|
|
if (functionList == null) {
|
|
if (functionList == null) {
|
|
|
- return ResponseResultUtil.error(ResponseCodeEnum.NO_ACCESS);
|
|
|
|
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.NO_ACCESS.getCode(),ResponseCodeEnum.NO_ACCESS.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -160,7 +164,7 @@ public class HttpRequestAspect {
|
|
|
}
|
|
}
|
|
|
// 4.2 如果无权限返回
|
|
// 4.2 如果无权限返回
|
|
|
if (!has) {
|
|
if (!has) {
|
|
|
- return ResponseResultUtil.error(ResponseCodeEnum.NO_ACCESS);
|
|
|
|
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.NO_ACCESS.getCode(),ResponseCodeEnum.NO_ACCESS.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// endregion
|
|
// endregion
|