Your Name 1 year ago
parent
commit
878d78a795
3 changed files with 114 additions and 49 deletions
  1. 24 0
      pom.xml
  2. 6 1
      src/main/java/com/tuoren/forward/App.java
  3. 84 48
      src/main/resources/application.yml

+ 24 - 0
pom.xml

@@ -168,11 +168,35 @@
 			<artifactId>tea-util</artifactId>
 			<version>0.2.21</version>
 		</dependency>
+
+		<dependency>
+			<groupId> org.springframework.boot </groupId>
+			<artifactId> spring-boot-configuration-processor </artifactId>
+			<optional> true </optional>
+		</dependency>
+
+		<dependency>
+			<groupId>org.yaml</groupId>
+			<artifactId>snakeyaml</artifactId>
+			<version>1.30</version>
+		</dependency>
+
+		<dependency>
+			<groupId>io.netty</groupId>
+			<artifactId>netty-all</artifactId>
+		</dependency>
+
 		<!--<dependency>
         	<groupId>com.demo</groupId>
         	<artifactId>forward</artifactId>
         	<version>0.0.1-SNAPSHOT</version>
         </dependency>-->
+
+		<dependency>
+			<groupId>org.eclipse.californium</groupId>
+			<artifactId>californium-core</artifactId>
+			<version>2.0.0-M17</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 6 - 1
src/main/java/com/tuoren/forward/App.java

@@ -1,7 +1,11 @@
 package com.tuoren.forward;
 
+import com.tuoren.forward.netty.YmlConfig;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.ComponentScan;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 /**
@@ -10,13 +14,14 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
  */
 @SpringBootApplication
 @EnableTransactionManagement
