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 efed2738
authored
Jun 10, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户组织feign开放接口
1 parent
137b35a2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
5 deletions
src/main/java/cn/com/glsx/usercenter/api/feign/ApiUserService.java
src/main/java/cn/com/glsx/usercenter/api/feign/OrganizationService.java
src/main/java/cn/com/glsx/usercenter/api/feign/UserService.java
src/main/java/cn/com/glsx/usercenter/api/feign/fallback/OrganizationServiceFallbackImpl.java
src/main/java/cn/com/glsx/usercenter/api/feign/ApiUserService.java
View file @
efed273
...
@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import
java.util.List
;
import
java.util.List
;
/**
* 不需要登录的接口
*/
@FeignClient
(
@FeignClient
(
name
=
"${feign.usercenter.name}"
,
name
=
"${feign.usercenter.name}"
,
path
=
"${feign.usercenter.path}"
+
"/api/user"
,
path
=
"${feign.usercenter.path}"
+
"/api/user"
,
...
@@ -19,9 +22,21 @@ import java.util.List;
...
@@ -19,9 +22,21 @@ import java.util.List;
)
)
public
interface
ApiUserService
{
public
interface
ApiUserService
{
/**
* 根据账号名获取用户列表
*
* @param account
* @return
*/
@GetMapping
(
value
=
"/findByAccount"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/findByAccount"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
findByAccount
(
@RequestParam
(
"account"
)
String
account
);
R
<
List
<
User
>>
findByAccount
(
@RequestParam
(
"account"
)
String
account
);
/**
* 根据用户名获取用户列表
*
* @param username
* @return
*/
@GetMapping
(
value
=
"/findByUsername"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/findByUsername"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
findByUsername
(
@RequestParam
(
"username"
)
String
username
);
R
<
List
<
User
>>
findByUsername
(
@RequestParam
(
"username"
)
String
username
);
...
...
src/main/java/cn/com/glsx/usercenter/api/feign/OrganizationService.java
View file @
efed273
...
@@ -13,7 +13,7 @@ import java.util.List;
...
@@ -13,7 +13,7 @@ import java.util.List;
@FeignClient
(
@FeignClient
(
name
=
"${feign.usercenter.name}"
,
name
=
"${feign.usercenter.name}"
,
path
=
"${feign.usercenter.path}"
+
"/org"
,
path
=
"${feign.usercenter.path}"
+
"/
f
org"
,
contextId
=
"feignorgz"
,
contextId
=
"feignorgz"
,
fallbackFactory
=
OrganizationServiceFallbackFactory
.
class
,
fallbackFactory
=
OrganizationServiceFallbackFactory
.
class
,
decode404
=
true
decode404
=
true
...
@@ -30,13 +30,13 @@ public interface OrganizationService {
...
@@ -30,13 +30,13 @@ public interface OrganizationService {
R
<
List
<
Organization
>>
getTenantPathsByUserId
(
@RequestParam
(
"userId"
)
Long
userId
);
R
<
List
<
Organization
>>
getTenantPathsByUserId
(
@RequestParam
(
"userId"
)
Long
userId
);
/**
/**
* 根据userIds获取租户机构
* 根据userIds获取租户
及(下级)
机构
*
*
* @param userIds
* @param userIds
* @return
* @return
*/
*/
@GetMapping
(
value
=
"/getTenant
ByUserIds
"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/getTenant
PathsByUserId
"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
Organization
>>
getTenant
ByUserIds
(
@RequestParam
(
"userIds"
)
List
<
Long
>
userIds
);
R
<
List
<
Organization
>>
getTenant
PathsByUserId
(
@RequestParam
(
"userIds"
)
List
<
Long
>
userIds
);
/**
/**
...
...
src/main/java/cn/com/glsx/usercenter/api/feign/UserService.java
View file @
efed273
...
@@ -20,18 +20,47 @@ import java.util.List;
...
@@ -20,18 +20,47 @@ import java.util.List;
)
)
public
interface
UserService
{
public
interface
UserService
{
/**
* 获取所有(特定租户)用户
*
* @return
*/
@GetMapping
(
value
=
"/findAll"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/findAll"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
findAll
();
R
<
List
<
User
>>
findAll
();
/**
* 根据id获取用户信息
*
* @param id
* @return
*/
@GetMapping
(
value
=
"/getById"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/getById"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
User
>
getById
(
@RequestParam
(
"id"
)
Long
id
);
R
<
User
>
getById
(
@RequestParam
(
"id"
)
Long
id
);
/**
* 根据用户信息查询用户
*
* @param request
* @return
*/
@GetMapping
(
value
=
"/findByUser"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/findByUser"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
findByUser
(
FindUserRequest
request
);
R
<
List
<
User
>>
findByUser
(
FindUserRequest
request
);
/**
* 根据组织信息查询当前组织下面的用户
*
* @param request
* @return
*/
@GetMapping
(
value
=
"/findByOrg"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/findByOrg"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
findByOrg
(
FindUserRequest
request
);
R
<
List
<
User
>>
findByOrg
(
FindUserRequest
request
);
/**
* 根据组织信息查询整个组织层级下的用户
*
* @param request
* @return
*/
@GetMapping
(
value
=
"/findAllByOrg"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
value
=
"/findAllByOrg"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
R
<
List
<
User
>>
findAllByOrg
(
FindUserRequest
request
);
R
<
List
<
User
>>
findAllByOrg
(
FindUserRequest
request
);
...
...
src/main/java/cn/com/glsx/usercenter/api/feign/fallback/OrganizationServiceFallbackImpl.java
View file @
efed273
...
@@ -24,7 +24,7 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
...
@@ -24,7 +24,7 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
}
}
@Override
@Override
public
R
<
List
<
Organization
>>
getTenant
ByUserIds
(
List
<
Long
>
userIds
)
{
public
R
<
List
<
Organization
>>
getTenant
PathsByUserId
(
List
<
Long
>
userIds
)
{
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
();
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