package org.qinan.safetyeval.infrastructure.utils;

import lombok.experimental.UtilityClass;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

@UtilityClass
public class RequestHandlerUtil {


    /**
     * holder
     *
     * @return String
     */
    public static Long getOrgId() {
        String orgInfoId = ((ServletRequestAttributes) RequestContextHolder
                .getRequestAttributes()).getRequest().getHeader("orgInfoId");
        return StringUtils.isBlank(orgInfoId) ? null : Long.valueOf(orgInfoId);
    }
}
