Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-usercenter-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4d2bef6d
authored
Sep 28, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户组织feign开放接口
1 parent
21522612
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
src/main/java/cn/com/glsx/usercenter/api/dto/response/User.java
src/main/java/cn/com/glsx/usercenter/api/feign/UserService.java
src/main/java/cn/com/glsx/usercenter/api/feign/fallback/UserServiceFallbackImpl.java
src/main/java/cn/com/glsx/usercenter/api/dto/response/User.java
View file @
4d2bef6
...
...
@@ -24,4 +24,9 @@ public class User implements Serializable {
*/
private
String
account
;
/**
* 映射id,可能是用户上级id,也可能是用户下级id
*/
private
Long
mId
;
}
src/main/java/cn/com/glsx/usercenter/api/feign/UserService.java
View file @
4d2bef6
...
...
@@ -9,6 +9,7 @@ import org.springframework.http.MediaType;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.Collection
;
import
java.util.List
;
@FeignClient
(
...
...
@@ -38,6 +39,24 @@ public interface UserService {
R
<
User
>
getById
(
@RequestParam
(
"id"
)
Long
id
);
/**
* 根据id获取上级用户信息
*
* @param id
* @return
*/
@GetMapping
(
value
=
"/getSuperiorUserById"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
User
>
getSuperiorUserById
(
@RequestParam
(
"id"
)
Long
id
);
/**
* 根据id获取上级用户信息
*
* @param userIds
* @return
*/
@GetMapping
(
value
=
"/getSuperiorUserByIds"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
getSuperiorUserByIds
(
@RequestParam
(
"userIds"
)
Collection
<
Long
>
userIds
);
/**
* 根据用户信息查询用户
*
* @param request
...
...
src/main/java/cn/com/glsx/usercenter/api/feign/fallback/UserServiceFallbackImpl.java
View file @
4d2bef6
...
...
@@ -8,6 +8,7 @@ import lombok.Setter;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.List
;
@Slf4j
...
...
@@ -30,6 +31,18 @@ public class UserServiceFallbackImpl implements UserService {
}
@Override
public
R
<
User
>
getSuperiorUserById
(
Long
id
)
{
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
();
}
@Override
public
R
<
List
<
User
>>
getSuperiorUserByIds
(
Collection
<
Long
>
userIds
)
{
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
();
}
@Override
public
R
<
List
<
User
>>
findByUser
(
FindUserRequest
request
)
{
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment