|
@@ -4,12 +4,14 @@ import cn.hutool.core.util.RandomUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.aliyuncs.exceptions.ClientException;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
|
+import org.jeecg.common.api.CommonAPI;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CacheConstant;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
@@ -24,12 +26,14 @@ import org.jeecg.modules.system.entity.SysDepart;
|
|
|
import org.jeecg.modules.system.entity.SysRoleIndex;
|
|
|
import org.jeecg.modules.system.entity.SysTenant;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.system.enums.UserType;
|
|
|
import org.jeecg.modules.system.model.SysLoginModel;
|
|
|
import org.jeecg.modules.system.service.*;
|
|
|
import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
|
|
|
import org.jeecg.modules.system.util.RandImageUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -69,6 +73,10 @@ public class LoginController {
|
|
|
@Autowired
|
|
|
private JeecgBaseConfig jeecgBaseConfig;
|
|
|
|
|
|
+ @Lazy
|
|
|
+ @Resource
|
|
|
+ private CommonAPI commonApi;
|
|
|
+
|
|
|
private final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
|
|
|
|
|
|
@ApiOperation("登录接口")
|
|
@@ -115,6 +123,16 @@ public class LoginController {
|
|
|
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(SysUser::getUsername,username);
|
|
|
SysUser sysUser = sysUserService.getOne(queryWrapper);
|
|
|
+
|
|
|
+ //管理端登录需要校验
|
|
|
+ if(UserType.ADMIN.getCode().equals(sysLoginModel.getLoginType())){
|
|
|
+ //查询用户拥有的角色
|
|
|
+ Set<String> roleSet = commonApi.queryUserRoles(username);
|
|
|
+ if(!CollectionUtils.isEmpty(roleSet) && roleSet.contains(UserType.STUDENT.getValue()) ){
|
|
|
+ return Result.error("考生不允许登录管理系统");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//update-end-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false
|
|
|
result = sysUserService.checkUserIsEffective(sysUser);
|
|
|
if(!result.isSuccess()) {
|