| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
|
| | | import com.ruoyi.common.constant.CameraConstants;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.device.camera.domain.ArdCameras;
|
| | | import com.ruoyi.device.camera.domain.CameraCmd;
|
| | | import com.ruoyi.device.camera.domain.DeptAndCamerasDto;
|
| | |
| | | import com.ruoyi.device.camera.service.ICameraSdkService;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.inspect.service.IArdVideoInspectTaskService;
|
| | | import com.ruoyi.utils.tools.ArdTool;
|
| | | import io.swagger.annotations.Api;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | |
| | | List<ArdCameras> list = ardCamerasService.selectArdCamerasList(ardCamera);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询相机设备列表(不校验权限)
|
| | | */
|
| | |
| | | List<ArdCameras> list = ardCamerasService.selectArdCamerasList(ardCamera);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导出相机设备列表
|
| | | */
|
| | |
| | | @Log(title = "相机设备", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@RequestBody ArdCameras camera) {
|
| | | if (CameraConstants.NOT_UNIQUE.equals(ardCamerasService.checkCameraIpAndPortUnique(camera)))
|
| | | {
|
| | | return error("新增相机'" + camera.getIp()+":"+camera.getPort() + "'失败,相机已存在");
|
| | | if (CameraConstants.NOT_UNIQUE.equals(ardCamerasService.checkCameraIpAndPortUnique(camera))) {
|
| | | return error("新增相机'" + camera.getIp() + ":" + camera.getPort() + "'失败,相机已存在");
|
| | | }
|
| | | camera.setState("0");
|
| | | int i = ardCamerasService.insertArdCameras(camera);
|
| | | if (i > 0) {
|
| | | cameraSdkService.logout(camera.getId());
|
| | | cameraSdkService.login(camera);
|
| | | AjaxResult result = cameraSdkService.login(camera);
|
| | | return success(result.get("msg"));
|
| | | } else {
|
| | | return error("新增相机设备失败");
|
| | | }
|
| | | return toAjax(i);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @Log(title = "相机设备", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@RequestBody ArdCameras camera) {
|
| | | if (CameraConstants.NOT_UNIQUE.equals(ardCamerasService.checkCameraIpAndPortUnique(camera)))
|
| | | {
|
| | | return error("修改相机'" + camera.getIp()+":"+camera.getPort() + "'失败,相机已存在");
|
| | | if (CameraConstants.NOT_UNIQUE.equals(ardCamerasService.checkCameraIpAndPortUnique(camera))) {
|
| | | return error("修改相机'" + camera.getIp() + ":" + camera.getPort() + "'失败,相机已存在");
|
| | | }
|
| | | ArdCameras cameraOld = ardCamerasService.selectArdCamerasById(camera.getId());
|
| | | ArdTool.fillNullFields(cameraOld, camera);
|
| | |
|
| | | camera.setState("0");
|
| | | int i = ardCamerasService.updateArdCameras(camera);
|
| | | if (i > 0) {
|
| | | cameraSdkService.logout(camera.getId());
|
| | | cameraSdkService.login(camera);
|
| | | AjaxResult result = cameraSdkService.login(camera);
|
| | | return success(result.get("msg"));
|
| | | } else {
|
| | | return error("修改相机设备失败");
|
| | | }
|
| | | return toAjax(i);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @GetMapping("/options")
|
| | | @ApiOperation("选择相机数据")
|
| | | public List options(ArdCameras ardCameras) {
|
| | |
| | | Map deptAndCamera = ardCamerasService.getChildDeptAndCamera(true);
|
| | | return AjaxResult.success(deptAndCamera);
|
| | | }
|
| | | @GetMapping("/getDeptAndCamera1")
|
| | | @ApiOperation("获取部门和相机1")
|
| | | public AjaxResult getDeptAndCamera1() {
|
| | |
|
| | | @GetMapping("/getDeptAndCameraByRole")
|
| | | @ApiOperation("获取部门和相机按角色")
|
| | | public AjaxResult getDeptAndCameraByRole() {
|
| | | List<DeptAndCamerasDto> deptAndCamera = ardCamerasService.getChildDeptAndCamera();
|
| | | return AjaxResult.success(deptAndCamera);
|
| | | }
|
| | |
|
| | | @GetMapping("/getDeptAndCameraWithCheckBox")
|
| | | @ApiOperation("获取部门和相机(开启复选框)")
|
| | | public AjaxResult getDeptAndCameraWithCheckBox() {
|
| | | Map deptAndCamera = ardCamerasService.getChildDeptAndCamera(false);
|
| | | //Map deptAndCamera = ardCamerasService.getChildDeptAndCamera(false);
|
| | | List<Map<String, Object>> deptAndCamera = ardCamerasService.getChildDeptAndCameraOwn(false);
|
| | | return AjaxResult.success(deptAndCamera);
|
| | | }
|
| | |
|
| | |
| | | TreeMap nearCamerasBycoordinate = ardCamerasService.getNearCamerasBycoordinate(cmd);
|
| | | return AjaxResult.success(nearCamerasBycoordinate);
|
| | | }
|
| | |
|
| | | @GetMapping("/getCamerasByDeptId")
|
| | | @ApiOperation("获取权限及下属权限下的相机")
|
| | | public AjaxResult getCamerasByDeptId() {
|
| | | Long deptId = SecurityUtils.getDeptId();
|
| | | String userId = SecurityUtils.getUserId();
|
| | | List<Map<String, Object>> camerasList = ardCamerasService.getCamerasByDeptId(deptId, userId);
|
| | | return AjaxResult.success(camerasList);
|
| | | }
|
| | |
|
| | | @PostMapping("/getCameraOperationByCameraId")
|
| | | @ApiOperation("查看相机可否操控")
|
| | | public AjaxResult getCameraOperationByCameraId(@RequestBody Map<String, String> map) {
|
| | | String userId = SecurityUtils.getUserId();
|
| | | Boolean flag = ardCamerasService.getCameraOperationByCameraId(map.get("id"), userId);
|
| | | return AjaxResult.success(flag);
|
| | | }
|
| | |
|
| | | @PostMapping("/getChannelByCameraId")
|
| | | @ApiOperation("获取相机通道")
|
| | | public AjaxResult getChannelByCameraId(@RequestBody Map<String, String> map) {
|
| | | Map<String, Object> result = ardCamerasService.getChannelByCameraId(map.get("id"));
|
| | | return AjaxResult.success(result);
|
| | | }
|
| | | }
|