优化 登录消息 支持集群发送

This commit is contained in:
数据小王子 2024-03-01 10:00:56 +08:00
parent d151c053a7
commit e7b6dac49f
2 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import com.ruoyi.common.social.config.properties.SocialLoginConfigProperties;
import com.ruoyi.common.social.config.properties.SocialProperties; import com.ruoyi.common.social.config.properties.SocialProperties;
import com.ruoyi.common.social.utils.SocialUtils; import com.ruoyi.common.social.utils.SocialUtils;
import com.ruoyi.common.tenant.helper.TenantHelper; import com.ruoyi.common.tenant.helper.TenantHelper;
import com.ruoyi.common.websocket.dto.WebSocketMessageDto;
import com.ruoyi.common.websocket.utils.WebSocketUtils; import com.ruoyi.common.websocket.utils.WebSocketUtils;
import com.ruoyi.system.domain.bo.SysTenantBo; import com.ruoyi.system.domain.bo.SysTenantBo;
import com.ruoyi.system.domain.vo.SysClientVo; import com.ruoyi.system.domain.vo.SysClientVo;
@ -110,7 +111,10 @@ public class AuthController {
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
scheduledExecutorService.schedule(() -> { scheduledExecutorService.schedule(() -> {
WebSocketUtils.sendMessage(userId, "欢迎登录RuoYi-Flex多租户管理系统"); WebSocketMessageDto dto = new WebSocketMessageDto();
dto.setMessage("欢迎登录RuoYi-Flex多租户管理系统");
dto.setSessionKeys(List.of(userId));
WebSocketUtils.publishMessage(dto);
}, 3, TimeUnit.SECONDS); }, 3, TimeUnit.SECONDS);
return R.ok(loginVo); return R.ok(loginVo);

View File

@ -1,6 +1,7 @@
package com.ruoyi.common.encrypt.core; package com.ruoyi.common.encrypt.core;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.ruoyi.common.encrypt.annotation.EncryptField; import com.ruoyi.common.encrypt.annotation.EncryptField;
@ -19,6 +20,7 @@ import java.util.stream.Collectors;
* @version 4.6.0 * @version 4.6.0
*/ */
@Slf4j @Slf4j
@NoArgsConstructor
public class EncryptorManager { public class EncryptorManager {
/** /**