Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
feo-jobs
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
feo-jobs
Commits
3d02b61b
Commit
3d02b61b
authored
Nov 25, 2021
by
钱坤
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into dev
parents
a9deb923
6b3e04a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
OrgSyncByWxcpJob.java
...main/java/com/tanpu/feo/feojob/jobs/OrgSyncByWxcpJob.java
+19
-7
No files found.
src/main/java/com/tanpu/feo/feojob/jobs/OrgSyncByWxcpJob.java
View file @
3d02b61b
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.crypto.digest.MD5
;
import
cn.hutool.json.JSONUtil
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.feo.feojob.constant.BaseConstant
;
import
com.tanpu.feo.feojob.constant.OrgExtConstant
;
import
com.tanpu.feo.feojob.dao.user.entity.*
;
...
...
@@ -30,10 +31,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -112,13 +110,15 @@ public class OrgSyncByWxcpJob {
}
log
.
info
(
"======从企业微信获取组织信息及员工信息 结束======"
);
logOrgManSimpleInfo
(
orgId
,
wxCpDepartDtoList
);
//4 判断是否需要 同步
String
digestHex
=
isExecute
(
isAuto
,
wxCpDepartDtoList
,
orgExtEntity
.
getMd5WxcpData
());
log
.
info
(
"====== 机构:{}整体digest, old: {}, new: {}======="
,
orgId
,
orgExtEntity
.
getMd5WxcpData
(),
digestHex
);
if
(
StrUtil
.
isBlank
(
digestHex
))
{
log
.
info
(
"====== 机构:{} 不需要执行同步======="
,
orgId
);
continue
;
}
String
qrCodeUrl
=
getQrCodeUrl
(
orgEntity
.
getId
());
//5 开始比对 5张表 数据 user_info employee department department_employee employee_role
...
...
@@ -141,6 +141,18 @@ public class OrgSyncByWxcpJob {
}
private
void
logOrgManSimpleInfo
(
String
orgId
,
List
<
WxCpDepartDto
>
wxCpDepartDtoList
)
{
if
(
CollectionUtils
.
isEmpty
(
wxCpDepartDtoList
))
{
log
.
info
(
"机构{}当前无部门人员信息"
,
orgId
);
return
;
}
Map
<
String
,
Integer
>
map
=
new
LinkedHashMap
<>(
wxCpDepartDtoList
.
size
());
for
(
WxCpDepartDto
departDto
:
wxCpDepartDtoList
)
{
map
.
put
(
departDto
.
getName
()
+
","
+
departDto
.
getEnName
()
+
","
+
departDto
.
getId
(),
departDto
.
getMembers
());
}
log
.
info
(
"机构{}当前部门数:{}, 人员数概要是: {}"
,
orgId
,
wxCpDepartDtoList
.
size
(),
JsonUtil
.
toJson
(
map
));
}
private
String
getQrCodeUrl
(
String
orgId
)
{
CommonResp
<
String
>
commonResp
=
feignClientForFatools
.
getQrCodeUrl
(
orgId
);
if
(
commonResp
.
isNotSuccess
())
{
...
...
@@ -300,7 +312,7 @@ public class OrgSyncByWxcpJob {
}
//更新
Long
parentId1
=
wxCpDepartDto
.
getParentId
();
String
parentId
=
ObjectUtil
.
isNull
(
hashMap2
.
get
(
parentId1
))
?
null
:
orgId
+
"_"
+
parentId1
;
String
parentId
=
ObjectUtil
.
isNull
(
hashMap2
.
get
(
parentId1
))
?
""
:
orgId
+
"_"
+
parentId1
;
Integer
level
=
getLevel
(
hashMap2
,
wxCpDepartDto
.
getId
());
if
(!
department
.
getDepartmentName
().
equals
(
wxCpDepartDto
.
getName
())
||
StrUtil
.
compareIgnoreCase
(
department
.
getParentDepartId
(),
parentId
,
false
)
!=
0
||
!
department
.
getMembers
().
equals
(
wxCpDepartDto
.
getMembers
())
||
!
level
.
equals
(
department
.
getLevel
()))
{
...
...
@@ -316,7 +328,7 @@ public class OrgSyncByWxcpJob {
for
(
String
departmentId
:
hashMap
.
keySet
())
{
WxCpDepartDto
wxCpDepartDto
=
hashMap
.
get
(
departmentId
);
Long
parentId1
=
wxCpDepartDto
.
getParentId
();
String
parentId
=
ObjectUtil
.
isNull
(
hashMap2
.
get
(
parentId1
))
?
null
:
orgId
+
"_"
+
parentId1
;
String
parentId
=
ObjectUtil
.
isNull
(
hashMap2
.
get
(
parentId1
))
?
""
:
orgId
+
"_"
+
parentId1
;
DepartmentEntity
department
=
new
DepartmentEntity
();
department
.
setDepartmentId
(
orgId
+
"_"
+
wxCpDepartDto
.
getId
());
department
.
setParentDepartId
(
parentId
);
...
...
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