| | |
| | | package com.fzzy.sys.controller.security; |
| | | |
| | | import com.fzzy.igds.constant.CameraPlayType; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.data.PageResponse; |
| | | import com.fzzy.igds.domain.Camera; |
| | | import com.fzzy.igds.domain.Dept; |
| | | import com.fzzy.igds.service.CoreDeptService; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.fzzy.sys.manager.security.SecManager; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description 安防controller层 |
| | |
| | | */ |
| | | @Slf4j |
| | | @Controller |
| | | @RequestMapping("/security") |
| | | @RequestMapping("security") |
| | | public class SecurityController { |
| | | |
| | | private static final String prefix = "security"; |
| | | |
| | | @Resource |
| | | private SecManager secManager; |
| | | @Resource |
| | | private CoreDeptService deptService; |
| | | |
| | | /** |
| | | * 库区安防页面 |
| | | * @param type 1.表示2.5D鸟瞰图页面预览;2.表示列表预览页面 |
| | | * @param view |
| | | * @return |
| | | */ |
| | | @RequestMapping("/video-dept") |
| | | public String videoDept(@RequestParam(value = "type", required = false) String type, |
| | | ModelMap view) { |
| | | |
| | | if (StringUtils.isBlank(type)) { |
| | | type = "2"; |
| | | } |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | view.put(Constant.MODEL_KEY_LOGIN_USER, user); |
| | | |
| | | String deptId = ContextUtil.subDeptId(user); |
| | | view.put("deptId", deptId); |
| | | |
| | | List<Camera> listCamera = secManager.listCamera(deptId, user.getCompanyId()); |
| | | view.put("listCamera", listCamera); |
| | | |
| | | //默认监控列表页面 |
| | | String viewUrl = prefix + "/video-list-dept"; |
| | | |
| | | if("1".equals(type)){ |
| | | viewUrl = prefix + "/video-aerial-dept"; |
| | | |
| | | //鸟瞰图 |
| | | Dept dept = deptService.getDeptById(deptId); |
| | | if (dept != null && StringUtils.isNotEmpty(dept.getImgPath())) { |
| | | view.put("backgroundImg", dept.getImgPath()); |
| | | } |
| | | } |
| | | if("2".equals(type)){ |
| | | viewUrl = prefix + "/video-list-dept"; |
| | | } |
| | | |
| | | return viewUrl; |
| | | } |
| | | |
| | | /** |
| | | * 监管安防页面 |
| | | * @param type 1.表示2.5D鸟瞰图页面预览;2.表示列表预览页面 |
| | | * @param view |
| | | * @return |
| | | */ |
| | | @RequestMapping("/video-super") |
| | | public String videoSuper(@RequestParam(value = "type", required = false) String type, |
| | | ModelMap view) { |
| | | |
| | | if (StringUtils.isBlank(type)) { |
| | | type = "2"; |
| | | } |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | view.put(Constant.MODEL_KEY_LOGIN_USER, user); |
| | | |
| | | String deptId = ContextUtil.subDeptId(user); |
| | | view.put("deptId", deptId); |
| | | |
| | | List<Camera> listCamera = secManager.listCamera(deptId, user.getCompanyId()); |
| | | view.put("listCamera", listCamera); |
| | | |
| | | //默认监控列表页面 |
| | | String viewUrl = prefix + "/video-list-dept"; |
| | | |
| | | if("1".equals(type)){ |
| | | viewUrl = prefix + "/video-aerial-dept"; |
| | | |
| | | //鸟瞰图 |
| | | Dept dept = deptService.getDeptById(deptId); |
| | | if (dept != null && StringUtils.isNotEmpty(dept.getImgPath())) { |
| | | view.put("backgroundImg", dept.getImgPath()); |
| | | } |
| | | } |
| | | if("2".equals(type)){ |
| | | viewUrl = prefix + "/video-list-dept"; |
| | | } |
| | | |
| | | return viewUrl; |
| | | } |
| | | |
| | | /** |
| | | * 鸟瞰图页面 -- 视频播放,通过播放参数不同跳转不同页面播放 |
| | | * |
| | | * @param cameraId 摄像机系统ID |
| | | * @param playType 配置的播放方式 |
| | | * @param time 时间参数,无具体含义 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/video-play") |
| | | public String play(@RequestParam(value = "cameraId", required = true) String cameraId, |
| | | @RequestParam(value = "playType", required = false) String playType, |
| | | @RequestParam(value = "time", required = false) String time, |
| | | ModelMap view) { |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | |
| | | // 设置默认播放方式 |
| | | if (org.apache.commons.lang3.StringUtils.isEmpty(playType)) { |
| | | playType = CameraPlayType.PLAY_TYPE_VLC.getCode(); |
| | | } |
| | | |
| | | // 设置摄像头信息 |
| | | Camera camera = secManager.getCameraById(null, cameraId); |
| | | if (camera == null) { |
| | | view.put("errorMsg", "获取视频设备出错,请先刷新缓存!"); |
| | | } |
| | | view.put("cameraData", camera); |
| | | |
| | | String viewUrl = prefix + "/video-webrtc"; |
| | | |
| | | //WEB-RTC播放 |
| | | if (CameraPlayType.PLAY_TYPE_WEB_RTC.getCode().equals(playType)) { |
| | | viewUrl = prefix + "/video-webrtc"; |
| | | } |
| | | |
| | | return viewUrl; |
| | | } |
| | | |
| | | /*** |
| | | * 视频鸟瞰图中更改摄像头位置 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @RequestMapping("/update-pos") |
| | | @ResponseBody |
| | | public PageResponse<String> updatePos( |
| | | @RequestBody List<Camera> params) { |
| | | return secManager.updatePos(params); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 首页总览 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/quantity") |
| | | public String infrared( |
| | | @RequestParam(value = "type", required = false) String type, |
| | | ModelMap view) { |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | view.put(Constant.MODEL_KEY_LOGIN_USER, user); |
| | | |
| | | String deptId = ContextUtil.subDeptId(user); |
| | | view.put("deptId", deptId); |
| | | // List<InfraredCamera> listCamera = infraredManager.listCamera(deptId, user.getCompanyId()); |
| | | // |
| | | // if(null == listCamera){ |
| | | // listCamera = new ArrayList<>(); |
| | | // listCamera.add(new InfraredCamera()); |
| | | // } |
| | | // view.put("listCamera", listCamera); |
| | | |
| | | return prefix + "/quantity"; |
| | | } |
| | | |
| | | } |