Commit 904c8e4d by fudahua

企业微信同步

parent 28f2a520
......@@ -28,6 +28,7 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -107,7 +108,8 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
* @param enterpriseId
* @param infoDTO
*/
private void saveRelation(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO) {
private void saveRelation(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
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());
......@@ -124,6 +126,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
groupRelation.setWxEnterpriseId(wxEnterpriseId);
saveRelationList.add(groupRelation);
List<TabQywxTagRelation> itemList = tabQywxTagItems.stream().map(tab -> {
QywxTagItemDTO orgItem = orgMap.get(tab.getQywxTagName());
TabQywxTagRelation itemRelation = new TabQywxTagRelation();
itemRelation.setWxEnterpriseId(wxEnterpriseId);
itemRelation.setQywxTagRelationId(ToolUtil.randomUUID());
......@@ -134,7 +137,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
itemRelation.setMemberTagId(groupKey.getQywxGroupKey());
itemRelation.setEnterpriseId(enterpriseId);
itemRelation.setQywxTagItemId(tab.getQywxTagItemId());
itemRelation.setTagItemId(tab.getQywxTagKey());
itemRelation.setTagItemId(orgItem.getQywxTagKey());
return itemRelation;
}).collect(Collectors.toList());
saveRelationList.addAll(itemList);
......@@ -157,7 +160,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
List<QywxTagDTO> tagItems = items.stream().map(item -> {
QywxTagDTO qywxTagDTO = new QywxTagDTO();
qywxTagDTO.setId(item.getQywxTagKey());
qywxTagDTO.setName(item.getQywxTagName());
qywxTagDTO.setOrder(item.getOrder());
return qywxTagDTO;
......
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