Pārlūkot izejas kodu

新增UWB定位模块

添加了UWB定位相关的MQTT客户端配置和监听器,实现了与UWB定位设备的通信。同时创建了新的Spring Boot应用程序来处理UWB定位数据,并提供了围栏信息的CRUD操作接口。
chen.cheng 9 mēneši atpakaļ
vecāks
revīzija
b9b1db9608
30 mainītis faili ar 1113 papildinājumiem un 68 dzēšanām
  1. 13 0
      bd-location/build.xml
  2. 112 0
      bd-location/pom.xml
  3. 22 0
      bd-location/src/main/java/com/ruoyi/BDApplication.java
  4. 18 0
      bd-location/src/main/java/com/ruoyi/RuoYiServletInitializer.java
  5. 13 13
      bd-location/src/main/java/com/ruoyi/bd/domain/BdFenceInfo.java
  6. 2 2
      bd-location/src/main/java/com/ruoyi/bd/domain/BdFenceVioEvt.java
  7. 10 9
      bd-location/src/main/java/com/ruoyi/bd/mapper/BdFenceInfoMapper.java
  8. 10 9
      bd-location/src/main/java/com/ruoyi/bd/mapper/BdFenceVioEvtMapper.java
  9. 10 9
      bd-location/src/main/java/com/ruoyi/bd/service/IBdFenceInfoService.java
  10. 10 9
      bd-location/src/main/java/com/ruoyi/bd/service/IBdFenceVioEvtService.java
  11. 5 5
      bd-location/src/main/java/com/ruoyi/bd/service/impl/BdFenceInfoServiceImpl.java
  12. 13 12
      bd-location/src/main/java/com/ruoyi/bd/service/impl/BdFenceVioEvtServiceImpl.java
  13. 31 0
      bd-location/src/main/java/com/ruoyi/mqtt/UWBLocationListener.java
  14. 40 0
      bd-location/src/main/java/com/ruoyi/mqtt/UWBLocationSubscribeListener.java
  15. 95 0
      bd-location/src/main/java/com/ruoyi/web/controller/bd/BdFenceInfoController.java
  16. 95 0
      bd-location/src/main/java/com/ruoyi/web/controller/bd/BdFenceVioEvtController.java
  17. 125 0
      bd-location/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
  18. 1 0
      bd-location/src/main/resources/META-INF/spring-devtools.properties
  19. 83 0
      bd-location/src/main/resources/application-druid.yml
  20. 102 0
      bd-location/src/main/resources/application-hm.yml
  21. 120 0
      bd-location/src/main/resources/application.yml
  22. 2 0
      bd-location/src/main/resources/banner.txt
  23. 38 0
      bd-location/src/main/resources/i18n/messages.properties
  24. 93 0
      bd-location/src/main/resources/logback.xml
  25. 0 0
      bd-location/src/main/resources/mapper/bd/BdFenceInfoMapper.xml
  26. 0 0
      bd-location/src/main/resources/mapper/bd/BdFenceVioEvtMapper.xml
  27. 20 0
      bd-location/src/main/resources/mybatis/mybatis-config.xml
  28. 7 0
      pom.xml
  29. 4 0
      ruoyi-admin/pom.xml
  30. 19 0
      ruoyi-admin/src/main/resources/application-druid.yml

+ 13 - 0
bd-location/build.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="tfc-minapp-be" basedir=".">
+    <property environment="SystemVariable"/>
+    <property name="buildName" value="ruoyi-admin"/>
+    <!--默认目标-->
+    <target name="Build" depends="copy-out"/>
+    <!--所有的打包最终需要文件copy到特定目录,方便jenkins上取包-->
+    <target name="copy-out">
+        <copy todir="${basedir}/../out" overwrite="true" failonerror="no">
+            <fileset file="${basedir}/target/${buildName}.jar"/>
+        </copy>
+    </target>
+</project>

+ 112 - 0
bd-location/pom.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.ruoyi</groupId>
+        <artifactId>ruoyi</artifactId>
+        <version>3.8.8</version>
+    </parent>
+    <packaging>jar</packaging>
+    <artifactId>bd-location</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <!-- spring-boot-devtools -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>true</optional> <!-- 表示依赖不会传递 -->
+        </dependency>
+
+        <!-- swagger3-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-boot-starter</artifactId>
+        </dependency>
+
+        <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-models</artifactId>
+            <version>1.6.2</version>
+        </dependency>
+
+        <!-- Mysql驱动包 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <!-- 核心模块-->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-framework</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.dtflys.forest</groupId>
+            <artifactId>forest-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.dreamlu</groupId>
+            <artifactId>mica-mqtt-client-spring-boot-starter</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.5.15</version>
+                <configuration>
+                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                    <warName>${project.artifactId}</warName>
+                </configuration>
+            </plugin>
+            <!--The configuration of maven-antrun-plugin 打zip包-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <id>package</id>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <ant antfile="build.xml">
+                                    <target name="Build"/>
+                                </ant>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+</project>

+ 22 - 0
bd-location/src/main/java/com/ruoyi/BDApplication.java

