修复通道列表音频开关
parent
2f9dc36405
commit
91c4677de4
|
@ -179,7 +179,7 @@ public class DeviceChannel extends CommonGBChannel {
|
||||||
private String streamId;
|
private String streamId;
|
||||||
|
|
||||||
@Schema(description = "是否含有音频")
|
@Schema(description = "是否含有音频")
|
||||||
private boolean hasAudio;
|
private boolean ld;
|
||||||
|
|
||||||
@Schema(description = "GPS的更新时间")
|
@Schema(description = "GPS的更新时间")
|
||||||
private String gpsTime;
|
private String gpsTime;
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
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);
|
return deviceChannelService.getSubChannels(deviceChannel.getDeviceDbId(), channelId, query, channelType, online, page, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Operation(summary = "开启/关闭通道的音频", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
* 更新通道信息
|
@Parameter(name = "channelId", description = "通道的数据库ID", required = true)
|
||||||
* @param deviceId 设备id
|
@Parameter(name = "audio", description = "开启/关闭音频", required = true)
|
||||||
* @param channel 通道
|
@PostMapping("/channel/audio")
|
||||||
* @return
|
public void changeAudio(Integer channelId, Boolean audio){
|
||||||
*/
|
Assert.notNull(channelId, "通道的数据库ID不可为NULL");
|
||||||
@Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
Assert.notNull(audio, "开启/关闭音频不可为NULL");
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
deviceChannelService.changeAudio(channelId, audio);
|
||||||
@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))
|
@Operation(summary = "修改通道的码流类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
|
|
@ -982,4 +982,10 @@ public interface DeviceChannelMapper {
|
||||||
" </script>"})
|
" </script>"})
|
||||||
List<DeviceChannel> getByDeviceId(@Param("deviceDbId") int deviceDbId);
|
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 {
|
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 getOneForSourceById(Integer channelId);
|
||||||
|
|
||||||
DeviceChannel getBroadcastChannel(int deviceDbId);
|
DeviceChannel getBroadcastChannel(int deviceDbId);
|
||||||
|
|
||||||
|
void changeAudio(Integer channelId, Boolean audio);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,26 +74,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
private IPlatformChannelService platformChannelService;
|
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
|
@Override
|
||||||
public int updateChannels(Device device, List<DeviceChannel> channels) {
|
public int updateChannels(Device device, List<DeviceChannel> channels) {
|
||||||
List<DeviceChannel> addChannels = new ArrayList<>();
|
List<DeviceChannel> addChannels = new ArrayList<>();
|
||||||
|
@ -623,4 +603,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeAudio(Integer channelId, Boolean audio) {
|
||||||
|
channelMapper.changeAudio(channelId, audio);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,8 +475,11 @@ export default {
|
||||||
updateChannel: function (row) {
|
updateChannel: function (row) {
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: `/api/device/query/channel/update/${this.deviceId}`,
|
url: `/api/device/query/channel/audio`,
|
||||||
params: row
|
params: {
|
||||||
|
channelId: row.id,
|
||||||
|
audio: row.hasAudio
|
||||||
|
}
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
console.log(JSON.stringify(res));
|
console.log(JSON.stringify(res));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue