| | |
| | | import org.springframework.transaction.TransactionStatus; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | |
| | | deviceChannel.setStreamId(allChannelMapInPlay.get(deviceChannel.getChannelId()).getStreamId()); |
| | | } |
| | | channels.add(deviceChannel); |
| | | if (!StringUtils.isEmpty(deviceChannel.getParentId())) { |
| | | if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) { |
| | | if (subContMap.get(deviceChannel.getParentId()) == null) { |
| | | subContMap.put(deviceChannel.getParentId(), 1); |
| | | }else { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ParentPlatform> queryParentPlatformList(int page, int count) { |
| | | PageHelper.startPage(page, count); |
| | | List<ParentPlatform> all = platformMapper.getParentPlatformList(); |
| | | return new PageInfo<>(all); |
| | | } |
| | | |
| | | @Override |
| | | public ParentPlatform queryParentPlatByServerGBId(String platformGbId) { |
| | | return platformMapper.getParentPlatByServerGBId(platformGbId); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateMediaList(List<StreamPushItem> streamPushItems) { |
| | | if (streamPushItems == null || streamPushItems.size() == 0) { |
| | | return; |
| | | } |
| | | logger.info("updateMediaList: " + streamPushItems.size()); |
| | | streamPushMapper.addAll(streamPushItems); |
| | | // TODO 待优化 |
| | | for (int i = 0; i < streamPushItems.size(); i++) { |
| | | int onlineResult = mediaOnline(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream()); |
| | | if (onlineResult > 0) { |
| | | // 发送上线通知 |
| | | eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void updateMedia(StreamPushItem streamPushItem) { |
| | | streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream()); |
| | | streamPushMapper.add(streamPushItem); |
| | | mediaOffline(streamPushItem.getApp(), streamPushItem.getStream()); |
| | | } |
| | | |
| | | @Override |
| | | public int removeMedia(String app, String stream) { |
| | | return streamPushMapper.del(app, stream); |
| | | } |
| | | |
| | | @Override |
| | | public StreamPushItem getMedia(String app, String stream) { |
| | | return streamPushMapper.selectOne(app, stream); |
| | | } |
| | | |
| | | @Override |
| | | public void clearMediaList() { |
| | | streamPushMapper.clear(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if ("proxy".equals(gbStream.getStreamType())) { |
| | | result = streamProxyMapper.updateStatus(app, stream, false); |
| | | }else { |
| | | result = streamPushMapper.updateStatus(app, stream, false); |
| | | result = streamPushMapper.updatePushStatus(app, stream, false); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | if ("proxy".equals(gbStream.getStreamType())) { |
| | | result = streamProxyMapper.updateStatus(app, stream, true); |
| | | }else { |
| | | result = streamPushMapper.updateStatus(app, stream, true); |
| | | result = streamPushMapper.updatePushStatus(app, stream, true); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | platformCatalog.setParentId(platform.getDeviceGBId()); |
| | | }else { |
| | | // 获取顶层的 |
| | | PlatformCatalog topCatalog = getTopCatalog(platformCatalog.getParentId(), platformCatalog.getPlatformId()); |
| | | PlatformCatalog topCatalog = getTopCatalog(platformCatalog.getParentId(), platform.getDeviceGBId()); |
| | | platformCatalog.setBusinessGroupId(topCatalog.getId()); |
| | | } |
| | | } |