| | |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.camera.service.ICameraSdkService; |
| | | import com.ruoyi.device.camera.service.impl.CameraSdkServiceImpl; |
| | | import com.ruoyi.device.dhsdk.service.IDhClientService; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import com.ruoyi.device.hiksdk.service.impl.HikClientServiceImpl; |
| | |
| | | private IHikClientService hikSdk; |
| | | @Resource |
| | | private IDhClientService dhSdk; |
| | | @Resource |
| | | private ICameraSdkService cameraSdkService; |
| | | @Resource |
| | | private IArdCamerasService ardCamerasService; |
| | | @Resource |
| | |
| | | public AjaxResult add(@RequestBody ArdCameras camera) { |
| | | int i = ardCamerasService.insertArdCameras(camera); |
| | | if (i > 0) { |
| | | if (camera.getFactory().equals("1")) { |
| | | //注销 |
| | | hikSdk.logout(camera.getId()); |
| | | //异步登录 |
| | | hikSdk.asyncLogin(camera); |
| | | } |
| | | else if(camera.getFactory().equals("2")) |
| | | { |
| | | dhSdk.logout(camera.getId()); |
| | | dhSdk.login(camera); |
| | | } |
| | | cameraSdkService.logout(camera.getId()); |
| | | cameraSdkService.login(camera); |
| | | } |
| | | return toAjax(i); |
| | | } |
| | |
| | | public AjaxResult edit(@RequestBody ArdCameras camera) { |
| | | int i = ardCamerasService.updateArdCameras(camera); |
| | | if (i > 0) { |
| | | camera= ardCamerasService.selectArdCamerasById(camera.getId()); |
| | | if(camera.getFactory().equals("1")) { |
| | | hikSdk.logout(camera.getId()); |
| | | hikSdk.asyncLogin(camera); |
| | | } |
| | | else if(camera.getFactory().equals("2")) { |
| | | dhSdk.logout(camera.getId()); |
| | | dhSdk.login(camera); |
| | | } |
| | | cameraSdkService.logout(camera.getId()); |
| | | cameraSdkService.login(camera); |
| | | } |
| | | return toAjax(i); |
| | | } |
| | |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) { |
| | | for (String id : ids) { |
| | | hikSdk.logout(id); |
| | | dhSdk.logout(id); |
| | | cameraSdkService.logout(id); |
| | | } |
| | | return toAjax(ardCamerasService.deleteArdCamerasByIds(ids)); |
| | | } |
| | |
| | | @ApiOperation("选择相机数据") |
| | | public List options(ArdCameras ardCameras) { |
| | | List<ArdCameras> list = ardCamerasService.findOptions(ardCameras); |
| | | System.out.println("list:"+list.size()); |
| | | List options = new ArrayList(); |
| | | for (ArdCameras item : list) { |
| | | Map option = new HashMap(); |
| | | option.put("value", item.getId()); |
| | | option.put("label", item.getName()); |
| | | option.put("channel", item.getChanNo()); |
| | | option.put("channelList", item.getChannelList()); |
| | | List timeList = ardVideoInspectTaskService.getCameraIdleTimeList(item.getId()); |
| | | option.put("idleTimeList", timeList);//空闲时间段 |
| | | options.add(option); |