Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lyf-beidou-cdp-api
Overview
Overview
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
zhoupeng
lyf-beidou-cdp-api
Commits
2d45a71c
Commit
2d45a71c
authored
Sep 01, 2023
by
zhoupeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交导入组织架构openapi接口
parent
ac1a0146
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
SyncEmployeCdpServiceImpl.java
.../order/domain/service/impl/SyncEmployeCdpServiceImpl.java
+17
-7
No files found.
src/main/java/com/rome/order/domain/service/impl/SyncEmployeCdpServiceImpl.java
View file @
2d45a71c
...
...
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
import
com.rome.order.domain.enums.ResponseMsg
;
import
com.rome.order.domain.service.OrganizationRedisService
;
import
com.rome.order.domain.service.SyncEmployeCdpService
;
import
com.rome.order.domain.util.BatchHandlerUtil
;
import
com.rome.order.domain.util.HttpUtil
;
import
com.rome.order.domain.util.ParameterCheckUtils
;
import
com.rome.order.infrastructure.dataobject.SyncEmployeeCdpDO
;
...
...
@@ -126,6 +127,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
try
{
//转换成Map
Map
<
String
,
List
<
OrgDTO
>>
orgDTOMap
=
this
.
getOrgDTOMap
(
allOrg
);
List
<
EmpMainDataResDTO
>
allEmps
=
new
ArrayList
<>();
// 分页获取全量数据
int
pageNum
=
1
;
if
(
pageParamNum
!=
null
){
...
...
@@ -145,7 +147,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
break
;
}
// 处理同步的员工信息
this
.
dealthEmpCdpList
(
empResList
,
orgDTOMap
);
this
.
dealthEmpCdpList
(
empResList
,
allEmps
);
if
(
empResList
.
size
()<
pageSize
){
// 处理同步的员工信息
log
.
info
(
"------synAllEmpCdp全量同步结束-------"
);
...
...
@@ -153,6 +155,10 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
}
pageNum
++;
}
//同步腾讯
if
(!
CollectionUtils
.
isEmpty
(
allEmps
)){
this
.
orgSyncTecent
(
allEmps
,
orgDTOMap
);
}
log
.
info
(
"------synAllEmpCdp全量同步结束-------"
);
return
true
;
}
catch
(
Exception
e
)
{
...
...
@@ -179,7 +185,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
* 处理同步的员工信息
* @param empResList
*/
private
void
dealthEmpCdpList
(
List
<
EmpMainDataResDTO
>
empResList
,
Map
<
String
,
List
<
OrgDTO
>>
orgDTOMap
){
private
void
dealthEmpCdpList
(
List
<
EmpMainDataResDTO
>
empResList
,
List
<
EmpMainDataResDTO
>
allEmps
){
empResList
.
forEach
(
s
->{
s
.
setCreator
(-
1
);
s
.
setCreatorName
(
"system"
);
...
...
@@ -195,8 +201,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
//需要用户id 根据进行去重
// empResList = empResList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getUserId()))), ArrayList::new));
syncEmployeeCdpMapper
.
batchSaveEmpCdp
(
empResList
);
//同步腾讯
this
.
orgSyncTecent
(
empResList
,
orgDTOMap
);
allEmps
.
addAll
(
empResList
);
}
else
{
//批量添加
List
<
EmpMainDataResDTO
>
batchAdd
=
new
ArrayList
<>();
...
...
@@ -209,8 +214,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
}
if
(!
CollectionUtils
.
isEmpty
(
batchAdd
)){
syncEmployeeCdpMapper
.
batchSaveEmpCdp
(
batchAdd
);
//同步腾讯
this
.
orgSyncTecent
(
empResList
,
orgDTOMap
);
allEmps
.
addAll
(
batchAdd
);
}
}
}
...
...
@@ -299,7 +303,13 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
s
.
setErrorMsg
(
errMsg
);
}
}
syncEmployeeCdpMapper
.
batchUpdateEmpCdp
(
empResList
);
if
(!
CollectionUtils
.
isEmpty
(
empResList
)){
List
<
List
<
EmpMainDataResDTO
>>
addLists
=
BatchHandlerUtil
.
splitTo
(
empResList
,
200
);
log
.
info
(
"appPlanExecuteList总条数:{},分{}批更新"
,
addLists
.
size
(),
addLists
.
size
());
for
(
List
<
EmpMainDataResDTO
>
list
:
addLists
)
{
syncEmployeeCdpMapper
.
batchUpdateEmpCdp
(
list
);
}
}
}
private
String
orgSetAdminAccountId
(
String
accountId
){
...
...
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