Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
youjj
cloud-platform
Commits
05c5e8dd
Commit
05c5e8dd
authored
Sep 02, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据权限
parent
1b4a4edc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
9 deletions
+65
-9
User.java
...n/java/com/github/wxiaoqi/security/admin/entity/User.java
+5
-4
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+3
-0
UserDTO.java
.../com/github/wxiaoqi/security/admin/feign/dto/UserDTO.java
+4
-1
UserRestInterface.java
.../wxiaoqi/security/admin/feign/rest/UserRestInterface.java
+18
-3
PublicController.java
.../github/wxiaoqi/security/admin/rest/PublicController.java
+34
-0
AdminBranchCompanyController.java
...form/vehicle/rest/admin/AdminBranchCompanyController.java
+1
-1
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/User.java
View file @
05c5e8dd
...
...
@@ -3,11 +3,9 @@ package com.github.wxiaoqi.security.admin.entity;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.*
;
import
java.util.Date
;
import
java.util.List
;
@Table
(
name
=
"base_user"
)
@Data
...
...
@@ -109,5 +107,8 @@ public class User {
private
String
attr8
;
@Transient
private
List
<
Integer
>
companyIds
;
}
\ No newline at end of file
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
05c5e8dd
...
...
@@ -37,6 +37,9 @@ public interface UserFeign {
@RequestMapping
(
value
=
"/public/userinfo-by-token"
)
public
ObjectRestResponse
<
UserDTO
>
userinfoByToken
(
@RequestParam
(
"token"
)
String
token
);
@RequestMapping
(
value
=
"/public/v2/userinfo-by-token"
)
ObjectRestResponse
<
UserDTO
>
userinfoByTokenV2
(
@RequestParam
(
"token"
)
String
token
,
@RequestParam
(
"flag"
)
boolean
flag
);
@RequestMapping
(
value
=
"/public/userinfo-by-uid"
)
public
ObjectRestResponse
<
UserDTO
>
userinfoByUid
(
@RequestParam
(
"uid"
)
Integer
uid
);
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/dto/UserDTO.java
View file @
05c5e8dd
...
...
@@ -17,6 +17,9 @@ public class UserDTO extends User {
}
public
List
<
Integer
>
dataCompany2List
()
{
if
(
getCompanyIds
()
!=
null
&&
getCompanyIds
().
size
()
>
0
){
return
getCompanyIds
();
}
return
str2List
(
getDataCompany
());
}
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/rest/UserRestInterface.java
View file @
05c5e8dd
...
...
@@ -17,6 +17,8 @@ import java.util.List;
public
interface
UserRestInterface
{
public
UserFeign
getUserFeign
();
default
HttpServletRequest
getRequest
()
{
return
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
}
...
...
@@ -39,14 +41,22 @@ public interface UserRestInterface {
}
}
default
UserDTO
getAdminUserInfoV2
(
boolean
flag
)
{
if
(
getRequest
().
getHeader
(
"Authorization"
)
!=
null
)
{
return
getUserFeign
().
userinfoByTokenV2
(
getRequest
().
getHeader
(
"Authorization"
),
flag
).
getData
();
}
else
{
return
null
;
}
}
default
void
checkAdminUser
(){
if
(
null
==
getAdminUserInfo
())
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
}
}
default
void
setPowerData
(
DataInter
dataInter
){
UserDTO
userDTO
=
getAdminUserInfo
(
);
default
void
setPowerData
(
DataInter
dataInter
,
boolean
flag
){
UserDTO
userDTO
=
getAdminUserInfo
V2
(
flag
);
if
(
userDTO
==
null
)
{
return
;
}
...
...
@@ -58,7 +68,12 @@ public interface UserRestInterface {
}
else
{
List
<
Integer
>
dataCorporation2List
=
userDTO
.
dataCorporation2List
();
if
(
dataCorporation2List
!=
null
&&
dataCorporation2List
.
size
()
>
0
){
if
(
flag
){
dataInter
.
setDataCorporationIds
(
dataCorporation2List
);
}
else
{
dataInter
.
setDataCompanyIds
(
dataCompany2List
);
}
}
else
{
List
<
Integer
>
ids
=
new
ArrayList
<>();
ids
.
add
(
0
);
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/PublicController.java
View file @
05c5e8dd
...
...
@@ -12,13 +12,18 @@ import com.github.wxiaoqi.security.admin.vo.UserMemberVo;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchDTO
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchVO
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* ${DESCRIPTION}
...
...
@@ -51,6 +56,9 @@ public class PublicController {
@Autowired
private
AppUserRelationBiz
relationBiz
;
@Autowired
VehicleFeign
vehicleFeign
;
@RequestMapping
(
value
=
"/userinfo-by-token"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
ObjectRestResponse
userinfoByToken
(
String
token
)
throws
Exception
{
...
...
@@ -65,6 +73,32 @@ public class PublicController {
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
}
@RequestMapping
(
value
=
"v2/userinfo-by-token"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
ObjectRestResponse
userinfoByTokenV2
(
String
token
,
boolean
flag
)
throws
Exception
{
String
username
=
userAuthUtil
.
getInfoFromToken
(
token
).
getUniqueName
();
if
(
username
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
));
}
User
user
=
userBiz
.
getUserByUsername
(
username
);
if
(
user
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
));
}
if
(!
flag
&&
user
.
getDataCorporation
()
!=
null
){
CompanySearchDTO
companySearchDTO
=
new
CompanySearchDTO
();
companySearchDTO
.
setCompanyIds
(
Arrays
.
asList
(
user
.
getDataCorporation
().
split
(
","
)).
parallelStream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
()));
ObjectRestResponse
<
List
<
CompanySearchVO
>>
restResponse
=
vehicleFeign
.
listByIds
(
companySearchDTO
);
if
(
restResponse
!=
null
){
List
<
CompanySearchVO
>
companySearchVOList
=
restResponse
.
getData
();
if
(
companySearchVOList
!=
null
&&
companySearchVOList
.
size
()
>
0
){
List
<
Integer
>
companyIds
=
companySearchVOList
.
stream
().
map
(
CompanySearchVO:
:
getId
).
distinct
().
collect
(
Collectors
.
toList
());
user
.
setCompanyIds
(
companyIds
);
}
}
}
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
}
@RequestMapping
(
value
=
"/app/userinfo-by-token"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
ObjectRestResponse
userDetailByToken
(
String
token
)
throws
Exception
{
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/AdminBranchCompanyController.java
View file @
05c5e8dd
...
...
@@ -38,7 +38,7 @@ public class AdminBranchCompanyController extends BaseController<BranchCompanyBi
@RequestMapping
(
value
=
"/search"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
PageDataVO
<
CompanySearchVO
>>
search
(
@Validated
CompanySearchDTO
vo
)
{
setPowerData
(
vo
);
setPowerData
(
vo
,
false
);
return
RestResponse
.
data
(
baseBiz
.
search
(
vo
));
}
...
...
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