...
|
...
|
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
public class MessageRouterReciverImpl implements MessageRouterReciverService {
|
...
|
...
|
@@ -36,15 +37,19 @@ public class MessageRouterReciverImpl implements MessageRouterReciverService { |
|
|
public boolean batchAddMessageRouterReciver(MessageRouter messageRouter) {
|
|
|
int i =0;
|
|
|
if (StringUtils.isNotBlank(messageRouter.getId())){
|
|
|
if (messageRouter.getRcvrs()!=null && !messageRouter.getRcvrs().isEmpty()){
|
|
|
if (messageRouter.getRcvrList()!=null && !messageRouter.getRcvrList().isEmpty()){
|
|
|
// 获取订阅者列表,循环添加
|
|
|
for (String rcvr: messageRouter.getRcvrs()
|
|
|
for (MessageRouterReciver rcvr: messageRouter.getRcvrList()
|
|
|
) {
|
|
|
MessageRouterReciver reciver = new MessageRouterReciver();
|
|
|
reciver.setRcvrTopic(rcvr);
|
|
|
reciver.setMessageRouterId(messageRouter.getId());
|
|
|
reciver.setId(IdUtils.generateId());
|
|
|
i += messageRouterReciverMapper.insertSelective(reciver);
|
|
|
if (StringUtils.isNotBlank(rcvr.getRcvrTopic())){
|
|
|
rcvr.setMessageRouterId(messageRouter.getId());
|
|
|
rcvr.setId(IdUtils.generateId());
|
|
|
List<MessageRouterReciver> list = messageRouterReciverMapper.selectByRouterKeyAndTopic(rcvr);
|
|
|
//判断是否已经有这条数据
|
|
|
if(list.isEmpty()){
|
|
|
i += messageRouterReciverMapper.insertSelective(rcvr);
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return i > 0;
|
...
|
...
|
|