czt
昨天 bc3e9b68c66fdeeb7c49155ff46ed68d3650cc18
fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SecurityController.java
@@ -1,5 +1,7 @@
package com.fzzy.sys.controller.security;
import com.fzzy.igds.camera.data.ApiCameraData;
import com.fzzy.igds.camera.data.ApiCameraResp;
import com.fzzy.igds.constant.CameraPlayType;
import com.fzzy.igds.constant.Constant;
import com.fzzy.igds.data.PageResponse;
@@ -7,6 +9,7 @@
import com.fzzy.igds.domain.Dept;
import com.fzzy.igds.service.CoreDeptService;
import com.fzzy.igds.utils.ContextUtil;
import com.fzzy.igds.utils.SystemUtil;
import com.fzzy.sys.manager.security.SecManager;
import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
@@ -17,8 +20,8 @@
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 javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -39,39 +42,88 @@
    private CoreDeptService deptService;
    /**
     * 监控概览
     *
     * 库区安防页面
     * @param type 1.表示2.5D鸟瞰图页面预览;2.表示列表预览页面
     * @param view
     * @return
     */
    @RequestMapping("/aerial-video")
    public String aerialVideo(
            @RequestParam(value = "type", required = false) String type,
            ModelMap view) {
    @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);
        List<Camera> listCamera = secManager.listCamera(deptId, user.getCompanyId());
        view.put("deptId", deptId);
        List<Camera> listCamera = secManager.listCamera(deptId, user.getCompanyId());
        view.put("listCamera", listCamera);
        //默认监控列表页面
        String viewUrl = prefix + "/video-list";
        String viewUrl = prefix + "/video-list-dept";
        if (StringUtils.isNotBlank( type) && "1".equals(type)) {
        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());
                viewUrl = prefix + "/video-aerial";
            }
        }
        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;
    }
    /**
     * 鸟瞰图页面 -- 视频播放,通过播放参数不同跳转不同页面播放
@@ -103,12 +155,53 @@
        String viewUrl = prefix + "/video-webrtc";
        //WEB-RTC大华播放
        //WEB-RTC播放
        if (CameraPlayType.PLAY_TYPE_WEB_RTC.getCode().equals(playType)) {
            viewUrl = prefix + "/video-webrtc";
        }
        return viewUrl;
    }
    /**
     * 获取视频播放地址
     *
     * @param param
     * @return
     */
    @RequestMapping("/get-media")
    @ResponseBody
    public ApiCameraResp getMedia(HttpServletRequest request, @RequestBody Camera param) {
        //获取请求方IP
        String ip = SystemUtil.getIP(request);
        return secManager.getPlayAddr(param, ip);
    }
    /**
     * 视频云台控制,所有类型的云台控制入口
     *
     * @param param 前端转换的参数
     * @return 执行结果
     */
    @RequestMapping("/ptz-media")
    @ResponseBody
    public ApiCameraResp ptzMedia(@RequestBody ApiCameraData param) {
        //log.debug("-----云台调用-----{}",param);
        return secManager.ptzMedia(param);
    }
    /**
     * 视频云台预置位设置
     *
     * @param param
     * @return
     */
    @RequestMapping("/ptz-preset")
    @ResponseBody
    public ApiCameraResp ptzPreset(@RequestBody ApiCameraData param) {
        return secManager.ptzPreset(param);
    }
    /***
@@ -124,4 +217,32 @@
        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";
    }
}