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

feature/model
疯狂的狮子Li 1 year ago
parent cb59082bad
commit 348938eb96

@ -4,7 +4,6 @@ import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.model.AuthUser; import me.zhyd.oauth.model.AuthUser;
@ -15,7 +14,6 @@ import org.dromara.common.core.domain.dto.RoleDTO;
import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.enums.LoginType; import org.dromara.common.core.enums.LoginType;
import org.dromara.common.core.enums.TenantStatus; import org.dromara.common.core.enums.TenantStatus;
import org.dromara.common.core.enums.UserStatus;
import org.dromara.common.core.exception.user.UserException; import org.dromara.common.core.exception.user.UserException;
import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.core.utils.MessageUtils; import org.dromara.common.core.utils.MessageUtils;
@ -34,7 +32,6 @@ import org.dromara.system.mapper.SysUserMapper;
import org.dromara.system.service.ISysPermissionService; import org.dromara.system.service.ISysPermissionService;
import org.dromara.system.service.ISysSocialService; import org.dromara.system.service.ISysSocialService;
import org.dromara.system.service.ISysTenantService; import org.dromara.system.service.ISysTenantService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -72,13 +69,13 @@ public class SysLoginService {
* @return * @return
*/ */
public void socialRegister(AuthUser authUserData) { public void socialRegister(AuthUser authUserData) {
SysSocialBo bo = new SysSocialBo(); SysSocialBo bo = BeanUtil.toBean(authUserData, SysSocialBo.class);
BeanUtil.copyProperties(authUserData.getToken(), bo);
bo.setUserId(LoginHelper.getUserId()); bo.setUserId(LoginHelper.getUserId());
bo.setAuthId(authUserData.getSource() + authUserData.getUuid()); bo.setAuthId(authUserData.getSource() + authUserData.getUuid());
bo.setOpenId(authUserData.getUuid()); bo.setOpenId(authUserData.getUuid());
bo.setUserName(authUserData.getUsername()); bo.setUserName(authUserData.getUsername());
BeanUtils.copyProperties(authUserData, bo); bo.setNickName(authUserData.getNickname());
BeanUtils.copyProperties(authUserData.getToken(), bo);
sysSocialService.insertByBo(bo); sysSocialService.insertByBo(bo);
} }

Loading…
Cancel
Save