@@ -0,0 +1,22 @@
+package com.ruoyi;
+
+import com.dtflys.forest.springboot.annotation.ForestScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+/**
+ * 启动程序
+ *
+ * @author ruoyi
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+@ForestScan(basePackages = "com.ruoyi.system.rest")
+public class BDApplication
+{
+    public static void main(String[] args)
+    {
+        // System.setProperty("spring.devtools.restart.enabled", "false");
+        SpringApplication.run(BDApplication.class, args);
+    }
+}

+ 18 - 0
bd-location/src/main/java/com/ruoyi/RuoYiServletInitializer.java

@@ -0,0 +1,18 @@
+package com.ruoyi;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+/**
+ * web容器中进行部署
+ *
+ * @author ruoyi
+ */
+public class RuoYiServletInitializer extends SpringBootServletInitializer
+{
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
+    {
+        return application.sources(BDApplication.class);
+    }
+}

+ 13 - 13
ruoyi-system/src/main/java/com/ruoyi/bd/domain/BdFenceInfo.java → bd-location/src/main/java/com/ruoyi/bd/domain/BdFenceInfo.java

@@ -1,13 +1,13 @@
 package com.ruoyi.bd.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 围栏基础信息对象 bd_fence_info
- * 
+ *
  * @author ruoyi
  * @date 2024-10-14
  */
@@ -33,48 +33,48 @@ public class BdFenceInfo extends BaseEntity
     @Excel(name = "中心点")
     private Double centerLat;
 
