Commit 5a026396 by 王祖波

好办消息通知去重

parent c9510909
...@@ -5,9 +5,7 @@ import static org.slf4j.LoggerFactory.getLogger; ...@@ -5,9 +5,7 @@ import static org.slf4j.LoggerFactory.getLogger;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
...@@ -194,15 +192,17 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -194,15 +192,17 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
logger.info("企业为空:{}",wxEnterpriseId); logger.info("企业为空:{}",wxEnterpriseId);
return; return;
} }
// 用于成员去重
Set<String> userIdSet = new HashSet<>();
List<List<StaffClerkRelationDTO>> listList = ListUtil.split(v, 1000); List<List<StaffClerkRelationDTO>> listList = ListUtil.split(v, 1000);
listList.forEach(list->{ listList.forEach(list->{
sendMessage(notifyMessageBatchQDTO, list, qwDTO); sendMessage(notifyMessageBatchQDTO, list,userIdSet, qwDTO);
}); });
}); });
return ServiceResponse.success(); return ServiceResponse.success();
} }
private void sendMessage(NotifyMessageBatchQDTO notifyMessageBatchQDTO, List<StaffClerkRelationDTO> list, WxEnterpriseQwDTO qwDTO) { private void sendMessage(NotifyMessageBatchQDTO notifyMessageBatchQDTO, List<StaffClerkRelationDTO> list,Set<String> userIdSet, WxEnterpriseQwDTO qwDTO) {
//企业微信模板 //企业微信模板
List<TemplateContentBO> contentList = getDescriotion(notifyMessageBatchQDTO); List<TemplateContentBO> contentList = getDescriotion(notifyMessageBatchQDTO);
//好办模板 //好办模板
...@@ -224,7 +224,9 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -224,7 +224,9 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
if(qwDTO.needOpenUserId3th()) { if(qwDTO.needOpenUserId3th()) {
wxUserId = relationDTO.getOpenUserId() ; wxUserId = relationDTO.getOpenUserId() ;
} }
wxUserIdList.add(wxUserId); if (userIdSet.add(wxUserId)) {
wxUserIdList.add(wxUserId);
}
//消息组装 新增消息 //消息组装 新增消息
NoticeMessageBO noticeMessageBO = new NoticeMessageBO(); NoticeMessageBO noticeMessageBO = new NoticeMessageBO();
noticeMessageBO.setCategoryType(messageTypeEnum.getCategory()); noticeMessageBO.setCategoryType(messageTypeEnum.getCategory());
......
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