Browse Source

项目重命名

Yumin 6 years ago
parent
commit
3c3135112e

+ 1 - 1
README.md

@@ -1,3 +1,3 @@
-## IoT
+## IoTServer
 
 基于 MQTT 协议通讯的物联网后端服务

+ 3 - 3
pom.xml

@@ -9,10 +9,10 @@
         <relativePath/> <!-- lookup parent from repository -->
     </parent>
     <groupId>cn.minbb</groupId>
-    <artifactId>IoT</artifactId>
+    <artifactId>IoTServer</artifactId>
     <version>0.0.1-SNAPSHOT</version>
-    <name>IoT</name>
-    <description>Iot project for Spring Boot</description>
+    <name>IoTServer</name>
+    <description>IotServer project for Spring Boot</description>
     <packaging>war</packaging>
 
     <properties>

+ 3 - 3
src/main/java/cn/minbb/iot/IoTApplication.java → src/main/java/cn/minbb/iot/IoTServerApplication.java

@@ -9,16 +9,16 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 
 @EnableScheduling
 @SpringBootApplication
-public class IoTApplication extends SpringBootServletInitializer {
+public class IoTServerApplication extends SpringBootServletInitializer {
 
     public static void main(String[] args) {
-        SpringApplication application = new SpringApplication(IoTApplication.class);
+        SpringApplication application = new SpringApplication(IoTServerApplication.class);
         application.setBannerMode(Banner.Mode.CONSOLE);
         application.run(args);
     }
 
     @Override
     protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
-        return builder.sources(IoTApplication.class);
+        return builder.sources(IoTServerApplication.class);
     }
 }

+ 2 - 1
src/main/java/cn/minbb/iot/config/WebSocketConfig.java

@@ -1,9 +1,10 @@
 package cn.minbb.iot.config;
 
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
-//@Configuration
+@Configuration
 public class WebSocketConfig {
     @Bean
     public ServerEndpointExporter serverEndpointExporter() {

+ 5 - 3
src/main/java/cn/minbb/iot/task/AutoConfig.java

@@ -1,8 +1,10 @@
 package cn.minbb.iot.task;
 
 import cn.minbb.iot.config.Const;
+import cn.minbb.iot.model.DeviceData;
 import cn.minbb.iot.service.MqttGateway;
 import cn.minbb.iot.util.Application;
+import com.alibaba.fastjson.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -30,8 +32,8 @@ public class AutoConfig {
         int random1 = 1 + ((int) (new Random().nextFloat() * (10 - 1)));
         mqttGateway.sendToMqtt(Application.getCurrentStringTime(), Const.MQTT_TOPIC_TIME, 2);
         int random2 = 1 + ((int) (new Random().nextFloat() * (10 - 1)));
-//        mqttGateway.sendToMqtt(JSONObject.toJSONString(
-//                new DeviceData("3447.9" + random1 + "043 N", "11339.2" + random2 + "603 E",
-//                        Application.getCurrentStringTime())), Const.MQTT_TOPIC_CAR_DATA, 2);
+        mqttGateway.sendToMqtt(JSONObject.toJSONString(
+                new DeviceData("3447.92" + random1 + "00 N", "11338.93" + random2 + "33 E",
+                        Application.getCurrentStringTime())), Const.MQTT_TOPIC_CAR_DATA, 2);
     }
 }

+ 1 - 1
src/main/resources/static/js/map.js

@@ -34,7 +34,7 @@ function moveCar(prvePoint, newPoint, timer, marker, count) {
             map.clearOverlays();
             marker.setLabel(label);
             map.addOverlay(marker);
-            map.addOverlay(new BMap.Circle(pos, 160, {fillColor: "gray", strokeWeight: 1, fillOpacity: 0.3, strokeOpacity: 0.3}));
+            map.addOverlay(new BMap.Circle(pos, 80, {fillColor: "gray", strokeWeight: 1, fillOpacity: 0.3, strokeOpacity: 0.3}));
             // 调整方向
             setRotation(prvePoint, newPoint, marker);
         }

+ 7 - 5
src/main/resources/templates/map.html

@@ -47,9 +47,11 @@
 <script type="text/javascript">
     let top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});  // 左上角,添加比例尺
     let top_left_navigation = new BMap.NavigationControl();  // 左上角,添加默认缩放平移控件
-    let top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); //右上角,仅包含平移和缩放按钮
-    /*缩放控件type有四种类型:
-    BMAP_NAVIGATION_CONTROL_SMALL:仅包含平移和缩放按钮;BMAP_NAVIGATION_CONTROL_PAN:仅包含平移按钮;BMAP_NAVIGATION_CONTROL_ZOOM:仅包含缩放按钮*/
+    let top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); // 右上角,仅包含平移和缩放按钮
+    /*
+    缩放控件type有四种类型:
+    BMAP_NAVIGATION_CONTROL_SMALL:仅包含平移和缩放按钮;BMAP_NAVIGATION_CONTROL_PAN:仅包含平移按钮;BMAP_NAVIGATION_CONTROL_ZOOM:仅包含缩放按钮
+    */
 
     // 百度地图 API 功能
     let map = new BMap.Map("map");
@@ -58,7 +60,7 @@
     // IP 定位
     let myCity = new BMap.LocalCity();
     myCity.get(getCity);
-    map.centerAndZoom(point, 18);
+    map.centerAndZoom(point, 19);
     // 添加地图类型控件
     map.addControl(new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP]}));
     map.setCurrentCity("郑州");          // 设置地图显示的城市 此项是必须设置的
@@ -80,7 +82,7 @@
 
     marker.setLabel(label);                 // 创建标注的文字标签
     map.addOverlay(marker);                 // 将标注添加到地图中
-    let circle = new BMap.Circle(point, 100, {fillColor: "gray", strokeWeight: 1, fillOpacity: 0.3, strokeOpacity: 0.3});
+    let circle = new BMap.Circle(point, 80, {fillColor: "gray", strokeWeight: 1, fillOpacity: 0.3, strokeOpacity: 0.3});
     map.addOverlay(circle);
 
     function updateLocation(data) {