| | |
| | | import cn.gistack.sm.hk.constant.ProtocolConstant; |
| | | import cn.gistack.sm.hk.service.HkService; |
| | | import cn.gistack.sm.hk.vo.HkVO; |
| | | import cn.gistack.sm.hk.vo.VideoVO; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.gistack.sm.hk.util.GetCameraUtils.*; |
| | |
| | | @ApiOperation(value = "海康设备-分页列表查询", notes = "海康设备-分页列表查询") |
| | | @GetMapping(value = "/queryHkList") |
| | | public R queryHkList(Query query) { |
| | | String result = GetCameraResourcePage(query.getCurrent(), query.getSize(), HkConstant.cameras); |
| | | String result = GetCameraResourcePage(1,query.getCurrent(), query.getSize(), HkConstant.cameras); |
| | | JSONObject jsonObject1 = JSONObject.parseObject(result); |
| | | // 查询海康设备列表并返回 |
| | | return R.data(jsonObject1); |
| | |
| | | @ApiOperation(value = "海康设备-海康播放url查询(ws)", notes = "海康设备-海康播放url查询(ws)") |
| | | @GetMapping(value = "/queryHkPreviewUrl") |
| | | public R queryHkPreviewUrl(HkVO hk) { |
| | | String expand = ""; |
| | | if (null!=hk.getExpand() && !hk.getExpand().equals("")){ |
| | | expand = hk.getExpand(); |
| | | } |
| | | String url = ""; |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.WS); |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(), |
| | | HkConstant.previewURLs, |
| | | hk.getCameraIndexCode(), |
| | | ProtocolConstant.WS, |
| | | expand); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | | url = map.get("url").toString(); |
| | | } |
| | | // 查询海康设备列表并返回 |
| | | return R.data(url); |
| | | } |
| | | |
| | | /** |
| | | * 海康播放url查询-可以传协议 |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-海康播放url查询", notes = "海康设备-海康播放url查询") |
| | | @GetMapping(value = "/queryHkPreviewUrlCommon") |
| | | public R queryHkPreviewUrlCommon(HkVO hk) { |
| | | String url = ""; |
| | | String expand = ""; |
| | | if (null!=hk.getExpand() && !hk.getExpand().equals("")){ |
| | | expand = hk.getExpand(); |
| | | } |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(), |
| | | HkConstant.previewURLs, |
| | | hk.getCameraIndexCode(), |
| | | hk.getProtocol(), |
| | | expand); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | | url = map.get("url").toString(); |
| | | } |
| | | // 查询海康设备列表并返回 |
| | | return R.data(url); |
| | | } |
| | | |
| | | /** |
| | | * 海康播放url查询(Hls) |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-海康播放url查询(Hls)", notes = "海康设备-海康播放url查询(Hls)") |
| | | @GetMapping(value = "/queryHkPreviewUrlByHls") |
| | | public R queryHkPreviewUrlByHls(HkVO hk) { |
| | | String url = ""; |
| | | String expand = ""; |
| | | if (null!=hk.getExpand() && !hk.getExpand().equals("")){ |
| | | expand = hk.getExpand(); |
| | | } |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(), |
| | | HkConstant.previewURLs, |
| | | hk.getCameraIndexCode(), |
| | | ProtocolConstant.HLS, |
| | | expand); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | @GetMapping(value = "/handleCameraPosition") |
| | | public R handleCameraPosition(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = controlling(HkConstant.controllingURLs, |
| | | hk.getCameraIndexCode(),hk.getAction(),hk.getCommand(),hk.getSpeed(),null); |
| | | String result = controlling(null==hk.getType()?1:hk.getType(),HkConstant.controllingURLs, |
| | | hk.getCameraIndexCode(),hk.getAction(),hk.getCommand(),hk.getSpeed(),hk.getPresetIndex()); |
| | | // 返回 |
| | | return R.data(result); |
| | | } |
| | |
| | | @GetMapping(value = "/selZoom") |
| | | public R selZoom(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = selZoomURLs(HkConstant.selZoomURLs, |
| | | String result = selZoomURLs(null==hk.getType()?1:hk.getType(),HkConstant.selZoomURLs, |
| | | hk.getCameraIndexCode(),hk.getStartX(),hk.getStartY(),hk.getEndX(),hk.getEndY()); |
| | | // 返回 |
| | | return R.data(result); |
| | | } |
| | | |
| | | /** |
| | | * 查询监控点的预置点信息 |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-查询监控点的预置点信息", notes = "海康设备-查询监控点的预置点信息") |
| | | @GetMapping(value = "/presetsSearchesUrls") |
| | | public R presetsSearchesUrls(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = presetsSearches(null==hk.getType()?1:hk.getType(),HkConstant.presetsSearchesUrls,hk.getCameraIndexCode()); |
| | | // 返回 |
| | | return R.data(result); |
| | | } |
| | |
| | | @GetMapping(value = "/manualCapture") |
| | | public R manualCapture(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = manualCaptureUrls(HkConstant.manualCaptureUrls, |
| | | String result = manualCaptureUrls(null==hk.getType()?1:hk.getType(),HkConstant.manualCaptureUrls, |
| | | hk.getCameraIndexCode()); |
| | | // 返回 |
| | | return R.data(result); |
| | |
| | | return R.data(hkService.getHkStatisticData(hk,query)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取海康摄像头回放url |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-获取海康摄像头回放url", notes = "海康设备-获取海康摄像头回放url") |
| | | @GetMapping(value = "/playbackURLs") |
| | | public R playbackURLs(HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", hk.getCameraIndexCode()); |
| | | jsonBody.put("protocol", hk.getProtocol()); |
| | | jsonBody.put("recordLocation", "1"); |
| | | jsonBody.put("beginTime", hk.getBeginTime()); |
| | | jsonBody.put("endTime", hk.getEndTime()); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.playbackURLs, body)); |
| | | } |
| | | |
| | | /** |
| | | * 获取海康摄像头语音对讲url |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-获取海康摄像头语音对讲url", notes = "海康设备-获取海康摄像头语音对讲url") |
| | | @GetMapping(value = "/talkURLs") |
| | | public R talkURLs(HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", hk.getCameraIndexCode()); |
| | | jsonBody.put("protocol", hk.getProtocol()); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.talkURLs, body)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置监控点的预置点信息 |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-设置监控点的预置点信息", notes = "海康设备-设置监控点的预置点信息") |
| | | @GetMapping(value = "/presetsAddition") |
| | | public R presetsAddition(HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", hk.getCameraIndexCode()); |
| | | jsonBody.put("presetName", hk.getPresetName()); |
| | | jsonBody.put("presetIndex", hk.getPresetIndex()); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.presetsAdditionURLs, body)); |
| | | } |
| | | |
| | | /** |
| | | * 删除监控点的预置点信息 |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-删除监控点的预置点信息", notes = "海康设备-删除监控点的预置点信息") |
| | | @GetMapping(value = "/presetsDeletion") |
| | | public R presetsDeletion(HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", hk.getCameraIndexCode()); |
| | | jsonBody.put("presetIndex", hk.getPresetIndex()); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.presetsDeletionURLs, body)); |
| | | } |
| | | |
| | | /** |
| | | * 同步水库设备信息 |
| | | * @param hk 水库设备 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-同步水库设备信息", notes = "海康设备-同步水库设备信息") |
| | | @PostMapping(value = "/syncVideo") |
| | | public R syncVideo(@RequestBody HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | List<VideoVO> list = new ArrayList<>(); |
| | | VideoVO video = new VideoVO(); |
| | | video.setRegionName(hk.getRegionName()); |
| | | video.setRegionIndexCode(hk.getRegionIndexCode()); |
| | | video.setParentIndexCode("root000000"); |
| | | video.setRegionType(10); |
| | | list.add(video); |
| | | String body = JSON.toJSONString(list); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(JSONObject.parseObject(common(null==hk.getType()?2:hk.getType(),HkConstant.batchAddURLs, body))); |
| | | } |
| | | |
| | | } |