| | |
| | |
|
| | | 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.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)))
|
| | | {
|
| | | 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)))
|
| | | {
|
| | | 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) {
|
| | | if(StringUtils.isNotNull(camera.getPassword())) {
|
| | | 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("/getDeptAndCameraByRole")
|
| | | @ApiOperation("获取部门和相机按角色")
|
| | | public AjaxResult getDeptAndCameraByRole() {
|
| | | List<DeptAndCamerasDto> deptAndCamera = ardCamerasService.getChildDeptAndCamera();
|
| | | return AjaxResult.success(deptAndCamera);
|
| | | }
|
| | |
|
| | | @GetMapping("/getDeptAndCameraWithCheckBox")
|
| | | @ApiOperation("获取部门和相机(开启复选框)")
|
| | | public AjaxResult getDeptAndCameraWithCheckBox() {
|