From 64e9b6674fde9193c197a7061a231601c1f9a21d Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 28 Aug 2024 16:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E9=81=93=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=E7=9A=84BUG=E4=BB=A5=E5=8F=8A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=9A=E9=81=93=E6=89=8B=E5=8A=A8=E6=8E=A8=E9=80=81=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/bean/SubscribeInfo.java | 102 +++------------- .../controller/PlatformController.java | 9 ++ .../gb28181/dao/PlatformChannelMapper.java | 57 +++------ .../gb28181/service/IGbChannelService.java | 2 - .../service/IPlatformChannelService.java | 9 +- .../impl/DeviceChannelServiceImpl.java | 22 ++-- .../service/impl/GbChannelServiceImpl.java | 58 +++------ .../impl/PlatformChannelServiceImpl.java | 113 ++++++++++++------ .../service/impl/PlatformServiceImpl.java | 13 +- .../query/cmd/CatalogQueryMessageHandler.java | 9 +- web_src/src/components/PlatformList.vue | 32 +++++ 11 files changed, 198 insertions(+), 228 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java index e5c50455..a131ccb4 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java @@ -2,9 +2,12 @@ package com.genersoft.iot.vmp.gb28181.bean; import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPResponse; +import lombok.Data; import javax.sip.header.*; +import java.util.UUID; +@Data public class SubscribeInfo { @@ -31,9 +34,9 @@ public class SubscribeInfo { /** * 以下为可选字段 - * @return */ private String sn; + private int gpsInterval; /** @@ -51,91 +54,18 @@ public class SubscribeInfo { */ private String simulatedCallId; - public String getId() { - return id; + + public static SubscribeInfo buildSimulated(String platFormServerId, String platFormServerIp){ + SubscribeInfo subscribeInfo = new SubscribeInfo(); + subscribeInfo.setId(platFormServerId); + subscribeInfo.setExpires(-1); + subscribeInfo.setEventType("Catalog"); + int random = (int) Math.floor(Math.random() * 10000); + subscribeInfo.setEventId(random + ""); + subscribeInfo.setSimulatedCallId(UUID.randomUUID().toString().replace("-", "") + "@" + platFormServerIp); + subscribeInfo.setSimulatedFromTag(UUID.randomUUID().toString().replace("-", "")); + subscribeInfo.setSimulatedToTag(UUID.randomUUID().toString().replace("-", "")); + return subscribeInfo; } - public void setId(String id) { - this.id = id; - } - - public SIPRequest getRequest() { - return request; - } - - public void setRequest(SIPRequest request) { - this.request = request; - } - - public int getExpires() { - return expires; - } - - public void setExpires(int expires) { - this.expires = expires; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } - - public String getEventType() { - return eventType; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public SIPResponse getResponse() { - return response; - } - - public void setResponse(SIPResponse response) { - this.response = response; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public int getGpsInterval() { - return gpsInterval; - } - - public void setGpsInterval(int gpsInterval) { - this.gpsInterval = gpsInterval; - } - - public String getSimulatedFromTag() { - return simulatedFromTag; - } - - public void setSimulatedFromTag(String simulatedFromTag) { - this.simulatedFromTag = simulatedFromTag; - } - - public String getSimulatedCallId() { - return simulatedCallId; - } - - public void setSimulatedCallId(String simulatedCallId) { - this.simulatedCallId = simulatedCallId; - } - - public String getSimulatedToTag() { - return simulatedToTag; - } - - public void setSimulatedToTag(String simulatedToTag) { - this.simulatedToTag = simulatedToTag; - } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlatformController.java index e6391c00..f91d1662 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlatformController.java @@ -359,4 +359,13 @@ public class PlatformController { throw new ControllerException(ErrorCode.ERROR100); } } + + @Operation(summary = "推送通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "id", description = "平台ID", required = true) + @GetMapping("/channel/push") + @ResponseBody + public void pushChannel(Integer id) { + Assert.notNull(id, "平台ID不可为空"); + platformChannelService.pushChannel(id); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java index f9ed954a..80466cc6 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java @@ -2,13 +2,10 @@ package com.genersoft.iot.vmp.gb28181.dao; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce; -import org.apache.ibatis.annotations.Delete; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; +import java.util.Collection; import java.util.List; import java.util.Set; @@ -56,17 +53,6 @@ public interface PlatformChannelMapper { @Select("SELECT dc.* from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_type = 0 and dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}") List queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId); - @Select("") - List queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); - - @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " + - " from wvp_device_channel dc left join wvp_platform_channel pgc on dc.id = pgc.device_channel_id " + - " where dc.channel_type = 0 and pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") - List queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); - @Select("select d.*\n" + "from wvp_platform_channel pgc\n" + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + @@ -74,16 +60,6 @@ public interface PlatformChannelMapper { "where dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId); - @Delete("") - int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id); - - @Delete("") - int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); - @Select(" ") List queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List platforms); - @Delete("") - void delByPlatformId(String serverGBId); - - @Delete("") - int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId); - @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" + "from wvp_platform_channel pgc\n" + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + @@ -428,7 +393,21 @@ public interface PlatformChannelMapper { " dc.id = pgc.device_channel_id " + " WHERE " + " pgc.device_channel_id IN" + - " #{item.id}" + + " #{item}" + " ") - List queryPlatFormListByChannelList(List channelList); + List queryPlatFormListByChannelList(Collection ids); + + @Select(" ") + List queryPlatFormListByChannelId(@Param("channelId") int channelId); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java index 7f133dd8..967d053f 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java @@ -30,8 +30,6 @@ public interface IGbChannelService { void updateStatus(List channelList); - List queryByPlatform(Platform platform); - CommonGBChannel getOne(int id); List getIndustryCodeList(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlatformChannelService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlatformChannelService.java index 7b80304c..c191874a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlatformChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlatformChannelService.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.gb28181.service; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; +import com.genersoft.iot.vmp.gb28181.bean.Platform; import com.genersoft.iot.vmp.gb28181.bean.PlatformChannel; import com.github.pagehelper.PageInfo; @@ -22,5 +23,11 @@ public interface IPlatformChannelService { int removeChannels(Integer platformId, List channelIds); - void removeChannels(List channelList); + void removeChannels(List ids); + + void removeChannel(int gbId); + + List queryByPlatform(Platform platform); + + void pushChannel(Integer platformId); } 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 49556739..9e51ff48 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 @@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.common.InviteInfo; import com.genersoft.iot.vmp.common.InviteSessionType; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; -import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; @@ -538,6 +537,16 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { } if (!deleteChannels.isEmpty()) { + try { + // 这些通道可能关联了,上级平台需要删除同时发送消息 + List ids = new ArrayList<>(); + deleteChannels.stream().forEach(deviceChannel -> { + ids.add(deviceChannel.getId()); + }); + platformChannelService.removeChannels(ids); + }catch (Exception e) { + log.error("[移除通道国标级联共享失败]", e); + } if (deleteChannels.size() > limitCount) { for (int i = 0; i < deleteChannels.size(); i += limitCount) { int toIndex = i + limitCount; @@ -549,17 +558,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { }else { channelMapper.batchDel(deleteChannels); } - // 这些通道可能关联了,上级平台需要删除同时发送消息 - - List channelList = new ArrayList<>(); - deleteChannels.stream().forEach(deviceChannel -> { - CommonGBChannel commonGBChannel = new CommonGBChannel(); - commonGBChannel.setGbId(deviceChannel.getId()); - commonGBChannel.setGbDeviceId(deviceChannel.getDeviceId()); - commonGBChannel.setGbName(deviceChannel.getName()); - channelList.add(commonGBChannel); - }); - platformChannelService.removeChannels(channelList); } return true; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java index b68f2818..29994033 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java @@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.gb28181.dao.RegionMapper; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; +import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.github.pagehelper.PageHelper; @@ -35,6 +36,9 @@ public class GbChannelServiceImpl implements IGbChannelService { @Autowired private PlatformChannelMapper platformChannelMapper; + @Autowired + private IPlatformChannelService platformChannelService; + @Autowired private RegionMapper regionMapper; @@ -66,7 +70,15 @@ public class GbChannelServiceImpl implements IGbChannelService { } @Override + @Transactional public int delete(int gbId) { + // 移除国标级联关联的信息 + try { + platformChannelService.removeChannel(gbId); + }catch (Exception e) { + log.error("[移除通道国标级联共享失败]", e); + } + CommonGBChannel channel = commonGBChannelMapper.queryById(gbId); if (channel != null) { commonGBChannelMapper.delete(gbId); @@ -81,18 +93,19 @@ public class GbChannelServiceImpl implements IGbChannelService { } @Override + @Transactional public void delete(Collection ids) { + // 移除国标级联关联的信息 + try { + platformChannelService.removeChannels(new ArrayList<>(ids)); + }catch (Exception e) { + log.error("[移除通道国标级联共享失败]", e); + } List channelListInDb = commonGBChannelMapper.queryByIds(ids); if (channelListInDb.isEmpty()) { return; } commonGBChannelMapper.batchDelete(channelListInDb); - try { - // 发送通知 - eventPublisher.catalogEventPublish(null, channelListInDb, CatalogEvent.DEL); - } catch (Exception e) { - log.warn("[通道移除通知] 发送失败,{}条", channelListInDb.size(), e); - } } @Override @@ -309,40 +322,7 @@ public class GbChannelServiceImpl implements IGbChannelService { } } - @Override - public List queryByPlatform(Platform platform) { - if (platform == null) { - return null; - } - List commonGBChannelList = commonGBChannelMapper.queryWithPlatform(platform.getId()); - if (commonGBChannelList.isEmpty()) { - return new ArrayList<>(); - } - List channelList = new ArrayList<>(); - // 是否包含平台信息 - if (platform.getCatalogWithPlatform()) { - CommonGBChannel channel = CommonGBChannel.build(platform); - channelList.add(channel); - } - // 关联的行政区划信息 - if (platform.getCatalogWithRegion()) { - // 查询关联平台的行政区划信息 - List regionChannelList = regionMapper.queryByPlatform(platform.getId()); - if (!regionChannelList.isEmpty()) { - channelList.addAll(regionChannelList); - } - } - if (platform.getCatalogWithGroup()) { - // 关联的分组信息 - List groupChannelList = groupMapper.queryForPlatform(platform.getId()); - if (!groupChannelList.isEmpty()) { - channelList.addAll(groupChannelList); - } - } - channelList.addAll(commonGBChannelList); - return channelList; - } @Override public CommonGBChannel getOne(int id) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java index 03e3a2bd..a9d6a7c2 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java @@ -2,13 +2,11 @@ package com.genersoft.iot.vmp.gb28181.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.genersoft.iot.vmp.gb28181.bean.*; -import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; -import com.genersoft.iot.vmp.gb28181.dao.GroupMapper; -import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper; -import com.genersoft.iot.vmp.gb28181.dao.RegionMapper; +import com.genersoft.iot.vmp.gb28181.dao.*; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService; +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -16,7 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import javax.sip.InvalidArgumentException; +import javax.sip.SipException; import java.beans.Transient; +import java.text.ParseException; import java.util.*; /** @@ -43,6 +44,12 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { @Autowired private CommonGBChannelMapper commonGBChannelMapper; + @Autowired + private PlatformMapper platformMapper; + + @Autowired + private ISIPCommanderForPlatform sipCommanderFroPlatform; + @Override public PageInfo queryChannelList(int page, int count, String query, Boolean online, Integer platformId, Boolean hasShare) { @@ -336,44 +343,82 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { } @Override - public void removeChannels(List channelList) { - List platformList = platformChannelMapper.queryPlatFormListByChannelList(channelList); + @Transient + public void removeChannels(List ids) { + List platformList = platformChannelMapper.queryPlatFormListByChannelList(ids); if (platformList.isEmpty()) { return; } - - - - // TODO 不对呀 for (Platform platform : platformList) { - int result = platformChannelMapper.removeChannelsWithPlatform(platform.getId(), channelList); - if (result > 0) { - // 查询通道相关的分组信息 - Set regionSet = regionMapper.queryByChannelList(channelList); - Set deleteRegion = deleteEmptyRegion(regionSet, platform.getId()); - if (!deleteRegion.isEmpty()) { - for (Region region : deleteRegion) { - channelList.add(0, CommonGBChannel.build(region)); - } - } + removeChannels(platform.getId(), ids); + } + } - // 查询通道相关的分组信息 - Set groupSet = groupMapper.queryByChannelList(channelList); - Set deleteGroup = deleteEmptyGroup(groupSet, platform.getId()); - if (!deleteGroup.isEmpty()) { - for (Group group : deleteGroup) { - channelList.add(0, CommonGBChannel.build(group)); - } - } + @Override + public void removeChannel(int channelId) { + List platformList = platformChannelMapper.queryPlatFormListByChannelId(channelId); + if (platformList.isEmpty()) { + return; + } + + for (Platform platform : platformList) { + ArrayList ids = new ArrayList<>(); + ids.add(channelId); + removeChannels(platform.getId(), ids); + } + } + + @Override + public List queryByPlatform(Platform platform) { + if (platform == null) { + return null; + } + List commonGBChannelList = commonGBChannelMapper.queryWithPlatform(platform.getId()); + if (commonGBChannelList.isEmpty()) { + return new ArrayList<>(); + } + List channelList = new ArrayList<>(); + // 是否包含平台信息 + if (platform.getCatalogWithPlatform()) { + CommonGBChannel channel = CommonGBChannel.build(platform); + channelList.add(channel); + } + // 关联的行政区划信息 + if (platform.getCatalogWithRegion()) { + // 查询关联平台的行政区划信息 + List regionChannelList = regionMapper.queryByPlatform(platform.getId()); + if (!regionChannelList.isEmpty()) { + channelList.addAll(regionChannelList); } - // 发送消息 - try { - // 发送catalog - eventPublisher.catalogEventPublish(platform.getId(), channelList, CatalogEvent.DEL); - } catch (Exception e) { - log.warn("[移除关联通道] 发送失败,数量:{}", channelList.size(), e); + } + if (platform.getCatalogWithGroup()) { + // 关联的分组信息 + List groupChannelList = groupMapper.queryForPlatform(platform.getId()); + if (!groupChannelList.isEmpty()) { + channelList.addAll(groupChannelList); } } + + channelList.addAll(commonGBChannelList); + return channelList; + } + + @Override + public void pushChannel(Integer platformId) { + Platform platform = platformMapper.query(platformId); + Assert.notNull(platform, "平台不存在"); + List channelList = queryByPlatform(platform); + if (channelList.isEmpty()){ + return; + } + SubscribeInfo subscribeInfo = SubscribeInfo.buildSimulated(platform.getServerGBId(), platform.getServerIp()); + + try { + sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(CatalogEvent.UPDATE, platform, channelList, subscribeInfo, null); + } catch (InvalidArgumentException | ParseException | NoSuchFieldException | + SipException | IllegalAccessException e) { + log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage()); + } } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java index e5f8e8bd..42f0bc95 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java @@ -43,7 +43,6 @@ import javax.sip.InvalidArgumentException; import javax.sip.ResponseEvent; import javax.sip.SipException; import java.text.ParseException; -import java.util.Collections; import java.util.List; import java.util.UUID; import java.util.Vector; @@ -329,16 +328,8 @@ public class PlatformServiceImpl implements IPlatformService { @Override public void addSimulatedSubscribeInfo(Platform platform) { // 自动添加一条模拟的订阅信息 - SubscribeInfo subscribeInfo = new SubscribeInfo(); - subscribeInfo.setId(platform.getServerGBId()); - subscribeInfo.setExpires(-1); - subscribeInfo.setEventType("Catalog"); - int random = (int) Math.floor(Math.random() * 10000); - subscribeInfo.setEventId(random + ""); - subscribeInfo.setSimulatedCallId(UUID.randomUUID().toString().replace("-", "") + "@" + platform.getServerIp()); - subscribeInfo.setSimulatedFromTag(UUID.randomUUID().toString().replace("-", "")); - subscribeInfo.setSimulatedToTag(UUID.randomUUID().toString().replace("-", "")); - subscribeHolder.putCatalogSubscribe(platform.getServerGBId(), subscribeInfo); + subscribeHolder.putCatalogSubscribe(platform.getServerGBId(), + SubscribeInfo.buildSimulated(platform.getServerGBId(), platform.getServerIp())); } private void registerTask(Platform platform, SipTransactionInfo sipTransactionInfo){ diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java index d66d6a47..2db81b4f 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java @@ -1,16 +1,14 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; -import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Platform; -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; +import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService; import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import gov.nist.javax.sip.message.SIPRequest; import lombok.extern.slf4j.Slf4j; import org.dom4j.Element; @@ -38,6 +36,9 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem @Autowired private IGbChannelService channelService; + @Autowired + private IPlatformChannelService platformChannelService; + @Autowired private SIPCommanderFroPlatform cmderFroPlatform; @@ -67,7 +68,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem } Element snElement = rootElement.element("SN"); String sn = snElement.getText(); - List channelList = channelService.queryByPlatform(platform); + List channelList = platformChannelService.queryByPlatform(platform); try { if (!channelList.isEmpty()) { diff --git a/web_src/src/components/PlatformList.vue b/web_src/src/components/PlatformList.vue index a2ff6b54..f72cbcf3 100755 --- a/web_src/src/components/PlatformList.vue +++ b/web_src/src/components/PlatformList.vue @@ -54,6 +54,7 @@ @@ -94,6 +95,7 @@ export default { deviceIps: [], //设备列表 defaultPlatform: null, platform: null, + pushChannelLoading: false, winHeight: window.innerHeight - 260, currentPage:1, count:15, @@ -155,6 +157,36 @@ export default { chooseChannel: function(platform) { this.$refs.shareChannel.openDialog(platform.id, this.initData) }, + pushChannel: function(row) { + this.pushChannelLoading = true; + this.$axios({ + method: 'get', + url: `/api/platform/channel/push`, + params: { + id: row.id, + } + }).then((res)=> { + this.pushChannelLoading = false; + if (res.data.code === 0) { + this.$message.success({ + showClose: true, + message: '推送成功', + }); + }else { + this.$message.error({ + showClose: true, + message: res.data.msg, + }); + } + }).catch((error)=> { + console.log(error); + this.pushChannelLoading = false; + this.$message.error({ + showClose: true, + message: error, + }); + }); + }, initData: function() { this.$axios({ method: 'get',