Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
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
项目统一框架
amos-boot-biz
Commits
5c7be6d5
Commit
5c7be6d5
authored
Mar 21, 2024
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
112c566a
34d02390
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
44 deletions
+34
-44
DealerRestrictInterceptor.java
...oot/module/hygf/api/config/DealerRestrictInterceptor.java
+11
-43
UserLimitsAdvice.java
...in/amos/boot/module/hygf/api/config/UserLimitsAdvice.java
+19
-1
StdUserEmpower.java
...join/amos/boot/module/hygf/api/entity/StdUserEmpower.java
+4
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/DealerRestrictInterceptor.java
View file @
5c7be6d5
...
...
@@ -70,53 +70,21 @@ public class DealerRestrictInterceptor implements Interceptor {
String
fileBetweenCondition
=
dealerRestrict
.
relationship
();
//获取参数值,
StdUserEmpower
dataAuthRule
=(
StdUserEmpower
)
redisUtils
.
get
(
"Emp_"
+
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()));
String
[]
data
=
new
String
[]{
String
.
join
(
","
,
dataAuthRule
.
getAmosOrgCode
()),
dataAuthRule
.
getRegionalCompaniesCode
(),
dataAuthRule
.
getUserId
()};
String
[]
data
=
new
String
[]{
String
.
join
(
","
,
dataAuthRule
.
getAmosOrgCode
()),
dataAuthRule
.
getRegionalCompaniesCode
(),
dataAuthRule
.
getUserId
()
,
dataAuthRule
.
getAdminRegionalCompaniesCode
()
};
BoundSql
boundSql
=
(
BoundSql
)
metaObject
.
getValue
(
"delegate.boundSql"
);
//获取sql
String
sql
=
boundSql
.
getSql
();
String
json
=
null
;
try
{
json
=
IOUtils
.
toString
(
paramsTree
.
getInputStream
(),
java
.
lang
.
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
List
<
Map
>
list
=
parseArray
(
json
,
Map
.
class
);
List
<
String
>
fileds
=
new
ArrayList
<>();
List
<
String
>
datas
=
new
ArrayList
<>();
for
(
Map
map
:
list
)
{
String
roleIds
=
map
.
get
(
"roleIds"
).
toString
();
for
(
Long
aLong
:
reginParam
.
getUserModel
().
getOrgRoles
().
keySet
())
{
List
<
RoleModel
>
roleModels
=
reginParam
.
getUserModel
().
getOrgRoles
().
get
(
aLong
);
for
(
RoleModel
roleModel
:
roleModels
)
{
if
(
roleIds
.
contains
(
String
.
valueOf
(
roleModel
.
getSequenceNbr
())))
{
if
(
map
.
get
(
"key"
).
equals
(
"manage"
))
{
fileds
.
add
(
filed
[
0
]);
datas
.
add
(
data
[
0
]);
}
else
if
(
map
.
get
(
"key"
).
equals
(
"develop"
))
{
fileds
.
add
(
filed
[
0
]);
fileds
.
add
(
filed
[
2
]);
datas
.
add
(
data
[
0
]);
datas
.
add
(
data
[
2
]);
}
else
{
fileds
.
add
(
filed
[
0
]);
fileds
.
add
(
filed
[
1
]);
datas
.
add
(
data
[
0
]);
datas
.
add
(
data
[
1
]);
}
}
}
List
<
String
>
sq
;
//获取sql
String
sql
=
boundSql
.
getSql
();
List
<
String
>
fileds
=
Arrays
.
asList
(
filed
);
if
(!
ValidationUtil
.
isEmpty
(
dataAuthRule
.
getAdminRegionalCompaniesCode
()))
{
sq
=
selectSql
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
1
)},
fileCondition
,
Arrays
.
asList
(
data
));
}
else
if
(!
ValidationUtil
.
isEmpty
(
dataAuthRule
.
getUserId
()))
{
sq
=
selectSql
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
2
)},
fileCondition
,
Arrays
.
asList
(
data
));
}
else
{
sq
=
selectSql
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
1
)},
fileCondition
,
Arrays
.
asList
(
data
));
}
}
String
[]
preSizedArray
=
new
String
[
fileds
.
size
()];
String
[]
objects
=
fileds
.
toArray
(
preSizedArray
);
//拼接参数
List
<
String
>
sq
=
selectSql
(
objects
,
fileCondition
,
datas
);
String
sqldata
=
" "
;
if
(
sq
!=
null
&&
sq
.
size
()
>
0
)
{
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/UserLimitsAdvice.java
View file @
5c7be6d5
...
...
@@ -3,11 +3,14 @@ package com.yeejoin.amos.boot.module.hygf.api.config;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.RegionalCompanies
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.RegionalCompaniesMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.UserEmpowerMapper
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
...
...
@@ -40,10 +43,16 @@ public class UserLimitsAdvice {
@Autowired
PersonnelBusinessMapper
personnelBusinessMapper
;
@Autowired
RegionalCompaniesMapper
regionalCompaniesMapper
;
@Autowired
private
RedisUtils
redisUtils
;
private
static
final
String
ROLEFLAG
=
"-经销商-"
;
private
static
final
String
ROLEFLAGADMIN
=
"-经销商-管理员"
;
private
static
final
String
ROLEFLDEVELOP
=
"-经销商-开发"
;
//调用的方法有该注解才会拦截
@Pointcut
(
"@annotation(com.yeejoin.amos.boot.module.hygf.api.config.UserLimits)"
)
private
void
annotationPointCut
()
{
...
...
@@ -64,8 +73,17 @@ public class UserLimitsAdvice {
stdUserEmpower
.
setFlag
(
false
);
stdUserEmpower
.
setDeveloperId
(
userUnitInformationDto
!=
null
?
userUnitInformationDto
.
getAmosUnitInfoId
():
null
);
stdUserEmpower
.
setRegionalCompaniesCode
(
userUnitInformationDto
!=
null
?
userUnitInformationDto
.
getRegionalCompaniesCode
():
null
);
stdUserEmpower
.
setUserId
(
userid
);
stdUserEmpower
.
setAmosOrgCode
(
Arrays
.
asList
(
userUnitInformationDto
.
getAmosUnitOrgCode
()));
if
(
org
.
contains
(
ROLEFLAGADMIN
)){
LambdaQueryWrapper
<
RegionalCompanies
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
RegionalCompanies:
:
getUnitId
,
userUnitInformationDto
!=
null
?
userUnitInformationDto
.
getAmosUnitInfoId
():
null
);
queryWrapper
.
eq
(
BaseEntity:
:
getIsDelete
,
0
);
List
<
RegionalCompanies
>
regionalCompanies
=
regionalCompaniesMapper
.
selectList
(
queryWrapper
);
List
<
String
>
regionalCompaniesCodes
=
regionalCompanies
.
stream
().
map
(
RegionalCompanies:
:
getRegionalCompaniesCode
).
collect
(
Collectors
.
toList
());
stdUserEmpower
.
setAdminRegionalCompaniesCode
(
String
.
join
(
","
,
regionalCompaniesCodes
));
}
else
if
(
org
.
contains
(
ROLEFLDEVELOP
)){
stdUserEmpower
.
setUserId
(
userid
);
}
}
else
{
LambdaQueryWrapper
<
StdUserEmpower
>
qu
=
new
LambdaQueryWrapper
();
qu
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
userid
);
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/StdUserEmpower.java
View file @
5c7be6d5
...
...
@@ -69,4 +69,8 @@ public class StdUserEmpower extends BaseEntity {
//管理端 true,还是经销商false
@TableField
(
exist
=
false
)
private
boolean
flag
;
//经销商管理员区域公司orgcode
@TableField
(
exist
=
false
)
private
String
adminRegionalCompaniesCode
;
}
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