findByGatewayIdAndClassifyId(Integer gateway_id,Integer classify_id) {
79 | return sensorMapper.findByGatewayIdAndClassifyId(gateway_id,classify_id);
80 | }
81 |
82 | @Override
83 | public Sensor findByIdWithDatas(int id) {
84 | return sensorMapper.findByIdWithDatas(id);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/com/my/iot/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.my.iot.service.impl;
2 |
3 | import com.my.iot.domain.User;
4 | import com.my.iot.mapper.UserMapper;
5 | import com.my.iot.service.UserService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | @Service("userService")
10 | public class UserServiceImpl implements UserService {
11 | @Autowired
12 | private UserMapper userMapper;
13 |
14 | @Override
15 | public boolean regist(User user) {
16 | User u = userMapper.findByUsername(user.getUsername());
17 | if (u != null) {//用户名已存在,注册失败
18 | return false;
19 | }
20 | userMapper.insert(user);//不存在,注册
21 | return true;
22 | }
23 |
24 | @Override
25 | public User login(User user) {//登录,成功返回完整用户信息,失败返回null
26 | return userMapper.findByUsernameAndPassword(user);
27 | }
28 |
29 | @Override
30 | public void update(User user) {
31 | userMapper.update(user);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/my/iot/util/Md5Util.java:
--------------------------------------------------------------------------------
1 | package com.my.iot.util;
2 |
3 | import java.security.MessageDigest;
4 |
5 | /**
6 | * 写一个MD5算法,运行结果与MySQL的md5()函数相同
7 | * 将明文密码转成MD5密码
8 | * 123456->e10adc3949ba59abbe56e057f20f883e
9 | */
10 | public final class Md5Util {
11 | private Md5Util(){}
12 | /**
13 | * 将明文密码转成MD5密码
14 | */
15 | public static String encodeByMd5(String password) throws Exception{
16 | //Java中MessageDigest类封装了MD5和SHA算法,今天我们只要MD5算法
17 | MessageDigest md5 = MessageDigest.getInstance("MD5");
18 | //调用MD5算法,即返回16个byte类型的值
19 | byte[] byteArray = md5.digest(password.getBytes());
20 | //注意:MessageDigest只能将String转成byte[],接下来的事情,由我们程序员来完成
21 | return byteArrayToHexString(byteArray);
22 | }
23 | /**
24 | * 将byte[]转在16进制字符串
25 | */
26 | private static String byteArrayToHexString(byte[] byteArray) {
27 | StringBuffer sb = new StringBuffer();
28 | //遍历
29 | for(byte b : byteArray){//16次
30 | //取出每一个byte类型,进行转换
31 | String hex = byteToHexString(b);
32 | //将转换后的值放入StringBuffer中
33 | sb.append(hex);
34 | }
35 | return sb.toString();
36 | }
37 | /**
38 | * 将byte转在16进制字符串
39 | */
40 | private static String byteToHexString(byte b) {//-31转成e1,10转成0a,。。。
41 | //将byte类型赋给int类型
42 | int n = b;
43 | //如果n是负数
44 | if(n < 0){
45 | //转正数
46 | //-31的16进制数,等价于求225的16进制数
47 | n = 256 + n;
48 | }
49 | //商(14),数组的下标
50 | int d1 = n / 16;
51 | //余(1),数组的下标
52 | int d2 = n % 16;
53 | //通过下标取值
54 | return hex[d1] + hex[d2];
55 | }
56 | private static String[] hex = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"};
57 | /**
58 | * 测试
59 | */
60 | public static void main(String[] args) throws Exception{
61 | String password = "123456";
62 | String passwordMD5 = Md5Util.encodeByMd5(password);
63 | System.out.println(password);
64 | System.out.println(passwordMD5);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080 # 内置tomcat端口
3 | servlet:
4 | context-path: / # 项目部署虚拟路径
5 |
6 | spring:
7 | datasource: # hikari pool 数据源
8 | driver-class-name: com.mysql.jdbc.Driver
9 | url: jdbc:mysql://localhost:3306/iot
10 | username: root
11 | password: root
12 | redis:
13 | host: 127.0.0.1
14 | port: 6379
15 |
16 | mybatis:
17 | type-aliases-package: com.my.domain # pojo别名扫描
--------------------------------------------------------------------------------
/src/main/resources/iot.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.26, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: iot
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.26-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `tb_data`
20 | --
21 |
22 | DROP TABLE IF EXISTS `tb_data`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `tb_data` (
26 | `id` int(11) NOT NULL AUTO_INCREMENT,
27 | `data` float DEFAULT NULL,
28 | `time` datetime DEFAULT NULL,
29 | `sensor_id` int(11) NOT NULL,
30 | PRIMARY KEY (`id`),
31 | KEY `fk_data_sensor_1` (`sensor_id`),
32 | CONSTRAINT `fk_data_sensor_1` FOREIGN KEY (`sensor_id`) REFERENCES `tb_sensor` (`id`)
33 | ) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
34 | /*!40101 SET character_set_client = @saved_cs_client */;
35 |
36 | --
37 | -- Dumping data for table `tb_data`
38 | --
39 |
40 | LOCK TABLES `tb_data` WRITE;
41 | /*!40000 ALTER TABLE `tb_data` DISABLE KEYS */;
42 | INSERT INTO `tb_data` VALUES (1,0,'2020-02-17 14:16:32',1),(2,0.1,'2020-02-17 14:16:33',1),(3,0.2,'2020-02-17 14:16:34',1),(4,0.3,'2020-02-17 14:16:35',1),(5,0.4,'2020-02-17 14:16:46',1),(6,0.5,'2020-02-17 14:16:47',1),(7,0.6,'2020-02-17 14:16:48',1),(8,0.7,'2020-02-17 14:16:49',1),(9,0.8,'2020-02-17 14:16:50',1),(10,0.9,'2020-02-17 14:16:51',1),(11,0,'2020-02-17 18:05:24',2),(12,0.2,'2020-02-17 18:05:25',2),(13,0.4,'2020-02-17 18:05:26',2),(14,0.6,'2020-02-17 18:05:27',2),(15,0.8,'2020-02-17 18:05:28',2),(16,1,'2020-02-17 18:05:29',2),(17,1.2,'2020-02-17 18:05:30',2),(18,1.4,'2020-02-17 18:05:31',2),(19,1.6,'2020-02-17 18:05:32',2),(20,1.8,'2020-02-17 18:05:33',2),(21,11.78,'2020-02-20 00:23:48',2),(22,61.97,'2020-05-13 16:26:07',9),(23,76.67,'2020-05-13 16:26:17',9),(24,11.96,'2020-05-13 16:26:19',9),(25,91.32,'2020-05-13 16:26:20',9),(26,71.42,'2020-05-13 16:26:22',9),(27,48.56,'2020-05-13 16:29:48',9),(28,31.27,'2020-05-13 16:29:49',9),(29,69.18,'2020-05-13 16:29:52',9),(30,39.23,'2020-05-13 16:29:54',9),(31,73.88,'2020-05-13 16:29:56',9),(32,65.97,'2020-05-13 16:57:12',9),(33,65.52,'2020-05-13 16:58:50',9),(40,-2.3,'2020-05-13 17:05:57',9),(41,-1.3,'2020-05-13 17:05:58',9),(42,-0.3,'2020-05-13 17:05:59',9),(43,0.699,'2020-05-13 17:06:00',9),(44,1.699,'2020-05-13 17:06:01',9),(45,64.29,'2020-05-13 21:45:38',9),(46,92.22,'2020-05-13 21:47:58',9),(47,42.12,'2020-05-13 21:48:06',9),(48,43.12,'2020-05-13 21:48:07',9),(49,44.12,'2020-05-13 21:48:08',9),(50,45.12,'2020-05-13 21:48:09',9),(51,46.12,'2020-05-13 21:48:10',9),(52,50.03,'2020-05-13 21:49:07',9),(53,51.03,'2020-05-13 21:49:08',9),(54,52.03,'2020-05-13 21:49:09',9),(55,53.03,'2020-05-13 21:49:10',9),(56,54.03,'2020-05-13 21:49:11',9),(58,13.74,'2020-05-13 21:52:54',9),(59,14.74,'2020-05-13 21:52:55',9),(60,15.74,'2020-05-13 21:52:56',9),(61,2,'2020-05-13 21:52:57',9),(62,1,'2020-05-13 21:52:58',9);
43 | /*!40000 ALTER TABLE `tb_data` ENABLE KEYS */;
44 | UNLOCK TABLES;
45 |
46 | --
47 | -- Table structure for table `tb_gateway`
48 | --
49 |
50 | DROP TABLE IF EXISTS `tb_gateway`;
51 | /*!40101 SET @saved_cs_client = @@character_set_client */;
52 | /*!40101 SET character_set_client = utf8 */;
53 | CREATE TABLE `tb_gateway` (
54 | `id` int(11) NOT NULL AUTO_INCREMENT,
55 | `ip` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
56 | `port` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
57 | `description` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
58 | `location` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
59 | PRIMARY KEY (`id`)
60 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
61 | /*!40101 SET character_set_client = @saved_cs_client */;
62 |
63 | --
64 | -- Dumping data for table `tb_gateway`
65 | --
66 |
67 | LOCK TABLES `tb_gateway` WRITE;
68 | /*!40000 ALTER TABLE `tb_gateway` DISABLE KEYS */;
69 | INSERT INTO `tb_gateway` VALUES (1,'127.0.0.1','8080','我是网关1号','天马-1-1-101'),(4,'127.0.0.4','8484','haha,我是网关4号','天马-1-1-104'),(5,'127.0.0.5','80','haha,我是网关5号','天马-1-1-105'),(6,'127.0.0.6','666','haha,我是网关6号','天马-1-1-106'),(7,'127.0.0.7','8787','我是网关7号','天马-1-1-107');
70 | /*!40000 ALTER TABLE `tb_gateway` ENABLE KEYS */;
71 | UNLOCK TABLES;
72 |
73 | --
74 | -- Table structure for table `tb_gateway_exception`
75 | --
76 |
77 | DROP TABLE IF EXISTS `tb_gateway_exception`;
78 | /*!40101 SET @saved_cs_client = @@character_set_client */;
79 | /*!40101 SET character_set_client = utf8 */;
80 | CREATE TABLE `tb_gateway_exception` (
81 | `id` int(11) NOT NULL AUTO_INCREMENT,
82 | `description` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
83 | `time` datetime DEFAULT NULL,
84 | `gate_id` int(11) NOT NULL,
85 | PRIMARY KEY (`id`),
86 | KEY `fk_exception_gateway_1` (`gate_id`),
87 | CONSTRAINT `fk_exception_gateway_1` FOREIGN KEY (`gate_id`) REFERENCES `tb_gateway` (`id`)
88 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
89 | /*!40101 SET character_set_client = @saved_cs_client */;
90 |
91 | --
92 | -- Dumping data for table `tb_gateway_exception`
93 | --
94 |
95 | LOCK TABLES `tb_gateway_exception` WRITE;
96 | /*!40000 ALTER TABLE `tb_gateway_exception` DISABLE KEYS */;
97 | INSERT INTO `tb_gateway_exception` VALUES (1,'数据异常','2020-02-19 15:05:30',7),(2,'网络异常','2020-02-19 15:06:30',7),(3,'连接异常','2020-02-19 15:07:30',7);
98 | /*!40000 ALTER TABLE `tb_gateway_exception` ENABLE KEYS */;
99 | UNLOCK TABLES;
100 |
101 | --
102 | -- Table structure for table `tb_sensor`
103 | --
104 |
105 | DROP TABLE IF EXISTS `tb_sensor`;
106 | /*!40101 SET @saved_cs_client = @@character_set_client */;
107 | /*!40101 SET character_set_client = utf8 */;
108 | CREATE TABLE `tb_sensor` (
109 | `id` int(11) NOT NULL AUTO_INCREMENT,
110 | `description` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
111 | `location` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
112 | `factory` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
113 | `install_time` date DEFAULT NULL,
114 | `produce_date` date DEFAULT NULL,
115 | `maintenance_time` date DEFAULT NULL,
116 | `gate_id` int(11) NOT NULL,
117 | `classify_id` int(11) NOT NULL,
118 | PRIMARY KEY (`id`),
119 | KEY `fk_sensor_gate_1` (`gate_id`),
120 | KEY `fk_sensor_class_1` (`classify_id`),
121 | CONSTRAINT `fk_sensor_class_1` FOREIGN KEY (`classify_id`) REFERENCES `tb_sensor_classify` (`id`),
122 | CONSTRAINT `fk_sensor_gate_1` FOREIGN KEY (`gate_id`) REFERENCES `tb_gateway` (`id`)
123 | ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
124 | /*!40101 SET character_set_client = @saved_cs_client */;
125 |
126 | --
127 | -- Dumping data for table `tb_sensor`
128 | --
129 |
130 | LOCK TABLES `tb_sensor` WRITE;
131 | /*!40000 ALTER TABLE `tb_sensor` DISABLE KEYS */;
132 | INSERT INTO `tb_sensor` VALUES (1,'haha,我是温度传感器1号','天马-1-3-131','华美集团','2020-02-01','2020-01-01','2021-01-31',1,1),(2,'haha,我是温度传感器2号','天马-1-3-132','华美集团','2020-01-31','2019-12-31','2021-01-30',1,1),(3,'haha,我是湿度传感器1号','天马-1-3-133','xx集团','2020-01-28','2019-12-28','2021-01-27',5,2),(4,'haha,我是湿度传感器2号','天马-1-3-134','华美集团','2020-01-26','2019-12-26','2021-01-25',4,2),(6,'haha,我是温度传感器3号','天马-1-3-135','yy集团','2020-01-30','2019-12-30','2021-01-29',1,1),(7,'我是光照传感器1号','天马-1-1-107','mm集团','2020-01-01','2020-01-01','2020-02-02',1,3),(8,'haha,我是光照传感器2号','天马-2-1-201','东马集团','2020-02-01','2020-01-01','2020-08-01',5,3),(9,'红外传感器1号','天马-3-3-103','zz集团','2020-05-01','2020-05-03','2020-05-07',7,4);
133 | /*!40000 ALTER TABLE `tb_sensor` ENABLE KEYS */;
134 | UNLOCK TABLES;
135 |
136 | --
137 | -- Table structure for table `tb_sensor_classify`
138 | --
139 |
140 | DROP TABLE IF EXISTS `tb_sensor_classify`;
141 | /*!40101 SET @saved_cs_client = @@character_set_client */;
142 | /*!40101 SET character_set_client = utf8 */;
143 | CREATE TABLE `tb_sensor_classify` (
144 | `id` int(11) NOT NULL AUTO_INCREMENT,
145 | `name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
146 | PRIMARY KEY (`id`)
147 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
148 | /*!40101 SET character_set_client = @saved_cs_client */;
149 |
150 | --
151 | -- Dumping data for table `tb_sensor_classify`
152 | --
153 |
154 | LOCK TABLES `tb_sensor_classify` WRITE;
155 | /*!40000 ALTER TABLE `tb_sensor_classify` DISABLE KEYS */;
156 | INSERT INTO `tb_sensor_classify` VALUES (1,'温度传感器'),(2,'湿度传感器'),(3,'光照传感器'),(4,'红外传感器');
157 | /*!40000 ALTER TABLE `tb_sensor_classify` ENABLE KEYS */;
158 | UNLOCK TABLES;
159 |
160 | --
161 | -- Table structure for table `tb_sensor_exception`
162 | --
163 |
164 | DROP TABLE IF EXISTS `tb_sensor_exception`;
165 | /*!40101 SET @saved_cs_client = @@character_set_client */;
166 | /*!40101 SET character_set_client = utf8 */;
167 | CREATE TABLE `tb_sensor_exception` (
168 | `id` int(11) NOT NULL AUTO_INCREMENT,
169 | `description` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
170 | `time` datetime DEFAULT NULL,
171 | `sensor_id` int(11) NOT NULL,
172 | PRIMARY KEY (`id`),
173 | KEY `fk_exception_sensor_1` (`sensor_id`),
174 | CONSTRAINT `fk_exception_sensor_1` FOREIGN KEY (`sensor_id`) REFERENCES `tb_sensor` (`id`)
175 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
176 | /*!40101 SET character_set_client = @saved_cs_client */;
177 |
178 | --
179 | -- Dumping data for table `tb_sensor_exception`
180 | --
181 |
182 | LOCK TABLES `tb_sensor_exception` WRITE;
183 | /*!40000 ALTER TABLE `tb_sensor_exception` DISABLE KEYS */;
184 | INSERT INTO `tb_sensor_exception` VALUES (1,'网络异常','2020-02-19 15:03:15',7);
185 | /*!40000 ALTER TABLE `tb_sensor_exception` ENABLE KEYS */;
186 | UNLOCK TABLES;
187 |
188 | --
189 | -- Table structure for table `tb_user`
190 | --
191 |
192 | DROP TABLE IF EXISTS `tb_user`;
193 | /*!40101 SET @saved_cs_client = @@character_set_client */;
194 | /*!40101 SET character_set_client = utf8 */;
195 | CREATE TABLE `tb_user` (
196 | `id` int(11) NOT NULL AUTO_INCREMENT,
197 | `username` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
198 | `nickname` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
199 | `password` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
200 | `tel` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
201 | `email` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
202 | PRIMARY KEY (`id`),
203 | UNIQUE KEY `username` (`username`)
204 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
205 | /*!40101 SET character_set_client = @saved_cs_client */;
206 |
207 | --
208 | -- Dumping data for table `tb_user`
209 | --
210 |
211 | LOCK TABLES `tb_user` WRITE;
212 | /*!40000 ALTER TABLE `tb_user` DISABLE KEYS */;
213 | INSERT INTO `tb_user` VALUES (1,'zhangsan','张三','01d7f40760960e7bd9443513f22ab9af','17788888877','xxxx@126.com');
214 | /*!40000 ALTER TABLE `tb_user` ENABLE KEYS */;
215 | UNLOCK TABLES;
216 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
217 |
218 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
219 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
220 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
221 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
222 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
223 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
224 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
225 |
226 | -- Dump completed on 2020-05-14 18:29:48
227 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/changeBasicInfomation.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 修改基本信息
6 |
7 |
8 | 修改基本信息
9 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/changePassword.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 修改密码
6 |
7 |
8 | 修改密码
9 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/data_post.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 模拟传感器数据提交
6 |
7 |
8 |
56 |
57 |
58 |
59 | 传感器id=
60 |
64 |
65 |
66 | - 实时数值data=0(提交单个数据,时间为当前时间)
67 | - 实时数值data=0 0 0 0 0(提交5个批量数据,时间为当前时间前5秒)
68 |
69 |
70 | data表单
71 |
72 |
73 | 返回消息:
74 |
75 |
76 | | status: | message: |
78 |
79 |
80 | 该api不提供返回数据
81 |
82 | 提交传感器data数据:
83 |
84 |
85 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/data_sensor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 获取传感器数据
6 |
7 |
8 |
9 |
61 |
62 |
63 | 传感器id:
64 |
65 |
66 | 返回消息:
67 |
68 | | status: | message: |
70 |
71 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/download.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 下载页面
6 |
7 |
19 |
20 |
21 | 下载相关
22 |
23 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/exception.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 获取网关和传感器异常
6 |
7 |
79 |
80 |
81 | Exception
82 |
86 | 页码:(不填写为不分页,默认一页两项)
87 |
88 |
89 | 根据时间戳查询:
90 | 从到
91 |
92 |
93 |
94 | 返回消息:
95 |
96 |
97 | | status: | message: |
98 |
99 |
100 | 返回数据:
101 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/gateway.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 网关
6 |
7 |
108 |
109 |
110 | gateway表单
111 |
118 |
119 | 返回消息:
120 |
121 |
122 | | status: | message: |
123 |
124 |
125 | 返回数据:
126 |
128 |
129 | 根据id查询网关:
130 |
131 | (不填写id表示查询所有)
132 | 新添加一个网关:
133 |
134 | (成功后回显信息)
135 | 根据id更新网关:
136 |
137 | (成功后回显信息)
138 | 根据id删除网关:
139 |
140 | (成功后清空输入框)
141 |
142 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录
6 |
7 |
8 | 用户登录
9 |
14 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/network.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 传感网络(网关分类)
6 |
7 |
8 |
93 |
94 |
95 | 传感网络
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/regist.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 注册
6 |
7 |
8 | 用户注册
9 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/sensor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 传感器
6 |
7 |
120 |
121 |
122 | sensor表单
123 |
134 |
135 | 返回消息:
136 |
137 |
138 | | status: | message: |
139 |
140 |
141 | 返回数据:
142 |
144 |
145 | 根据id查询传感器:
146 |
147 | (不填写id表示查询所有)
148 | 新添加一个传感器:
149 |
150 | (成功后回显信息)
151 | 根据id更新传感器:
152 |
153 | (成功后回显信息)
154 | 根据id删除传感器:
155 |
156 | (成功后清空输入框)
157 |
158 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/html/sensor_classify.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 传感器分类
6 |
7 |
65 |
66 |
67 | SensorClassify表单
68 |
72 |
73 | 返回消息:
74 |
75 |
76 | | status: | message: |
77 |
78 |
79 | 返回数据:
80 |
82 |
83 | 根据id查询分类:
84 |
85 | (不填写id表示查询所有)
86 | 新添加一个分类:
87 |
88 | (成功后回显信息)
89 |
90 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 |
7 |
8 |
9 | IOT 数据采集和管理系统 SpringBoot版
10 |
11 | 测试API
12 |
16 |
17 |
18 | user相关
19 |
27 |
28 | Gateway相关
29 |
32 |
33 | SensorClassify相关
34 |
37 |
38 | Sensor相关
39 |
42 |
43 | Data相关
44 |
48 |
49 | Exception相关
50 |
53 |
54 | 传感网络
55 |
58 |
59 | 下载相关
60 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/main/resources/static-old/js/dateformat.js:
--------------------------------------------------------------------------------
1 | // 对Date的扩展,将 Date 转化为指定格式的String
2 | // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
3 | // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
4 | // 例子:
5 | // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
6 | // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
7 | Date.prototype.Format = function (fmt) { //author: meizz
8 | var o = {
9 | "M+": this.getMonth() + 1, //月份
10 | "d+": this.getDate(), //日
11 | "h+": this.getHours(), //小时
12 | "m+": this.getMinutes(), //分
13 | "s+": this.getSeconds(), //秒
14 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度
15 | "S": this.getMilliseconds() //毫秒
16 | };
17 | if (/(y+)/.test(fmt))
18 | fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
19 | for (var k in o)
20 | if (new RegExp("(" + k + ")").test(fmt))
21 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
22 | return fmt;
23 | }
--------------------------------------------------------------------------------
/src/main/resources/static/html/basicInformation.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 个人信息
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
105 |
106 |
107 |
108 |
109 |
110 |
133 |
134 |
135 |
136 |
137 |
141 |
142 |
143 |
144 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 | 修改个人信息
162 | 提交
163 |
164 |
165 |
166 |
167 |
168 | © 2019-2020 . Powered by CUG |
169 | 服务器状态
170 | |
171 | 测试API
172 | |
173 | 注册新用户
174 |
175 |
176 |
177 |
265 |
266 |
--------------------------------------------------------------------------------
/src/main/resources/static/html/changePassword.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 修改密码
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
105 |
106 |
107 |
108 |
109 |
110 |
133 |
134 |
135 |
136 |
137 |
141 |
142 |
143 |
144 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 | 提交
166 | 重置
167 |
168 |
169 |
170 |
171 |
172 | © 2019-2020 . Powered by CUG |
173 | 服务器状态
174 | |
175 | 测试API
176 |
177 |
178 |
179 |
277 |
278 |
--------------------------------------------------------------------------------
/src/main/resources/static/html/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
95 |
96 |
97 |
98 |
99 |
100 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | 登录
138 | 重置
139 |
140 |
141 |
142 |
143 |
144 | © 2019-2020 . Powered by CUG |
145 | 服务器状态
146 | |
147 | 测试API
148 |
149 |
150 |
151 |
237 |
238 |
--------------------------------------------------------------------------------
/src/main/resources/static/html/network.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 传感网络
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
106 |
107 |
108 |
109 |
110 |
111 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 | © 2019-2020 . Powered by CUG |
150 | 服务器状态
151 | |
152 | 测试API
153 |
154 |
155 |
156 |
294 |
295 |
--------------------------------------------------------------------------------
/src/main/resources/static/html/regist.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 注册
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
105 |
106 |
107 |
108 |
109 |
110 |
131 |
132 |
133 |
134 |
135 |
139 |
140 |
141 |
142 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 | 注册
167 | 重置
168 |
169 |
170 |
171 |
172 |
173 | © 2019-2020 . Powered by CUG |
174 | 服务器状态
175 | |
176 | 测试API
177 |
178 |
179 |
180 |
283 |
284 |
--------------------------------------------------------------------------------
/src/main/resources/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
98 |
99 |
100 |
101 |
102 |
103 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
142 |
144 | 传感网络
145 |
146 |
147 |
148 |
149 |
151 |
153 | 网关
154 |
155 |
156 |
157 |
158 |
159 |
160 |
162 |
164 | 传感器
165 |
166 |
167 |
168 |
169 |
171 |
173 |
174 |
175 |
176 |
177 |
178 |
180 |
182 | 数据
183 |
184 |
185 |
186 |
187 |
188 |
189 |
191 |
193 | 异常
194 |
195 |
196 |
197 |
198 |
200 |
202 | 下载
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | © 2019-2020 . Powered by CUG |
213 | 服务器状态
214 | |
215 | 测试API
216 |
217 |
218 |
219 |
258 |
259 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/dateformat.js:
--------------------------------------------------------------------------------
1 | // 对Date的扩展,将 Date 转化为指定格式的String
2 | // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
3 | // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
4 | // 例子:
5 | // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
6 | // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
7 | Date.prototype.Format = function (fmt) { //author: meizz
8 | var o = {
9 | "M+": this.getMonth() + 1, //月份
10 | "d+": this.getDate(), //日
11 | "h+": this.getHours(), //小时
12 | "m+": this.getMinutes(), //分
13 | "s+": this.getSeconds(), //秒
14 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度
15 | "S": this.getMilliseconds() //毫秒
16 | };
17 | if (/(y+)/.test(fmt))
18 | fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
19 | for (var k in o)
20 | if (new RegExp("(" + k + ")").test(fmt))
21 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
22 | return fmt;
23 | }
--------------------------------------------------------------------------------
/src/test/java/com/my/iot/BaseTest.java:
--------------------------------------------------------------------------------
1 | package com.my.iot;
2 |
3 | import org.junit.runner.RunWith;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 | import org.springframework.test.context.junit4.SpringRunner;
6 |
7 | @RunWith(SpringRunner.class)
8 | @SpringBootTest(classes = IoTSpringBootApplication.class)
9 | public class BaseTest {
10 | }
11 |
--------------------------------------------------------------------------------
/src/test/java/com/my/iot/log/LoggerTest.java:
--------------------------------------------------------------------------------
1 | package com.my.iot.log;
2 |
3 | import com.my.iot.BaseTest;
4 | import com.my.iot.IoTSpringBootApplication;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.boot.test.context.SpringBootTest;
10 | import org.springframework.test.context.junit4.SpringRunner;
11 | public class LoggerTest extends BaseTest {
12 |
13 | Logger logger = LoggerFactory.getLogger(LoggerTest.class);
14 | @Test
15 | public void test1(){
16 | logger.debug("调试信息");//这句不会显示
17 | System.out.println("日志信息");
18 | logger.warn("警告信息");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------