| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package beilv.hik.controller;
- import beilv.common.core.controller.BaseController;
- import beilv.common.core.domain.AjaxResult;
- import beilv.hik.controller.utils.GetCameraPreviewURL;
- import beilv.hik.controller.utils.GetCameras;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Controller;
- import org.springframework.util.CollectionUtils;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- @Controller
- @RequestMapping("/system/hik")
- public class HiKController extends BaseController {
- private String prefix = "system/hik";
- @GetMapping()
- public String hik() {
- return prefix + "/hik";
- }
- @Value("${hik.appKey}")
- private String appKey;
- @Value("${hik.appSecret}")
- private String appSecret;
- @Value("${hik.host}")
- private String host;
- /**
- * 根据userId查询用户积分流水列表
- */
- @GetMapping("/getCameraPreviewURL")
- @ResponseBody
- public AjaxResult getCameraPreviewURL() {
- List<String> urlList = new ArrayList<>();
- List<Map<String, Object>> cameras = GetCameras.getCameras(host, appKey, appSecret);
- if (!CollectionUtils.isEmpty(cameras)) {
- for (Map<String, Object> map : cameras) {
- String url = GetCameraPreviewURL.getCameraPreviewURL(host, appKey, appSecret, map.get("cameraIndexCode").toString());
- urlList.add(url);
- }
- }
- return AjaxResult.success(urlList);
- }
- }
|