Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
a27a3d44
Commit
a27a3d44
authored
Jan 31, 2024
by
廖旭伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
b7be3774
c01ca213
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
32 deletions
+33
-32
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
+33
-32
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
View file @
a27a3d44
...
...
@@ -65,42 +65,43 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
log
.
info
(
"同步用户"
);
staffService
.
syncPersons
(
null
);
log
.
info
(
"同步钉钉usreId"
);
List
<
UserEntity
>
userList
=
userService
.
getCacheList
().
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getCustomerId
()))
.
filter
(
f
->
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
updateUserList
=
userList
.
stream
().
map
(
item
->
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
setId
(
item
.
getId
());
String
mobile
=
item
.
getMobile
();
if
(
ObjectUtils
.
isEmpty
(
mobile
))
{
//根据customerId查询staff 看是否有
StaffEntity
staffCache
=
staffService
.
getCache
(
item
.
getCustomerId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
staffCache
)
&&
!
ObjectUtils
.
isEmpty
(
staffCache
.
getPhoneNumber
()))
{
mobile
=
staffCache
.
getPhoneNumber
();
userEntity
.
setMobile
(
mobile
);
try
{
List
<
UserEntity
>
userList
=
userService
.
getCacheList
().
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getCustomerId
()))
.
filter
(
f
->
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
updateUserList
=
userList
.
stream
().
map
(
item
->
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
setId
(
item
.
getId
());
String
mobile
=
item
.
getMobile
();
if
(
ObjectUtils
.
isEmpty
(
mobile
))
{
//根据customerId查询staff 看是否有
StaffEntity
staffCache
=
staffService
.
getCache
(
item
.
getCustomerId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
staffCache
)
&&
!
ObjectUtils
.
isEmpty
(
staffCache
.
getPhoneNumber
()))
{
mobile
=
staffCache
.
getPhoneNumber
();
userEntity
.
setMobile
(
mobile
);
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
mobile
))
{
Rest
<
String
>
personByMobile
=
dingPersonService
.
getPersonByMobile
(
mobile
);
if
(!
ObjectUtils
.
isEmpty
(
personByMobile
)
&&
YesNoEnum
.
YES
.
getValue
()
==
personByMobile
.
getCode
()
&&
!
ObjectUtils
.
isEmpty
(
personByMobile
.
getData
()))
{
userEntity
.
setDingUserId
(
personByMobile
.
getData
());
if
(!
ObjectUtils
.
isEmpty
(
mobile
))
{
Rest
<
String
>
personByMobile
=
dingPersonService
.
getPersonByMobile
(
mobile
);
if
(!
ObjectUtils
.
isEmpty
(
personByMobile
)
&&
YesNoEnum
.
YES
.
getValue
()
==
personByMobile
.
getCode
()
&&
!
ObjectUtils
.
isEmpty
(
personByMobile
.
getData
()))
{
userEntity
.
setDingUserId
(
personByMobile
.
getData
());
}
}
}
userEntity
.
setUpdateTime
(
new
Date
());
userEntity
.
setUpdateUserId
(
1L
);
return
userEntity
;
}
).
collect
(
Collectors
.
toList
());
userEntity
.
setUpdateTime
(
new
Date
());
userEntity
.
setUpdateUserId
(
1L
);
return
userEntity
;
}).
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())
).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
updateUserList
)){
log
.
info
(
"更新用户钉钉id信息数量:{}"
,
updateUserList
.
size
());
userService
.
update
(
updateUserList
);
if
(!
ObjectUtils
.
isEmpty
(
updateUserList
))
{
log
.
info
(
"更新用户钉钉id信息数量:{}"
,
updateUserList
.
size
());
userService
.
getUserDao
().
updateBatch
(
updateUserList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"同步钉钉usreId失败"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"同步人事异常"
,
e
);
...
...
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