|
@@ -1,13 +1,24 @@
|
|
|
package com.usky.iot.controller.web;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.usky.common.core.bean.ApiResult;
|
|
|
+import com.usky.common.core.exception.BusinessException;
|
|
|
+import com.usky.common.core.util.HttpUtils;
|
|
|
+import com.usky.common.core.util.StringUtils;
|
|
|
+import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.iot.service.BaseAlarmService;
|
|
|
import com.usky.iot.service.DmpDataInfoService;
|
|
|
import com.usky.iot.service.DmpDeviceStatusService;
|
|
|
import com.usky.backend.domain.request.DmpDeviceDataRequestVO;
|
|
|
+import com.usky.transfer.RemoteTransferService;
|
|
|
+import org.apache.catalina.security.SecurityUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* @author zyj
|
|
|
* @date 2023/6/8 13:52:05
|
|
@@ -22,6 +33,9 @@ public class DeviceHttpController {
|
|
|
@Autowired
|
|
|
private DmpDataInfoService dmpDataInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteTransferService remoteTransferService;
|
|
|
+
|
|
|
@GetMapping(value = "/status")
|
|
|
public ApiResult<Void> status(){
|
|
|
baseAlarmService.status();
|
|
@@ -39,5 +53,88 @@ public class DeviceHttpController {
|
|
|
return ApiResult.success();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 下发门禁开门
|
|
|
+ */
|
|
|
+ @GetMapping("/doorControl")
|
|
|
+ public ApiResult<Map<String,Object>> control(@RequestParam("productCode") String productCode,
|
|
|
+ @RequestParam("deviceId") String deviceId,
|
|
|
+ @RequestParam("commandCode") String commandCode,
|
|
|
+ @RequestParam("commandValue") String commandValue){
|
|
|
+ Integer tenantId = SecurityUtils.getTenantId();
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("method","control");
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
+ map1.put("device_id",deviceId);
|
|
|
+ map1.put("commandCode",commandCode);
|
|
|
+ map1.put("commandValue",commandValue);
|
|
|
+ map.put("params",map1);
|
|
|
+
|
|
|
+ return ApiResult.success(remoteTransferService.deviceControl(productCode,deviceId,JSON.toJSONString(map),tenantId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-海康监控系统实时视频预览取流
|
|
|
+ *
|
|
|
+ * @param productCode 产品编码
|
|
|
+ * @param deviceId 设备Id
|
|
|
+ * @param streamType 码流类型,0:主码流 1:子码流 2:第三码流 参数不填,默认为主码流
|
|
|
+ * @param protocol 取流协议(应用层协议),“rtsp”:RTSP协议,“rtmp”:RTMP协议,“hls”:HLS协议(HLS协议只支持海康SDK协议、EHOME协议、GB28181协议、ONVIF协议接入的设备;只支持H264视频编码和AAC音频编码),参数不填,默认为RTSP协议
|
|
|
+ * @param transmode 传输协议(传输层协议),0:UDP 1:TCP 默认是TCP 注: GB28181 2011及以前版本只支持UDP传输
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/hikVideoStream")
|
|
|
+ public ApiResult<Map<String, Object>> hikVideoStream(@RequestParam("productCode") String productCode,
|
|
|
+ @RequestParam("deviceId") String deviceId,
|
|
|
+ @RequestParam("streamType") Integer streamType,
|
|
|
+ @RequestParam("protocol") String protocol,
|
|
|
+ @RequestParam("transmode") Integer transmode){
|
|
|
+ Integer tenantId = SecurityUtils.getTenantId();
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("method","streamControl");
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
+ map1.put("device_id",deviceId);
|
|
|
+ map1.put("streamType",streamType);
|
|
|
+ map1.put("protocol",protocol);
|
|
|
+ map1.put("transmode",transmode);
|
|
|
+ map.put("params",map1);
|
|
|
+
|
|
|
+ return ApiResult.success(remoteTransferService.deviceControl(productCode,deviceId, JSON.toJSONString(map),tenantId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取海康系统行车记录数据
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("driverRecordList")
|
|
|
+ public ApiResult<Map<String,Object>> driverRecordList(@RequestParam(value = "startTime",required = false) String startTime,
|
|
|
+ @RequestParam(value = "endTime",required = false) String endTime,
|
|
|
+ @RequestParam(value = "pageNo") Integer pageNo,
|
|
|
+ @RequestParam(value = "pageSize") Integer pageSize){
|
|
|
+ Integer tenantId = SecurityUtils.getTenantId();
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("method","driverRecordControl");
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
+ if(StringUtils.isNotBlank(startTime)){
|
|
|
+ map1.put("startTime",startTime);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(endTime)){
|
|
|
+ map1.put("endTime",endTime);
|
|
|
+ }
|
|
|
+ map1.put("pageNo",pageNo);
|
|
|
+ map1.put("pageSize",pageSize);
|
|
|
+ map.put("params",map1);
|
|
|
+
|
|
|
+ return ApiResult.success(remoteTransferService.deviceControl("501_HGHK","0001",JSON.toJSONString(map),tenantId));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|