package com.ningdatech.pmapi.common.helper.impl;

import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.user.manage.UserAuthLoginManage;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @author liuxinxin
 * @date 2023/2/10 下午4:40
 */
@Component
@RequiredArgsConstructor
public class UserInfoHelperImpl implements UserInfoHelper {


    private final UserAuthLoginManage userAuthLoginManage;


    @Override
    public String getOrganizationCode(Long userId) {
        UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);

        return userFullInfo.getOrganizationCode();
    }

    @Override
    public UserFullInfoDTO getUserFullInfo(Long userId) {
        UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
        return userFullInfo;
    }

    @Override
    public String getUserName(Long userId) {
        UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
        String realName = userFullInfo.getRealName();
        return realName;
    }
}
