Просмотр исходного кода

pms 海康 hikvision api 对接

zhangcl 1 неделя назад
Родитель
Сommit
5fde8fbea5

+ 10 - 0
yudao-module-pms/yudao-module-pms-biz/pom.xml

@@ -80,6 +80,16 @@
             <scope>system</scope>
             <systemPath>${project.basedir}/src/main/resources/lib/sapjco3.jar</systemPath>
         </dependency>
+
+        <!-- 海康视频监控相关 -->
+        <dependency>
+            <groupId>com.hikvision.ga</groupId>
+            <artifactId>artemis-http-client</artifactId>
+            <version>1.1.15.RELEASE</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/artemis-http-client-1.1.16.RELEASE.jar</systemPath>
+        </dependency>
+
         <!-- 拼音 -->
         <dependency>
             <groupId>com.belerweb</groupId>

+ 65 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/hikvision/HikvisionController.java

@@ -0,0 +1,65 @@
+package cn.iocoder.yudao.module.pms.hikvision;
+
+import cn.hutool.core.util.StrUtil;
+import cn.iocoder.yudao.module.pms.hikvision.vo.MonitorPointsPageReqVO;
+import com.alibaba.fastjson.JSON;
+import com.hikvision.artemis.sdk.ArtemisHttpUtil;
+import com.hikvision.artemis.sdk.config.ArtemisConfig;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Tag(name = "管理后台 - hikvision 实时视频 录像相关接口")
+@RequestMapping("/vms")
+@RestController
+@Validated
+public class HikvisionController {
+
+    @Value("${hikvision.appKey}")
+    private String appKey;
+
+    @Value("${hikvision.appSecret}")
+    private String appSecret;
+
+    @Value("${hikvision.host}")
+    private String host;
+
+    @Value("${hikvision.artemisPath}")
+    private String artemisPath;
+
+    @Value("${hikvision.monitorPoints}")
+    private String monitorPoints;
+
+    @GetMapping("/monitorPoints")
+    @Operation(summary = "查询监控点列表v2")
+    public String monitorPoints(MonitorPointsPageReqVO pageReqVO) {
+        ArtemisConfig config = new ArtemisConfig();
+        config.setHost(host); // 代理API网关nginx服务器ip端口
+        config.setAppKey(appKey);  // 秘钥appkey
+        config.setAppSecret(appSecret);// 秘钥appSecret
+        Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数
+        paramMap.put("pageNo", pageReqVO.getPageNo().toString());
+        paramMap.put("pageSize", pageReqVO.getPageSize().toString());
+        String body = JSON.toJSON(paramMap).toString();
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                put("https://", monitorPoints);
+            }
+        };
+        String result = StrUtil.EMPTY;
+        try {
+            result = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
+        } catch (Exception e) {
+            result = "接口异常";
+        }
+        return result;
+    }
+
+}

+ 18 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/hikvision/vo/MonitorPointsPageReqVO.java

@@ -0,0 +1,18 @@
+package cn.iocoder.yudao.module.pms.hikvision.vo;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Schema(description = "管理后台 - hikvision Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class MonitorPointsPageReqVO extends PageParam {
+
+    @Schema(description = "日报名称", example = "名称,模糊搜索,最大长度32,若包含中文,最大长度指不超过按照指定编码的字节长度,即getBytes(\"utf-8\").length")
+    private String name;
+
+}

BIN
yudao-module-pms/yudao-module-pms-biz/src/main/resources/lib/artemis-http-client-1.1.16.RELEASE.jar


+ 8 - 0
yudao-server/src/main/resources/application-prod.yaml

@@ -186,6 +186,14 @@ sap:
     pool_capacity: 10
     peak_limit: 20
 
+--- #################### hikvision 相关配置 ####################
+hikvision:
+  appKey: 24712355
+  appSecret: nn9oLQniUttSydka7a9o
+  host: 172.30.100.100:1443    # vms.deepoil.cc:1443
+  artemisPath: /artemis
+  monitorPoints: /artemis/api/resource/v2/camera/search   #监控点列表v2
+
 --- #################### 微信公众号相关配置 ####################
 wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
   mp: