|
|
@@ -20,6 +20,8 @@ import com.vber.common.satoken.utils.LoginHelper;
|
|
|
import com.vber.common.social.config.properties.SocialLoginConfigProperties;
|
|
|
import com.vber.common.social.config.properties.SocialProperties;
|
|
|
import com.vber.common.social.utils.SocialUtils;
|
|
|
+import com.vber.common.sse.dto.SseMessageDto;
|
|
|
+import com.vber.common.sse.utils.SseMessageUtils;
|
|
|
import com.vber.common.tenant.helper.TenantHelper;
|
|
|
import com.vber.system.domain.bo.SysTenantBo;
|
|
|
import com.vber.system.domain.vo.SysClientVo;
|
|
|
@@ -46,10 +48,12 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.net.URL;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* 认证
|
|
|
@@ -70,7 +74,6 @@ public class AuthController {
|
|
|
private final ISysTenantService tenantService;
|
|
|
private final ISysSocialService socialUserService;
|
|
|
private final ISysClientService clientService;
|
|
|
- @SuppressWarnings("unused")
|
|
|
private final ScheduledExecutorService scheduledExecutorService;
|
|
|
@SuppressWarnings("unused")
|
|
|
private final VbConfig vbConfig;
|
|
|
@@ -106,13 +109,13 @@ public class AuthController {
|
|
|
// 登录
|
|
|
LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
|
|
|
|
|
|
- // Long userId = LoginHelper.getUserId();
|
|
|
- // scheduledExecutorService.schedule(() -> {
|
|
|
- // SseMessageDto dto = new SseMessageDto();
|
|
|
- // dto.setUserIds(List.of(userId));
|
|
|
- // dto.setMessage("欢迎登录" + vbConfig.getName());
|
|
|
- // SseMessageUtils.publishMessage(dto);
|
|
|
- // }, 3, TimeUnit.SECONDS);
|
|
|
+ Long userId = LoginHelper.getUserId();
|
|
|
+ scheduledExecutorService.schedule(() -> {
|
|
|
+ SseMessageDto dto = new SseMessageDto();
|
|
|
+ dto.setUserIds(List.of(userId));
|
|
|
+ dto.setMessage(DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统");
|
|
|
+ SseMessageUtils.publishMessage(dto);
|
|
|
+ }, 3, TimeUnit.SECONDS);
|
|
|
return R.ok(loginVo);
|
|
|
}
|
|
|
|
|
|
@@ -124,7 +127,7 @@ public class AuthController {
|
|
|
*/
|
|
|
@GetMapping("/binding/{source}")
|
|
|
public R<String> authBinding(@PathVariable("source") String source, @RequestParam String tenantId,
|
|
|
- @RequestParam String domain) {
|
|
|
+ @RequestParam String domain) {
|
|
|
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
|
|
if (ObjectUtil.isNull(obj)) {
|
|
|
return R.fail(source + "平台账号暂不支持");
|