diff --git a/ruoyi-auth/src/main/java/org/dromara/auth/service/SysLoginService.java b/ruoyi-auth/src/main/java/org/dromara/auth/service/SysLoginService.java index f3e8f304..6284c17b 100644 --- a/ruoyi-auth/src/main/java/org/dromara/auth/service/SysLoginService.java +++ b/ruoyi-auth/src/main/java/org/dromara/auth/service/SysLoginService.java @@ -3,6 +3,7 @@ package org.dromara.auth.service; import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.secure.BCrypt; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -17,7 +18,9 @@ import org.dromara.common.core.enums.LoginType; import org.dromara.common.core.enums.TenantStatus; import org.dromara.common.core.enums.UserType; import org.dromara.common.core.exception.user.UserException; -import org.dromara.common.core.utils.*; +import org.dromara.common.core.utils.MessageUtils; +import org.dromara.common.core.utils.ServletUtils; +import org.dromara.common.core.utils.SpringUtils; import org.dromara.common.log.event.LogininforEvent; import org.dromara.common.redis.utils.RedisUtils; import org.dromara.common.satoken.utils.LoginHelper; @@ -30,7 +33,6 @@ import org.dromara.system.api.domain.bo.RemoteSocialBo; import org.dromara.system.api.domain.bo.RemoteUserBo; import org.dromara.system.api.domain.vo.RemoteTenantVo; import org.dromara.system.api.model.LoginUser; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -64,13 +66,13 @@ public class SysLoginService { * @param authUserData 授权响应实体 */ public void socialRegister(AuthUser authUserData) { - RemoteSocialBo bo = new RemoteSocialBo(); + RemoteSocialBo bo = BeanUtil.toBean(authUserData, RemoteSocialBo.class); + BeanUtil.copyProperties(authUserData.getToken(), bo); bo.setUserId(LoginHelper.getUserId()); bo.setAuthId(authUserData.getSource() + authUserData.getUuid()); bo.setOpenId(authUserData.getUuid()); bo.setUserName(authUserData.getUsername()); - BeanUtils.copyProperties(authUserData, bo); - BeanUtils.copyProperties(authUserData.getToken(), bo); + bo.setNickName(authUserData.getNickname()); remoteSocialService.insertByBo(bo); }