修复通道列表音频开关
parent
2f9dc36405
commit
91c4677de4
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue