Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
6e8239a3
Commit
6e8239a3
authored
Jun 22, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业微信标签同步
parent
c850417c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
+16
-9
QywxTagService.java
...com/gic/haoban/manage/service/service/QywxTagService.java
+2
-1
QywxTagServiceImpl.java
...aoban/manage/service/service/impl/QywxTagServiceImpl.java
+4
-2
QywxTagApiServiceImpl.java
...anage/service/service/out/impl/QywxTagApiServiceImpl.java
+10
-6
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/QywxTagService.java
View file @
6e8239a3
...
...
@@ -7,6 +7,7 @@ import com.gic.haoban.manage.service.entity.TabQywxTag;
import
com.gic.haoban.manage.service.entity.TabQywxTagItem
;
import
com.gic.haoban.manage.service.entity.TabQywxTagRelation
;
import
com.gic.wechat.api.dto.qywx.QywxTagGroupDTO
;
import
org.apache.commons.lang3.tuple.Pair
;
import
java.util.List
;
...
...
@@ -49,7 +50,7 @@ public interface QywxTagService {
* @param groupDTO
* @return
*/
public
void
saveQywxTagByQywxGroupKey
(
String
wxEnterpriseId
,
QywxTagGroupDTO
groupDTO
);
public
Pair
<
TabQywxTag
,
List
<
TabQywxTagItem
>>
saveQywxTagByQywxGroupKey
(
String
wxEnterpriseId
,
QywxTagGroupDTO
groupDTO
);
/**
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/QywxTagServiceImpl.java
View file @
6e8239a3
...
...
@@ -12,6 +12,7 @@ import com.gic.haoban.manage.service.entity.TabQywxTagRelation;
import
com.gic.haoban.manage.service.service.QywxTagService
;
import
com.gic.wechat.api.dto.qywx.QywxTagDTO
;
import
com.gic.wechat.api.dto.qywx.QywxTagGroupDTO
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -52,7 +53,7 @@ public class QywxTagServiceImpl implements QywxTagService {
}
@Override
public
void
saveQywxTagByQywxGroupKey
(
String
wxEnterpriseId
,
QywxTagGroupDTO
groupDTO
)
{
public
Pair
<
TabQywxTag
,
List
<
TabQywxTagItem
>>
saveQywxTagByQywxGroupKey
(
String
wxEnterpriseId
,
QywxTagGroupDTO
groupDTO
)
{
//判断保存 分组
TabQywxTag
qywxTag
=
this
.
getQywxTagByQywxGroupKey
(
wxEnterpriseId
,
groupDTO
.
getGroupId
());
if
(
null
==
qywxTag
)
{
...
...
@@ -75,7 +76,7 @@ public class QywxTagServiceImpl implements QywxTagService {
List
<
QywxTagDTO
>
dtos
=
groupDTO
.
getTag
();
if
(
CollectionUtils
.
isEmpty
(
dtos
))
{
return
;
return
null
;
}
Map
<
String
,
TabQywxTagItem
>
itemMap
=
new
HashMap
<>();
List
<
TabQywxTagItem
>
orgItems
=
this
.
listByQywxTagId
(
wxEnterpriseId
,
qywxTag
.
getQywxTagId
());
...
...
@@ -108,6 +109,7 @@ public class QywxTagServiceImpl implements QywxTagService {
}
items
.
add
(
qywxTagItem
);
}
return
Pair
.
of
(
qywxTag
,
items
);
}
@Override
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/QywxTagApiServiceImpl.java
View file @
6e8239a3
...
...
@@ -21,6 +21,7 @@ import com.gic.wechat.api.dto.qywx.response.QywxGetCorpTagListDTO;
import
com.gic.wechat.api.dto.qywx.response.QywxResponseDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -93,9 +94,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
List
<
QywxTagGroupDTO
>
tagGroup
=
resp
.
getTagGroup
();
QywxTagGroupDTO
groupDTO
=
tagGroup
.
get
(
0
);
//保存企业微信标签信息
qywxTagService
.
saveQywxTagByQywxGroupKey
(
wxEnterpriseId
,
groupDTO
);
Pair
<
TabQywxTag
,
List
<
TabQywxTagItem
>>
savePair
=
qywxTagService
.
saveQywxTagByQywxGroupKey
(
wxEnterpriseId
,
groupDTO
);
if
(
null
==
savePair
)
{
logger
.
info
(
"保存失败:{}"
,
JSONObject
.
toJSONString
(
groupDTO
));
return
;
}
//保存关联关系
saveRelation
(
wxEnterpriseId
,
enterpriseId
,
infoDTO
,
items
);
saveRelation
(
wxEnterpriseId
,
enterpriseId
,
infoDTO
,
items
,
savePair
);
//todo 后续处理 比如同步会员标签等
...
...
@@ -108,11 +113,11 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
* @param enterpriseId
* @param infoDTO
*/
private
void
saveRelation
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
private
void
saveRelation
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
,
Pair
<
TabQywxTag
,
List
<
TabQywxTagItem
>>
localQywxTagPair
)
{
Map
<
String
,
QywxTagItemDTO
>
orgMap
=
items
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getQywxTagName
(),
dto
->
dto
));
//设置关联关系
TabQywxTag
groupKey
=
qywxTagService
.
getQywxTagByQywxGroupKey
(
wxEnterpriseId
,
infoDTO
.
getQywxGroupKey
()
);
List
<
TabQywxTagItem
>
tabQywxTagItems
=
qywxTagService
.
listByQywxTagId
(
wxEnterpriseId
,
groupKey
.
getQywxTagId
()
);
TabQywxTag
groupKey
=
localQywxTagPair
.
getKey
(
);
List
<
TabQywxTagItem
>
tabQywxTagItems
=
localQywxTagPair
.
getRight
(
);
List
<
TabQywxTagRelation
>
saveRelationList
=
new
ArrayList
<>();
TabQywxTagRelation
groupRelation
=
new
TabQywxTagRelation
();
...
...
@@ -154,7 +159,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
*/
private
QywxGetCorpTagListDTO
saveQywxTag
(
WxEnterpriseDTO
wxEnterpriseDTO
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
QywxTagGroupDTO
qywxTagGroupDTO
=
new
QywxTagGroupDTO
();
qywxTagGroupDTO
.
setGroupId
(
infoDTO
.
getQywxGroupKey
());
qywxTagGroupDTO
.
setGroupName
(
"GIC"
+
infoDTO
.
getQywxGroupName
());
qywxTagGroupDTO
.
setOrder
(
infoDTO
.
getOrder
());
...
...
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