|
@@ -104,6 +104,25 @@ public class ImSendGroupMessageServiceImpl extends BaseServiceImpl<Long, ImSendG
|
|
|
List<String> groupIdList = Arrays.stream(groupIds.split(",")).collect(Collectors.toList());
|
|
|
List<String> targetIdList = Arrays.stream(sendGroupMessage.getTargetIds().split(",")).collect(Collectors.toList());
|
|
|
targetIdList.removeAll(groupIdList);
|
|
|
+ if (targetIdList.size() == 0) {
|
|
|
+ throw new BizException("消息没有指定群组");
|
|
|
+ }
|
|
|
+ sendGroupMessage.setTargetIds(String.join(",", targetIdList));
|
|
|
+ imSendGroupMessageDao.update(sendGroupMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void addGroupList(Long imSendGroupMessageId, String groupIds) {
|
|
|
+ ImSendGroupMessage sendGroupMessage =
|
|
|
+ Optional.of(imSendGroupMessageDao.get(imSendGroupMessageId)).orElseThrow(() -> new BizException("消息不存在"));
|
|
|
+ if(sendGroupMessage.getSendFlag()){
|
|
|
+ throw new BizException("消息已发送");
|
|
|
+ }
|
|
|
+ //添加指定的群列表
|
|
|
+ Set<String> groupIdList = Arrays.stream(groupIds.split(",")).collect(Collectors.toSet());
|
|
|
+ Set<String> targetIdList = Arrays.stream(sendGroupMessage.getTargetIds().split(",")).collect(Collectors.toSet());
|
|
|
+ targetIdList.addAll(groupIdList);
|
|
|
sendGroupMessage.setTargetIds(String.join(",", targetIdList));
|
|
|
imSendGroupMessageDao.update(sendGroupMessage);
|
|
|
}
|