From cd2a44781aea96a394513de12f9d9a9c5adab9dc Mon Sep 17 00:00:00 2001 From: liuzipei Date: Thu, 9 Sep 2021 15:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=87=E7=AD=BE=E7=BB=84?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=88=A0=E9=99=A4=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=BC=9A=E5=AF=BC=E8=87=B4=E8=AF=A5=E6=A0=87=E7=AD=BE=E7=BB=84?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=88=A0=E9=99=A4bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wecom/service/impl/WeTagGroupServiceImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java b/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java index 065aadb16..1206a909b 100644 --- a/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java +++ b/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java @@ -120,12 +120,17 @@ public class WeTagGroupServiceImpl extends ServiceImpl initWeTags = this.iWeTagService.list(new LambdaQueryWrapper().eq(WeTag::getGroupId, weTagGroup.getGroupId()).eq(WeTag::getStatus, Constants.NORMAL_CODE)); + // 如果标签组下最初的标签和需要删除的标签个数相等时,需要把标签组一并删除 + WeCropDelDto weCropDelDto = WeCropDelDto.builder() + .tag_id(ArrayUtil.toArray(removeWeTags.stream().map(WeTag::getTagId).collect(Collectors.toList()), String.class)) + .build(); + if (CollectionUtil.isNotEmpty(initWeTags) && initWeTags.size() == removeWeTags.size()) { + weCropDelDto.builder().group_id(ArrayUtil.toArray(ListUtil.toList(weTagGroup.getGroupId()), String.class)); + } //同步删除微信端的标签 - weCropTagClient.delCorpTag( - WeCropDelDto.builder() - .group_id(ArrayUtil.toArray(ListUtil.toList(weTagGroup.getGroupId()), String.class)) - .tag_id(ArrayUtil.toArray(removeWeTags.stream().map(WeTag::getTagId).collect(Collectors.toList()), String.class)) - .build()); + weCropTagClient.delCorpTag(weCropDelDto); //移除本地 removeWeTags.stream().forEach(v -> v.setStatus(Constants.DELETE_CODE)); -- Gitee