fix 修复 三方绑定 实体类copy覆盖问题

2.X
疯狂的狮子Li 1 year ago
parent d2f61fc241
commit 91008b39aa

@ -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);
}

Loading…
Cancel
Save