-    public void setId(Long id) 
+    public void setId(Long id)
     {
         this.id = id;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setDefenceName(String defenceName) 
+    public void setDefenceName(String defenceName)
     {
         this.defenceName = defenceName;
     }
 
-    public String getDefenceName() 
+    public String getDefenceName()
     {
         return defenceName;
     }
-    public void setPoly(String poly) 
+    public void setPoly(String poly)
     {
         this.poly = poly;
     }
 
-    public String getPoly() 
+    public String getPoly()
     {
         return poly;
     }
-    public void setCenterLng(Double centerLng) 
+    public void setCenterLng(Double centerLng)
     {
         this.centerLng = centerLng;
     }
 
-    public Double getCenterLng() 
+    public Double getCenterLng()
     {
         return centerLng;
     }
-    public void setCenterLat(Double centerLat) 
+    public void setCenterLat(Double centerLat)
     {
         this.centerLat = centerLat;
     }
 
-    public Double getCenterLat() 
+    public Double getCenterLat()
     {
         return centerLat;
     }

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/bd/domain/BdFenceVioEvt.java → bd-location/src/main/java/com/ruoyi/bd/domain/BdFenceVioEvt.java

@@ -1,9 +1,9 @@
 package com.ruoyi.bd.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 围栏闯禁事件对象 bd_fence_vio_evt

+ 10 - 9
ruoyi-system/src/main/java/com/ruoyi/bd/mapper/BdFenceInfoMapper.java → bd-location/src/main/java/com/ruoyi/bd/mapper/BdFenceInfoMapper.java

@@ -1,19 +1,20 @@
 package com.ruoyi.bd.mapper;
 
-import java.util.List;
 import com.ruoyi.bd.domain.BdFenceInfo;
 
+import java.util.List;
+
 /**
  * 围栏基础信息Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-10-14
  */
-public interface BdFenceInfoMapper 
+public interface BdFenceInfoMapper
 {
     /**
      * 查询围栏基础信息
-     * 
+     *
      * @param id 围栏基础信息主键
      * @return 围栏基础信息
      */
@@ -21,7 +22,7 @@ public interface BdFenceInfoMapper
 
     /**
      * 查询围栏基础信息列表
-     * 
+     *
      * @param bdFenceInfo 围栏基础信息
      * @return 围栏基础信息集合
      */
@@ -29,7 +30,7 @@ public interface BdFenceInfoMapper
 
     /**
      * 新增围栏基础信息
-     * 
+     *
      * @param bdFenceInfo 围栏基础信息
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface BdFenceInfoMapper
 
     /**
      * 修改围栏基础信息
-     * 
+     *
      * @param bdFenceInfo 围栏基础信息
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface BdFenceInfoMapper
 
     /**
      * 删除围栏基础信息
-     * 
+     *
      * @param id 围栏基础信息主键
      * @return 结果
      */
@@ -53,7 +54,7 @@ public interface BdFenceInfoMapper
 
     /**
      * 批量删除围栏基础信息
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 10 - 9
ruoyi-system/src/main/java/com/ruoyi/bd/mapper/BdFenceVioEvtMapper.java → bd-location/src/main/java/com/ruoyi/bd/mapper/BdFenceVioEvtMapper.java

@@ -1,19 +1,20 @@
 package com.ruoyi.bd.mapper;
 
-import java.util.List;
 import com.ruoyi.bd.domain.BdFenceVioEvt;
 
+import java.util.List;
+
 /**
  * 围栏闯禁事件Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-10-14
  */
-public interface BdFenceVioEvtMapper 
+public interface BdFenceVioEvtMapper
 {
     /**
      * 查询围栏闯禁事件
-     * 
+     *
      * @param id 围栏闯禁事件主键
      * @return 围栏闯禁事件
      */
@@ -21,7 +22,7 @@ public interface BdFenceVioEvtMapper
 
     /**
      * 查询围栏闯禁事件列表
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 围栏闯禁事件集合
      */
@@ -29,7 +30,7 @@ public interface BdFenceVioEvtMapper
 
     /**
      * 新增围栏闯禁事件
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface BdFenceVioEvtMapper
 
     /**
      * 修改围栏闯禁事件
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface BdFenceVioEvtMapper
 
     /**
      * 删除围栏闯禁事件
-     * 
+     *
      * @param id 围栏闯禁事件主键
      * @return 结果
      */
@@ -53,7 +54,7 @@ public interface BdFenceVioEvtMapper
 
     /**
      * 批量删除围栏闯禁事件
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 10 - 9
ruoyi-system/src/main/java/com/ruoyi/bd/service/IBdFenceInfoService.java → bd-location/src/main/java/com/ruoyi/bd/service/IBdFenceInfoService.java

@@ -1,19 +1,20 @@
 package com.ruoyi.bd.service;
 
-import java.util.List;
 import com.ruoyi.bd.domain.BdFenceInfo;
 
+import java.util.List;
+
 /**
  * 围栏基础信息Service接口
- * 
+ *
  * @author ruoyi
  * @date 2024-10-14
  */
-public interface IBdFenceInfoService 
+public interface IBdFenceInfoService
 {
     /**
      * 查询围栏基础信息
-     * 
+     *
      * @param id 围栏基础信息主键
      * @return 围栏基础信息
      */
@@ -21,7 +22,7 @@ public interface IBdFenceInfoService
 
     /**
      * 查询围栏基础信息列表
-     * 
+     *
      * @param bdFenceInfo 围栏基础信息
      * @return 围栏基础信息集合
      */
@@ -29,7 +30,7 @@ public interface IBdFenceInfoService
 
     /**
      * 新增围栏基础信息
-     * 
+     *
      * @param bdFenceInfo 围栏基础信息
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IBdFenceInfoService
 
     /**
      * 修改围栏基础信息
-     * 
+     *
      * @param bdFenceInfo 围栏基础信息
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IBdFenceInfoService
 
     /**
      * 批量删除围栏基础信息
-     * 
+     *
      * @param ids 需要删除的围栏基础信息主键集合
      * @return 结果
      */
@@ -53,7 +54,7 @@ public interface IBdFenceInfoService
 
     /**
      * 删除围栏基础信息信息
-     * 
+     *
      * @param id 围栏基础信息主键
      * @return 结果
      */

+ 10 - 9
ruoyi-system/src/main/java/com/ruoyi/bd/service/IBdFenceVioEvtService.java → bd-location/src/main/java/com/ruoyi/bd/service/IBdFenceVioEvtService.java

@@ -1,19 +1,20 @@
 package com.ruoyi.bd.service;
 
-import java.util.List;
 import com.ruoyi.bd.domain.BdFenceVioEvt;
 
+import java.util.List;
+
 /**
  * 围栏闯禁事件Service接口
- * 
+ *
  * @author ruoyi
  * @date 2024-10-14
  */
-public interface IBdFenceVioEvtService 
+public interface IBdFenceVioEvtService
 {
     /**
      * 查询围栏闯禁事件
-     * 
+     *
      * @param id 围栏闯禁事件主键
      * @return 围栏闯禁事件
      */
@@ -21,7 +22,7 @@ public interface IBdFenceVioEvtService
 
     /**
      * 查询围栏闯禁事件列表
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 围栏闯禁事件集合
      */
@@ -29,7 +30,7 @@ public interface IBdFenceVioEvtService
 
     /**
      * 新增围栏闯禁事件
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IBdFenceVioEvtService
 
     /**
      * 修改围栏闯禁事件
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IBdFenceVioEvtService
 
     /**
      * 批量删除围栏闯禁事件
-     * 
+     *
      * @param ids 需要删除的围栏闯禁事件主键集合
      * @return 结果
      */
@@ -53,7 +54,7 @@ public interface IBdFenceVioEvtService
 
     /**
      * 删除围栏闯禁事件信息
-     * 
+     *
      * @param id 围栏闯禁事件主键
      * @return 结果
      */

+ 5 - 5
ruoyi-system/src/main/java/com/ruoyi/bd/service/impl/BdFenceInfoServiceImpl.java → bd-location/src/main/java/com/ruoyi/bd/service/impl/BdFenceInfoServiceImpl.java

@@ -1,15 +1,15 @@
 package com.ruoyi.bd.service.impl;
 
-import java.util.List;
-
+import com.ruoyi.bd.domain.BdFenceInfo;
+import com.ruoyi.bd.mapper.BdFenceInfoMapper;
+import com.ruoyi.bd.service.IBdFenceInfoService;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.geo.GeoUtils;
 import org.locationtech.jts.geom.Point;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.bd.mapper.BdFenceInfoMapper;
-import com.ruoyi.bd.domain.BdFenceInfo;
-import com.ruoyi.bd.service.IBdFenceInfoService;
+
+import java.util.List;
 
 /**
  * 围栏基础信息Service业务层处理

+ 13 - 12
ruoyi-system/src/main/java/com/ruoyi/bd/service/impl/BdFenceVioEvtServiceImpl.java → bd-location/src/main/java/com/ruoyi/bd/service/impl/BdFenceVioEvtServiceImpl.java

@@ -1,28 +1,29 @@
 package com.ruoyi.bd.service.impl;
 
-import java.util.List;
+import com.ruoyi.bd.domain.BdFenceVioEvt;
+import com.ruoyi.bd.mapper.BdFenceVioEvtMapper;
+import com.ruoyi.bd.service.IBdFenceVioEvtService;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.bd.mapper.BdFenceVioEvtMapper;
-import com.ruoyi.bd.domain.BdFenceVioEvt;
-import com.ruoyi.bd.service.IBdFenceVioEvtService;
+
+import java.util.List;
 
 /**
  * 围栏闯禁事件Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-10-14
  */
 @Service
-public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService 
+public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService
 {
     @Autowired
     private BdFenceVioEvtMapper bdFenceVioEvtMapper;
 
     /**
      * 查询围栏闯禁事件
-     * 
+     *
      * @param id 围栏闯禁事件主键
      * @return 围栏闯禁事件
      */
@@ -34,7 +35,7 @@ public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService
 
     /**
      * 查询围栏闯禁事件列表
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 围栏闯禁事件
      */
@@ -46,7 +47,7 @@ public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService
 
     /**
      * 新增围栏闯禁事件
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 结果
      */
@@ -59,7 +60,7 @@ public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService
 
     /**
      * 修改围栏闯禁事件
-     * 
+     *
      * @param bdFenceVioEvt 围栏闯禁事件
      * @return 结果
      */
@@ -72,7 +73,7 @@ public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService
 
     /**
      * 批量删除围栏闯禁事件
-     * 
+     *
      * @param ids 需要删除的围栏闯禁事件主键
      * @return 结果
      */
@@ -84,7 +85,7 @@ public class BdFenceVioEvtServiceImpl implements IBdFenceVioEvtService
 
     /**
      * 删除围栏闯禁事件信息
-     * 
+     *
      * @param id 围栏闯禁事件主键
      * @return 结果
      */

+ 31 - 0
bd-location/src/main/java/com/ruoyi/mqtt/UWBLocationListener.java

@@ -0,0 +1,31 @@
+package com.ruoyi.mqtt;
+
+import net.dreamlu.iot.mqtt.core.client.MqttClientCreator;
+import net.dreamlu.iot.mqtt.spring.client.event.MqttConnectedEvent;
+import net.dreamlu.iot.mqtt.spring.client.event.MqttDisconnectEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.event.EventListener;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UWBLocationListener {
+    private static final Logger logger = LoggerFactory.getLogger(UWBLocationListener.class);
+
+    @Autowired
+    private MqttClientCreator mqttClientCreator;
+
+    @EventListener
+    public void onConnected(MqttConnectedEvent event) {
+        logger.info("MqttConnectedEvent:{}", event);
+    }
+
+    @EventListener
+    public void onDisconnect(MqttDisconnectEvent event) {
+        // 离线时更新重连时的密码,适用于类似阿里云 mqtt clientId 连接带时间戳的方式
+        logger.info("MqttDisconnectEvent:{}", event);
+        // 在断线时更新 clientId、username、password
+        mqttClientCreator.clientId("newClient" + System.currentTimeMillis()).username("newUserName").password("newPassword");
+    }
+}

+ 40 - 0
bd-location/src/main/java/com/ruoyi/mqtt/UWBLocationSubscribeListener.java

@@ -0,0 +1,40 @@
+package com.ruoyi.mqtt;
+
+import net.dreamlu.iot.mqtt.codec.MqttQoS;
+import net.dreamlu.iot.mqtt.spring.client.MqttClientSubscribe;
+import net.dreamlu.iot.mqtt.spring.client.MqttClientTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.nio.charset.StandardCharsets;
+
+@Service
+public class UWBLocationSubscribeListener {
+    private static final Logger logger = LoggerFactory.getLogger(UWBLocationSubscribeListener.class);
+    @Autowired
+    private MqttClientTemplate client;
+
+    public boolean publish() {
+        client.publish("/test/client", "mica最牛皮".getBytes(StandardCharsets.UTF_8));
+        return true;
+    }
+
+    @MqttClientSubscribe("/uwb/2/#")
+    public void subQos0(String topic, byte[] payload) {
+        logger.info("topic:{} payload:{}", topic, new String(payload, StandardCharsets.UTF_8));
+    }
+
+    @MqttClientSubscribe(value = "/uwb/1/#", qos = MqttQoS.QOS0)
+    public void subQos1(String topic, byte[] payload) {
+        logger.info("topic:{} payload:{}", topic, new String(payload, StandardCharsets.UTF_8));
+    }
+
+    @MqttClientSubscribe("/sys/${productKey}/${deviceName}/thing/sub/register")
+    public void thingSubRegister(String topic, byte[] payload) {
+        // 1.3.8 开始支持,@MqttClientSubscribe 注解支持 ${} 变量替换,会默认替换成 +
+        // 注意:mica-mqtt 会先从 Spring boot 配置中替换参数 ${},如果存在配置会优先被替换。
+        logger.info("topic:{} payload:{}", topic, new String(payload, StandardCharsets.UTF_8));
+    }
+}

+ 95 - 0
bd-location/src/main/java/com/ruoyi/web/controller/bd/BdFenceInfoController.java

@@ -0,0 +1,95 @@
+package com.ruoyi.web.controller.bd;
+
+import com.ruoyi.bd.domain.BdFenceInfo;
+import com.ruoyi.bd.service.IBdFenceInfoService;
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 围栏基础信息Controller
+ *
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+@RestController
+@RequestMapping("/bd/fenceInfo")
+@CrossOrigin
+@Anonymous
+public class BdFenceInfoController extends BaseController {
+    @Autowired
+    private IBdFenceInfoService bdFenceInfoService;
+
+    /**
+     * 查询围栏基础信息列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BdFenceInfo bdFenceInfo) {
+        startPage();
+        List<BdFenceInfo> list = bdFenceInfoService.selectBdFenceInfoList(bdFenceInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出围栏基础信息列表
+     */
+    @Log(title = "围栏基础信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BdFenceInfo bdFenceInfo) {
+        List<BdFenceInfo> list = bdFenceInfoService.selectBdFenceInfoList(bdFenceInfo);
+        ExcelUtil<BdFenceInfo> util = new ExcelUtil<BdFenceInfo>(BdFenceInfo.class);
+        util.exportExcel(response, list, "围栏基础信息数据");
+    }
+
+    /**
+     * 获取围栏基础信息详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(bdFenceInfoService.selectBdFenceInfoById(id));
+    }
+
+    /**
+     * 新增围栏基础信息
+     */
+    @Log(title = "围栏基础信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BdFenceInfo bdFenceInfo) {
+        return toAjax(bdFenceInfoService.insertBdFenceInfo(bdFenceInfo));
+    }
+
+    /**
+     * 修改围栏基础信息
+     */
+    @Log(title = "围栏基础信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BdFenceInfo bdFenceInfo) {
+        return toAjax(bdFenceInfoService.updateBdFenceInfo(bdFenceInfo));
+    }
+
+    /**
+     * 删除围栏基础信息
+     */
+    @Log(title = "围栏基础信息", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(bdFenceInfoService.deleteBdFenceInfoByIds(ids));
+    }
+}

+ 95 - 0
bd-location/src/main/java/com/ruoyi/web/controller/bd/BdFenceVioEvtController.java

@@ -0,0 +1,95 @@
+package com.ruoyi.web.controller.bd;
+
+import com.ruoyi.bd.domain.BdFenceVioEvt;
+import com.ruoyi.bd.service.IBdFenceVioEvtService;
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 围栏闯禁事件Controller
+ *
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+@RestController
+@RequestMapping("/bd/fenceVioEvt")
+@CrossOrigin
+@Anonymous
+public class BdFenceVioEvtController extends BaseController {
+    @Autowired
+    private IBdFenceVioEvtService bdFenceVioEvtService;
+
+    /**
+     * 查询围栏闯禁事件列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BdFenceVioEvt bdFenceVioEvt) {
+        startPage();
+        List<BdFenceVioEvt> list = bdFenceVioEvtService.selectBdFenceVioEvtList(bdFenceVioEvt);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出围栏闯禁事件列表
+     */
+    @Log(title = "围栏闯禁事件", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BdFenceVioEvt bdFenceVioEvt) {
+        List<BdFenceVioEvt> list = bdFenceVioEvtService.selectBdFenceVioEvtList(bdFenceVioEvt);
+        ExcelUtil<BdFenceVioEvt> util = new ExcelUtil<BdFenceVioEvt>(BdFenceVioEvt.class);
+        util.exportExcel(response, list, "围栏闯禁事件数据");
+    }
+
+    /**
+     * 获取围栏闯禁事件详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(bdFenceVioEvtService.selectBdFenceVioEvtById(id));
+    }
+
+    /**
+     * 新增围栏闯禁事件
+     */
+    @Log(title = "围栏闯禁事件", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BdFenceVioEvt bdFenceVioEvt) {
+        return toAjax(bdFenceVioEvtService.insertBdFenceVioEvt(bdFenceVioEvt));
+    }
+
+    /**
+     * 修改围栏闯禁事件
+     */
+    @Log(title = "围栏闯禁事件", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BdFenceVioEvt bdFenceVioEvt) {
+        return toAjax(bdFenceVioEvtService.updateBdFenceVioEvt(bdFenceVioEvt));
+    }
+
+    /**
+     * 删除围栏闯禁事件
+     */
+    @Log(title = "围栏闯禁事件", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(bdFenceVioEvtService.deleteBdFenceVioEvtByIds(ids));
+    }
+}

+ 125 - 0
bd-location/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@@ -0,0 +1,125 @@
+package com.ruoyi.web.core.config;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import com.ruoyi.common.config.RuoYiConfig;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.models.auth.In;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.ApiKey;
+import springfox.documentation.service.AuthorizationScope;
+import springfox.documentation.service.Contact;
+import springfox.documentation.service.SecurityReference;
+import springfox.documentation.service.SecurityScheme;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+
+/**
+ * Swagger2的接口配置
+ * 
+ * @author ruoyi
+ */
+@Configuration
+public class SwaggerConfig
+{
+    /** 系统基础配置 */
+    @Autowired
+    private RuoYiConfig ruoyiConfig;
+
+    /** 是否开启swagger */
+    @Value("${swagger.enabled}")
+    private boolean enabled;
+
+    /** 设置请求的统一前缀 */
+    @Value("${swagger.pathMapping}")
+    private String pathMapping;
+
+    /**
+     * 创建API
+     */
+    @Bean
+    public Docket createRestApi()
+    {
+        return new Docket(DocumentationType.OAS_30)
+                // 是否启用Swagger
+                .enable(enabled)
+                // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
+                .apiInfo(apiInfo())
+                // 设置哪些接口暴露给Swagger展示
+                .select()
+                // 扫描所有有注解的api,用这种方式更灵活
+                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+                // 扫描指定包中的swagger注解
+                // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
+                // 扫描所有 .apis(RequestHandlerSelectors.any())
+                .paths(PathSelectors.any())
+                .build()
+                /* 设置安全模式,swagger可以设置访问token */
+                .securitySchemes(securitySchemes())
+                .securityContexts(securityContexts())
+                .pathMapping(pathMapping);
+    }
+
+    /**
+     * 安全模式,这里指定token通过Authorization头请求头传递
+     */
+    private List<SecurityScheme> securitySchemes()
+    {
+        List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
+        apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
+        return apiKeyList;
+    }
+
+    /**
+     * 安全上下文
+     */
+    private List<SecurityContext> securityContexts()
+    {
+        List<SecurityContext> securityContexts = new ArrayList<>();
+        securityContexts.add(
+                SecurityContext.builder()
+                        .securityReferences(defaultAuth())
+                        .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
+                        .build());
+        return securityContexts;
+    }
+
+    /**
+     * 默认的安全上引用
+     */
+    private List<SecurityReference> defaultAuth()
+    {
+        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+        authorizationScopes[0] = authorizationScope;
+        List<SecurityReference> securityReferences = new ArrayList<>();
+        securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
+        return securityReferences;
+    }
+
+    /**
+     * 添加摘要信息
+     */
+    private ApiInfo apiInfo()
+    {
+        // 用ApiInfoBuilder进行定制
+        return new ApiInfoBuilder()
+                // 设置标题
+                .title("标题:若依管理系统_接口文档")
+                // 描述
+                .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
+                // 作者信息
+                .contact(new Contact(ruoyiConfig.getName(), null, null))
+                // 版本
+                .version("版本号:" + ruoyiConfig.getVersion())
+                .build();
+    }
+}

+ 1 - 0
bd-location/src/main/resources/META-INF/spring-devtools.properties

@@ -0,0 +1 @@
+restart.include.json=/com.alibaba.fastjson2.*.jar

+ 83 - 0
bd-location/src/main/resources/application-druid.yml

@@ -0,0 +1,83 @@
+# 数据源配置
+spring:
+  # redis 配置
+  redis:
+    # 地址
+    host: 172.192.10.105
+    # 端口,默认为6379
+    port: 30013
+    # 数据库索引
+    database: 1
+    # 密码
+    password:
+    # 连接超时时间
+    timeout: 10s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 8
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3s
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driverClassName: com.mysql.cj.jdbc.Driver
+    druid:
+      # 主库数据源
+      master:
+        url: jdbc:mysql://172.192.10.105:30002/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: root
+        password: root
+      # 从库数据源
+      slave:
+        # 从数据源开关/默认关闭
+        enabled: false
+        url:
+        username:
+        password:
+      # 初始连接数
+      initialSize: 5
+      # 最小连接池数量
+      minIdle: 10
+      # 最大连接池数量
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置连接超时时间
+      connectTimeout: 30000
+      # 配置网络超时时间
+      socketTimeout: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      # 配置一个连接在池中最大生存的时间,单位是毫秒
+      maxEvictableIdleTimeMillis: 900000
+      # 配置检测连接是否有效
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      webStatFilter:
+        enabled: true
+      statViewServlet:
+        enabled: true
+        # 设置白名单,不填则允许所有访问
+        allow:
+        url-pattern: /druid/*
+        # 控制台管理用户名和密码
+        login-username: ruoyi
+        login-password: 123456
+      filter:
+        stat:
+          enabled: true
+          # 慢SQL记录
+          log-slow-sql: true
+          slow-sql-millis: 1000
+          merge-sql: true
+        wall:
+          config:
+            multi-statement-allow: true

+ 102 - 0
bd-location/src/main/resources/application-hm.yml

@@ -0,0 +1,102 @@
+# 数据源配置
+spring:
+  # redis 配置
+  redis:
+    # 地址
+    host: 192.168.0.100
+    # 端口,默认为6379
+    port: 6379
+    # 数据库索引
+    database: 1
+    # 密码
+    password:
+    # 连接超时时间
+    timeout: 10s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 8
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3s
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driverClassName: com.mysql.cj.jdbc.Driver
+    druid:
+      # 主库数据源
+      master:
+        url: jdbc:mysql://192.168.0.100:13306/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: root
+        password: ct!QAZ
+      # 从库数据源
+      slave:
+        # 从数据源开关/默认关闭
+        enabled: false
+        url:
+        username:
+        password:
+      # 初始连接数
+      initialSize: 5
+      # 最小连接池数量
+      minIdle: 10
+      # 最大连接池数量
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置连接超时时间
+      connectTimeout: 30000
+      # 配置网络超时时间
+      socketTimeout: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      # 配置一个连接在池中最大生存的时间,单位是毫秒
+      maxEvictableIdleTimeMillis: 900000
+      # 配置检测连接是否有效
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      webStatFilter:
+        enabled: true
+      statViewServlet:
+        enabled: true
+        # 设置白名单,不填则允许所有访问
+        allow:
+        url-pattern: /druid/*
+        # 控制台管理用户名和密码
+        login-username: ruoyi
+        login-password: 123456
+      filter:
+        stat:
+          enabled: true
+          # 慢SQL记录
+          log-slow-sql: true
+          slow-sql-millis: 1000
+          merge-sql: true
+        wall:
+          config:
+            multi-statement-allow: true
+
+mqtt:
+  client:
+    enabled: true
+    ip: xt.wenhq.top
+    port: 8581
+    name: uwb-location-client
+    client-id: uwb-000001
+    global-subscribe:
+    timeout: 5
+    reconnect: true
+    re-interval: 5000
+    version: mqtt_3_1_1
+    read-buffer-size: 8KB
+    max-bytes-in-message: 10MB
+    keep-alive-secs: 60
+    clean-session: true
+    ssl:
+      enabled: false

+ 120 - 0
bd-location/src/main/resources/application.yml

@@ -0,0 +1,120 @@
+# 项目相关配置
+ruoyi:
+  # 名称
+  name: traffic-eff-be
+  # 版本
+  version: 3.8.8
+  # 版权年份
+  copyrightYear: 2024
+  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
+  profile: D:/ruoyi/uploadPath
+  # 获取ip地址开关
+  addressEnabled: false
+  # 验证码类型 math 数字计算 char 字符验证
+  captchaType: math
+
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为8080
+  port: 2012
+  servlet:
+    # 应用的访问路径
+    context-path: /tfc
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # 连接数满后的排队数,默认为100
+    accept-count: 1000
+    threads:
+      # tomcat最大线程数,默认为200
+      max: 800
+      # Tomcat启动初始化的线程数,默认值10
+      min-spare: 100
+
+# 日志配置
+logging:
+  level:
+    com.ruoyi: debug
+    org.springframework: warn
+
+# 用户配置
+user:
+  password:
+    # 密码最大错误次数
+    maxRetryCount: 5
+    # 密码锁定时间(默认10分钟)
+    lockTime: 10
+
+# Spring配置
+spring:
+  # 资源信息
+  messages:
+    # 国际化资源文件路径
+    basename: i18n/messages
+  profiles:
+    active: hm
+  # 文件上传
+  servlet:
+    multipart:
+      # 单个文件大小
+      max-file-size: 10MB
+      # 设置总上传的文件大小
+      max-request-size: 20MB
+  # 服务模块
+  devtools:
+    restart:
+      # 热部署开关
+      enabled: true
+forest:
+  max-connections: 1000        # 连接池最大连接数
+  connect-timeout: 3000        # 连接超时时间,单位为毫秒
+  read-timeout: 3000           # 数据读取超时时间,单位为毫秒
+  backend: okhttp3 # 配置后端HTTP API为 okhttp3
+  ## 日志总开关,打开/关闭Forest请求/响应日志(默认为 true)
+  log-enabled: true
+  ## 打开/关闭Forest请求日志(默认为 true)
+  log-request: true
+  ## 打开/关闭Forest响应状态日志(默认为 true)
+  log-response-status: true
+  ## 打开/关闭Forest响应内容日志(默认为 false)
+  log-response-content: true
+# token配置
+token:
+  # 令牌自定义标识
+  header: Authorization
+  # 令牌密钥
+  secret: abcdefghijklmnopqrstuvwxyz
+  # 令牌有效期(默认30分钟)
+  expireTime: 76000
+
+# MyBatis配置
+mybatis:
+  # 搜索指定包别名
+  typeAliasesPackage: com.ruoyi.**.domain
+  # 配置mapper的扫描,找到所有的mapper.xml映射文件
+  mapperLocations: classpath*:mapper/**/*Mapper.xml
+  # 加载全局的配置文件
+  configLocation: classpath:mybatis/mybatis-config.xml
+
+# PageHelper分页插件
+pagehelper:
+  helperDialect: mysql
+  supportMethodsArguments: true
+  params: count=countSql
+
+# Swagger配置
+swagger:
+  # 是否开启swagger
+  enabled: true
+  # 请求前缀
+  pathMapping: /dev-api
+
+# 防止XSS攻击
+xss:
+  # 过滤开关
+  enabled: true
+  # 排除链接(多个用逗号分隔)
+  excludes: /system/notice
+  # 匹配链接
+  urlPatterns: /system/*,/monitor/*,/tool/*
+

+ 2 - 0
bd-location/src/main/resources/banner.txt

@@ -0,0 +1,2 @@
+Application Version: ${ruoyi.version}
+Spring Boot Version: ${spring-boot.version}

+ 38 - 0
bd-location/src/main/resources/i18n/messages.properties

@@ -0,0 +1,38 @@
+#错误消息
+not.null=* 必须填写
+user.jcaptcha.error=验证码错误
+user.jcaptcha.expire=验证码已失效
+user.not.exists=用户不存在/密码错误
+user.password.not.match=用户不存在/密码错误
+user.password.retry.limit.count=密码输入错误{0}次
+user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
+user.password.delete=对不起,您的账号已被删除
+user.blocked=用户已封禁,请联系管理员
+role.blocked=角色已封禁,请联系管理员
+login.blocked=很遗憾,访问IP已被列入系统黑名单
+user.logout.success=退出成功
+
+length.not.valid=长度必须在{min}到{max}个字符之间
+
+user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
+user.password.not.valid=* 5-50个字符
+ 
+user.email.not.valid=邮箱格式错误
+user.mobile.phone.number.not.valid=手机号格式错误
+user.login.success=登录成功
+user.register.success=注册成功
+user.notfound=请重新登录
+user.forcelogout=管理员强制退出,请重新登录
+user.unknown.error=未知错误,请重新登录
+
+##文件上传消息
+upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
+upload.filename.exceed.length=上传的文件名最长{0}个字符
+
+##权限
+no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
+no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
+no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
+no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
+no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
+no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

+ 93 - 0
bd-location/src/main/resources/logback.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <!-- 日志存放路径 -->
+	<property name="log.path" value="/home/ruoyi/logs" />
+    <!-- 日志输出格式 -->
+	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
+
+	<!-- 控制台输出 -->
+	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+	</appender>
+
+	<!-- 系统日志输出 -->
+	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/sys-info.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+			<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 日志最大的历史 60天 -->
+			<maxHistory>60</maxHistory>
+		</rollingPolicy>
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>INFO</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+	</appender>
+
+	<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/sys-error.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 日志最大的历史 60天 -->
+			<maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>ERROR</level>
+			<!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+			<!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+	<!-- 用户访问日志输出  -->
+    <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${log.path}/sys-user.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 按天回滚 daily -->
+            <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+    </appender>
+
+	<!-- 系统模块日志级别控制  -->
+	<logger name="com.ruoyi" level="info" />
+	<!-- Spring日志级别控制  -->
+	<logger name="org.springframework" level="warn" />
+
+	<root level="info">
+		<appender-ref ref="console" />
+	</root>
+
+	<!--系统操作日志-->
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+    </root>
+
+	<!--系统用户操作日志-->
+    <logger name="sys-user" level="info">
+        <appender-ref ref="sys-user"/>
+    </logger>
+</configuration>

+ 0 - 0
ruoyi-system/src/main/resources/mapper/bd/BdFenceInfoMapper.xml → bd-location/src/main/resources/mapper/bd/BdFenceInfoMapper.xml


+ 0 - 0
ruoyi-system/src/main/resources/mapper/bd/BdFenceVioEvtMapper.xml → bd-location/src/main/resources/mapper/bd/BdFenceVioEvtMapper.xml


+ 20 - 0
bd-location/src/main/resources/mybatis/mybatis-config.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <!-- 全局参数 -->
+    <settings>
+        <!-- 使全局的映射器启用或禁用缓存 -->
+        <setting name="cacheEnabled"             value="true"   />
+        <!-- 允许JDBC 支持自动生成主键 -->
+        <setting name="useGeneratedKeys"         value="true"   />
+        <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
+        <setting name="defaultExecutorType"      value="SIMPLE" />
+		<!-- 指定 MyBatis 所用日志的具体实现 -->
+        <setting name="logImpl"                  value="SLF4J"  />
+        <!-- 使用驼峰命名法转换字段 -->
+		 <setting name="mapUnderscoreToCamelCase" value="true"/>
+	</settings>
+
+</configuration>

+ 7 - 0
pom.xml

@@ -34,6 +34,7 @@
         <forest.version>1.5.9</forest.version>
         <cffu.version>1.0.0-Alpha19</cffu.version>
         <jts.version>1.18.2</jts.version>
+        <mqttstarter.version>2.3.7</mqttstarter.version>
     </properties>
 
     <!-- 依赖声明 -->
@@ -200,6 +201,11 @@
                 <artifactId>jts-core</artifactId>
                 <version>${jts.version}</version>
             </dependency>
+            <dependency>
+                <groupId>net.dreamlu</groupId>
+                <artifactId>mica-mqtt-client-spring-boot-starter</artifactId>
+                <version>${mqttstarter.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -210,6 +216,7 @@
         <module>ruoyi-quartz</module>
         <module>ruoyi-generator</module>
         <module>ruoyi-common</module>
+        <module>bd-location</module>
     </modules>
     <packaging>pom</packaging>
 

+ 4 - 0
ruoyi-admin/pom.xml

@@ -64,6 +64,10 @@
             <groupId>com.dtflys.forest</groupId>
             <artifactId>forest-spring-boot-starter</artifactId>
         </dependency>
+        <dependency>
+            <groupId>net.dreamlu</groupId>
+            <artifactId>mica-mqtt-client-spring-boot-starter</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 19 - 0
ruoyi-admin/src/main/resources/application-druid.yml

@@ -87,3 +87,22 @@ wechat:
 app:
   cfg:
     role-top-dept-id: 201
+
+mqtt:
+  client:
+    enabled: true
+    ip: xt.wenhq.top
+    port: 8581
+    name: uwb-location-client
+    client-id: uwb-000001
+    global-subscribe:
+    timeout: 5
+    reconnect: true
+    re-interval: 5000
+    version: mqtt_3_1_1
+    read-buffer-size: 8KB
+    max-bytes-in-message: 10MB
+    keep-alive-secs: 60
+    clean-session: true
+    ssl:
+      enabled: false