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 b7df3a61
authored
May 27, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户组织feign开放接口
1 parent
ac969509
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
4 deletions
src/main/java/cn/com/glsx/usercenter/api/feign/OrganizationService.java
src/main/java/cn/com/glsx/usercenter/api/feign/fallback/OrganizationServiceFallbackImpl.java
src/main/java/cn/com/glsx/usercenter/api/feign/OrganizationService.java
View file @
b7df3a6
...
@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient;
...
@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
@FeignClient
(
@FeignClient
(
...
@@ -18,13 +19,48 @@ import java.util.List;
...
@@ -18,13 +19,48 @@ import java.util.List;
)
)
public
interface
OrganizationService
{
public
interface
OrganizationService
{
@GetMapping
(
value
=
"/getSuperiorsBySubId"
)
/**
R
<
List
<
Organization
>>
getSuperiorsBySubId
(
@RequestParam
(
"subOrgId"
)
Long
subOrgId
);
* 根据userId获取租户机构
*
* @param userId
* @return
*/
@GetMapping
(
value
=
"/getTenantPathsByUserId"
)
R
<
List
<
Organization
>>
getTenantPathsByUserId
(
@RequestParam
(
"userId"
)
Long
userId
);
/**
* 获取根组织层级
*
* @return
*/
@GetMapping
(
value
=
"/getRootOrgs"
)
@GetMapping
(
value
=
"/getRootOrgs"
)
R
<
List
<
Organization
>>
getRootOrganizations
();
R
<
List
<
Organization
>>
getRootOrganizations
();
@GetMapping
(
value
=
"/getSubOrgs"
)
/**
* 获取下级组织
*
* @param orgId
* @return
*/
@GetMapping
(
value
=
"/getSubOrgsBySuperiorId"
)
R
<
List
<
Organization
>>
getSubOrganizations
(
@RequestParam
(
"orgId"
)
Long
orgId
);
R
<
List
<
Organization
>>
getSubOrganizations
(
@RequestParam
(
"orgId"
)
Long
orgId
);
/**
* 根据用户id获取组织层级
*
* @param userIds
* @return
*/
@GetMapping
(
value
=
"/getOrgsByUserIds"
)
R
<
List
<
Organization
>>
getOrgsByUserIds
(
@RequestParam
(
"userIds"
)
Collection
<
Long
>
userIds
);
/**
* 获取特定层级的机构
*
* @param level
* @return
*/
@GetMapping
(
value
=
"/getSpecialLevelOrgs"
)
R
<
List
<
Organization
>>
getSpecialLevelOrganizations
(
@RequestParam
(
"level"
)
Integer
level
);
}
}
src/main/java/cn/com/glsx/usercenter/api/feign/fallback/OrganizationServiceFallbackImpl.java
View file @
b7df3a6
...
@@ -7,6 +7,7 @@ import lombok.Setter;
...
@@ -7,6 +7,7 @@ import lombok.Setter;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
@Slf4j
@Slf4j
...
@@ -17,7 +18,7 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
...
@@ -17,7 +18,7 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
private
Throwable
cause
;
private
Throwable
cause
;
@Override
@Override
public
R
<
List
<
Organization
>>
get
SuperiorsBySubId
(
Long
subOrg
Id
)
{
public
R
<
List
<
Organization
>>
get
TenantPathsByUserId
(
Long
user
Id
)
{
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
();
return
R
.
ok
();
}
}
...
@@ -34,4 +35,16 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
...
@@ -34,4 +35,16 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
return
R
.
ok
();
return
R
.
ok
();
}
}
@Override
public
R
<
List
<
Organization
>>
getOrgsByUserIds
(
Collection
<
Long
>
userIds
)
{
log
.
warn
(
"熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
();
}
@Override
public
R
<
List
<
Organization
>>
getSpecialLevelOrganizations
(
Integer
level
)
{
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