南昌市物联网技防平台-后台
zengh
2021-09-01 b948d8be706ff705985a0e5b7e270965d8ddfcba
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/controller/EquipmentController.java
@@ -16,6 +16,9 @@
 */
package org.springblade.jfpt.equipment.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
@@ -39,6 +42,9 @@
import org.springblade.jfpt.equipment.vo.EquipmentVO;
import org.springblade.jfpt.equipment.vo.EquipmentVOS;
import org.springblade.jfpt.equipment.wrapper.EqWrapper;
import org.springblade.jfpt.hk.constant.HkConstant;
import org.springblade.jfpt.hk.constant.ProtocolConstant;
import org.springblade.jfpt.hk.util.GetCameraPreviewURL;
import org.springblade.system.entity.Region;
import org.springblade.system.user.entity.User;
import org.springframework.web.bind.annotation.*;
@@ -582,7 +588,35 @@
      response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
      response.setHeader("Access-Control-Allow-Credentials", "true");
      //返回
      return R.data(equipmentService.selectEquimentPlayInfo(equipmentPlayInfo));
//      equipmentService.selectEquimentPlayInfo(equipmentPlayInfo)
      JSONObject res = new JSONObject();
      //根据设备id获取设备编号
      String result1 = GetCameraPreviewURL.QueryCameraPreviewURL(HkConstant.camerasID, equipmentPlayInfo.getNumber(), "encodeDevice", "deviceCode");
      JSONObject jsonObject1 = JSONObject.parseObject(result1);
      JSONObject res1 = (JSONObject) jsonObject1.get("data");
      JSONArray arr1 = JSON.parseArray(res1.getString("list"));
      if (arr1.size() > 0){
         JSONObject data1 = (JSONObject) arr1.get(0);
         String code1 = data1.get("indexCode").toString();
         //根据设备编号获取子节点编号
         String result2 = GetCameraPreviewURL.QueryCameraPreviewURL(HkConstant.camerasID, code1, "camera", "parentIndexCode");
         JSONObject jsonObject2 = JSONObject.parseObject(result2);
         JSONObject res2 = (JSONObject) jsonObject2.get("data");
         JSONArray arr2 = JSON.parseArray(res2.getString("list"));
         JSONObject data2 = (JSONObject) arr2.get(0);
         String code2 = data2.get("indexCode").toString();
         //根据子节点编号获取设备播放地址
         String result3 = GetCameraPreviewURL.GetCameraPreviewURL(HkConstant.previewURLs, code2, ProtocolConstant.HLS);
         res = JSONObject.parseObject(result3);
      }
      return R.data(res);
   }