修复数据库语法兼容以及redis接收推流信息导入

This commit is contained in:
648540858
2024-09-14 15:19:07 +08:00
parent a36c427394
commit 800d6c926a
21 changed files with 120 additions and 274 deletions

View File

@@ -0,0 +1,24 @@
package com.genersoft.iot.vmp.streamPush.bean;
import lombok.Data;
@Data
public class RedisPushStreamMessage {
private String gbId;
private String app;
private String stream;
private String name;
private boolean status;
public StreamPush buildstreamPush() {
StreamPush push = new StreamPush();
push.setApp(app);
push.setStream(stream);
push.setGbName(name);
push.setGbDeviceId(gbId);
push.setStartOfflinePush(true);
push.setGbStatus(status?"ON":"OFF");
return push;
}
}

View File

@@ -76,6 +76,8 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
@Schema(description = "拉起离线推流")
private boolean startOfflinePush;
private String uniqueKey;
@Override
public int compareTo(@NotNull StreamPush streamPushItem) {
return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(this.createTime)

View File

@@ -103,15 +103,15 @@ public interface StreamPushMapper {
" </script>"})
int getAllPushing(Boolean usePushingAsStatus);
@MapKey("vhost")
@Select("SELECT CONCAT(wsp.app, wsp.stream) as vhost, wsp.*, wsp.* , wsp.id as gb_id " +
@MapKey("uniqueKey")
@Select("SELECT CONCAT(wsp.app, wsp.stream) as unique_key, wsp.*, wsp.* , wdc.id as gb_id " +
" from wvp_stream_push wsp " +
" LEFT join wvp_device_channel wdc on wsp.id = wdc.stream_push_id")
Map<String, StreamPush> getAllAppAndStreamMap();
@MapKey("gb_device_id")
@Select("SELECT wdc.gb_device_id, wsp.id as stream_push_id, wsp.*, wsp.* , wsp.id as gb_id " +
@MapKey("gbDeviceId")
@Select("SELECT wdc.gb_device_id, wsp.id as stream_push_id, wsp.*, wsp.* , wdc.id as gb_id " +
" from wvp_stream_push wsp " +
" LEFT join wvp_device_channel wdc on wsp.id = wdc.stream_push_id")
Map<String, StreamPush> getAllGBId();
@@ -150,7 +150,7 @@ public interface StreamPushMapper {
", push_time=#{item.pushTime}" +
", pushing=#{item.pushing}" +
", start_offline_push=#{item.startOfflinePush}" +
" WHERE id=#{item.item.id}" +
" WHERE id=#{item.id}" +
"</foreach>" +
"</script>"})
int batchUpdate(List<StreamPush> streamPushItemForUpdate);

View File

@@ -542,16 +542,14 @@ public class StreamPushServiceImpl implements IStreamPushService {
@Override
public void batchUpdate(List<StreamPush> streamPushItemForUpdate) {
int result = streamPushMapper.batchUpdate(streamPushItemForUpdate);
if (result > 0) {
List<CommonGBChannel> commonGBChannels = new ArrayList<>();
for (StreamPush streamPush : streamPushItemForUpdate) {
if (!ObjectUtils.isEmpty(streamPush.getGbDeviceId())) {
commonGBChannels.add(streamPush.buildCommonGBChannel());
}
streamPushMapper.batchUpdate(streamPushItemForUpdate);
List<CommonGBChannel> commonGBChannels = new ArrayList<>();
for (StreamPush streamPush : streamPushItemForUpdate) {
if (!ObjectUtils.isEmpty(streamPush.getGbDeviceId())) {
commonGBChannels.add(streamPush.buildCommonGBChannel());
}
gbChannelService.batchUpdate(commonGBChannels);
}
gbChannelService.batchUpdate(commonGBChannels);
}
@Override