为推流列表增加批量移除功能

This commit is contained in:
648540858
2022-02-07 18:30:43 +08:00
parent e0028a87cb
commit d07a5680f3
11 changed files with 145 additions and 22 deletions

View File

@@ -43,4 +43,5 @@ public interface IGbStreamService {
DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId);
void sendCatalogMsg(GbStream gbStream, String type);
void sendCatalogMsgs(List<GbStream> gbStreams, String type);
}

View File

@@ -66,4 +66,6 @@ public interface IStreamPushService {
boolean saveToRandomGB();
void batchAdd(List<StreamPushItem> streamPushExcelDtoList);
boolean batchStop(List<GbStream> streamPushItems);
}

View File

@@ -20,6 +20,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@@ -144,8 +145,16 @@ public class GbStreamServiceImpl implements IGbStreamService {
gbStreams.add(streamProxyItem);
}
}
sendCatalogMsgs(gbStreams, type);
}
@Override
public void sendCatalogMsgs(List<GbStream> gbStreams, String type) {
if (gbStreams.size() > 0) {
for (GbStream gs : gbStreams) {
if (StringUtils.isEmpty(gs.getGbId())){
continue;
}
List<ParentPlatform> parentPlatforms = platformGbStreamMapper.selectByAppAndStream(gs.getApp(), gs.getStream());
if (parentPlatforms.size() > 0) {
for (ParentPlatform parentPlatform : parentPlatforms) {

View File

@@ -355,8 +355,26 @@ public class StreamPushServiceImpl implements IStreamPushService {
}
}
}
}
}
@Override
public boolean batchStop(List<GbStream> gbStreams) {
if (gbStreams == null || gbStreams.size() == 0) {
return false;
}
gbStreamService.sendCatalogMsgs(gbStreams, CatalogEvent.DEL);
int delStream = streamPushMapper.delAllForGbStream(gbStreams);
gbStreamMapper.batchDelForGbStream(gbStreams);
platformGbStreamMapper.delByGbStreams(gbStreams);
if (delStream > 0) {
for (GbStream gbStream : gbStreams) {
MediaServerItem mediaServerItem = mediaServerService.getOne(gbStream.getMediaServerId());
zlmresTfulUtils.closeStreams(mediaServerItem, gbStream.getApp(), gbStream.getStream());
}
}
return true;
}
}