|
|
|
@ -22,10 +22,12 @@ import org.dromara.common.core.domain.R;
|
|
|
|
import org.dromara.common.core.domain.model.LoginBody;
|
|
|
|
import org.dromara.common.core.domain.model.LoginBody;
|
|
|
|
import org.dromara.common.core.utils.*;
|
|
|
|
import org.dromara.common.core.utils.*;
|
|
|
|
import org.dromara.common.json.utils.JsonUtils;
|
|
|
|
import org.dromara.common.json.utils.JsonUtils;
|
|
|
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
|
|
|
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
|
|
|
import org.dromara.common.social.config.properties.SocialProperties;
|
|
|
|
import org.dromara.common.social.config.properties.SocialProperties;
|
|
|
|
import org.dromara.common.social.utils.SocialUtils;
|
|
|
|
import org.dromara.common.social.utils.SocialUtils;
|
|
|
|
import org.dromara.common.tenant.helper.TenantHelper;
|
|
|
|
import org.dromara.common.tenant.helper.TenantHelper;
|
|
|
|
|
|
|
|
import org.dromara.resource.api.RemoteMessageService;
|
|
|
|
import org.dromara.system.api.RemoteClientService;
|
|
|
|
import org.dromara.system.api.RemoteClientService;
|
|
|
|
import org.dromara.system.api.RemoteConfigService;
|
|
|
|
import org.dromara.system.api.RemoteConfigService;
|
|
|
|
import org.dromara.system.api.RemoteSocialService;
|
|
|
|
import org.dromara.system.api.RemoteSocialService;
|
|
|
|
@ -37,6 +39,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* token 控制
|
|
|
|
* token 控制
|
|
|
|
@ -51,6 +55,7 @@ public class TokenController {
|
|
|
|
|
|
|
|
|
|
|
|
private final SocialProperties socialProperties;
|
|
|
|
private final SocialProperties socialProperties;
|
|
|
|
private final SysLoginService sysLoginService;
|
|
|
|
private final SysLoginService sysLoginService;
|
|
|
|
|
|
|
|
private final ScheduledExecutorService scheduledExecutorService;
|
|
|
|
|
|
|
|
|
|
|
|
@DubboReference
|
|
|
|
@DubboReference
|
|
|
|
private final RemoteConfigService remoteConfigService;
|
|
|
|
private final RemoteConfigService remoteConfigService;
|
|
|
|
@ -60,6 +65,8 @@ public class TokenController {
|
|
|
|
private final RemoteClientService remoteClientService;
|
|
|
|
private final RemoteClientService remoteClientService;
|
|
|
|
@DubboReference
|
|
|
|
@DubboReference
|
|
|
|
private final RemoteSocialService remoteSocialService;
|
|
|
|
private final RemoteSocialService remoteSocialService;
|
|
|
|
|
|
|
|
@DubboReference
|
|
|
|
|
|
|
|
private final RemoteMessageService remoteMessageService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 登录方法
|
|
|
|
* 登录方法
|
|
|
|
@ -86,7 +93,13 @@ public class TokenController {
|
|
|
|
// 校验租户
|
|
|
|
// 校验租户
|
|
|
|
sysLoginService.checkTenant(loginBody.getTenantId());
|
|
|
|
sysLoginService.checkTenant(loginBody.getTenantId());
|
|
|
|
// 登录
|
|
|
|
// 登录
|
|
|
|
return R.ok(IAuthStrategy.login(body, clientVo, grantType));
|
|
|
|
LoginVo loginVo = IAuthStrategy.login(body, clientVo, grantType);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long userId = LoginHelper.getUserId();
|
|
|
|
|
|
|
|
scheduledExecutorService.schedule(() -> {
|
|
|
|
|
|
|
|
remoteMessageService.sendMessage(userId, "欢迎登录RuoYi-Cloud-Plus微服务管理系统");
|
|
|
|
|
|
|
|
}, 3, TimeUnit.SECONDS);
|
|
|
|
|
|
|
|
return R.ok(loginVo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|