| | |
| | |
|
| | | 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.IArdCamerasService;
|
| | | 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;
|
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.common.enums.BusinessType;
|
| | | import com.ruoyi.common.core.page.TableDataInfo;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import java.util.*;
|
| | |
|
| | |
| | | @GetMapping("/list")
|
| | | @ApiOperation("查询相机设备列表")
|
| | | public TableDataInfo list(ArdCameras ardCamera) {
|
| | | startPage();
|
| | | List<ArdCameras> list = ardCamerasService.selectArdCamerasList(ardCamera);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询相机设备列表(不校验权限)
|
| | | */
|
| | | @GetMapping("/list/noPerm")
|
| | | @ApiOperation("查询相机设备列表")
|
| | | public TableDataInfo listNoPerm(ArdCameras ardCamera) {
|
| | | startPage();
|
| | | 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);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | return toAjax(ardCamerasService.deleteArdCamerasByIds(ids));
|
| | | }
|
| | |
|
| | | @Log(title = "导入相机设备", businessType = BusinessType.IMPORT)
|
| | | @PreAuthorize("@ss.hasPermi('device:cameras:import')")
|
| | | @PostMapping("/importData")
|
| | | @ApiOperation("导入相机设备")
|
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
| | | ExcelUtil<ArdCameras> util = new ExcelUtil<ArdCameras>(ArdCameras.class);
|
| | | List<ArdCameras> camerasList = util.importExcel(file.getInputStream());
|
| | | String operName = getUsername();
|
| | | String message = ardCamerasService.importCameras(camerasList, updateSupport, operName);
|
| | | return success(message);
|
| | | }
|
| | |
|
| | | @PostMapping("/importTemplate")
|
| | | @ApiOperation("相机设备导入模板")
|
| | | public void importTemplate(HttpServletResponse response) {
|
| | | ExcelUtil<ArdCameras> util = new ExcelUtil<ArdCameras>(ArdCameras.class);
|
| | | util.importTemplateExcel(response, "相机设备数据");
|
| | | }
|
| | |
|
| | |
|
| | | @GetMapping("/options")
|
| | | @ApiOperation("选择相机数据")
|
| | | public List options(ArdCameras ardCameras) {
|
| | | List<ArdCameras> list = ardCamerasService.findOptions(ardCameras);
|
| | | System.out.println("list:"+list.size());
|
| | | //System.out.println("list:"+list.size());
|
| | | List options = new ArrayList();
|
| | | for (ArdCameras item : list) {
|
| | | Map option = new HashMap();
|
| | |
| | | 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() {
|
| | |
| | | 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);
|
| | | }
|
| | | }
|