RemoteApiUserService.java 977 Bytes
package cn.com.glsx.stdinterface.modules.remote;

import cn.com.glsx.usercenter.api.dto.response.TenantDto;
import cn.com.glsx.usercenter.api.feign.ApiUserService;
import cn.hutool.json.JSONUtil;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 调用usercenter 用户服务
 *
 * @author Yanglinlong
 * @date 2023/6/19 16:29
 */
@Slf4j
@Service
public class RemoteApiUserService {

    @Autowired
    private ApiUserService apiUserService;

    /**
     * 通过 userId 获取租户数据
     *
     * @param userId 用户ID
     * @return
     */
    public TenantDto getTenantByUserId(Long userId) {
        R<TenantDto> tenantR = apiUserService.getTenantByUserId(userId);
        TenantDto tenantDto = tenantR.getData(TenantDto.class);
        log.info("tenantDto==" + JSONUtil.toJsonStr(tenantDto));
        return tenantDto;
    }
}