|
|
@@ -44,10 +44,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.Serial;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
public class JzgAuthenticationProvider implements AuthenticationProvider {
|
|
|
@@ -143,19 +140,26 @@ public class JzgAuthenticationProvider implements AuthenticationProvider {
|
|
|
throw new SystemException("业务员不存在");
|
|
|
}
|
|
|
SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfos.get(0);
|
|
|
- if (sysUserJzgInfo.cannotLogin()) {
|
|
|
- log.info("用户被禁用/离职,不能登录。sysUserJzgInfo=[{}]", JSONUtil.toJsonStr(sysUserJzgInfo));
|
|
|
- throw new SystemException("用户已被禁用/离职,无法登录");
|
|
|
+ // 租户系统才会校验这个, 后台管理系统,没有租户的概念
|
|
|
+ if(this.isTenantLogin(system)){
|
|
|
+ if (sysUserJzgInfo.cannotLogin()) {
|
|
|
+ log.info("用户被禁用/离职,不能登录。sysUserJzgInfo=[{}]", JSONUtil.toJsonStr(sysUserJzgInfo));
|
|
|
+ throw new SystemException("用户已被禁用/离职,无法登录");
|
|
|
+ }
|
|
|
}
|
|
|
salt = weblogUser.getSalt();
|
|
|
}
|
|
|
- // modify by lipf, 用户所属租户如果被禁用,不能登录
|
|
|
- HttpResult<List<SysTennatVo>> tenants = organizationClient.getTenantList(username);
|
|
|
- log.info("用户[{}]有[{}]个租户,分别是tenants=[{}]",username, CollUtil.size(tenants.getData()), JSONUtil.toJsonStr(tenants));
|
|
|
- if(CollectionUtil.isEmpty(tenants.getData())){
|
|
|
- log.info("用户[{}]所属的租户已经被禁用,无法登录",username);
|
|
|
- throw new SystemException("用户所属的租户已经被禁用,无法登录");
|
|
|
+ if(this.isTenantLogin(system)){
|
|
|
+ // modify by lipf, 用户所属租户如果被禁用,不能登录
|
|
|
+ HttpResult<List<SysTennatVo>> tenants = organizationClient.getTenantList(username);
|
|
|
+ log.info("用户[{}]有[{}]个租户,分别是tenants=[{}]",username, CollUtil.size(tenants.getData()), JSONUtil.toJsonStr(tenants));
|
|
|
+ if(CollectionUtil.isEmpty(tenants.getData())){
|
|
|
+ log.info("用户[{}]所属的租户已经被禁用,无法登录",username);
|
|
|
+ throw new SystemException("用户所属的租户已经被禁用,无法登录");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//检验短信验证码
|
|
|
if(Objects.nonNull(code)){
|
|
|
String systemSmsCode = redissonClient.getBucket(RedisKeyConstants.SMS_CODE + username).get().toString();
|
|
|
@@ -374,6 +378,20 @@ public class JzgAuthenticationProvider implements AuthenticationProvider {
|
|
|
}};
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断是否是租户登录
|
|
|
+ *
|
|
|
+ * @return true 表示是租户登录, false 表示非租户登录
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/4/30 10:18
|
|
|
+ */
|
|
|
+ private boolean isTenantLogin(String system) {
|
|
|
+ Set<String> clients = new HashSet<>();
|
|
|
+ clients.add("APP");
|
|
|
+ clients.add("PLATFORM");
|
|
|
+ return !clients.contains(system);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public boolean supports(Class<?> authentication) {
|