import com.alibaba.ttl.TransmittableThreadLocal;
import com.didiglobal.ehr.ehrsupport.entity.StaffInfo;
public class UserInfoHolder {
private static final TransmittableThreadLocal<StaffInfo> USER_INFO = new TransmittableThreadLocal<>();
private static final TransmittableThreadLocal<String> ORIGIN_USER = new TransmittableThreadLocal<>();
/**
* 设置用户信息到本地变量
*
* @param userInfo
*/
public static void setUserInfo(StaffInfo userInfo) {
USER_INFO.set(userInfo);
}
public static void setOriginUser(String ldap) {
ORIGIN_USER.set(ldap);
}
/**
* 从本地线程变量中获取用户信息
*
* @return
*/
public static StaffInfo getUserInfo() {
return USER_INFO.get();
}
public static String getUserInfoLdap(String defaultLdap) {
StaffInfo staffInfo = getUserInfo();
if (staffInfo != null) {
return staffInfo.getL
|