临时提交
parent
e4c11bfebe
commit
7255e5a887
|
@ -100,6 +100,8 @@ public interface IStreamPushService {
|
||||||
*/
|
*/
|
||||||
boolean add(StreamPush stream);
|
boolean add(StreamPush stream);
|
||||||
|
|
||||||
|
boolean update(StreamPush stream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部的app+Streanm 用于判断推流列表是新增还是修改
|
* 获取全部的app+Streanm 用于判断推流列表是新增还是修改
|
||||||
* @return
|
* @return
|
||||||
|
@ -119,4 +121,5 @@ public interface IStreamPushService {
|
||||||
|
|
||||||
Map<String, StreamPush> getAllGBId();
|
Map<String, StreamPush> getAllGBId();
|
||||||
|
|
||||||
|
void updateStatus(StreamPush push);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
@ -116,10 +115,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
StreamPush pushInDb = getPush(event.getApp(), event.getStream());
|
StreamPush pushInDb = getPush(event.getApp(), event.getStream());
|
||||||
if (pushInDb == null) {
|
if (pushInDb == null) {
|
||||||
transform.setCreateTime(DateUtil.getNow());
|
transform.setCreateTime(DateUtil.getNow());
|
||||||
streamPushMapper.add(transform);
|
add(transform);
|
||||||
}else {
|
}else {
|
||||||
streamPushMapper.update(transform);
|
update(transform);
|
||||||
gbStreamMapper.updateMediaServer(event.getApp(), event.getStream(), event.getMediaServer().getId());
|
|
||||||
}
|
}
|
||||||
// 冗余数据,自己系统中自用
|
// 冗余数据,自己系统中自用
|
||||||
if (!"broadcast".equals(event.getApp()) && !"talk".equals(event.getApp())) {
|
if (!"broadcast".equals(event.getApp()) && !"talk".equals(event.getApp())) {
|
||||||
|
@ -166,14 +164,17 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
|
redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GbStream gbStream = gbStreamMapper.selectOne(event.getApp(), event.getStream());
|
StreamPush push = getPush(event.getApp(), event.getStream());
|
||||||
if (gbStream != null) {
|
push.setPushIng(false);
|
||||||
|
if (push.getGbDeviceId() != null) {
|
||||||
if (userSetting.isUsePushingAsStatus()) {
|
if (userSetting.isUsePushingAsStatus()) {
|
||||||
streamPushMapper.updatePushStatus(event.getApp(), event.getStream(), false);
|
push.setGbStatus(false);
|
||||||
eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
|
updateStatus(push);
|
||||||
|
// streamPushMapper.updatePushStatus(event.getApp(), event.getStream(), false);
|
||||||
|
// eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
streamPushMapper.del(event.getApp(), event.getStream());
|
deleteByAppAndStream(event.getApp(), event.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,31 +223,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
return streamPushMapper.selectAllByMediaServerIdWithOutGbID(mediaServerId);
|
return streamPushMapper.selectAllByMediaServerIdWithOutGbID(mediaServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean saveToGB(GbStream stream) {
|
|
||||||
stream.setStreamType("push");
|
|
||||||
stream.setStatus(true);
|
|
||||||
stream.setCreateTime(DateUtil.getNow());
|
|
||||||
stream.setStreamType("push");
|
|
||||||
stream.setMediaServerId(mediaConfig.getId());
|
|
||||||
int add = gbStreamMapper.add(stream);
|
|
||||||
return add > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean removeFromGB(GbStream stream) {
|
|
||||||
// 判断是否需要发送事件
|
|
||||||
gbStreamService.sendCatalogMsg(stream, CatalogEvent.DEL);
|
|
||||||
platformGbStreamMapper.delByAppAndStream(stream.getApp(), stream.getStream());
|
|
||||||
int del = gbStreamMapper.del(stream.getApp(), stream.getStream());
|
|
||||||
MediaServer mediaInfo = mediaServerService.getOne(stream.getMediaServerId());
|
|
||||||
List<StreamInfo> mediaList = mediaServerService.getMediaList(mediaInfo, stream.getApp(), stream.getStream(), null);
|
|
||||||
if (mediaList != null && mediaList.isEmpty()) {
|
|
||||||
streamPushMapper.del(stream.getApp(), stream.getStream());
|
|
||||||
}
|
|
||||||
return del > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamPush getPush(String app, String streamId) {
|
public StreamPush getPush(String app, String streamId) {
|
||||||
|
@ -595,6 +571,11 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean update(StreamPush stream) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getAllAppAndStream() {
|
public List<String> getAllAppAndStream() {
|
||||||
|
|
||||||
|
@ -635,4 +616,16 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
gbStreamMapper.updateMediaServer(param.getApp(), param.getStream(), param.getMediaServerId());
|
gbStreamMapper.updateMediaServer(param.getApp(), param.getStream(), param.getMediaServerId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateStatus(StreamPush push) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByAppAndStream(String app, String stream) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,25 +88,6 @@ public class StreamPushController {
|
||||||
return pushList;
|
return pushList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/save_to_gb")
|
|
||||||
@ResponseBody
|
|
||||||
@Operation(summary = "将推流添加到国标", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
public void saveToGB(@RequestBody GbStream stream){
|
|
||||||
if (!streamPushService.saveToGB(stream)){
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@DeleteMapping(value = "/remove_form_gb")
|
|
||||||
@ResponseBody
|
|
||||||
@Operation(summary = "将推流移出到国标", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
public void removeFormGB(@RequestBody GbStream stream){
|
|
||||||
if (!streamPushService.removeFromGB(stream)){
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "/stop")
|
@PostMapping(value = "/stop")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|
Loading…
Reference in New Issue