1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package com.ruoyi.system.service.impl;
- import com.alibaba.fastjson2.JSON;
- import com.alibaba.fastjson2.JSONArray;
- import com.alibaba.fastjson2.JSONObject;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.exception.ServiceException;
- import com.ruoyi.common.utils.SecurityUtils;
- import com.ruoyi.common.utils.StringUtils;
- import com.ruoyi.common.utils.hkws.GetCameraPreviewURL;
- import com.ruoyi.system.domain.vo.CameraInfoVo;
- import com.ruoyi.system.service.CameraService;
- import org.apache.poi.ss.usermodel.DateUtil;
- import org.springframework.stereotype.Service;
- import java.util.Date;
- /**
- * 监控Service业务层处理
- *
- * @author ruoyi
- * @date 2024-06-25
- */
- @Service
- public class CameraServiceImpl implements CameraService {
- @Override
- public AjaxResult selectCameraList(CameraInfoVo cameraInfoVo) {
- /**
- * STEP3:设置接口的URI地址
- */
- String url = "/api/resource/v2/camera/search";
- /**
- * STEP5:组装请求参数
- */
- String body = JSONArray.toJSONString(cameraInfoVo);
- /*JSONObject jsonBody = new JSONObject();
- jsonBody.put("cameraIndexCode", "8e59cc5559904589938be47888e5214a");
- jsonBody.put("streamType", 0);
- jsonBody.put("protocol", "httpflv");
- jsonBody.put("transmode", 1);
- jsonBody.put("expand", "streamform=ps");*/
- /* jsonBody.put("pageNo", 1);
- jsonBody.put("pageSize", 30);*/
- String result = GetCameraPreviewURL.GetCameraPreviewURL(url,body);
- JSONObject jsonObject = JSON.parseObject(result);
- return AjaxResult.success(jsonObject);
- }
- @Override
- public AjaxResult video(String cameraIndexCode) {
- if(StringUtils.isEmpty(cameraIndexCode)){
- throw new ServiceException("参数错误");
- }
- /**
- * STEP3:设置接口的URI地址
- */
- String url = "/api/video/v2/cameras/previewURLs";
- /**
- * STEP5:组装请求参数
- */
- JSONObject jsonBody = new JSONObject();
- jsonBody.put("cameraIndexCode", cameraIndexCode);
- jsonBody.put("streamType", 0);
- jsonBody.put("protocol", "httpflv");
- jsonBody.put("transmode", 1);
- jsonBody.put("expand", "streamform=ps");
- String result = GetCameraPreviewURL.GetCameraPreviewURL(url,jsonBody.toString());
- JSONObject jsonObject = JSON.parseObject(result);
- return AjaxResult.success(jsonObject);
- }
- }
|