Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
29fa2d0a
Commit
29fa2d0a
authored
Nov 17, 2021
by
李健华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取租户列表历史数据处理
parent
c8b3d979
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
TenantController.java
...n/quantgroup/xyqb/controller/tenant/TenantController.java
+19
-4
No files found.
src/main/java/cn/quantgroup/xyqb/controller/tenant/TenantController.java
View file @
29fa2d0a
package
cn
.
quantgroup
.
xyqb
.
controller
.
tenant
;
package
cn
.
quantgroup
.
xyqb
.
controller
.
tenant
;
import
cn.quantgroup.xyqb.entity.ProductLoginEntity
;
import
cn.quantgroup.xyqb.entity.ProductLoginEntity
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.user.IOauthClientDetailsService
;
import
cn.quantgroup.xyqb.service.user.IOauthClientDetailsService
;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@Slf4j
@Slf4j
...
@@ -24,6 +28,9 @@ public class TenantController {
...
@@ -24,6 +28,9 @@ public class TenantController {
@Autowired
@Autowired
private
IOauthClientDetailsService
oauthClientDetailsService
;
private
IOauthClientDetailsService
oauthClientDetailsService
;
@Autowired
private
IUserService
userService
;
/**
/**
* 根据用户ID查询租户列表
* 根据用户ID查询租户列表
* @param userId
* @param userId
...
@@ -34,12 +41,20 @@ public class TenantController {
...
@@ -34,12 +41,20 @@ public class TenantController {
public
JsonResult
findTenantByUserId
(
Long
userId
)
{
public
JsonResult
findTenantByUserId
(
Long
userId
)
{
// 通过userId获取租户机构和产品
// 通过userId获取租户机构和产品
List
<
ProductLoginEntity
>
productLoginEntityList
=
productLoginService
.
findSlaveByUserId
(
userId
);
List
<
ProductLoginEntity
>
productLoginEntityList
=
productLoginService
.
findSlaveByUserId
(
userId
);
if
(
productLoginEntityList
.
isEmpty
())
{
List
<
Integer
>
tenantList
=
new
ArrayList
<>();
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
if
(!
productLoginEntityList
.
isEmpty
())
{
// 通过机构和产品Id 获取租户id
tenantList
=
oauthClientDetailsService
.
findTenantList
(
productLoginEntityList
);
}
if
(!
tenantList
.
contains
(
TenantUtil
.
TENANT_DEFAULT
))
{
User
user
=
userService
.
findById
(
userId
);
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"该用户不存在"
,
null
);
}
tenantList
.
add
(
TenantUtil
.
TENANT_DEFAULT
);
}
}
// 通过机构和产品Id 获取租户id
List
<
Integer
>
tenantList
=
oauthClientDetailsService
.
findTenantList
(
productLoginEntityList
);
return
JsonResult
.
buildSuccessResult
(
"租户列表"
,
tenantList
);
return
JsonResult
.
buildSuccessResult
(
"租户列表"
,
tenantList
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment