Commit 1983b8b0a705995665dffadf709afd03239c5950
1 parent
8cab9f23
国标级联->选择通道支持移除目前下所有以及全部添加到目录下
Showing
18 changed files
with
234 additions
and
66 deletions
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service; |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | 5 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; |
| 6 | +import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 6 | 7 | |
| 7 | 8 | import java.util.List; |
| 8 | 9 | |
| ... | ... | @@ -38,4 +39,11 @@ public interface IDeviceChannelService { |
| 38 | 39 | * @return |
| 39 | 40 | */ |
| 40 | 41 | ResourceBaceInfo getOverview(); |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 查询所有未分配的通道 | |
| 45 | + * @param platformId | |
| 46 | + * @return | |
| 47 | + */ | |
| 48 | + List<ChannelReduce> queryAllChannelList(String platformId); | |
| 41 | 49 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
| ... | ... | @@ -55,4 +55,18 @@ public interface IGbStreamService { |
| 55 | 55 | int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate); |
| 56 | 56 | |
| 57 | 57 | DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform); |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 查询所有未分配的通道 | |
| 61 | + * @param platformId | |
| 62 | + * @return | |
| 63 | + */ | |
| 64 | + List<GbStream> getAllGBChannels(String platformId); | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 移除所有关联的通道 | |
| 68 | + * @param platformId | |
| 69 | + * @param catalogId | |
| 70 | + */ | |
| 71 | + void delAllPlatformInfo(String platformId, String catalogId); | |
| 58 | 72 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java
| ... | ... | @@ -19,4 +19,11 @@ public interface IPlatformChannelService { |
| 19 | 19 | */ |
| 20 | 20 | int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); |
| 21 | 21 | |
| 22 | + /** | |
| 23 | + * 移除目录下的所有通道 | |
| 24 | + * @param platformId | |
| 25 | + * @param catalogId | |
| 26 | + * @return | |
| 27 | + */ | |
| 28 | + int delAllChannelForGB(String platformId, String catalogId); | |
| 22 | 29 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
| ... | ... | @@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| 10 | 10 | import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| 11 | 11 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 12 | 12 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; |
| 13 | +import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 13 | 14 | import org.slf4j.Logger; |
| 14 | 15 | import org.slf4j.LoggerFactory; |
| 15 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -168,4 +169,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { |
| 168 | 169 | public ResourceBaceInfo getOverview() { |
| 169 | 170 | return channelMapper.getOverview(); |
| 170 | 171 | } |
| 172 | + | |
| 173 | + | |
| 174 | + @Override | |
| 175 | + public List<ChannelReduce> queryAllChannelList(String platformId) { | |
| 176 | + return channelMapper.queryChannelListInAll(null, null, null, platformId, null); | |
| 177 | + } | |
| 178 | + | |
| 179 | + | |
| 171 | 180 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
| ... | ... | @@ -4,11 +4,11 @@ import com.genersoft.iot.vmp.gb28181.bean.*; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 6 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 7 | +import com.genersoft.iot.vmp.service.IGbStreamService; | |
| 7 | 8 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| 8 | 9 | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; |
| 9 | 10 | import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper; |
| 10 | 11 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| 11 | -import com.genersoft.iot.vmp.service.IGbStreamService; | |
| 12 | 12 | import com.github.pagehelper.PageHelper; |
| 13 | 13 | import com.github.pagehelper.PageInfo; |
| 14 | 14 | import org.slf4j.Logger; |
| ... | ... | @@ -19,7 +19,6 @@ import org.springframework.stereotype.Service; |
| 19 | 19 | import org.springframework.transaction.TransactionDefinition; |
| 20 | 20 | import org.springframework.transaction.TransactionStatus; |
| 21 | 21 | import org.springframework.util.ObjectUtils; |
| 22 | -import org.springframework.util.StringUtils; | |
| 23 | 22 | |
| 24 | 23 | import java.util.ArrayList; |
| 25 | 24 | import java.util.List; |
| ... | ... | @@ -230,4 +229,35 @@ public class GbStreamServiceImpl implements IGbStreamService { |
| 230 | 229 | deviceChannel.setSecrecy("0"); |
| 231 | 230 | return deviceChannel; |
| 232 | 231 | } |
| 232 | + | |
| 233 | + @Override | |
| 234 | + public List<GbStream> getAllGBChannels(String platformId) { | |
| 235 | + | |
| 236 | + return gbStreamMapper.selectAll(platformId, null, null, null); | |
| 237 | + | |
| 238 | + } | |
| 239 | + | |
| 240 | + @Override | |
| 241 | + public void delAllPlatformInfo(String platformId, String catalogId) { | |
| 242 | + if (platformId == null) { | |
| 243 | + return ; | |
| 244 | + } | |
| 245 | + ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId); | |
| 246 | + if (platform == null) { | |
| 247 | + return ; | |
| 248 | + } | |
| 249 | + if (ObjectUtils.isEmpty(catalogId)) { | |
| 250 | + catalogId = platform.getDeviceGBId(); | |
| 251 | + } | |
| 252 | + if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) { | |
| 253 | + List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); | |
| 254 | + List<DeviceChannel> deviceChannelList = new ArrayList<>(); | |
| 255 | + for (GbStream gbStream : gbStreams) { | |
| 256 | + DeviceChannel deviceChannel = new DeviceChannel(); | |
| 257 | + deviceChannel.setChannelId(gbStream.getGbId()); | |
| 258 | + deviceChannelList.add(deviceChannel); | |
| 259 | + } | |
| 260 | + eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); | |
| 261 | + } | |
| 262 | + } | |
| 233 | 263 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java
| ... | ... | @@ -16,6 +16,7 @@ import org.slf4j.Logger; |
| 16 | 16 | import org.slf4j.LoggerFactory; |
| 17 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 18 | import org.springframework.stereotype.Service; |
| 19 | +import org.springframework.util.ObjectUtils; | |
| 19 | 20 | |
| 20 | 21 | import java.util.ArrayList; |
| 21 | 22 | import java.util.HashMap; |
| ... | ... | @@ -105,4 +106,26 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { |
| 105 | 106 | } |
| 106 | 107 | return deviceChannelList; |
| 107 | 108 | } |
| 109 | + | |
| 110 | + @Override | |
| 111 | + public int delAllChannelForGB(String platformId, String catalogId) { | |
| 112 | + | |
| 113 | + int result; | |
| 114 | + if (platformId == null) { | |
| 115 | + return 0; | |
| 116 | + } | |
| 117 | + ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId); | |
| 118 | + if (platform == null) { | |
| 119 | + return 0; | |
| 120 | + } | |
| 121 | + if (ObjectUtils.isEmpty(catalogId)) { | |
| 122 | + catalogId = platform.getDeviceGBId(); | |
| 123 | + } | |
| 124 | + | |
| 125 | + if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) { | |
| 126 | + List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId); | |
| 127 | + eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL); | |
| 128 | + } | |
| 129 | + return result; | |
| 130 | + } | |
| 108 | 131 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| 1 | 1 | package com.genersoft.iot.vmp.storager.dao; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 4 | 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; |
| 6 | 5 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
| ... | ... | @@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 5 | 5 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 6 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 7 | 7 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 8 | -import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; | |
| 9 | 8 | import org.apache.ibatis.annotations.*; |
| 10 | 9 | import org.springframework.stereotype.Repository; |
| 11 | 10 | |
| ... | ... | @@ -169,4 +168,5 @@ public interface GbStreamMapper { |
| 169 | 168 | |
| 170 | 169 | @Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}") |
| 171 | 170 | Boolean selectStatusForPush(String app, String stream); |
| 171 | + | |
| 172 | 172 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
| ... | ... | @@ -57,6 +57,9 @@ public interface PlatformChannelMapper { |
| 57 | 57 | @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'") |
| 58 | 58 | List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId); |
| 59 | 59 | |
| 60 | + @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId='${platformId}' and pgc.catalogId=#{catalogId}") | |
| 61 | + List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId); | |
| 62 | + | |
| 60 | 63 | @Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + |
| 61 | 64 | " from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " + |
| 62 | 65 | " where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") |
| ... | ... | @@ -99,4 +102,9 @@ public interface PlatformChannelMapper { |
| 99 | 102 | "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" + |
| 100 | 103 | "</script>") |
| 101 | 104 | void delByPlatformId(String serverGBId); |
| 105 | + | |
| 106 | + @Delete("<script> " + | |
| 107 | + "DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" + | |
| 108 | + "</script>") | |
| 109 | + int delChannelForGBByCatalogId(String platformId, String catalogId); | |
| 102 | 110 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
| ... | ... | @@ -105,4 +105,7 @@ public interface PlatformGbStreamMapper { |
| 105 | 105 | "</foreach>" + |
| 106 | 106 | "</script>") |
| 107 | 107 | void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId); |
| 108 | + | |
| 109 | + @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId} and catalogId=#{catalogId}") | |
| 110 | + int delByPlatformAndCatalogId(String platformId, String catalogId); | |
| 108 | 111 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.storager.impl; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.common.StreamInfo; | |
| 4 | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | 4 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 9 | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 10 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | |
| 11 | 9 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 12 | 10 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 13 | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| ... | ... | @@ -28,7 +26,6 @@ import org.springframework.transaction.TransactionStatus; |
| 28 | 26 | import org.springframework.transaction.annotation.Transactional; |
| 29 | 27 | import org.springframework.util.CollectionUtils; |
| 30 | 28 | import org.springframework.util.ObjectUtils; |
| 31 | -import org.springframework.util.StringUtils; | |
| 32 | 29 | |
| 33 | 30 | import java.util.*; |
| 34 | 31 | import java.util.concurrent.ConcurrentHashMap; |
| ... | ... | @@ -761,18 +758,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 761 | 758 | return gbStreamMapper.updateStreamGPS(gpsMsgInfos); |
| 762 | 759 | } |
| 763 | 760 | |
| 764 | - private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId) { | |
| 765 | - List<DeviceChannel> deviceChannelList = new ArrayList<>(); | |
| 766 | - if (channelReduces.size() > 0){ | |
| 767 | - for (ChannelReduce channelReduce : channelReduces) { | |
| 768 | - DeviceChannel deviceChannel = queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); | |
| 769 | - deviceChannel.setParental(1); | |
| 770 | - deviceChannel.setParentId(catalogId); | |
| 771 | - deviceChannelList.add(deviceChannel); | |
| 772 | - } | |
| 773 | - } | |
| 774 | - return deviceChannelList; | |
| 775 | - } | |
| 776 | 761 | |
| 777 | 762 | private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) { |
| 778 | 763 | ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId()); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
| 1 | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | +import com.genersoft.iot.vmp.service.IGbStreamService; | |
| 4 | 5 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 5 | 6 | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; |
| 6 | -import com.genersoft.iot.vmp.service.IGbStreamService; | |
| 7 | 7 | import com.github.pagehelper.PageInfo; |
| 8 | 8 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | 9 | import io.swagger.v3.oas.annotations.Parameter; |
| ... | ... | @@ -12,9 +12,10 @@ import org.slf4j.Logger; |
| 12 | 12 | import org.slf4j.LoggerFactory; |
| 13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 14 | import org.springframework.util.ObjectUtils; |
| 15 | -import org.springframework.util.StringUtils; | |
| 16 | 15 | import org.springframework.web.bind.annotation.*; |
| 17 | 16 | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 18 | 19 | @Tag(name = "视频流关联到级联平台") |
| 19 | 20 | @CrossOrigin |
| 20 | 21 | @RestController |
| ... | ... | @@ -76,11 +77,14 @@ public class GbStreamController { |
| 76 | 77 | @Operation(summary = "移除国标关联") |
| 77 | 78 | @DeleteMapping(value = "/del") |
| 78 | 79 | @ResponseBody |
| 79 | - public Object del(@RequestBody GbStreamParam gbStreamParam){ | |
| 80 | - if (gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams())) { | |
| 81 | - return "success"; | |
| 80 | + public void del(@RequestBody GbStreamParam gbStreamParam){ | |
| 81 | + | |
| 82 | + if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) { | |
| 83 | + if (gbStreamParam.isAll()) { | |
| 84 | + gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); | |
| 85 | + } | |
| 82 | 86 | }else { |
| 83 | - return "fail"; | |
| 87 | + gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams()); | |
| 84 | 88 | } |
| 85 | 89 | |
| 86 | 90 | } |
| ... | ... | @@ -93,11 +97,14 @@ public class GbStreamController { |
| 93 | 97 | @Operation(summary = "保存国标关联") |
| 94 | 98 | @PostMapping(value = "/add") |
| 95 | 99 | @ResponseBody |
| 96 | - public Object add(@RequestBody GbStreamParam gbStreamParam){ | |
| 97 | - if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId())) { | |
| 98 | - return "success"; | |
| 100 | + public void add(@RequestBody GbStreamParam gbStreamParam){ | |
| 101 | + if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) { | |
| 102 | + if (gbStreamParam.isAll()) { | |
| 103 | + List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId()); | |
| 104 | + gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); | |
| 105 | + } | |
| 99 | 106 | }else { |
| 100 | - return "fail"; | |
| 107 | + gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); | |
| 101 | 108 | } |
| 102 | 109 | } |
| 103 | 110 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java
| ... | ... | @@ -14,6 +14,9 @@ public class GbStreamParam { |
| 14 | 14 | @Schema(description = "目录ID") |
| 15 | 15 | private String catalogId; |
| 16 | 16 | |
| 17 | + @Schema(description = "关联所有通道") | |
| 18 | + private boolean all; | |
| 19 | + | |
| 17 | 20 | @Schema(description = "流国标信息列表") |
| 18 | 21 | private List<GbStream> gbStreams; |
| 19 | 22 | |
| ... | ... | @@ -40,4 +43,12 @@ public class GbStreamParam { |
| 40 | 43 | public void setGbStreams(List<GbStream> gbStreams) { |
| 41 | 44 | this.gbStreams = gbStreams; |
| 42 | 45 | } |
| 46 | + | |
| 47 | + public boolean isAll() { | |
| 48 | + return all; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setAll(boolean all) { | |
| 52 | + this.all = all; | |
| 53 | + } | |
| 43 | 54 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| ... | ... | @@ -10,8 +10,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| 12 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 13 | -import com.genersoft.iot.vmp.service.IPlatformChannelService; | |
| 14 | -import com.genersoft.iot.vmp.service.IPlatformService; | |
| 13 | +import com.genersoft.iot.vmp.service.*; | |
| 15 | 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 16 | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 17 | 16 | import com.genersoft.iot.vmp.utils.DateUtil; |
| ... | ... | @@ -72,6 +71,12 @@ public class PlatformController { |
| 72 | 71 | @Autowired |
| 73 | 72 | private IPlatformService platformService; |
| 74 | 73 | |
| 74 | + @Autowired | |
| 75 | + private IDeviceChannelService deviceChannelService; | |
| 76 | + | |
| 77 | + @Autowired | |
| 78 | + private IGbStreamService gbStreamService; | |
| 79 | + | |
| 75 | 80 | /** |
| 76 | 81 | * 获取国标服务的配置 |
| 77 | 82 | * |
| ... | ... | @@ -379,7 +384,16 @@ public class PlatformController { |
| 379 | 384 | if (logger.isDebugEnabled()) { |
| 380 | 385 | logger.debug("给上级平台添加国标通道API调用"); |
| 381 | 386 | } |
| 382 | - int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); | |
| 387 | + int result = 0; | |
| 388 | + if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) { | |
| 389 | + if (param.isAll()) { | |
| 390 | + logger.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId()); | |
| 391 | + List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId()); | |
| 392 | + result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId()); | |
| 393 | + } | |
| 394 | + }else { | |
| 395 | + result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); | |
| 396 | + } | |
| 383 | 397 | if (result <= 0) { |
| 384 | 398 | throw new ControllerException(ErrorCode.ERROR100); |
| 385 | 399 | } |
| ... | ... | @@ -399,8 +413,15 @@ public class PlatformController { |
| 399 | 413 | if (logger.isDebugEnabled()) { |
| 400 | 414 | logger.debug("给上级平台删除国标通道API调用"); |
| 401 | 415 | } |
| 402 | - int result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces()); | |
| 403 | - | |
| 416 | + int result = 0; | |
| 417 | + if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) { | |
| 418 | + if (param.isAll()) { | |
| 419 | + logger.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId()); | |
| 420 | + result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId()); | |
| 421 | + } | |
| 422 | + }else { | |
| 423 | + result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces()); | |
| 424 | + } | |
| 404 | 425 | if (result <= 0) { |
| 405 | 426 | throw new ControllerException(ErrorCode.ERROR100); |
| 406 | 427 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java
| ... | ... | @@ -17,6 +17,9 @@ public class UpdateChannelParam { |
| 17 | 17 | @Schema(description = "目录的国标编号") |
| 18 | 18 | private String catalogId; |
| 19 | 19 | |
| 20 | + @Schema(description = "处理所有通道") | |
| 21 | + private boolean all; | |
| 22 | + | |
| 20 | 23 | @Schema(description = "") |
| 21 | 24 | private List<ChannelReduce> channelReduces; |
| 22 | 25 | |
| ... | ... | @@ -43,4 +46,12 @@ public class UpdateChannelParam { |
| 43 | 46 | public void setCatalogId(String catalogId) { |
| 44 | 47 | this.catalogId = catalogId; |
| 45 | 48 | } |
| 49 | + | |
| 50 | + public boolean isAll() { | |
| 51 | + return all; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setAll(boolean all) { | |
| 55 | + this.all = all; | |
| 56 | + } | |
| 46 | 57 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| ... | ... | @@ -134,7 +134,6 @@ public class PlayController { |
| 134 | 134 | return result; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - | |
| 138 | 137 | @Operation(summary = "停止点播") |
| 139 | 138 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| 140 | 139 | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| ... | ... | @@ -171,7 +170,6 @@ public class PlayController { |
| 171 | 170 | json.put("deviceId", deviceId); |
| 172 | 171 | json.put("channelId", channelId); |
| 173 | 172 | return json; |
| 174 | - | |
| 175 | 173 | } |
| 176 | 174 | |
| 177 | 175 | /** | ... | ... |
web_src/src/components/dialog/chooseChannelForGb.vue
| ... | ... | @@ -18,8 +18,10 @@ |
| 18 | 18 | <el-option label="在线" value="true"></el-option> |
| 19 | 19 | <el-option label="离线" value="false"></el-option> |
| 20 | 20 | </el-select> |
| 21 | - <el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button> | |
| 22 | - <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button> | |
| 21 | + <el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button> | |
| 22 | + <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button> | |
| 23 | + <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" @click="add()">全部添加</el-button> | |
| 24 | + <el-button v-if="catalogId !== null" type="danger" icon="el-icon-delete" size="mini" @click="remove()">全部移除</el-button> | |
| 23 | 25 | </div> |
| 24 | 26 | |
| 25 | 27 | <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.deviceId + row.channelId" @selection-change="handleSelectionChange"> |
| ... | ... | @@ -115,13 +117,15 @@ export default { |
| 115 | 117 | this.initData(); |
| 116 | 118 | }, |
| 117 | 119 | add: function (row) { |
| 120 | + let all = typeof(row) === "undefined" | |
| 118 | 121 | this.getCatalogFromUser((catalogId)=> { |
| 119 | 122 | this.$axios({ |
| 120 | 123 | method:"post", |
| 121 | 124 | url:"/api/platform/update_channel_for_gb", |
| 122 | 125 | data:{ |
| 123 | 126 | platformId: this.platformId, |
| 124 | - channelReduces: [row], | |
| 127 | + all: all, | |
| 128 | + channelReduces: all?[]:[row], | |
| 125 | 129 | catalogId: catalogId |
| 126 | 130 | } |
| 127 | 131 | }).then((res)=>{ |
| ... | ... | @@ -134,21 +138,34 @@ export default { |
| 134 | 138 | |
| 135 | 139 | }, |
| 136 | 140 | remove: function (row) { |
| 137 | - console.log(row) | |
| 141 | + let all = typeof(row) === "undefined" | |
| 142 | + this.$confirm(`确定移除${all?"所有通道":""}吗?`, '提示', { | |
| 143 | + dangerouslyUseHTMLString: true, | |
| 144 | + confirmButtonText: '确定', | |
| 145 | + cancelButtonText: '取消', | |
| 146 | + type: 'warning' | |
| 147 | + }).then(() => { | |
| 148 | + console.log(row) | |
| 149 | + | |
| 150 | + this.$axios({ | |
| 151 | + method:"delete", | |
| 152 | + url:"/api/platform/del_channel_for_gb", | |
| 153 | + data:{ | |
| 154 | + platformId: this.platformId, | |
| 155 | + all: all, | |
| 156 | + channelReduces: all?[]:[row], | |
| 157 | + } | |
| 158 | + }).then((res)=>{ | |
| 159 | + console.log("移除成功") | |
| 160 | + this.getChannelList(); | |
| 161 | + }).catch(function (error) { | |
| 162 | + console.log(error); | |
| 163 | + }); | |
| 164 | + }).catch(() => { | |
| 138 | 165 | |
| 139 | - this.$axios({ | |
| 140 | - method:"delete", | |
| 141 | - url:"/api/platform/del_channel_for_gb", | |
| 142 | - data:{ | |
| 143 | - platformId: this.platformId, | |
| 144 | - channelReduces: [row] | |
| 145 | - } | |
| 146 | - }).then((res)=>{ | |
| 147 | - console.log("移除成功") | |
| 148 | - this.getChannelList(); | |
| 149 | - }).catch(function (error) { | |
| 150 | - console.log(error); | |
| 151 | 166 | }); |
| 167 | + | |
| 168 | + | |
| 152 | 169 | }, |
| 153 | 170 | // checkedChange: function (val) { |
| 154 | 171 | // let that = this; | ... | ... |
web_src/src/components/dialog/chooseChannelForStream.vue
| ... | ... | @@ -24,6 +24,8 @@ |
| 24 | 24 | </el-select> |
| 25 | 25 | <el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button> |
| 26 | 26 | <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button> |
| 27 | + <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" @click="add()">全部添加</el-button> | |
| 28 | + <el-button v-if="catalogId !== null" type="danger" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" @click="remove()">全部移除</el-button> | |
| 27 | 29 | </div> |
| 28 | 30 | <el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.app + row.stream" @selection-change="handleSelectionChange"> |
| 29 | 31 | <el-table-column align="center" type="selection" :reserve-selection="true" width="55"> |
| ... | ... | @@ -128,6 +130,7 @@ export default { |
| 128 | 130 | |
| 129 | 131 | }, |
| 130 | 132 | add: function (row, scope) { |
| 133 | + let all = typeof(row) === "undefined" | |
| 131 | 134 | this.getCatalogFromUser((catalogId)=>{ |
| 132 | 135 | this.$axios({ |
| 133 | 136 | method:"post", |
| ... | ... | @@ -135,7 +138,8 @@ export default { |
| 135 | 138 | data:{ |
| 136 | 139 | platformId: this.platformId, |
| 137 | 140 | catalogId: catalogId, |
| 138 | - gbStreams: [row], | |
| 141 | + all: all, | |
| 142 | + gbStreams: all?[]:[row], | |
| 139 | 143 | } |
| 140 | 144 | }).then((res)=>{ |
| 141 | 145 | console.log("保存成功") |
| ... | ... | @@ -149,20 +153,33 @@ export default { |
| 149 | 153 | |
| 150 | 154 | }, |
| 151 | 155 | remove: function (row, scope) { |
| 152 | - this.$axios({ | |
| 153 | - method:"delete", | |
| 154 | - url:"/api/gbStream/del", | |
| 155 | - data:{ | |
| 156 | - platformId: this.platformId, | |
| 157 | - gbStreams: [row], | |
| 158 | - } | |
| 159 | - }).then((res)=>{ | |
| 160 | - console.log("移除成功") | |
| 161 | - // this.gbStreams.splice(scope.$index,1) | |
| 162 | - this.getChannelList(); | |
| 163 | - }).catch(function (error) { | |
| 164 | - console.log(error); | |
| 156 | + let all = typeof(row) === "undefined" | |
| 157 | + this.$confirm(`确定移除${all?"所有通道":""}吗?`, '提示', { | |
| 158 | + dangerouslyUseHTMLString: true, | |
| 159 | + confirmButtonText: '确定', | |
| 160 | + cancelButtonText: '取消', | |
| 161 | + type: 'warning' | |
| 162 | + }).then(() => { | |
| 163 | + | |
| 164 | + this.$axios({ | |
| 165 | + method:"delete", | |
| 166 | + url:"/api/gbStream/del", | |
| 167 | + data:{ | |
| 168 | + platformId: this.platformId, | |
| 169 | + all: all, | |
| 170 | + gbStreams: all?[]:[row], | |
| 171 | + } | |
| 172 | + }).then((res)=>{ | |
| 173 | + console.log("移除成功") | |
| 174 | + // this.gbStreams.splice(scope.$index,1) | |
| 175 | + this.getChannelList(); | |
| 176 | + }).catch(function (error) { | |
| 177 | + console.log(error); | |
| 178 | + }); | |
| 179 | + }).catch(() => { | |
| 180 | + | |
| 165 | 181 | }); |
| 182 | + | |
| 166 | 183 | }, |
| 167 | 184 | getChannelList: function () { |
| 168 | 185 | let that = this; | ... | ... |