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
d0e6fe5e
Commit
d0e6fe5e
authored
Aug 04, 2025
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(amos-boot-module-tcm): 添加空列表判断
- 使用 try-catch包裹可能抛出异常的代码,提高稳定性 - 优化日志输出,记录成功和失败的情况
parent
8693f8c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
48 deletions
+59
-48
TzsUserInfoServiceImpl.java
...t/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
+59
-48
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/TzsUserInfoServiceImpl.java
View file @
d0e6fe5e
...
@@ -2402,46 +2402,53 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
...
@@ -2402,46 +2402,53 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
List
<
RegUnitInfo
>
regUnitInfos
=
regUnitInfoService
.
lambdaQuery
().
in
(
RegUnitInfo:
:
getAdminUserId
,
adminUserIdList
).
list
();
List
<
RegUnitInfo
>
regUnitInfos
=
regUnitInfoService
.
lambdaQuery
().
in
(
RegUnitInfo:
:
getAdminUserId
,
adminUserIdList
).
list
();
List
<
String
>
useUnitCodes
=
regUnitInfos
.
stream
().
map
(
RegUnitInfo:
:
getUnitCode
).
collect
(
Collectors
.
toList
());
List
<
String
>
useUnitCodes
=
regUnitInfos
.
stream
().
map
(
RegUnitInfo:
:
getUnitCode
).
collect
(
Collectors
.
toList
());
if
(
ValidationUtil
.
isEmpty
(
useUnitCodes
))
{
return
;
}
List
<
TzBaseEnterpriseInfo
>
enterpriseInfos
=
baseEnterpriseInfoService
.
lambdaQuery
().
in
(
TzBaseEnterpriseInfo:
:
getUseUnitCode
,
useUnitCodes
).
list
();
List
<
TzBaseEnterpriseInfo
>
enterpriseInfos
=
baseEnterpriseInfoService
.
lambdaQuery
().
in
(
TzBaseEnterpriseInfo:
:
getUseUnitCode
,
useUnitCodes
).
list
();
Map
<
String
,
TzBaseEnterpriseInfo
>
enterpriseInfoMap
=
enterpriseInfos
.
stream
().
collect
(
Collectors
.
toMap
(
TzBaseEnterpriseInfo:
:
getUseUnitCode
,
x
->
x
,
(
oldValue
,
newValue
)
->
newValue
));
Map
<
String
,
TzBaseEnterpriseInfo
>
enterpriseInfoMap
=
enterpriseInfos
.
stream
().
collect
(
Collectors
.
toMap
(
TzBaseEnterpriseInfo:
:
getUseUnitCode
,
x
->
x
,
(
oldValue
,
newValue
)
->
newValue
));
for
(
RegUnitInfo
regUnitInfo
:
regUnitInfos
)
{
for
(
RegUnitInfo
regUnitInfo
:
regUnitInfos
)
{
String
useCode
=
regUnitInfo
.
getUnitCode
();
String
useCode
=
regUnitInfo
.
getUnitCode
();
CompanyModel
companyInfo
=
Privilege
.
companyClient
.
queryByCompanyCode
(
useCode
).
getResult
();
try
{
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
CompanyModel
companyInfo
=
Privilege
.
companyClient
.
queryByCompanyCode
(
useCode
).
getResult
();
Map
<
Long
,
List
<
Long
>>
roleSeqMap
=
new
HashMap
<>();
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
Map
<
Long
,
List
<
Long
>>
roleSeqMap
=
new
HashMap
<>();
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
List
<
Long
>
roleIds
=
new
ArrayList
<>();
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
Long
>
roleIds
=
new
ArrayList
<>();
List
<
RoleModel
>
roleModels
=
roleListResult
.
getResult
();
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
DataDictionary
>
unitTypeList
=
regUnitInfoService
.
setAndGetUnitTypeList
();
List
<
RoleModel
>
roleModels
=
roleListResult
.
getResult
();
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
enterpriseInfoMap
.
get
(
regUnitInfo
.
getUnitCode
());
List
<
DataDictionary
>
unitTypeList
=
regUnitInfoService
.
setAndGetUnitTypeList
();
String
[]
unitTypes
=
baseEnterpriseInfo
.
getUnitType
().
split
(
"#"
);
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
enterpriseInfoMap
.
get
(
regUnitInfo
.
getUnitCode
());
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
String
[]
unitTypes
=
baseEnterpriseInfo
.
getUnitType
().
split
(
"#"
);
AgencyUserModel
agencyUserModel
=
userResult
.
getResult
();
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
regUnitInfo
.
getAdminUserId
());
Map
<
String
,
DataDictionary
>
dataDictionaryMap
=
unitTypeList
.
stream
().
collect
(
Collectors
.
toMap
(
DataDictionary:
:
getName
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
AgencyUserModel
agencyUserModel
=
userResult
.
getResult
();
for
(
String
type
:
unitTypes
)
{
Map
<
String
,
DataDictionary
>
dataDictionaryMap
=
unitTypeList
.
stream
().
collect
(
Collectors
.
toMap
(
DataDictionary:
:
getName
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
DataDictionary
unitType
=
dataDictionaryMap
.
get
(
type
);
for
(
String
type
:
unitTypes
)
{
String
appCode
=
unitType
.
getTypeDesc
()
!=
null
?
unitType
.
getTypeDesc
()
:
""
;
DataDictionary
unitType
=
dataDictionaryMap
.
get
(
type
);
String
[]
appCodes
=
appCode
.
split
(
","
);
String
appCode
=
unitType
.
getTypeDesc
()
!=
null
?
unitType
.
getTypeDesc
()
:
""
;
Collections
.
addAll
(
appCodesSet
,
appCodes
);
String
[]
appCodes
=
appCode
.
split
(
","
);
userRoleList
.
addAll
(
roleModels
.
stream
()
Collections
.
addAll
(
appCodesSet
,
appCodes
);
.
filter
(
r
->
unitType
.
getExtend
().
contains
(
r
.
getSequenceNbr
().
toString
())).
collect
(
Collectors
.
toList
()));
userRoleList
.
addAll
(
roleModels
.
stream
()
userRoleList
.
forEach
(
r
->
{
.
filter
(
r
->
unitType
.
getExtend
().
contains
(
r
.
getSequenceNbr
().
toString
())).
collect
(
Collectors
.
toList
()));
if
(!
roleIds
.
contains
(
r
.
getSequenceNbr
()))
{
userRoleList
.
forEach
(
r
->
{
roleIds
.
add
(
r
.
getSequenceNbr
());
if
(!
roleIds
.
contains
(
r
.
getSequenceNbr
()))
{
}
roleIds
.
add
(
r
.
getSequenceNbr
());
});
}
roleSeqMap
.
put
(
companyInfo
.
getSequenceNbr
(),
roleIds
);
});
orgRoles
.
put
(
companyInfo
.
getSequenceNbr
(),
userRoleList
);
roleSeqMap
.
put
(
companyInfo
.
getSequenceNbr
(),
roleIds
);
}
orgRoles
.
put
(
companyInfo
.
getSequenceNbr
(),
userRoleList
);
}
agencyUserModel
.
setAppCodes
(
new
ArrayList
<>(
appCodesSet
));
agencyUserModel
.
setAppCodes
(
new
ArrayList
<>(
appCodesSet
));
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
userResult
=
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
regUnitInfo
.
getAdminUserId
());
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
regUnitInfo
.
getAdminUserId
());
System
.
out
.
println
(
userResult
);
log
.
info
(
"更新企业管理员:{} 成功"
,
useCode
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"更新企业管理员:{} 失败, 错误原因: {}"
,
useCode
,
e
.
getMessage
());
}
}
}
}
}
...
@@ -2469,21 +2476,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
...
@@ -2469,21 +2476,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Map
<
String
,
RegUnitInfo
>
regUnitInfoMap
=
regUnitInfos
.
stream
().
collect
(
Collectors
.
toMap
(
RegUnitInfo:
:
getUnitCode
,
x
->
x
,
(
oldValue
,
newValue
)
->
newValue
));
Map
<
String
,
RegUnitInfo
>
regUnitInfoMap
=
regUnitInfos
.
stream
().
collect
(
Collectors
.
toMap
(
RegUnitInfo:
:
getUnitCode
,
x
->
x
,
(
oldValue
,
newValue
)
->
newValue
));
for
(
TzsUserInfo
userInfo
:
userInfos
)
{
for
(
TzsUserInfo
userInfo
:
userInfos
)
{
// 更新人员信息同步平台
try
{
TzsUserInfoDto
tzsUserInfoDto
=
new
TzsUserInfoDto
();
// 更新人员信息同步平台
Bean
.
toModel
(
userInfo
,
tzsUserInfoDto
);
TzsUserInfoDto
tzsUserInfoDto
=
new
TzsUserInfoDto
();
RegUnitInfo
regUnitInfo
=
regUnitInfoMap
.
get
(
tzsUserInfoDto
.
getUnitCode
());
Bean
.
toModel
(
userInfo
,
tzsUserInfoDto
);
if
(
regUnitInfo
==
null
||
StringUtils
.
isEmpty
(
regUnitInfo
.
getAdminUserId
()))
{
RegUnitInfo
regUnitInfo
=
regUnitInfoMap
.
get
(
tzsUserInfoDto
.
getUnitCode
());
continue
;
if
(
regUnitInfo
==
null
||
StringUtils
.
isEmpty
(
regUnitInfo
.
getAdminUserId
()))
{
}
continue
;
AgencyUserModel
adminUserModel
=
userModelMap
.
get
(
regUnitInfo
.
getAdminUserId
());
}
if
(
adminUserModel
==
null
)
{
AgencyUserModel
adminUserModel
=
userModelMap
.
get
(
regUnitInfo
.
getAdminUserId
());
continue
;
if
(
adminUserModel
==
null
)
{
continue
;
}
Long
companySeq
=
Long
.
valueOf
(
regUnitInfo
.
getAmosCompanySeq
());
List
<
String
>
appCodesSet
=
adminUserModel
.
getAppCodes
();
// 根据post同步平台的用户组
syncNewPost
(
tzsUserInfoDto
,
companySeq
,
appCodesSet
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"更新企业管理员:{} 失败, 错误原因: {}"
,
userInfo
,
e
.
getMessage
());
}
}
Long
companySeq
=
Long
.
valueOf
(
regUnitInfo
.
getAmosCompanySeq
());
List
<
String
>
appCodesSet
=
adminUserModel
.
getAppCodes
();
// 根据post同步平台的用户组
syncNewPost
(
tzsUserInfoDto
,
companySeq
,
appCodesSet
);
}
}
}
}
}
}
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