[feat] 通过用户ID查询用户信息

This commit is contained in:
hsdllcw
2024-08-23 09:49:35 +08:00
parent 04adbe7d46
commit 84570cb6cf
25 changed files with 39 additions and 24 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.6.41</version>
<version>3.6.41.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api</artifactId>
<version>3.6.41</version>
<version>3.6.41.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -22,6 +22,15 @@ import com.ruoyi.system.api.model.LoginUser;
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
/**
* 通过用户ID查询用户信息
*
* @param userId 用户ID
* @param source 请求来源
* @return 结果
*/
@GetMapping({"/user/", "/user/{userId}"})
public R<LoginUser> getInfo(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 通过用户名查询用户信息
*

View File

@@ -25,6 +25,12 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
log.error("用户服务调用失败:{}", throwable.getMessage());
return new RemoteUserService()
{
@Override
public R<LoginUser> getInfo(Long userId, String source)
{
return R.fail("获取用户失败:" + throwable.getMessage());
}
@Override
public R<LoginUser> getUserInfo(String username, String source)
{