| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | 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.channel.service.IArdChannelService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import com.ruoyi.scheduling.domian.SchedulingParam; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.utils.tools.ArdTool; |
| | |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | @Resource |
| | | private IHikClientService hikClientService; |
| | | @Resource |
| | | private ArdChannelMapper ardChannelMapper; |
| | | |
| | | |
| | | @PostConstruct |
| | |
| | | ardCameras.setCreateTime(DateUtils.getNowDate()); |
| | | ardCameras.setUserId(SecurityUtils.getUserId()); |
| | | redisCache.setCacheObject(getCacheKey(ardCameras.getId()), ardCameras); |
| | | return ardCamerasMapper.insertArdCameras(ardCameras); |
| | | int i = ardCamerasMapper.insertArdCameras(ardCameras); |
| | | if (i > 0) { |
| | | // //删除当前相机的所有通道 |
| | | // ardChannelMapper.deleteArdChannelByDeviceId(ardCameras.getId()); |
| | | // //获取相机通道 |
| | | // List<ArdChannel> ipChannelList = hikClientService.getCameraChannelList(ardCameras); |
| | | // if (ipChannelList.size() > 0) { |
| | | // for (ArdChannel channel : ipChannelList) { |
| | | // channel.setId(IdUtils.simpleUUID()); |
| | | // ardChannelMapper.insertArdChannel(channel); |
| | | // } |
| | | // } |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (res > 0) { |
| | | for (String id : ids) { |
| | | redisCache.deleteObject(getCacheKey(id)); |
| | | //删除当前相机的所有通道 |
| | | ardChannelMapper.deleteArdChannelByDeviceId(id); |
| | | } |
| | | } |
| | | return res; |
| | |
| | | */ |
| | | @Override |
| | | public int deleteArdCamerasById(String id) { |
| | | return ardCamerasMapper.deleteArdCamerasById(id); |
| | | int i = ardCamerasMapper.deleteArdCamerasById(id); |
| | | if (i > 0) { |
| | | //删除当前相机的所有通道 |
| | | ardChannelMapper.deleteArdChannelByDeviceId(id); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | public List findOptions(ArdCameras ardCameras) { |
| | |
| | | } |
| | | if (distance != 0.0 && distance <= camera.getCamMaxVisibleDistance()) { |
| | | distanceMap.put(camera.getId(), distance); |
| | | camera.setChannel(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | ardCameras.put(distance, camera); |
| | | } |
| | | |
| | |
| | | double[] camPosition = new double[]{camera.getLongitude(), camera.getLatitude()}; |
| | | double distance = GisTool.getDistance(new double[]{longitude, latitude}, camPosition); |
| | | if (distance <= radius) { |
| | | camera.setChannel(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | ardCameras.add(camera); |
| | | } |
| | | } |