package com.fzzy.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.GroupIndexData;
|
import com.fzzy.igds.data.IgdsBaseParam;
|
import com.fzzy.igds.data.PageResponse;
|
import com.fzzy.igds.data.PatrolSuperData;
|
import com.fzzy.igds.domain.*;
|
import com.fzzy.igds.response.BaseResponse;
|
import com.fzzy.igds.utils.ContextUtil;
|
import com.fzzy.igds.utils.SystemUtil;
|
import com.fzzy.common.manager.CommonManager;
|
import com.fzzy.security.manager.SecManager;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
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.*;
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
|
/**
|
* @Description 安防controller层
|
* @Author CZT
|
* @Date 2025/12/9 9:12
|
*/
|
@Slf4j
|
@Controller
|
@RequestMapping("security")
|
public class SecurityController {
|
|
private static final String prefix = "security";
|
|
@Resource
|
private SecManager secManager;
|
@Resource
|
private CommonManager commonManager;
|
|
/*------------------安防管理------------------*/
|
|
/**
|
* 库区安防页面
|
*
|
* @param type 1.表示2.5D鸟瞰图页面预览;2.表示列表预览页面
|
* @param deptId
|
* @param view
|
* @return
|
*/
|
@RequestMapping("/video-dept")
|
public String videoDept(@RequestParam(value = "type", required = false) String type,
|
@RequestParam(value = "deptId", required = false) String deptId,
|
@RequestParam(value = "lan", required = false) String lan,
|
ModelMap view) {
|
|
if (StringUtils.isBlank(type)) {
|
type = "2";
|
}
|
|
if (StringUtils.isBlank(lan)) {
|
//内网播放
|
lan = "1";
|
}
|
|
SysUser user = ContextUtil.getLoginUser();
|
view.put(Constant.MODEL_KEY_LOGIN_USER, user);
|
|
if (StringUtils.isBlank(deptId)) {
|
deptId = ContextUtil.subDeptId(user);
|
}
|
view.put("deptId", deptId);
|
|
List<Camera> listCamera = secManager.listCamera(deptId, user.getCompanyId());
|
view.put("listCamera", listCamera);
|
|
SysDept sysDept = commonManager.getDeptById(deptId);
|
view.put("dept", sysDept);
|
view.put("type", type);
|
view.put("lan", lan);
|
|
//判断是否显示库区选择弹窗
|
String showDeptList = "Y";
|
if (Constant.USER_TYPE_30.equals(user.getUserType())) {
|
showDeptList = "N";
|
}
|
view.put("showDeptList", showDeptList);
|
|
//库区网关信息
|
GatewaySer gatewaySer = commonManager.getGatewaySerByDeptId(deptId);
|
view.put("gatewaySer", gatewaySer);
|
|
//默认监控列表页面
|
String viewUrl = prefix + "/video-list-dept";
|
|
if ("1".equals(type)) {
|
viewUrl = prefix + "/video-aerial-dept";
|
|
view.put("backgroundImg", commonManager.isDeptImgExit(deptId));
|
}
|
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 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);
|
}
|
|
/***
|
* 视频鸟瞰图中更改摄像头位置
|
*
|
* @param params
|
* @return
|
*/
|
@RequestMapping("/update-pos")
|
@ResponseBody
|
public PageResponse<String> updatePos(
|
@RequestBody List<Camera> params) {
|
return secManager.updatePos(params);
|
}
|
|
/*------------------巡检监管------------------*/
|
|
/**
|
* 巡检监管
|
*
|
* @return
|
*/
|
@RequestMapping("/patrol-count")
|
public String patrolCount(ModelMap view) {
|
|
SysUser user = ContextUtil.getLoginUser();
|
view.put(Constant.MODEL_KEY_LOGIN_USER, user);
|
|
String deptId = ContextUtil.subDeptId(user);
|
view.put("deptId", deptId);
|
|
|
PatrolSuperData patrolSuperData = secManager.patrolTrack();
|
view.put("patrolSuperData", patrolSuperData);
|
|
return prefix + "/patrol-count";
|
}
|
|
|
/*------------------数量检测------------------*/
|
|
/**
|
* 首页总览
|
*
|
* @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<QuantityConf> listCamera = secManager.getQuantityConfByDeptId(deptId);
|
view.put("listCamera", listCamera);
|
|
return prefix + "/quantity";
|
}
|
|
/**
|
* 查询记录信息
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/quantity-list")
|
@ResponseBody
|
public PageResponse<List<Quantity>> quantityList(@RequestBody IgdsBaseParam param) {
|
return secManager.quantityList(param);
|
}
|
|
/**
|
* 查询曲线图信息
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/quantity-chart")
|
@ResponseBody
|
public PageResponse<GroupIndexData> getQuantityChart(@RequestBody IgdsBaseParam param) {
|
return secManager.getQuantityChart(param);
|
}
|
|
/**
|
* 查询曲线图信息
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/quantity-files")
|
@ResponseBody
|
public PageResponse<List<FileInfo>> getQuantityFiles(@RequestBody IgdsBaseParam param) {
|
return secManager.getQuantityFiles(param);
|
}
|
|
/**
|
* 数量监测-开始检测
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/check-single")
|
@ResponseBody
|
public BaseResponse checkSingle(@RequestBody IgdsBaseParam param) {
|
|
return secManager.checkSingle(param);
|
}
|
|
/**
|
* 数量监测-停止检测
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/check-stop")
|
@ResponseBody
|
public BaseResponse checkStop(@RequestBody IgdsBaseParam param) {
|
return secManager.checkStop(param);
|
}
|
|
/*------------------料位计页面------------------*/
|
/**
|
* 料位总览
|
*
|
* @param deptId
|
* @return
|
*/
|
@RequestMapping("/height-all")
|
public String oilAll(@RequestParam(value = "deptId", required = false) String deptId,
|
ModelMap view) {
|
|
SysUser user = ContextUtil.getLoginUser();
|
view.put(Constant.MODEL_KEY_LOGIN_USER, user);
|
|
// 获取当前用户所在的分库名称
|
if(StringUtils.isBlank(deptId)){
|
deptId = ContextUtil.subDeptId(user);
|
}
|
view.put("deptId", deptId);
|
|
// 获取当前部门下所有油罐列表信息
|
List<Quantity> heightList = secManager.getHeightList(ContextUtil.subDeptId(user));
|
view.put(Constant.MODEL_KEY_DEPOT_LIST, heightList);
|
|
view.put("bizType", "quantity");
|
|
return prefix + "/height-all";
|
}
|
|
/*------------------巡更轨迹页面------------------*/
|
/**
|
* 获取巡更记录页面
|
*
|
* @param patrolId
|
* @param view
|
* @return
|
*/
|
@RequestMapping("/patrol-record")
|
public String getPatrolRecordById(@RequestParam(value = "patrolId", required = true) String patrolId,
|
ModelMap view) {
|
IgdsBaseParam param = new IgdsBaseParam();
|
param.setKey(patrolId);
|
List<PatrolRecord> trackPoints = secManager.getRecordByPatrolId(patrolId);
|
view.put("patrolRecordList", trackPoints);
|
|
return prefix + "/patrol-record";
|
}
|
|
}
|