Commit 90c57853 by 徐高华

标签同步

parent 6fab5b6e
...@@ -141,14 +141,23 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -141,14 +141,23 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override @Override
public ServiceResponse syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) { public ServiceResponse syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
logger.info("标签同步到企业微信,wxEnterpriseId={},memberTagId={}",wxEnterpriseId,infoDTO.getMemberTagId()); String memberTagId = infoDTO.getMemberTagId() ;
logger.info("标签同步到企业微信,wxEnterpriseId={},memberTagId={}",wxEnterpriseId,memberTagId);
List<MemberTagItemDTO> tagItems = memberTagApiService.queryMemberTagItem(memberTagId);
items = tagItems.stream().map(item -> {
QywxTagItemDTO mid = new QywxTagItemDTO();
mid.setMemberTagItemId(item.getTagItemId());
mid.setQywxTagKey(item.getTagItemId());
mid.setQywxTagName(item.getTagItemName());
return mid;
}).collect(Collectors.toList());
ServiceResponse ret = new ServiceResponse(); ServiceResponse ret = new ServiceResponse();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
// 判断更新 // 判断更新
List<String> needDelList = new ArrayList<>() ; List<String> needDelList = new ArrayList<>() ;
List<QywxTagItemDTO> needAddList = new ArrayList<>() ; List<QywxTagItemDTO> needAddList = new ArrayList<>() ;
List<String> memberTagItemIdList = items.stream().map(o->o.getMemberTagItemId()).collect(Collectors.toList()); ; List<String> memberTagItemIdList = items.stream().map(o->o.getMemberTagItemId()).collect(Collectors.toList()); ;
List<TabQywxTagRelation> relationList = this.qywxTagRelationMapper.listByMemberTagId(wxEnterpriseId,infoDTO.getMemberTagId()) ; List<TabQywxTagRelation> relationList = this.qywxTagRelationMapper.listByMemberTagId(wxEnterpriseId,memberTagId) ;
if(CollectionUtils.isNotEmpty(relationList)) { if(CollectionUtils.isNotEmpty(relationList)) {
String hbTagId = relationList.get(0).getQywxTagId() ; String hbTagId = relationList.get(0).getQywxTagId() ;
TabQywxTag tag = this.qywxTagService.getQywxTagByQywxTagId(wxEnterpriseId,hbTagId) ; TabQywxTag tag = this.qywxTagService.getQywxTagByQywxTagId(wxEnterpriseId,hbTagId) ;
...@@ -162,13 +171,15 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -162,13 +171,15 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
infoDTO.setQywxGroupKey(qwGroupKey); infoDTO.setQywxGroupKey(qwGroupKey);
// 需要删除的标签值 // 需要删除的标签值
for(TabQywxTagRelation relation : relationList) { for(TabQywxTagRelation relation : relationList) {
String memberTagId = relation.getTagItemId() ; String memberItemTagId = relation.getTagItemId() ;
if(!memberTagItemIdList.contains(memberTagId)) { if(!memberTagItemIdList.contains(memberItemTagId)) {
this.qywxTagRelationMapper.deleteByPrimaryKey(relation.getQywxTagRelationId()) ; this.qywxTagRelationMapper.deleteByPrimaryKey(relation.getQywxTagRelationId()) ;
String hbTagItemId = relation.getQywxTagItemId() ; String hbTagItemId = relation.getQywxTagItemId() ;
TabQywxTagItem tagItem = tagItemMap.get(hbTagItemId) ;
this.qywxTagService.delQywxTagItemById(wxEnterpriseId,hbTagItemId) ; this.qywxTagService.delQywxTagItemById(wxEnterpriseId,hbTagItemId) ;
needDelList.add(tagItem.getQywxTagKey()) ; TabQywxTagItem tagItem = tagItemMap.get(hbTagItemId) ;
if(null != tagItem) {
needDelList.add(tagItem.getQywxTagKey()) ;
}
} }
} }
if(CollectionUtils.isNotEmpty(needDelList)) { if(CollectionUtils.isNotEmpty(needDelList)) {
...@@ -260,8 +271,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -260,8 +271,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
/** /**
* 调用企业微信接口 保存标签 * 调用企业微信接口 保存标签
*
* @param wxEnterpriseDTO
* @param infoDTO * @param infoDTO
* @param items * @param items
* @return * @return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment