From 91c4677de4e4428000a32db3f7bf80f4ebaab19f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 19 Sep 2024 10:03:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E9=81=93=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9F=B3=E9=A2=91=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/bean/DeviceChannel.java | 2 +- .../vmp/gb28181/controller/DeviceQuery.java | 21 +++++++--------- .../vmp/gb28181/dao/DeviceChannelMapper.java | 6 +++++ .../service/IDeviceChannelService.java | 10 ++------ .../impl/DeviceChannelServiceImpl.java | 25 ++++--------------- web_src/src/components/channelList.vue | 7 ++++-- 6 files changed, 28 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java index 28eb01a8..914116f0 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java @@ -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; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java index 9c92ca5d..bc084c2c 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java @@ -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)) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java index 9602e775..f74f81fb 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java @@ -982,4 +982,10 @@ public interface DeviceChannelMapper { " "}) List getByDeviceId(@Param("deviceDbId") int deviceDbId); + @Update(value = {" "}) + void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java index e5babf36..22828e39 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java @@ -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); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java index fd90386d..ae5332be 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java @@ -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 channels) { List 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); + } } diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index df05d24e..7304ec32 100755 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -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)); });