|
@@ -1,5 +1,8 @@
|
|
package com.usky.system.service;
|
|
package com.usky.system.service;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.usky.common.core.constants.Constants;
|
|
import com.usky.common.core.constants.Constants;
|
|
import com.usky.common.core.util.IpUtils;
|
|
import com.usky.common.core.util.IpUtils;
|
|
import com.usky.common.core.util.ServletUtils;
|
|
import com.usky.common.core.util.ServletUtils;
|
|
@@ -15,6 +18,8 @@ import com.usky.system.service.enums.UserStatus;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 登录校验方法
|
|
* 登录校验方法
|
|
*
|
|
*
|
|
@@ -35,6 +40,9 @@ public class SysLoginService {
|
|
@Autowired
|
|
@Autowired
|
|
private SysPersonService sysPersonService;
|
|
private SysPersonService sysPersonService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysTenantService sysTenantService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 登录
|
|
* 登录
|
|
*/
|
|
*/
|
|
@@ -78,6 +86,20 @@ public class SysLoginService {
|
|
recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码错误");
|
|
recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码错误");
|
|
throw new BusinessException("用户不存在/密码错误");
|
|
throw new BusinessException("用户不存在/密码错误");
|
|
}
|
|
}
|
|
|
|
+ //判断租户状态是否停用
|
|
|
|
+ LambdaQueryWrapper<SysTenant> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryWrapper.select(SysTenant::getStatus, SysTenant::getDomain)
|
|
|
|
+ .eq(SysTenant::getId, tenantId);
|
|
|
|
+ List<SysTenant> list = sysTenantService.list(queryWrapper);
|
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
|
+ String status = list.get(0).getStatus();
|
|
|
|
+ String domain = list.get(0).getDomain();
|
|
|
|
+ if(status.equals("1")){
|
|
|
|
+ recordLogininfor(username, Constants.LOGIN_FAIL, "租户已停用,请联系管理员");
|
|
|
|
+ throw new BusinessException("对不起,租户已停用,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
SysPerson sysPerson = sysPersonService.getsysPerson(user.getUserId());
|
|
SysPerson sysPerson = sysPersonService.getsysPerson(user.getUserId());
|
|
loginUser.setSysPerson(sysPerson);
|
|
loginUser.setSysPerson(sysPerson);
|
|
recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
|
recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|