Merge branch 'master' into dev/springBoot3
# Conflicts: # src/main/java/com/genersoft/iot/vmp/gb28181/controller/MediaController.java # src/main/java/com/genersoft/iot/vmp/jt1078/config/JT1078Controller.java
This commit is contained in:
@@ -105,7 +105,7 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
|
||||
|
||||
private String uniqueKey;
|
||||
|
||||
private Integer dataType = ChannelDataType.STREAM_PUSH.value;
|
||||
private Integer dataType = ChannelDataType.STREAM_PUSH;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -145,7 +145,7 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
|
||||
if (ObjectUtils.isEmpty(this.getGbName())) {
|
||||
this.setGbName( app+ "-" +stream);
|
||||
}
|
||||
this.setDataType(ChannelDataType.STREAM_PUSH.value);
|
||||
this.setDataType(ChannelDataType.STREAM_PUSH);
|
||||
this.setDataDeviceId(this.getId());
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.streamPush.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
@@ -183,12 +184,21 @@ public class StreamPushController {
|
||||
ReadSheet readSheet = EasyExcel.readSheet(0).build();
|
||||
excelReader.read(readSheet);
|
||||
excelReader.finish();
|
||||
}catch (ExcelDataConvertException e) {
|
||||
log.error("通道导入失败:行: {}, 列: {}, 内容: {}", e.getRowIndex(), e.getColumnIndex(), e.getCellData().getStringValue());
|
||||
RequestMessage msg = new RequestMessage();
|
||||
msg.setKey(key);
|
||||
WVPResult<Object> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg("数据异常: " + e.getRowIndex() +"行" + e.getColumnIndex() + "列, 内容:" + e.getCellData().getStringValue() );
|
||||
msg.setData(wvpResult);
|
||||
resultHolder.invokeAllResult(msg);
|
||||
}catch (Exception e) {
|
||||
log.warn("通道导入失败:", e);
|
||||
RequestMessage msg = new RequestMessage();
|
||||
msg.setKey(key);
|
||||
WVPResult<Object> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(-1);
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg("通道导入失败: " + e.getMessage() );
|
||||
msg.setData(wvpResult);
|
||||
resultHolder.invokeAllResult(msg);
|
||||
@@ -218,7 +228,7 @@ public class StreamPushController {
|
||||
if (!streamPushService.add(stream)) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
}
|
||||
stream.setDataType(ChannelDataType.STREAM_PUSH.value);
|
||||
stream.setDataType(ChannelDataType.STREAM_PUSH);
|
||||
stream.setDataDeviceId(stream.getId());
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
@Repository
|
||||
public interface StreamPushMapper {
|
||||
|
||||
Integer dataType = ChannelDataType.GB28181.value;
|
||||
Integer dataType = ChannelDataType.GB28181;
|
||||
|
||||
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) VALUES" +
|
||||
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime} ,#{updateTime}, #{createTime}, #{pushing}, #{startOfflinePush})")
|
||||
@@ -53,8 +53,8 @@ public interface StreamPushMapper {
|
||||
" 1=1 " +
|
||||
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" <if test='pushing == true' > AND st.pushing=1</if>" +
|
||||
" <if test='pushing == false' > AND st.pushing=0 </if>" +
|
||||
" <if test='pushing == true' > AND st.pushing=true</if>" +
|
||||
" <if test='pushing == false' > AND st.pushing=false </if>" +
|
||||
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
|
||||
" order by st.create_time desc" +
|
||||
" </script>"})
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.genersoft.iot.vmp.streamPush.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
|
||||
@Slf4j
|
||||
@Service(ChannelDataType.PLAY_SERVICE + ChannelDataType.STREAM_PUSH)
|
||||
public class SourcePlayServiceForStreamPushImpl implements ISourcePlayService {
|
||||
|
||||
@Autowired
|
||||
private IStreamPushPlayService playService;
|
||||
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
String serverGBId = null;
|
||||
String platformName = null;
|
||||
if (platform != null) {
|
||||
// 推流
|
||||
serverGBId = platform.getServerGBId();
|
||||
platformName = platform.getName();
|
||||
}
|
||||
// 推流
|
||||
try {
|
||||
playService.start(channel.getDataDeviceId(), callback, serverGBId, platformName);
|
||||
}catch (PlayException e) {
|
||||
callback.run(e.getCode(), e.getMsg(), null);
|
||||
}catch (Exception e) {
|
||||
log.error("[点播推流通道失败] 通道: {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
callback.run(Response.BUSY_HERE, "busy here", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
// 推流
|
||||
try {
|
||||
playService.stop(channel.getDataDeviceId());
|
||||
}catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user