-//@MapperScan("com.tuoren.forward.mapper")
+@EnableConfigurationProperties(YmlConfig.class)
 public class App {
 
 	/**
 	 * @title 项目启动 
 	 * @param args
 	 */
+
 	public static void main(String[] args) {
 		SpringApplication.run(App.class, args);
 	}

+ 84 - 48
src/main/resources/application.yml

@@ -2,7 +2,7 @@ server:
   port: 8585
 spring:
   profiles:
-      active: dev
+    active: dev
   application:
     name: forward
   jackson:
@@ -10,7 +10,7 @@ spring:
     date-format: yyyy-MM-dd HH:mm:ss
 
 
-    
+
 mybatis:
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
@@ -18,7 +18,7 @@ mybatis:
 #  type-aliases-package: com.tuoren.forward.entity,com.tuoren.forward.entity.dto,com.tuoren.forward.entity.req,com.tuoren.forward.entity.resp
 
 # Sa-Token配置
-sa-token: 
+sa-token:
   # token 名称 (同时也是cookie名称)
   token-name: token
   # token 有效期,单位s 默认30天, -1代表永不过期 
@@ -34,7 +34,7 @@ sa-token:
   # 是否输出操作日志 
   is-log: false
   isReadCookie: false
-  
+
 #开发环境
 ---
 spring:
@@ -63,10 +63,11 @@ spring:
     baseline-on-migrate: true
   redis:
     database: 2
-    host: 127.0.0.1
+    host: 192.168.103.33
     port: 6379
+
     timeout: 5000
-    lettuce: 
+    lettuce:
       pool:
         # 连接池最大连接数
         max-active: 200
@@ -74,7 +75,7 @@ spring:
         max-wait: -1ms
         # 连接池中的最大空闲连接
         max-idle: 10
-         # 连接池中的最小空闲连接
+        # 连接池中的最小空闲连接
         min-idle: 0
   data:
     mongodb:
@@ -83,17 +84,27 @@ spring:
       database: forward
       username: forward
       password: 1qaz!QAZ
-
 mqtt:
-  hostUrl: tcp://192.168.100.32:1883		# 你自己服务器的地址和端口,这个需要改 
-  clientId: fe80aba1dfd66b3576ce							# 这个改不改随意,但不同的客户端肯定不能一样
-  username: server							
-  password: 1qaz!QAZ
-  timeout: 100							   
-  keepalive: 100
-  
+    hostUrl: tcp://192.168.100.32:1883        # 你自己服务器的地址和端口,这个需要改
+    clientId: fe80aba1dfd66b3576ce                            # 这个改不改随意,但不同的客户端肯定不能一样
+    username: server
+    password: 1qaz!QAZ
+    timeout: 100
+    keepalive: 100
+
+register:
+    port: 8888
+    accessKey: LTAI5tRaK95AqvWiQ9LspZ3q
+    accessKeySecret: wZUpYGeztNcV4tGbBLfK2OvxnZzZF3
+    productKey: k0g9w9xRhhi
+    productSecret: TLkQNSgJnEDP2Rx7
+    instanceId: iot-06z00hi2guq5qi3
+    regionId: cn-shanghai
+
+
+
 #阿里云配置
-aliyun1: 
+aliyun1:
   enable: true
   accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
   accessSecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
@@ -101,8 +112,8 @@ aliyun1:
   iotInstanceId: iot-060a0bgd
   clientId: fe80aba1dfd66b3576ce
   amqpHost: iot-060a0bgd.amqp.iothub.aliyuncs.com
-  
-aliyun2: 
+
+aliyun2:
   enable: true
   accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
   accessSecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
@@ -110,13 +121,14 @@ aliyun2:
   iotInstanceId: iot-060a0bgd
   clientId: fe80aba1dfd66b3576ce
   amqpHost: iot-060a0bgd.amqp.iothub.aliyuncs.com
-  
+
 #日志
 logging:
   config: classpath:log/logback.xml
-  path: D://logs/forward
-  level: 
+  level:
     com.tuoren.forward.mapper: debug
+  file:
+    path: D://logs/forward
 handleLog:
   enable: true   #是否记录请求操作
 #pca获取医院编码地址
@@ -124,6 +136,8 @@ remote:
   hospitalCodeAddress: https://pca.tuoren.com:9090/api/bus/device/info/hospitalCodeAndAlias
   h5Address: https://iot.tuoren.com/wap
 
+
+
 #测试环境
 ---
 spring:
@@ -155,7 +169,7 @@ spring:
     host: 192.168.100.249
     port: 6379
     timeout: 5000
-    lettuce: 
+    lettuce:
       pool:
         # 连接池最大连接数
         max-active: 200
@@ -163,7 +177,7 @@ spring:
         max-wait: -1ms
         # 连接池中的最大空闲连接
         max-idle: 10
-         # 连接池中的最小空闲连接
+        # 连接池中的最小空闲连接
         min-idle: 0
   data:
     mongodb:
@@ -174,15 +188,25 @@ spring:
       password: 1qaz!QAZ
 
 mqtt:
-  hostUrl: tcp://192.168.100.249:1883		# 你自己服务器的地址和端口,这个需要改 
-  clientId: fe80aba1dfd66b3576ce							# 这个改不改随意,但不同的客户端肯定不能一样
-  username: server							
+  hostUrl: tcp://192.168.100.249:1883        # 你自己服务器的地址和端口,这个需要改
+  clientId: fe80aba1dfd66b3576ce                            # 这个改不改随意,但不同的客户端肯定不能一样
+  username: server
   password: 1qaz!QAZ
-  timeout: 100							   
+  timeout: 100
   keepalive: 100
-  
+
+register:
+  port: 8888
+  #aliyun
+  accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
+  accessKeySecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
+  productKey: he1fuh9LSDW
+  productSecret: fQdyinHahyRhQcRZ
+  instanceId: iot-060a0bgd
+  regionId: cn-shanghai
+
 #阿里云配置
-aliyun1: 
+aliyun1:
   enable: true
   accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
   accessSecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
@@ -190,8 +214,8 @@ aliyun1:
   iotInstanceId: iot-060a0bgd
   clientId: fe80aba1dfd66b3576ce
   amqpHost: iot-060a0bgd.amqp.iothub.aliyuncs.com
-  
-aliyun2: 
+
+aliyun2:
   enable: false
   accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
   accessSecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
@@ -199,13 +223,14 @@ aliyun2:
   iotInstanceId: iot-060a0bgd
   clientId: fe80aba1dfd66b3576ce
   amqpHost: iot-060a0bgd.amqp.iothub.aliyuncs.com
-  
+
 #日志
 logging:
   config: classpath:log/logback.xml
-  path: /home/log/forward-service
-  level: 
+  level:
     com.tuoren.forward.mapper: debug
+  file:
+    path: /home/log/forward-service
 handleLog:
   enable: true   #是否记录请求操作
 #pca获取医院编码地址
@@ -213,7 +238,7 @@ remote:
   hospitalCodeAddress: https://pca.tuoren.com:9090/api/bus/device/info/hospitalCodeAndAlias
   h5Address: https://iot.tuoren.com/wap
 
-  
+
 #生产环境
 ---
 spring:
@@ -248,7 +273,7 @@ spring:
     host: 192.168.100.115
     port: 6379
     timeout: 5000
-    lettuce: 
+    lettuce:
       pool:
         # 连接池最大连接数
         max-active: 200
@@ -256,7 +281,7 @@ spring:
         max-wait: -1ms
         # 连接池中的最大空闲连接
         max-idle: 10
-         # 连接池中的最小空闲连接
+        # 连接池中的最小空闲连接
         min-idle: 0
   data:
     mongodb:
@@ -267,15 +292,25 @@ spring:
       password: 1qaz!QAZ
 
 mqtt:
-  hostUrl: tcp://192.168.100.115:1883		# 你自己服务器的地址和端口,这个需要改 
-  clientId: fe80aba1dfd66b3576ce							# 这个改不改随意,但不同的客户端肯定不能一样
-  username: server							
+  hostUrl: tcp://192.168.100.115:1883        # 你自己服务器的地址和端口,这个需要改
+  clientId: fe80aba1dfd66b3576ce                            # 这个改不改随意,但不同的客户端肯定不能一样
+  username: server
   password: 1qaz!QAZ
-  timeout: 100							   
+  timeout: 100
   keepalive: 100
-  
+
+register:
+  port: 8888
+  #aliyun
+  accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
+  accessKeySecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
+  productKey: he1fAihB9M9
+  productSecret: Bdqo0DpoMTY6bnDr
+  instanceId: iot-060a0bgd
+  regionId: cn-shanghai
+
 #阿里云配置
-aliyun1: 
+aliyun1:
   enable: true
   accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
   accessSecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
@@ -283,8 +318,8 @@ aliyun1:
   iotInstanceId: iot-060a0bgd
   clientId: fe80aba1dfd66b3576ce
   amqpHost: iot-060a0bgd.amqp.iothub.aliyuncs.com
-  
-aliyun2: 
+
+aliyun2:
   enable: true
   accessKey: LTAI4G7FA9ytMc76oNkJ45YJ
   accessSecret: R7hOvMfiHb0PYroDqUDXAYgB9htQss
@@ -292,13 +327,14 @@ aliyun2:
   iotInstanceId: iot-060a0bgd
   clientId: fe80aba1dfd66b3576ce
   amqpHost: iot-060a0bgd.amqp.iothub.aliyuncs.com
-  
+
 #日志
 logging:
   config: classpath:log/logback.xml
-  path: /home/log/forward-service
-  level: 
+  level:
     com.tuoren.forward.mapper: debug
+  file:
+    path: /home/log/forward-service
 handleLog:
   enable: true   #是否记录请求操作