old mode 100644
new mode 100755
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | |
| | | * @author lin |
| | | */ |
| | | @Service |
| | | @DS("master") |
| | | public class PlatformChannelServiceImpl implements IPlatformChannelService { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(PlatformChannelServiceImpl.class); |
| | |
| | | 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); |
| | | if (catalog == null && !catalogId.equals(platform.getDeviceGBId())) { |
| | | PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId); |
| | | if (catalog == null && catalogId.equals(platform.getDeviceGBId())) { |
| | | for (ChannelReduce channelReduce : channelReduces) { |
| | | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setCivilCode(platform.getServerGBDomain()); |
| | | deviceChannelList.add(deviceChannel); |
| | | } |
| | | return deviceChannelList; |
| | | } else if (catalog == null && !catalogId.equals(platform.getDeviceGBId())) { |
| | | logger.warn("未查询到目录{}的信息", catalogId); |
| | | return null; |
| | | } |
| | | for (ChannelReduce channelReduce : channelReduces) { |
| | | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setCivilCode(catalog.getCivilCode()); |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | | deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId()); |
| | | deviceChannelList.add(deviceChannel); |
| | | if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){ |
| | | deviceChannel.setCivilCode(catalogId); |
| | | }else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){ |
| | | deviceChannel.setParentId(catalogId); |
| | | if (catalog != null) { |
| | | deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return deviceChannelList; |
| | |
| | | return 0; |
| | | } |
| | | if (ObjectUtils.isEmpty(catalogId)) { |
| | | catalogId = platform.getDeviceGBId(); |
| | | catalogId = null; |
| | | } |
| | | |
| | | if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) { |
| | | List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId); |
| | | eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL); |
| | | } |
| | | return result; |
| | | List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId); |
| | | eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL); |
| | | |
| | | return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId); |
| | | } |
| | | } |