From b936b1ebc9654f35f212148019536946ed5fd956 Mon Sep 17 00:00:00 2001
From: huzhengkao <562572218@qq.com>
Date: Tue, 20 May 2025 16:11:22 +0800
Subject: [PATCH 1/5] =?UTF-8?q?maven=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 7373e0c..4db2994 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
tcctyn-cloud
1.0.0
- forest-fire
+ tcctyn-cloud
森林防火监测预警管理平台
From 36eccebd31cc8e6755f6782646d829a9fc7801d2 Mon Sep 17 00:00:00 2001
From: huzhengkao <562572218@qq.com>
Date: Thu, 22 May 2025 15:08:05 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sql/iot.sql | 21 +++++
tcctyn-common/tcctyn-common-core/pom.xml | 5 ++
tcctyn-modules/pom.xml | 1 +
tcctyn-modules/tcctyn-iot/pom.xml | 89 +++++++++++++++++++
.../com/tcctyn/iot/TcctynIotApplication.java | 18 ++++
.../src/main/resources/application.yml | 25 ++++++
.../tcctyn-iot/src/main/resources/banner.txt | 11 +++
7 files changed, 170 insertions(+)
create mode 100644 sql/iot.sql
create mode 100644 tcctyn-modules/tcctyn-iot/pom.xml
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/TcctynIotApplication.java
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/resources/application.yml
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/resources/banner.txt
diff --git a/sql/iot.sql b/sql/iot.sql
new file mode 100644
index 0000000..41ef815
--- /dev/null
+++ b/sql/iot.sql
@@ -0,0 +1,21 @@
+CREATE TABLE api_configs (
+ id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+ name VARCHAR(64) NOT NULL COMMENT 'API名称',
+ url VARCHAR(255) NOT NULL COMMENT 'API URL地址',
+ api_key VARCHAR(255) DEFAULT NULL COMMENT 'API访问密钥',
+ api_secret VARCHAR(512) DEFAULT NULL COMMENT 'API安全密钥',
+ status TINYINT(1) UNSIGNED DEFAULT 0 COMMENT '状态(0-启用 1-停用)',
+ create_time datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ update_time datetime COMMENT '更新时间',
+ create_by VARCHAR(64) DEFAULT NULL COMMENT '创建人',
+ update_by VARCHAR(64) DEFAULT NULL COMMENT '更新人',
+ is_deleted TINYINT(1) UNSIGNED DEFAULT 0 COMMENT '是否删除(0-未删除 1-已删除)',
+ remark VARCHAR(255) DEFAULT NULL COMMENT '备注',
+ PRIMARY KEY (id),
+ UNIQUE KEY uk_name (name) COMMENT 'API名称唯一索引',
+ KEY idx_status (status) COMMENT '状态索引'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='API信息配置表';
+
+
+INSERT INTO api_configs (name, url, api_key, api_secret, status,create_by)
+VALUES("海康平台API","https://116.53.205.228:14443/artemis","21887937","hwOzOEqxuPDz5frAnEXb",0,"admin");
\ No newline at end of file
diff --git a/tcctyn-common/tcctyn-common-core/pom.xml b/tcctyn-common/tcctyn-common-core/pom.xml
index b4016c2..e2f9873 100644
--- a/tcctyn-common/tcctyn-common-core/pom.xml
+++ b/tcctyn-common/tcctyn-common-core/pom.xml
@@ -107,6 +107,11 @@
javax.servlet-api
+
+ org.projectlombok
+ lombok
+
+
diff --git a/tcctyn-modules/pom.xml b/tcctyn-modules/pom.xml
index 55037f6..8ed4a4c 100644
--- a/tcctyn-modules/pom.xml
+++ b/tcctyn-modules/pom.xml
@@ -11,6 +11,7 @@
tcctyn-system
tcctyn-gen
+ tcctyn-iot
tcctyn-modules
diff --git a/tcctyn-modules/tcctyn-iot/pom.xml b/tcctyn-modules/tcctyn-iot/pom.xml
new file mode 100644
index 0000000..7b61830
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/pom.xml
@@ -0,0 +1,89 @@
+
+
+ 4.0.0
+
+ com.tcctyn
+ tcctyn-modules
+ 1.0.0
+
+ tcctyn-iot
+
+
+ tcctyn-iot物联网模块
+
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ org.apache.velocity
+ velocity-engine-core
+
+
+
+
+ com.mysql
+ mysql-connector-j
+
+
+
+
+ com.tcctyn
+ tcctyn-common-log
+
+
+
+
+ com.tcctyn
+ tcctyn-common-swagger
+
+
+
+ com.tcctyn
+ tcctyn-common-core
+
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/TcctynIotApplication.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/TcctynIotApplication.java
new file mode 100644
index 0000000..3235800
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/TcctynIotApplication.java
@@ -0,0 +1,18 @@
+package com.tcctyn.iot;
+
+import com.tcctyn.common.security.annotation.EnableCustomConfig;
+import com.tcctyn.common.security.annotation.EnableRyFeignClients;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableCustomConfig
+@EnableRyFeignClients
+@SpringBootApplication
+public class TcctynIotApplication {
+
+ public static void main(String[] args)
+ {
+ SpringApplication.run(TcctynIotApplication.class, args);
+ System.out.println("(♥◠‿◠)ノ゙ 物联网模块启动成功 ლ(´ڡ`ლ)゙");
+ }
+}
\ No newline at end of file
diff --git a/tcctyn-modules/tcctyn-iot/src/main/resources/application.yml b/tcctyn-modules/tcctyn-iot/src/main/resources/application.yml
new file mode 100644
index 0000000..f8feccf
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/resources/application.yml
@@ -0,0 +1,25 @@
+# Tomcat
+server:
+ port: 9004
+
+spring:
+ application:
+ name: ${artifactId}
+ cloud:
+ nacos:
+ username: @nacos.username@
+ password: @nacos.password@
+ # 服务发现配置
+ discovery:
+ server-addr: 47.109.202.121:8858
+ config:
+ server-addr: ${spring.cloud.nacos.discovery.server-addr}
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-@profiles.active@.${spring.cloud.nacos.config.file-extension}
+ config:
+ import:
+ # - optional:nacos:application-@profiles.active@.yml
+ - optional:nacos:${spring.application.name}-@profiles.active@.yml
diff --git a/tcctyn-modules/tcctyn-iot/src/main/resources/banner.txt b/tcctyn-modules/tcctyn-iot/src/main/resources/banner.txt
new file mode 100644
index 0000000..ad83e3e
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/resources/banner.txt
@@ -0,0 +1,11 @@
+Spring Boot Version: ${spring-boot.version}
+Spring Application Name: ${spring.application.name}
+
+ _ _ _ _
+ | | | | (_) | |
+ | |_ ___ ___ | |_ _ _ _ __ _ ___ | |_
+ | __| / __| / __| | __| | | | | | '_ \ | | / _ \ | __|
+ | |_ | (__ | (__ | |_ | |_| | | | | | | | | (_) | | |_
+ \__| \___| \___| \__| \__, | |_| |_| |_| \___/ \__|
+ __/ |
+ |___/
\ No newline at end of file
From 73a6924eef0d7da3a82967bff9a817596462e97d Mon Sep 17 00:00:00 2001
From: huzhengkao <562572218@qq.com>
Date: Thu, 22 May 2025 15:13:57 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/java/com/tcctyn/iot/common/config/test.java | 8 ++++++++
.../tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java | 8 ++++++++
.../tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java | 8 ++++++++
3 files changed, 24 insertions(+)
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java
new file mode 100644
index 0000000..8264136
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java
@@ -0,0 +1,8 @@
+package com.tcctyn.iot.common.config;
+
+/**
+ * @author Jason
+ * @date 2025年05月22日 15:13:27
+ */
+public class test {
+}
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java
new file mode 100644
index 0000000..a4f0c49
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java
@@ -0,0 +1,8 @@
+package com.tcctyn.iot.hk;
+
+/**
+ * @author Jason
+ * @date 2025年05月22日 15:13:09
+ */
+public class test {
+}
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java
new file mode 100644
index 0000000..2bc94f9
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java
@@ -0,0 +1,8 @@
+package com.tcctyn.iot.uav;
+
+/**
+ * @author Jason
+ * @date 2025年05月22日 15:13:16
+ */
+public class test {
+}
From 4a77e8e9cbdd332d779b035a8b84f935cbd5a729 Mon Sep 17 00:00:00 2001
From: huzhengkao <562572218@qq.com>
Date: Thu, 22 May 2025 16:17:07 +0800
Subject: [PATCH 4/5] =?UTF-8?q?API=20pom=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
tcctyn-modules/tcctyn-iot/pom.xml | 7 +++
.../main/java/com/tcctyn/iot/hk/TestApi.java | 49 +++++++++++++++++++
.../src/main/java/com/tcctyn/iot/hk/test.java | 8 ---
3 files changed, 56 insertions(+), 8 deletions(-)
create mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java
delete mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java
diff --git a/tcctyn-modules/tcctyn-iot/pom.xml b/tcctyn-modules/tcctyn-iot/pom.xml
index 7b61830..eed9978 100644
--- a/tcctyn-modules/tcctyn-iot/pom.xml
+++ b/tcctyn-modules/tcctyn-iot/pom.xml
@@ -68,6 +68,13 @@
tcctyn-common-core
+
+
+ com.hikvision.ga
+ artemis-http-client
+ 1.1.3
+
+
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java
new file mode 100644
index 0000000..6f2cbd4
--- /dev/null
+++ b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java
@@ -0,0 +1,49 @@
+package com.tcctyn.iot.hk;
+
+import com.alibaba.fastjson.JSON;
+import com.hikvision.artemis.sdk.ArtemisHttpUtil;
+import com.hikvision.artemis.sdk.config.ArtemisConfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Jason
+ * @date 2025年05月22日 15:13:09
+ */
+public class TestApi {
+
+ private static final String ARTEMIS_PATH = "/artemis";
+
+ /**
+ * 调用POST请求类型接口,这里以获取组织列表为例
+ * 接口实际url:https://ip:port/artemis/api/resource/v1/org/orgList
+ * @return
+ */
+ public static String callPostApiGetOrgList() throws Exception {
+ /**
+ * https://ip:port/artemis/api/resource/v1/org/orgList
+ * 通过查阅AI Cloud开放平台文档或网关门户的文档可以看到获取组织列表的接口定义,该接口为POST请求的Rest接口, 入参为JSON字符串,接口协议为https。
+ * ArtemisHttpUtil工具类提供了doPostStringArtemis调用POST请求的方法,入参可传JSON字符串, 请阅读开发指南了解方法入参,没有的参数可传null
+ */
+ ArtemisConfig config = new ArtemisConfig();
+ config.setHost("116.53.205.228:14443"); // 代理API网关nginx服务器ip端口
+ config.setAppKey("21887937"); // 秘钥appkey
+ config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret
+ final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/org/orgList";
+ Map paramMap = new HashMap();// post请求Form表单参数
+ paramMap.put("pageNo", "1");
+ paramMap.put("pageSize", "2");
+ String body = JSON.toJSON(paramMap).toString();
+ Map path = new HashMap(2) {
+ {
+ put("https://", getCamsApi);
+ }
+ };
+ return ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json");
+ }
+
+ public static void main(String[] args) throws Exception {
+ callPostApiGetOrgList();
+ }
+}
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java
deleted file mode 100644
index a4f0c49..0000000
--- a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.tcctyn.iot.hk;
-
-/**
- * @author Jason
- * @date 2025年05月22日 15:13:09
- */
-public class test {
-}
From 5f925b1ffe88cca87ca812d3ee26bb937b393f5d Mon Sep 17 00:00:00 2001
From: huzhengkao <562572218@qq.com>
Date: Thu, 22 May 2025 17:04:40 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
tcctyn-modules/tcctyn-iot/pom.xml | 13 ++++++
.../com/tcctyn/iot/common/config/test.java | 8 ----
.../main/java/com/tcctyn/iot/hk/TestApi.java | 46 ++++++++++++++++++-
.../main/java/com/tcctyn/iot/uav/test.java | 8 ----
4 files changed, 57 insertions(+), 18 deletions(-)
delete mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java
delete mode 100644 tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java
diff --git a/tcctyn-modules/tcctyn-iot/pom.xml b/tcctyn-modules/tcctyn-iot/pom.xml
index eed9978..a68b129 100644
--- a/tcctyn-modules/tcctyn-iot/pom.xml
+++ b/tcctyn-modules/tcctyn-iot/pom.xml
@@ -51,6 +51,19 @@
mysql-connector-j
+
+
+ com.tcctyn
+ tcctyn-common-datasource
+
+
+
+
+ com.tcctyn
+ tcctyn-common-datascope
+
+
+
com.tcctyn
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java
deleted file mode 100644
index 8264136..0000000
--- a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/common/config/test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.tcctyn.iot.common.config;
-
-/**
- * @author Jason
- * @date 2025年05月22日 15:13:27
- */
-public class test {
-}
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java
index 6f2cbd4..bafc8f1 100644
--- a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java
+++ b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/hk/TestApi.java
@@ -4,8 +4,14 @@ import com.alibaba.fastjson.JSON;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.time.Instant;
+import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
/**
* @author Jason
@@ -29,7 +35,8 @@ public class TestApi {
ArtemisConfig config = new ArtemisConfig();
config.setHost("116.53.205.228:14443"); // 代理API网关nginx服务器ip端口
config.setAppKey("21887937"); // 秘钥appkey
- config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret
+ config.setAppSecret("hwOzOEqxuPDz5frAnEXb");// 秘钥appSecret
+
final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/org/orgList";
Map paramMap = new HashMap();// post请求Form表单参数
paramMap.put("pageNo", "1");
@@ -40,7 +47,42 @@ public class TestApi {
put("https://", getCamsApi);
}
};
- return ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json");
+ Map headers = new HashMap<>();
+ headers.put("Content-Type", "application/json");
+ return ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, "application/json",headers);
+
+
+ }
+
+ public static String calculateSignature(String appKey,String appSecret, String method, String path,
+ String query, String body, String timestamp) {
+ try {
+ // 1. 构建待签名字符串
+ String content = method + "\n" +
+ "application/json\n" + // Accept
+ "application/json\n" + // Content-Type
+ "\n" + // Date (可为空)
+ "x-ca-key:" + appKey + "\n" +
+ "x-ca-nonce:" + UUID.randomUUID().toString() + "\n" +
+ "x-ca-timestamp:" + timestamp + "\n" +
+ path;
+
+ if (query != null && !query.isEmpty()) {
+ content += "?" + query;
+ }
+
+ content += "\n" + body;
+
+ // 2. 计算HMAC-SHA256签名
+ Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
+ SecretKeySpec secret_key = new SecretKeySpec(appSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
+ sha256_HMAC.init(secret_key);
+ byte[] hash = sha256_HMAC.doFinal(content.getBytes(StandardCharsets.UTF_8));
+
+ return Base64.getEncoder().encodeToString(hash);
+ } catch (Exception e) {
+ throw new RuntimeException("计算签名失败", e);
+ }
}
public static void main(String[] args) throws Exception {
diff --git a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java b/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java
deleted file mode 100644
index 2bc94f9..0000000
--- a/tcctyn-modules/tcctyn-iot/src/main/java/com/tcctyn/iot/uav/test.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.tcctyn.iot.uav;
-
-/**
- * @author Jason
- * @date 2025年05月22日 15:13:16
- */
-public class test {
-}