package com.tuoheng.admin.utils;

import com.tuoheng.admin.entity.User;
import com.tuoheng.common.core.exception.ServiceException;
import org.springframework.http.HttpStatus;

import java.util.Optional;

/**
 * Shiro工具类
 */
public class ShiroUtils {

    /**
     * 私有构造器
     **/
    private ShiroUtils() {
    }

    /**
     * 获取当前用户信息
     *
             * @return
             */
    public static User getUserInfo() {
//        return (User) SecurityUtils.getSubject().getPrincipal();

        return null;
    }

    /**
     * 获取用户编号
     *
     * @return
     */
    public static String getUserId() {
//        User user = getUserInfo();
//        return Optional.ofNullable(user.getId()).orElseThrow(() ->
//                new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前用户信息!"));

        return "1";
    }

    /**
     * 租户ID
     *
     * @return
     */
    public static String getTenantId() {
        return "0";
    }
}
