hexq
2024-01-20 dd4e0d0d9c75b5216b08644bfe1333a79f794b58
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
old mode 100644 new mode 100755
@@ -18,6 +18,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
@@ -76,8 +77,6 @@
        }
        try {
            List<DeviceChannel> deviceChannelList = new ArrayList<>();
            for (int i = 0; i < gbStreams.size(); i++) {
                GbStream gbStream = gbStreams.get(i);
                gbStream.setCatalogId(catalogId);
@@ -250,17 +249,21 @@
            return ;
        }
        if (ObjectUtils.isEmpty(catalogId)) {
            catalogId = platform.getDeviceGBId();
            catalogId = null;
        }
        if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) {
            List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
            List<DeviceChannel> deviceChannelList = new ArrayList<>();
            for (GbStream gbStream : gbStreams) {
                DeviceChannel deviceChannel = new DeviceChannel();
                deviceChannel.setChannelId(gbStream.getGbId());
                deviceChannelList.add(deviceChannel);
            }
            eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
        List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
        List<DeviceChannel> deviceChannelList = new ArrayList<>();
        for (GbStream gbStream : gbStreams) {
            DeviceChannel deviceChannel = new DeviceChannel();
            deviceChannel.setChannelId(gbStream.getGbId());
            deviceChannelList.add(deviceChannel);
        }
        eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
        platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId);
    }
    @Override
    public List<GbStream> getGbChannelWithGbid(String gbId) {
        return gbStreamMapper.selectByGBId(gbId);
    }
}