| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package com.zhiqiyun.open.mvc.controller;
- import com.alibaba.fastjson.JSONObject;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.google.common.collect.Maps;
- import com.zhiqiyun.open.annotation.Permission;
- import com.zhiqiyun.open.core.models.hwVideo.DeviceList;
- import com.zhiqiyun.open.core.video.VideoDockingService;
- import com.zhiqiyun.open.mvc.Result;
- import com.zhiqiyun.open.mvc.params.QueryPageParams;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.util.List;
- import java.util.Map;
- /**
- * 华为视频接口登录问题
- *
- * @author NINGMEI
- */
- @RestController
- @RequestMapping("/hw/video/")
- public class HwVideoController {
- @Resource
- private VideoDockingService videoDockingService;
- @PostMapping("findPage")
- @Permission(value = "hw.video.find", tags = "查询子设备列表")
- public Result page(@RequestBody QueryPageParams pageParams) throws Exception {
- Map<String, String> params = Maps.newHashMap();
- params.put("fromIndex", String.valueOf((pageParams.getCurrent() - 1) * 10 + 1));
- params.put("toIndex", String.valueOf(pageParams.getCurrent() * 10));
- JSONObject jsonObject = videoDockingService.loadDeviceList(params);
- JSONObject cameraBriefExInfos = jsonObject.getJSONObject("cameraBriefExInfos");
- int total = cameraBriefExInfos.getIntValue("total");
- JSONObject cameraBriefInfoExList = jsonObject.getJSONObject("cameraBriefInfoExList");
- List<DeviceList> cameraBriefInfoExes = cameraBriefInfoExList.getJSONArray("cameraBriefInfoExes")
- .toJavaList(DeviceList.class);
- Page<DeviceList> resultData = pageParams.getPage();
- resultData.setTotal(total);
- resultData.setRecords(cameraBriefInfoExes);
- return Result.instance(Result.Code.SUCCESS).setData(resultData);
- }
- @Permission(value = "hw.video.url.find", tags = "获取视频URL信息")
- @PostMapping("/rtspUrl")
- public Result loadVideoRtspUrl(@RequestBody String cameraCode) throws Exception {
- JSONObject jsonObject = videoDockingService.loadVideoRtspUrl(cameraCode);
- return Result.instance(Result.Code.SUCCESS).setData(jsonObject.getString("rtspURL"));
- }
- }
|