Merge branch 'wvp-28181-2.0' into main-dev
| | |
| | | // 查询平台下是否有该通道 |
| | | DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId); |
| | | GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId); |
| | | PlatformCatalog catalog = storager.getCatalog(channelId); |
| | | PlatformCatalog catalog = storager.getCatalog(requesterId, channelId); |
| | | |
| | | MediaServerItem mediaServerItem = null; |
| | | StreamPushItem streamPushItem = null; |
| | |
| | | } |
| | | |
| | | private void executeSave(){ |
| | | executeSaveForAdd(); |
| | | executeSaveForUpdate(); |
| | | executeSaveForDelete(); |
| | | executeSaveForOnline(); |
| | |
| | | |
| | | deviceChannel.setRegisterWay(1); |
| | | |
| | | PlatformCatalog catalog = catalogMapper.select(catalogId); |
| | | PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platform.getServerGBId(), catalogId); |
| | | if (catalog != null) { |
| | | deviceChannel.setCivilCode(catalog.getCivilCode()); |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | |
| | | deviceChannel.setStatus(status != null && status); |
| | | |
| | | deviceChannel.setRegisterWay(1); |
| | | PlatformCatalog catalog = catalogMapper.select(catalogId); |
| | | PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platform.getServerGBId(), catalogId); |
| | | if (catalog != null) { |
| | | deviceChannel.setCivilCode(catalog.getCivilCode()); |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | |
| | | private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, ParentPlatform platform) { |
| | | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| | | if (channelReduces.size() > 0){ |
| | | PlatformCatalog catalog = catalogManager.select(catalogId); |
| | | PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId); |
| | | if (catalog == null || !catalogId.equals(platform.getDeviceGBId())) { |
| | | logger.warn("未查询到目录{}的信息", catalogId); |
| | | return null; |
| | |
| | | |
| | | int addCatalog(PlatformCatalog platformCatalog); |
| | | |
| | | PlatformCatalog getCatalog(String id); |
| | | PlatformCatalog getCatalog(String platformId, String id); |
| | | |
| | | int delCatalog(String id); |
| | | int delCatalog(String platformId, String id); |
| | | |
| | | int updateCatalog(PlatformCatalog platformCatalog); |
| | | |
| | |
| | | "(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})") |
| | | int add(PlatformCatalog platformCatalog); |
| | | |
| | | @Delete("DELETE from wvp_platform_catalog WHERE id=#{id}") |
| | | int del(String id); |
| | | @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId} and id=#{id}") |
| | | int del(String platformId, String id); |
| | | |
| | | @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}") |
| | | int delByPlatformId(String platformId); |
| | |
| | | "group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id") |
| | | List<PlatformCatalog> selectByParentId(String platformId, String parentId); |
| | | |
| | | @Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.id=#{id}") |
| | | PlatformCatalog select(String id); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE wvp_platform_catalog " + |
| | | "SET name=#{name}" + |
| | | "WHERE id=#{id}"+ |
| | | "WHERE id=#{id} and platform_id=#{platformId}"+ |
| | | "</script>"}) |
| | | int update(PlatformCatalog platformCatalog); |
| | | |
| | |
| | | @Select("SELECT pc.* FROM wvp_platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})") |
| | | PlatformCatalog selectDefaultByPlatFormId(String platformId); |
| | | |
| | | |
| | | @Select("SELECT pc.* FROM wvp_platform_catalog pc WHERE pc.id = #{id}") |
| | | PlatformCatalog selectParentCatalog(String id); |
| | | |
| | | @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " + |
| | | " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}") |
| | | List<DeviceChannel> queryCatalogInPlatform(String platformId); |
| | | |
| | | @Select("SELECT *, " + |
| | | "(SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count " + |
| | | " from wvp_platform_catalog pc " + |
| | | " WHERE pc.id=#{id} and pc.platform_id=#{platformId}") |
| | | PlatformCatalog selectByPlatFormAndCatalogId(String platformId, String id); |
| | | } |
| | |
| | | List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{id}" + |
| | | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" + |
| | | "</script>") |
| | | int delByCatalogId(String id); |
| | | int delByCatalogId(String platformId, String id); |
| | | |
| | | @Delete("<script> "+ |
| | | "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" + |
| | |
| | | |
| | | @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " + |
| | | "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " + |
| | | "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{serverGBId}") |
| | | StreamProxyItem selectOne(String app, String stream, String serverGBId); |
| | | "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}") |
| | | StreamProxyItem selectOne(String app, String stream, String platformId); |
| | | |
| | | @Select("select gs.* \n" + |
| | | "from wvp_gb_stream gs\n" + |
| | |
| | | " on gs.gb_stream_id = pgs.gb_stream_id\n" + |
| | | "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") |
| | | List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); |
| | | |
| | | @Delete("DELETE from wvp_platform_gb_stream WHERE catalog_id=#{id}") |
| | | int delByCatalogId(String id); |
| | | |
| | | @Select("<script> " + |
| | | "SELECT " + |
| | |
| | | if (platformCatalog.getParentId().length() <= 8) { |
| | | platformCatalog.setCivilCode(platformCatalog.getParentId()); |
| | | }else { |
| | | PlatformCatalog catalog = catalogMapper.select(platformCatalog.getParentId()); |
| | | PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(), platformCatalog.getParentId()); |
| | | if (catalog != null) { |
| | | platformCatalog.setCivilCode(catalog.getCivilCode()); |
| | | } |
| | |
| | | if (platformCatalog.getParentId().length() <= 8) { |
| | | platformCatalog.setCivilCode(platformCatalog.getParentId()); |
| | | }else { |
| | | PlatformCatalog catalog = catalogMapper.select(platformCatalog.getParentId()); |
| | | PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(),platformCatalog.getParentId()); |
| | | if (catalog == null) { |
| | | logger.warn("[添加目录] 无法获取目录{}的CivilCode和BusinessGroupId", platformCatalog.getPlatformId()); |
| | | break; |
| | |
| | | } |
| | | |
| | | private PlatformCatalog getTopCatalog(String id, String platformId) { |
| | | PlatformCatalog catalog = catalogMapper.selectParentCatalog(id); |
| | | PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformId, id); |
| | | if (catalog.getParentId().equals(platformId)) { |
| | | return catalog; |
| | | }else { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PlatformCatalog getCatalog(String id) { |
| | | return catalogMapper.select(id); |
| | | public PlatformCatalog getCatalog(String platformId, String id) { |
| | | return catalogMapper.selectByPlatFormAndCatalogId(platformId, id); |
| | | } |
| | | |
| | | @Override |
| | | public int delCatalog(String id) { |
| | | PlatformCatalog platformCatalog = catalogMapper.select(id); |
| | | if (platformCatalog.getChildrenCount() > 0) { |
| | | List<PlatformCatalog> platformCatalogList = catalogMapper.selectByParentId(platformCatalog.getPlatformId(), platformCatalog.getId()); |
| | | for (PlatformCatalog catalog : platformCatalogList) { |
| | | if (catalog.getChildrenCount() == 0) { |
| | | delCatalogExecute(catalog.getId(), catalog.getPlatformId()); |
| | | }else { |
| | | delCatalog(catalog.getId()); |
| | | } |
| | | } |
| | | } |
| | | return delCatalogExecute(id, platformCatalog.getPlatformId()); |
| | | public int delCatalog(String platformId, String id) { |
| | | return delCatalogExecute(id, platformId); |
| | | } |
| | | private int delCatalogExecute(String id, String platformId) { |
| | | int delresult = catalogMapper.del(id); |
| | | int delresult = catalogMapper.del(platformId, id); |
| | | DeviceChannel deviceChannelForCatalog = new DeviceChannel(); |
| | | if (delresult > 0){ |
| | | deviceChannelForCatalog.setChannelId(id); |
| | |
| | | } |
| | | eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); |
| | | } |
| | | int delStreamresult = platformGbStreamMapper.delByCatalogId(id); |
| | | int delStreamresult = platformGbStreamMapper.delByPlatformAndCatalogId(platformId,id); |
| | | List<PlatformCatalog> platformCatalogs = platformChannelMapper.queryChannelInParentPlatformAndCatalog(platformId, id); |
| | | if (platformCatalogs.size() > 0){ |
| | | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| | |
| | | } |
| | | eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); |
| | | } |
| | | int delChannelresult = platformChannelMapper.delByCatalogId(id); |
| | | int delChannelresult = platformChannelMapper.delByCatalogId(platformId, id); |
| | | return delresult + delChannelresult + delStreamresult; |
| | | } |
| | | |
| | |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("添加目录,{}", JSON.toJSONString(platformCatalog)); |
| | | } |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId()); |
| | | |
| | | if (platformCatalogInStore != null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " already exists"); |
| | |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("编辑目录,{}", JSON.toJSONString(platformCatalog)); |
| | | } |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId()); |
| | | |
| | | if (platformCatalogInStore == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " not exists"); |
| | |
| | | throw new ControllerException(ErrorCode.ERROR400); |
| | | } |
| | | |
| | | int delResult = storager.delCatalog(id); |
| | | int delResult = storager.delCatalog(platformId, id); |
| | | // 如果删除的是默认目录则根目录设置为默认目录 |
| | | PlatformCatalog parentPlatform = storager.queryDefaultCatalogInPlatform(platformId); |
| | | |