修复推流流注册时写入节点ID

dev/数据库统合
648540858 2024-12-30 16:47:03 +08:00
parent c2fb892f2a
commit 3d2a87f61d
3 changed files with 13 additions and 17 deletions

View File

@ -80,9 +80,9 @@ public interface StreamPushMapper {
List<StreamPush> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
@Update("UPDATE wvp_stream_push " +
"SET pushing=#{pushing}, server_id=#{serverId} " +
"SET pushing=#{pushing}, server_id=#{serverId}, media_server_id=#{mediaServerId} " +
"WHERE id=#{id}")
int updatePushStatus(@Param("id") int id, @Param("pushing") boolean pushing, @Param("serverId") String serverId);
int updatePushStatus(StreamPush streamPush);
@Select("<script> "+
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +

View File

@ -88,11 +88,9 @@ public interface IStreamPushService {
Map<String, StreamPush> getAllGBId();
void updateStatus(StreamPush push);
void deleteByAppAndStream(String app, String stream);
void updatePushStatus(StreamPush streamPush, boolean pushIng);
void updatePushStatus(StreamPush streamPush);
void batchUpdate(List<StreamPush> streamPushItemForUpdate);

View File

@ -93,7 +93,11 @@ public class StreamPushServiceImpl implements IStreamPushService {
streamPush.setPushTime(DateUtil.getNow());
add(streamPush);
}else {
updatePushStatus(streamPushInDb, true);
streamPushInDb.setPushTime(DateUtil.getNow());
streamPushInDb.setPushing(true);
streamPushInDb.setServerId(userSetting.getServerId());
streamPushInDb.setMediaServerId(mediaInfo.getMediaServer().getId());
updatePushStatus(streamPushInDb);
}
// 冗余数据,自己系统中自用
if (!"broadcast".equals(event.getApp()) && !"talk".equals(event.getApp())) {
@ -144,7 +148,8 @@ public class StreamPushServiceImpl implements IStreamPushService {
return;
}
if (streamPush.getGbDeviceId() != null) {
updatePushStatus(streamPush, false);
streamPush.setPushing(false);
updatePushStatus(streamPush);
}else {
deleteByAppAndStream(event.getApp(), event.getStream());
}
@ -492,20 +497,13 @@ public class StreamPushServiceImpl implements IStreamPushService {
return streamPushMapper.getAllGBId();
}
@Override
public void updateStatus(StreamPush push) {
}
@Override
@Transactional
public void updatePushStatus(StreamPush streamPush, boolean pushIng) {
streamPush.setPushing(pushIng);
public void updatePushStatus(StreamPush streamPush) {
if (userSetting.getUsePushingAsStatus()) {
streamPush.setGbStatus(pushIng?"ON":"OFF");
streamPush.setGbStatus(streamPush.isPushing()?"ON":"OFF");
}
streamPush.setPushTime(DateUtil.getNow());
streamPushMapper.updatePushStatus(streamPush.getId(), pushIng, userSetting.getServerId());
streamPushMapper.updatePushStatus(streamPush);
if (ObjectUtils.isEmpty(streamPush.getGbDeviceId())) {
return;
}