You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
586 B
Java
21 lines
586 B
Java
2 years ago
|
package com.supervision.util;
|
||
|
|
||
|
import cn.hutool.core.util.ObjectUtil;
|
||
|
import cn.hutool.json.JSONUtil;
|
||
|
import com.supervision.config.ThreadCache;
|
||
|
import com.supervision.domain.UserInfo;
|
||
|
import com.supervision.exception.BusinessException;
|
||
|
import com.supervision.model.User;
|
||
|
|
||
|
public class UserUtil {
|
||
|
|
||
|
public static User getUser(){
|
||
|
String userStr = ThreadCache.USER.get();
|
||
|
User bean = JSONUtil.toBean(userStr, User.class);
|
||
|
if (ObjectUtil.isEmpty(bean)){
|
||
|
throw new BusinessException("未获取到用户信息");
|
||
|
}
|
||
|
return bean;
|
||
|
}
|
||
|
}
|