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
ee66048c
Commit
ee66048c
authored
Jun 27, 2025
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tcm): 更新单位管理员信息和用户角色同步
-增加单位管理员信息非空校验 - 更新单位信息后删除 Redis 缓存 - 实现用户角色同步功能,包括人员管理和公司类型相关角色 - 修复用户角色组绑定逻辑
parent
483184fc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
1 deletion
+85
-1
TzBaseEnterpriseInfoServiceImpl.java
...tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+4
-1
TzsUserInfoServiceImpl.java
...t/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
+81
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
ee66048c
...
@@ -1102,7 +1102,9 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1102,7 +1102,9 @@ public class TzBaseEnterpriseInfoServiceImpl
}
}
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
AgencyUserModel
agencyUserModel
=
Optional
.
ofNullable
(
userResult
).
map
(
FeignClientResult:
:
getResult
).
orElse
(
null
);
AgencyUserModel
agencyUserModel
=
Optional
.
ofNullable
(
userResult
).
map
(
FeignClientResult:
:
getResult
).
orElse
(
null
);
if
(
ValidationUtil
.
isEmpty
(
agencyUserModel
))
{
throw
new
BadRequest
(
"未找到单位管理员信息"
);
}
regUnitInfo
.
setName
(
tzBaseEnterpriseInfo
.
getUseUnit
());
regUnitInfo
.
setName
(
tzBaseEnterpriseInfo
.
getUseUnit
());
regUnitInfo
.
setUnitCode
(
tzBaseEnterpriseInfo
.
getUseCode
());
regUnitInfo
.
setUnitCode
(
tzBaseEnterpriseInfo
.
getUseCode
());
regUnitInfo
.
setManagementUnit
(
tzBaseEnterpriseInfo
.
getGoverningBody
());
regUnitInfo
.
setManagementUnit
(
tzBaseEnterpriseInfo
.
getGoverningBody
());
...
@@ -1188,6 +1190,7 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1188,6 +1190,7 @@ public class TzBaseEnterpriseInfoServiceImpl
updateUserInfo
(
newData
,
String
.
valueOf
(
map
.
get
(
"useCode"
)));
updateUserInfo
(
newData
,
String
.
valueOf
(
map
.
get
(
"useCode"
)));
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
BeanUtils
.
copyProperties
(
tzBaseEnterpriseInfo
,
tzBaseEnterpriseInfoDto
);
BeanUtils
.
copyProperties
(
tzBaseEnterpriseInfo
,
tzBaseEnterpriseInfoDto
);
redisUtil
.
del
(
RedisKey
.
buildReginRoleKey
(
agencyUserModel
.
getUserId
()));
return
tzBaseEnterpriseInfoDto
;
return
tzBaseEnterpriseInfoDto
;
}
else
{
}
else
{
return
null
;
return
null
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
View file @
ee66048c
...
@@ -1254,6 +1254,8 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
...
@@ -1254,6 +1254,8 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
tzsUserPermissionServiceImpl
.
updatePermissionData
(
tzsUserInfoDto
);
tzsUserPermissionServiceImpl
.
updatePermissionData
(
tzsUserInfoDto
);
tzsUserInfoDto
.
setQrCodeState
(
"1"
);
tzsUserInfoDto
.
setQrCodeState
(
"1"
);
this
.
updateWithModel
(
tzsUserInfoDto
);
this
.
updateWithModel
(
tzsUserInfoDto
);
// 更新人员信息同步平台
syncNewPost
(
tzsUserInfoDto
);
return
tzsUserInfoDto
;
return
tzsUserInfoDto
;
}
}
...
@@ -1805,4 +1807,83 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
...
@@ -1805,4 +1807,83 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
}
return
individuality
;
return
individuality
;
}
}
private
void
syncNewPost
(
TzsUserInfoDto
tzsUserInfoDto
)
{
System
.
out
.
println
(
tzsUserInfoDto
);
// tzs_user_info;
if
(
ValidationUtil
.
isEmpty
(
tzsUserInfoDto
.
getAmosUserId
()))
{
return
;
}
FeignClientResult
<
AgencyUserModel
>
userFeignClientResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
tzsUserInfoDto
.
getAmosUserId
());
if
(
userFeignClientResult
==
null
||
userFeignClientResult
.
getResult
()
==
null
)
{
return
;
}
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
ObjectUtils
.
isEmpty
(
reginParams
))
{
return
;
}
List
<
DataDictionary
>
dataDictionaries
=
iDataDictionaryService
.
lambdaQuery
()
.
in
(
DataDictionary:
:
getType
,
Arrays
.
asList
(
"QYRYJS"
,
"QYRYYHZ"
))
.
eq
(
DataDictionary:
:
getIsDelete
,
false
).
list
();
List
<
DataDictionary
>
qyrygwList
=
dataDictionaries
.
stream
().
filter
(
item
->
"QYRYJS"
.
equals
(
item
.
getType
())).
collect
(
Collectors
.
toList
());
List
<
DataDictionary
>
qyryyhzList
=
dataDictionaries
.
stream
().
filter
(
item
->
"QYRYYHZ"
.
equals
(
item
.
getType
())).
collect
(
Collectors
.
toList
());
String
roles
=
qyrygwList
.
get
(
0
).
getCode
();
String
roleGroupCode
=
qyryyhzList
.
get
(
0
).
getCode
();
Long
companySeq
=
reginParams
.
getCompany
().
getSequenceNbr
();
List
<
String
>
appCodesSet
=
reginParams
.
getUserModel
().
getAppCodes
();
List
<
RoleModel
>
allRoleList
=
new
ArrayList
<>();
List
<
Long
>
roleIds
=
new
ArrayList
<>();
DataDictionary
unitType
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
roles
).
eq
(
DataDictionary:
:
getType
,
USER_ROLE
));
String
role
=
unitType
.
getExtend
()
!=
null
?
unitType
.
getExtend
()
:
""
;
for
(
String
s
:
role
.
split
(
","
))
{
RoleModel
roleModel
=
Privilege
.
roleClient
.
seleteOne
(
Long
.
valueOf
(
s
)).
getResult
();
allRoleList
.
add
(
roleModel
);
}
allRoleList
.
forEach
(
r
->
{
if
(!
roleIds
.
contains
(
r
.
getSequenceNbr
()))
{
roleIds
.
add
(
r
.
getSequenceNbr
());
}
});
// 添加人员管理角色
String
post
=
tzsUserInfoDto
.
getPost
();
if
(
post
.
contains
(
PersonManageRoleEnum
.
code
.
getId
().
toString
()))
{
CompanyModel
companyModel
=
Optional
.
ofNullable
(
Privilege
.
companyClient
.
seleteOne
(
companySeq
)).
map
(
FeignClientResult:
:
getResult
).
orElse
(
null
);
if
(!
ValidationUtil
.
isEmpty
(
companyModel
))
{
String
companyType
=
companyModel
.
getCompanyType
();
setBizOperateUserRole
(
companyType
,
roleIds
);
}
}
Map
<
Long
,
List
<
Long
>>
roleSeqMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
roleSeqMap
.
put
(
companySeq
,
roleIds
);
orgRoles
.
put
(
companySeq
,
allRoleList
);
AgencyUserModel
agencyUserModel
=
userFeignClientResult
.
getResult
();
agencyUserModel
.
setAppCodes
(
new
ArrayList
<>(
appCodesSet
));
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
tzsUserInfoDto
.
getAmosUserId
());
if
(
userResult
.
getStatus
()
==
200
)
{
// 绑定企业整改用户组
List
<
String
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userResult
.
getResult
().
getUserId
());
DataDictionary
roleGroup
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
roleGroupCode
).
eq
(
DataDictionary:
:
getType
,
ROLE_GROUP
));
if
(!
ObjectUtils
.
isEmpty
(
roleGroup
)
&&
roleGroup
.
getExtend
()
!=
null
)
{
Privilege
.
groupUserClient
.
create
(
Long
.
valueOf
(
roleGroup
.
getExtend
()),
userIds
);
}
// 绑定两个规定用户组
post
=
post
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replace
(
"\""
,
""
);
for
(
String
code
:
post
.
split
(
","
))
{
DataDictionary
groupId
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
code
).
likeRight
(
DataDictionary:
:
getType
,
QYRYGW
));
if
(!
ObjectUtils
.
isEmpty
(
groupId
)
&&
groupId
.
getExtend
()
!=
null
)
{
Privilege
.
groupUserClient
.
deleteGroupUser
(
Long
.
valueOf
(
groupId
.
getExtend
()),
userResult
.
getResult
().
getUserId
());
Privilege
.
groupUserClient
.
create
(
Long
.
valueOf
(
groupId
.
getExtend
()),
userIds
);
}
}
}
}
}
}
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