修复通道列表音频开关

pull/1642/head
648540858 2024-09-19 10:03:32 +08:00
parent 2f9dc36405
commit 91c4677de4
6 changed files with 28 additions and 43 deletions

View File

@ -179,7 +179,7 @@ public class DeviceChannel extends CommonGBChannel {
private String streamId;
@Schema(description = "是否含有音频")
private boolean hasAudio;
private boolean ld;
@Schema(description = "GPS的更新时间")
private String gpsTime;

View File

@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.DeferredResult;
@ -239,18 +240,14 @@ public class DeviceQuery {
return deviceChannelService.getSubChannels(deviceChannel.getDeviceDbId(), channelId, query, channelType, online, page, count);
}
/**
*
* @param deviceId id
* @param channel
* @return
*/
@Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channel", description = "通道信息", required = true)
@PostMapping("/channel/update/{deviceId}")
public void updateChannel(@PathVariable String deviceId,DeviceChannel channel){
deviceChannelService.updateChannel(deviceId, channel);
@Operation(summary = "开启/关闭通道的音频", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "channelId", description = "通道的数据库ID", required = true)
@Parameter(name = "audio", description = "开启/关闭音频", required = true)
@PostMapping("/channel/audio")
public void changeAudio(Integer channelId, Boolean audio){
Assert.notNull(channelId, "通道的数据库ID不可为NULL");
Assert.notNull(audio, "开启/关闭音频不可为NULL");
deviceChannelService.changeAudio(channelId, audio);
}
@Operation(summary = "修改通道的码流类型", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@ -982,4 +982,10 @@ public interface DeviceChannelMapper {
" </script>"})
List<DeviceChannel> getByDeviceId(@Param("deviceDbId") int deviceDbId);
@Update(value = {" <script>" +
"UPDATE wvp_device_channel " +
"SET has_audio=#{audio}" +
" WHERE id=#{channelId}" +
" </script>"})
void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio);
}

View File

@ -16,14 +16,6 @@ import java.util.List;
*/
public interface IDeviceChannelService {
/**
*
*
* @param deviceId id
* @param channel
*/
void updateChannel(String deviceId, DeviceChannel channel);
/**
*
*/
@ -125,4 +117,6 @@ public interface IDeviceChannelService {
DeviceChannel getOneForSourceById(Integer channelId);
DeviceChannel getBroadcastChannel(int deviceDbId);
void changeAudio(Integer channelId, Boolean audio);
}

View File

@ -74,26 +74,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
private IPlatformChannelService platformChannelService;
@Override
public void updateChannel(String deviceId, DeviceChannel channel) {
String channelId = channel.getDeviceId();
channel.setDeviceId(deviceId);
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
}
String now = DateUtil.getNow();
channel.setUpdateTime(now);
DeviceChannel deviceChannel = getOne(deviceId, channelId);
if (deviceChannel == null) {
channel.setCreateTime(now);
channelMapper.add(channel);
}else {
channelMapper.update(channel);
}
channelMapper.updateChannelSubCount(channel.getDeviceDbId(),channel.getParentId());
}
@Override
public int updateChannels(Device device, List<DeviceChannel> channels) {
List<DeviceChannel> addChannels = new ArrayList<>();
@ -623,4 +603,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
return null;
}
@Override
public void changeAudio(Integer channelId, Boolean audio) {
channelMapper.changeAudio(channelId, audio);
}
}

View File

@ -475,8 +475,11 @@ export default {
updateChannel: function (row) {
this.$axios({
method: 'post',
url: `/api/device/query/channel/update/${this.deviceId}`,
params: row
url: `/api/device/query/channel/audio`,
params: {
channelId: row.id,
audio: row.hasAudio
}
}).then(function (res) {
console.log(JSON.stringify(res));
});