aijinhui
2023-10-24 8a87e4226aa802d6a0e3566c66824fedf68e77da
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -12,6 +12,9 @@
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.channel.domain.ArdChannel;
import com.ruoyi.device.channel.mapper.ArdChannelMapper;
import com.ruoyi.device.hiksdk.service.IHikClientService;
import com.ruoyi.media.domain.Vtdu;
import com.ruoyi.media.service.IVtduService;
import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.utils.gis.GisUtil;
import com.ruoyi.utils.tools.ArdTool;
@@ -45,10 +48,15 @@
    @Resource
    private ArdChannelMapper ardChannelMapper;
    @Resource
    private IVtduService vtduService;
    @PostConstruct
    public void loadCameras() {
        //清空相机缓存
        Collection<String> cacheKeys = redisCache.keys(getCacheKey("*"));
        redisCache.deleteObject(cacheKeys);
        //重新加载相机到缓存
        List<ArdCameras> ardCameras = selectArdCamerasListNoDataScope(new ArdCameras());
        for (ArdCameras ardCamera : ardCameras) {
            redisCache.setCacheObject(getCacheKey(ardCamera.getId()), ardCamera);
@@ -74,7 +82,16 @@
     */
    @Override
    public ArdCameras selectArdCamerasById(String id) {
        return ardCamerasMapper.selectArdCamerasById(id);
        ArdCameras ardCameras = ardCamerasMapper.selectArdCamerasById(id);
        if (ardCameras != null) {
            ArdChannel ardChannel = new ArdChannel();
            ardChannel.setDeviceId(ardCameras.getId());
            List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
            if (ardChannels != null) {
                ardCameras.setChannelList(ardChannels);
            }
        }
        return ardCameras;
    }
    /**
@@ -156,6 +173,8 @@
        if (res > 0) {
            for (String id : ids) {
                redisCache.deleteObject(getCacheKey(id));
                //删除流媒体
                vtduService.deleteVtduByCameraId(id);
                //删除当前相机的所有通道
                ardChannelMapper.deleteArdChannelByDeviceId(id);
            }
@@ -180,7 +199,15 @@
    }
    public List findOptions(ArdCameras ardCameras) {
        return ardCamerasMapper.findOptions(ardCameras);
        List<ArdCameras> options = ardCamerasMapper.findOptions(ardCameras);
        for (ArdCameras camera :
                options) {
            ArdChannel ardChannel = new ArdChannel();
            ardChannel.setDeviceId(camera.getId());
            List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
            camera.setChannelList(ardChannels);
        }
        return options;
    }
    /**