|
|
|
|
@ -33,9 +33,11 @@ import org.springblade.core.tool.utils.StringPool; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springblade.system.pojo.entity.UserInfo; |
|
|
|
|
|
|
|
|
|
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE; |
|
|
|
|
import static org.springblade.core.launch.constant.FlowConstant.TASK_USR_PREFIX; |
|
|
|
|
import static org.springblade.system.feign.IUserClient.USER_BY_CODE; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 系统缓存 |
|
|
|
|
@ -44,6 +46,7 @@ import static org.springblade.core.launch.constant.FlowConstant.TASK_USR_PREFIX; |
|
|
|
|
*/ |
|
|
|
|
public class UserCache { |
|
|
|
|
private static final String USER_CACHE_ID = "user:id:"; |
|
|
|
|
private static final String USER_CACHE_CODE = "user:code:"; |
|
|
|
|
private static final String USER_CACHE_ACCOUNT = "user:account:"; |
|
|
|
|
|
|
|
|
|
private static IUserClient userClient; |
|
|
|
|
@ -93,4 +96,16 @@ public class UserCache { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取用户 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static UserInfo getUserByCode(String code) { |
|
|
|
|
return CacheUtil.get(USER_CACHE, USER_CACHE_CODE, code, () -> { |
|
|
|
|
R<UserInfo> result = getUserClient().userInfoByCode(code); |
|
|
|
|
return result.getData(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|