chen.cheng 8 сар өмнө
parent
commit
10b9d80c10
36 өөрчлөгдсөн 1242 нэмэгдсэн , 81 устгасан
  1. 16 1
      bd-location/pom.xml
  2. 4 6
      bd-location/src/main/java/com/ruoyi/BDApplication.java
  3. 83 0
      bd-location/src/main/java/com/ruoyi/bd/domain/BdDevcTrail.java
  4. 48 0
      bd-location/src/main/java/com/ruoyi/bd/domain/UWBAuth.java
  5. 61 0
      bd-location/src/main/java/com/ruoyi/bd/mapper/BdDevcTrailMapper.java
  6. 11 9
      bd-location/src/main/java/com/ruoyi/bd/mapper/BdDevcTrailUwbMapper.java
  7. 61 0
      bd-location/src/main/java/com/ruoyi/bd/service/IBdDevcTrailService.java
  8. 2 0
      bd-location/src/main/java/com/ruoyi/bd/service/IBdDevcTrailUwbService.java
  9. 96 0
      bd-location/src/main/java/com/ruoyi/bd/service/impl/BdDevcTrailServiceImpl.java
  10. 22 21
      bd-location/src/main/java/com/ruoyi/bd/service/impl/BdDevcTrailUwbServiceImpl.java
  11. 10 0
      bd-location/src/main/java/com/ruoyi/bd/service/rpc/UWBWebService.java
  12. 77 0
      bd-location/src/main/java/com/ruoyi/bd/socket/UWBSocket/UWBSocketClient.java
  13. 30 0
      bd-location/src/main/java/com/ruoyi/task/BaseTask.java
  14. 24 0
      bd-location/src/main/java/com/ruoyi/task/taskiml/ObjTailTask.java
  15. 104 0
      bd-location/src/main/java/com/ruoyi/web/controller/bd/BdDevcTrailController.java
  16. 18 0
      bd-location/src/main/java/com/ruoyi/web/controller/bd/BdDevcTrailUwbController.java
  17. 134 0
      bd-location/src/main/java/com/ruoyi/web/core/config/UWBCfg.java
  18. 20 0
      bd-location/src/main/java/com/ruoyi/web/core/config/forest/UWBService.java
  19. 7 1
      bd-location/src/main/resources/application-druid.yml
  20. 1 1
      bd-location/src/main/resources/application-hm.yml
  21. 1 1
      bd-location/src/main/resources/application-k8s.yml
  22. 1 1
      bd-location/src/main/resources/application-prod.yml
  23. 82 0
      bd-location/src/main/resources/mapper/bd/BdDevcTrailMapper.xml
  24. 35 0
      bd-location/src/main/resources/mapper/bd/BdDevcTrailUwbMapper.xml
  25. 16 1
      pom.xml
  26. 1 1
      ruoyi-admin/src/main/resources/application-druid.yml
  27. 1 1
      ruoyi-admin/src/main/resources/application.yml
  28. 5 0
      ruoyi-common/pom.xml
  29. 38 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/ExpressUtil.java
  30. 22 0
      ruoyi-ui/.env.console
  31. 1 0
      ruoyi-ui/package.json
  32. 44 0
      ruoyi-ui/src/api/bd/devcTrail.js
  33. 1 1
      ruoyi-ui/src/views/bd/index.scss
  34. 36 0
      ruoyi-ui/src/views/bd/location/index.scss
  35. 127 34
      ruoyi-ui/src/views/bd/location/index.vue
  36. 2 2
      ruoyi-ui/src/views/bd/rooms/index.vue

+ 16 - 1
bd-location/pom.xml

@@ -48,12 +48,27 @@
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-framework</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-quartz</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.java-websocket</groupId>
+            <artifactId>Java-WebSocket</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.dtflys.forest</groupId>
             <artifactId>forest-spring-boot-starter</artifactId>
         </dependency>
         <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-core</artifactId>
+        </dependency>
+        <dependency>
             <groupId>net.dreamlu</groupId>
             <artifactId>mica-mqtt-client-spring-boot-starter</artifactId>
         </dependency>

+ 4 - 6
bd-location/src/main/java/com/ruoyi/BDApplication.java

@@ -10,12 +10,10 @@ 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)
-    {
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
+@ForestScan(basePackages = {"com.ruoyi.bd.service.rpc"})
+public class BDApplication {
+    public static void main(String[] args) {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(BDApplication.class, args);
     }

+ 83 - 0
bd-location/src/main/java/com/ruoyi/bd/domain/BdDevcTrail.java

@@ -0,0 +1,83 @@
+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;
+
+/**
+ * 设备轨迹对象 bd_devc_trail
+ * 
+ * @author ruoyi
+ * @date 2024-11-07
+ */
+public class BdDevcTrail extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /**  */
+    private Long id;
+
+    /** 设备唯一键 */
+    @Excel(name = "设备唯一键")
+    private String devcKey;
+
+    /**  */
+    @Excel(name = "")
+    private String dt;
+
+    /**  */
+    @Excel(name = "")
+    private String poly;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setDevcKey(String devcKey) 
+    {
+        this.devcKey = devcKey;
+    }
+
+    public String getDevcKey() 
+    {
+        return devcKey;
+    }
+    public void setDt(String dt) 
+    {
+        this.dt = dt;
+    }
+
+    public String getDt() 
+    {
+        return dt;
+    }
+    public void setPoly(String poly) 
+    {
+        this.poly = poly;
+    }
+
+    public String getPoly() 
+    {
+        return poly;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("devcKey", getDevcKey())
+            .append("dt", getDt())
+            .append("poly", getPoly())
+            .append("updateTime", getUpdateTime())
+            .append("createTime", getCreateTime())
+            .append("createBy", getCreateBy())
+            .append("updateBy", getUpdateBy())
+            .toString();
+    }
+}

+ 48 - 0
bd-location/src/main/java/com/ruoyi/bd/domain/UWBAuth.java

@@ -0,0 +1,48 @@
+package com.ruoyi.bd.domain;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+
+public class UWBAuth {
+    @JSONField(name = "token")
+    private String accessToken;
+
+    @JSONField(name = "register")
+    private String register;
+
+    @JSONField(name = "key")
+    private String key;
+
+    private String tagId;
+
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+    public void setAccessToken(String accessToken) {
+        this.accessToken = accessToken;
+    }
+
+    public String getRegister() {
+        return register;
+    }
+
+    public void setRegister(String register) {
+        this.register = register;
+    }
+
+    public void setTagId(String tagId) {
+        this.tagId = tagId;
+    }
+
+    public String getTagId() {
+        return tagId;
+    }
+
+    public String getKey() {
+        return this.register;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+}

+ 61 - 0
bd-location/src/main/java/com/ruoyi/bd/mapper/BdDevcTrailMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.bd.mapper;
+
+import java.util.List;
+import com.ruoyi.bd.domain.BdDevcTrail;
+
+/**
+ * 设备轨迹Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-11-07
+ */
+public interface BdDevcTrailMapper 
+{
+    /**
+     * 查询设备轨迹
+     * 
+     * @param id 设备轨迹主键
+     * @return 设备轨迹
+     */
+    public BdDevcTrail selectBdDevcTrailById(Long id);
+
+    /**
+     * 查询设备轨迹列表
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 设备轨迹集合
+     */
+    public List<BdDevcTrail> selectBdDevcTrailList(BdDevcTrail bdDevcTrail);
+
+    /**
+     * 新增设备轨迹
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 结果
+     */
+    public int insertBdDevcTrail(BdDevcTrail bdDevcTrail);
+
+    /**
+     * 修改设备轨迹
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 结果
+     */
+    public int updateBdDevcTrail(BdDevcTrail bdDevcTrail);
+
+    /**
+     * 删除设备轨迹
+     * 
+     * @param id 设备轨迹主键
+     * @return 结果
+     */
+    public int deleteBdDevcTrailById(Long id);
+
+    /**
+     * 批量删除设备轨迹
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteBdDevcTrailByIds(Long[] ids);
+}

+ 11 - 9
bd-location/src/main/java/com/ruoyi/bd/mapper/BdDevcTrailUwbMapper.java

@@ -1,19 +1,19 @@
 package com.ruoyi.bd.mapper;
 
 import java.util.List;
+
 import com.ruoyi.bd.domain.BdDevcTrailUwb;
 
 /**
  * 室内坐标定位Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-10-16
  */
-public interface BdDevcTrailUwbMapper 
-{
+public interface BdDevcTrailUwbMapper {
     /**
      * 查询室内坐标定位
-     * 
+     *
      * @param id 室内坐标定位主键
      * @return 室内坐标定位
      */
@@ -21,7 +21,7 @@ public interface BdDevcTrailUwbMapper
 
     /**
      * 查询室内坐标定位列表
-     * 
+     *
      * @param bdDevcTrailUwb 室内坐标定位
      * @return 室内坐标定位集合
      */
@@ -29,7 +29,7 @@ public interface BdDevcTrailUwbMapper
 
     /**
      * 新增室内坐标定位
-     * 
+     *
      * @param bdDevcTrailUwb 室内坐标定位
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface BdDevcTrailUwbMapper
 
     /**
      * 修改室内坐标定位
-     * 
+     *
      * @param bdDevcTrailUwb 室内坐标定位
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface BdDevcTrailUwbMapper
 
     /**
      * 删除室内坐标定位
-     * 
+     *
      * @param id 室内坐标定位主键
      * @return 结果
      */
@@ -53,9 +53,11 @@ public interface BdDevcTrailUwbMapper
 
     /**
      * 批量删除室内坐标定位
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteBdDevcTrailUwbByIds(Long[] ids);
+
+    void saveObjTail(String dt);
 }

+ 61 - 0
bd-location/src/main/java/com/ruoyi/bd/service/IBdDevcTrailService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.bd.service;
+
+import java.util.List;
+import com.ruoyi.bd.domain.BdDevcTrail;
+
+/**
+ * 设备轨迹Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-11-07
+ */
+public interface IBdDevcTrailService 
+{
+    /**
+     * 查询设备轨迹
+     * 
+     * @param id 设备轨迹主键
+     * @return 设备轨迹
+     */
+    public BdDevcTrail selectBdDevcTrailById(Long id);
+
+    /**
+     * 查询设备轨迹列表
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 设备轨迹集合
+     */
+    public List<BdDevcTrail> selectBdDevcTrailList(BdDevcTrail bdDevcTrail);
+
+    /**
+     * 新增设备轨迹
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 结果
+     */
+    public int insertBdDevcTrail(BdDevcTrail bdDevcTrail);
+
+    /**
+     * 修改设备轨迹
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 结果
+     */
+    public int updateBdDevcTrail(BdDevcTrail bdDevcTrail);
+
+    /**
+     * 批量删除设备轨迹
+     * 
+     * @param ids 需要删除的设备轨迹主键集合
+     * @return 结果
+     */
+    public int deleteBdDevcTrailByIds(Long[] ids);
+
+    /**
+     * 删除设备轨迹信息
+     * 
+     * @param id 设备轨迹主键
+     * @return 结果
+     */
+    public int deleteBdDevcTrailById(Long id);
+}

+ 2 - 0
bd-location/src/main/java/com/ruoyi/bd/service/IBdDevcTrailUwbService.java

@@ -58,4 +58,6 @@ public interface IBdDevcTrailUwbService
      * @return 结果
      */
     public int deleteBdDevcTrailUwbById(Long id);
+
+    public void saveUwbTrail();
 }

+ 96 - 0
bd-location/src/main/java/com/ruoyi/bd/service/impl/BdDevcTrailServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.bd.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.bd.mapper.BdDevcTrailMapper;
+import com.ruoyi.bd.domain.BdDevcTrail;
+import com.ruoyi.bd.service.IBdDevcTrailService;
+
+/**
+ * 设备轨迹Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-11-07
+ */
+@Service
+public class BdDevcTrailServiceImpl implements IBdDevcTrailService 
+{
+    @Autowired
+    private BdDevcTrailMapper bdDevcTrailMapper;
+
+    /**
+     * 查询设备轨迹
+     * 
+     * @param id 设备轨迹主键
+     * @return 设备轨迹
+     */
+    @Override
+    public BdDevcTrail selectBdDevcTrailById(Long id)
+    {
+        return bdDevcTrailMapper.selectBdDevcTrailById(id);
+    }
+
+    /**
+     * 查询设备轨迹列表
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 设备轨迹
+     */
+    @Override
+    public List<BdDevcTrail> selectBdDevcTrailList(BdDevcTrail bdDevcTrail)
+    {
+        return bdDevcTrailMapper.selectBdDevcTrailList(bdDevcTrail);
+    }
+
+    /**
+     * 新增设备轨迹
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 结果
+     */
+    @Override
+    public int insertBdDevcTrail(BdDevcTrail bdDevcTrail)
+    {
+        bdDevcTrail.setCreateTime(DateUtils.getNowDate());
+        return bdDevcTrailMapper.insertBdDevcTrail(bdDevcTrail);
+    }
+
+    /**
+     * 修改设备轨迹
+     * 
+     * @param bdDevcTrail 设备轨迹
+     * @return 结果
+     */
+    @Override
+    public int updateBdDevcTrail(BdDevcTrail bdDevcTrail)
+    {
+        bdDevcTrail.setUpdateTime(DateUtils.getNowDate());
+        return bdDevcTrailMapper.updateBdDevcTrail(bdDevcTrail);
+    }
+
+    /**
+     * 批量删除设备轨迹
+     * 
+     * @param ids 需要删除的设备轨迹主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBdDevcTrailByIds(Long[] ids)
+    {
+        return bdDevcTrailMapper.deleteBdDevcTrailByIds(ids);
+    }
+
+    /**
+     * 删除设备轨迹信息
+     * 
+     * @param id 设备轨迹主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBdDevcTrailById(Long id)
+    {
+        return bdDevcTrailMapper.deleteBdDevcTrailById(id);
+    }
+}

+ 22 - 21
bd-location/src/main/java/com/ruoyi/bd/service/impl/BdDevcTrailUwbServiceImpl.java

@@ -1,6 +1,8 @@
 package com.ruoyi.bd.service.impl;
 
 import java.util.List;
+
+import com.ruoyi.common.utils.DateTimeUtil;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -10,87 +12,86 @@ import com.ruoyi.bd.service.IBdDevcTrailUwbService;
 
 /**
  * 室内坐标定位Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-10-16
  */
 @Service
-public class BdDevcTrailUwbServiceImpl implements IBdDevcTrailUwbService 
-{
+public class BdDevcTrailUwbServiceImpl implements IBdDevcTrailUwbService {
     @Autowired
     private BdDevcTrailUwbMapper bdDevcTrailUwbMapper;
 
     /**
      * 查询室内坐标定位
-     * 
+     *
      * @param id 室内坐标定位主键
      * @return 室内坐标定位
      */
     @Override
-    public BdDevcTrailUwb selectBdDevcTrailUwbById(Long id)
-    {
+    public BdDevcTrailUwb selectBdDevcTrailUwbById(Long id) {
         return bdDevcTrailUwbMapper.selectBdDevcTrailUwbById(id);
     }
 
     /**
      * 查询室内坐标定位列表
-     * 
+     *
      * @param bdDevcTrailUwb 室内坐标定位
      * @return 室内坐标定位
      */
     @Override
-    public List<BdDevcTrailUwb> selectBdDevcTrailUwbList(BdDevcTrailUwb bdDevcTrailUwb)
-    {
+    public List<BdDevcTrailUwb> selectBdDevcTrailUwbList(BdDevcTrailUwb bdDevcTrailUwb) {
         return bdDevcTrailUwbMapper.selectBdDevcTrailUwbList(bdDevcTrailUwb);
     }
 
     /**
      * 新增室内坐标定位
-     * 
+     *
      * @param bdDevcTrailUwb 室内坐标定位
      * @return 结果
      */
     @Override
-    public int insertBdDevcTrailUwb(BdDevcTrailUwb bdDevcTrailUwb)
-    {
+    public int insertBdDevcTrailUwb(BdDevcTrailUwb bdDevcTrailUwb) {
         bdDevcTrailUwb.setCreateTime(DateUtils.getNowDate());
         return bdDevcTrailUwbMapper.insertBdDevcTrailUwb(bdDevcTrailUwb);
     }
 
     /**
      * 修改室内坐标定位
-     * 
+     *
      * @param bdDevcTrailUwb 室内坐标定位
      * @return 结果
      */
     @Override
-    public int updateBdDevcTrailUwb(BdDevcTrailUwb bdDevcTrailUwb)
-    {
+    public int updateBdDevcTrailUwb(BdDevcTrailUwb bdDevcTrailUwb) {
         bdDevcTrailUwb.setUpdateTime(DateUtils.getNowDate());
         return bdDevcTrailUwbMapper.updateBdDevcTrailUwb(bdDevcTrailUwb);
     }
 
     /**
      * 批量删除室内坐标定位
-     * 
+     *
      * @param ids 需要删除的室内坐标定位主键
      * @return 结果
      */
     @Override
-    public int deleteBdDevcTrailUwbByIds(Long[] ids)
-    {
+    public int deleteBdDevcTrailUwbByIds(Long[] ids) {
         return bdDevcTrailUwbMapper.deleteBdDevcTrailUwbByIds(ids);
     }
 
     /**
      * 删除室内坐标定位信息
-     * 
+     *
      * @param id 室内坐标定位主键
      * @return 结果
      */
     @Override
-    public int deleteBdDevcTrailUwbById(Long id)
-    {
+    public int deleteBdDevcTrailUwbById(Long id) {
         return bdDevcTrailUwbMapper.deleteBdDevcTrailUwbById(id);
     }
+
+    @Override
+    public void saveUwbTrail() {
+        String yesterday = DateTimeUtil.yesterday(DateTimeUtil.DateFormatter.yyyyMMdd);
+        bdDevcTrailUwbMapper.saveObjTail(yesterday);
+    }
 }

+ 10 - 0
bd-location/src/main/java/com/ruoyi/bd/service/rpc/UWBWebService.java

@@ -0,0 +1,10 @@
+package com.ruoyi.bd.service.rpc;
+
+import com.dtflys.forest.annotation.*;
+
+import java.util.Map;
+
+public interface UWBWebService {
+    @Post(url = "{uwbBaseUrl}/stage-api/auth/login", dataType = "json")
+    Map exchangeToken(@JSONBody Map<String, Object> data);
+}

+ 77 - 0
bd-location/src/main/java/com/ruoyi/bd/socket/UWBSocket/UWBSocketClient.java

@@ -0,0 +1,77 @@
+package com.ruoyi.bd.socket.UWBSocket;
+
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.util.Map;
+
+import org.java_websocket.drafts.Draft;
+import org.java_websocket.handshake.ServerHandshake;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.bd.domain.UWBAuth;
+
+public class UWBSocketClient extends org.java_websocket.client.WebSocketClient {
+
+    private static final Logger log = LoggerFactory.getLogger(UWBSocketClient.class);
+
+    private UWBAuth authToken;
+
+    public UWBAuth getAuthToken() {
+        return authToken;
+    }
+
+    public void setAuthToken(UWBAuth authToken) {
+        this.authToken = authToken;
+    }
+
+    public UWBSocketClient(URI serverUri) {
+        super(serverUri);
+    }
+
+    public UWBSocketClient(URI serverUri, Draft protocolDraft) {
+        super(serverUri, protocolDraft);
+    }
+
+    public UWBSocketClient(URI serverUri, Draft protocolDraft, Map<String, String> httpHeaders, int connectTimeout) {
+        super(serverUri, protocolDraft, httpHeaders, connectTimeout);
+    }
+
+    @Override
+    public void onOpen(ServerHandshake serverHandshake) {
+        log.info("[websocket] 连接成功,{}", JSON.toJSONString(this.authToken));
+        send(JSON.toJSONString(this.authToken));
+    }
+
+
+    @Override
+    public void onMessage(String message) {
+        log.info("[websocket] 收到消息={}", message);
+        JSONObject data = JSON.parseObject(message);
+        if ("handshake".equals(data.getString("message"))) {
+            this.authToken.setTagId("847F3");
+            log.info("[websocket] 推送={}", JSON.toJSONString(this.authToken));
+            // tagId要去掉前缀0
+            send(JSON.toJSONString(this.authToken));
+        }
+    }
+
+    @Override
+    public void onMessage(ByteBuffer bytes) {
+        log.info("[websocket] 收到消息={}", JSON.parseObject(bytes.array()));
+
+    }
+
+    @Override
+    public void onClose(int i, String s, boolean b) {
+        log.info("[websocket] 退出连接");
+    }
+
+    @Override
+    public void onError(Exception e) {
+        log.info("[websocket] 连接错误={}", e.getMessage());
+    }
+
+}

+ 30 - 0
bd-location/src/main/java/com/ruoyi/task/BaseTask.java

@@ -0,0 +1,30 @@
+package com.ruoyi.task;
+
+import cn.hutool.core.map.MapUtil;
+import com.ruoyi.quartz.domain.SysJob;
+import org.quartz.Scheduler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Map;
+
+public abstract class BaseTask {
+    public static final Logger log = LoggerFactory.getLogger(BaseTask.class);
+
+    @Autowired
+    private Scheduler scheduler;
+
+    public abstract void run(SysJob taskProperties);
+
+    public void execute() {
+        try {
+            Map<String, Object> wrappedMap = scheduler.getCurrentlyExecutingJobs().get(0).getJobDetail().getJobDataMap().getWrappedMap();
+            SysJob taskProperties = MapUtil.get(wrappedMap, "TASK_PROPERTIES", SysJob.class);
+            log.info("开始执行任务,任务名:{}", taskProperties.getJobName());
+            run(taskProperties);
+        } catch (Exception e) {
+            log.error("执行任务失败", e);
+        }
+    }
+}

+ 24 - 0
bd-location/src/main/java/com/ruoyi/task/taskiml/ObjTailTask.java

@@ -0,0 +1,24 @@
+package com.ruoyi.task.taskiml;
+
+import com.ruoyi.bd.service.IBdDevcTrailUwbService;
+import com.ruoyi.quartz.domain.SysJob;
+import com.ruoyi.task.BaseTask;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 定时任务调度测试
+ *
+ * @author ruoyi
+ */
+@Component("objTailTask")
+public class ObjTailTask extends BaseTask {
+
+    @Autowired
+    private IBdDevcTrailUwbService bdDevcTrailUwbService;
+
+    @Override
+    public void run(SysJob taskProperties) {
+        bdDevcTrailUwbService.saveUwbTrail();
+    }
+}

+ 104 - 0
bd-location/src/main/java/com/ruoyi/web/controller/bd/BdDevcTrailController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.bd.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.bd.domain.BdDevcTrail;
+import com.ruoyi.bd.service.IBdDevcTrailService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 设备轨迹Controller
+ * 
+ * @author ruoyi
+ * @date 2024-11-07
+ */
+@RestController
+@RequestMapping("/bd/devcTrail")
+public class BdDevcTrailController extends BaseController
+{
+    @Autowired
+    private IBdDevcTrailService bdDevcTrailService;
+
+    /**
+     * 查询设备轨迹列表
+     */
+    @PreAuthorize("@ss.hasPermi('bd:devcTrail:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(BdDevcTrail bdDevcTrail)
+    {
+        startPage();
+        List<BdDevcTrail> list = bdDevcTrailService.selectBdDevcTrailList(bdDevcTrail);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出设备轨迹列表
+     */
+    @PreAuthorize("@ss.hasPermi('bd:devcTrail:export')")
+    @Log(title = "设备轨迹", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BdDevcTrail bdDevcTrail)
+    {
+        List<BdDevcTrail> list = bdDevcTrailService.selectBdDevcTrailList(bdDevcTrail);
+        ExcelUtil<BdDevcTrail> util = new ExcelUtil<BdDevcTrail>(BdDevcTrail.class);
+        util.exportExcel(response, list, "设备轨迹数据");
+    }
+
+    /**
+     * 获取设备轨迹详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('bd:devcTrail:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(bdDevcTrailService.selectBdDevcTrailById(id));
+    }
+
+    /**
+     * 新增设备轨迹
+     */
+    @PreAuthorize("@ss.hasPermi('bd:devcTrail:add')")
+    @Log(title = "设备轨迹", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BdDevcTrail bdDevcTrail)
+    {
+        return toAjax(bdDevcTrailService.insertBdDevcTrail(bdDevcTrail));
+    }
+
+    /**
+     * 修改设备轨迹
+     */
+    @PreAuthorize("@ss.hasPermi('bd:devcTrail:edit')")
+    @Log(title = "设备轨迹", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BdDevcTrail bdDevcTrail)
+    {
+        return toAjax(bdDevcTrailService.updateBdDevcTrail(bdDevcTrail));
+    }
+
+    /**
+     * 删除设备轨迹
+     */
+    @PreAuthorize("@ss.hasPermi('bd:devcTrail:remove')")
+    @Log(title = "设备轨迹", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(bdDevcTrailService.deleteBdDevcTrailByIds(ids));
+    }
+}

+ 18 - 0
bd-location/src/main/java/com/ruoyi/web/controller/bd/BdDevcTrailUwbController.java

@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.bd;
 import com.alibaba.fastjson2.JSON;
 import com.ruoyi.bd.domain.BdDevcTrailUwb;
 import com.ruoyi.bd.service.IBdDevcTrailUwbService;
+import com.ruoyi.bd.service.rpc.UWBWebService;
 import com.ruoyi.common.BDConst;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.annotation.Log;
@@ -45,6 +46,9 @@ public class BdDevcTrailUwbController extends BaseController {
     @Autowired
     private MqttClientTemplate client;
 
+    @Autowired
+    private UWBWebService uwbWebService;
+
     /**
      * 查询室内坐标定位列表
      */
@@ -90,6 +94,18 @@ public class BdDevcTrailUwbController extends BaseController {
         return success(bdDevcTrailUwbService.selectBdDevcTrailUwbById(id));
     }
 
+    @GetMapping(value = "/token/{id}")
+    @Anonymous
+    public AjaxResult getTokenInfo() {
+        return success(uwbWebService.exchangeToken(new HashMap<String,Object>(){
+            {
+                put("username", "admin");
+                put("password", "admin123");
+                put("isfresh", 1);
+            }
+        }));
+    }
+
     /**
      * 新增室内坐标定位
      */
@@ -117,4 +133,6 @@ public class BdDevcTrailUwbController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(bdDevcTrailUwbService.deleteBdDevcTrailUwbByIds(ids));
     }
+
+
 }

+ 134 - 0
bd-location/src/main/java/com/ruoyi/web/core/config/UWBCfg.java

@@ -0,0 +1,134 @@
+package com.ruoyi.web.core.config;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.annotation.Resource;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.java_websocket.client.WebSocketClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.ruoyi.bd.domain.UWBAuth;
+import com.ruoyi.bd.service.rpc.UWBWebService;
+import com.ruoyi.bd.socket.UWBSocket.UWBSocketClient;
+import com.ruoyi.common.utils.DateTimeUtil;
+
+import cn.hutool.core.map.MapUtil;
+
+@Configuration
+@ConfigurationProperties(prefix = "bd.uwb")
+@ConditionalOnProperty(name = "bd.uwb.enabled", havingValue = "true")
+public class UWBCfg {
+    private static final Logger log = LoggerFactory.getLogger(UWBCfg.class);
+
+    private String uwbSocket;
+
+    private String uwbUsr;
+
+    private String uwbPwd;
+
+    private String uwbHost;
+
+    public String getUwbHost() {
+        return uwbHost;
+    }
+
+    public void setUwbHost(String uwbHost) {
+        this.uwbHost = uwbHost;
+    }
+
+    @Resource
+    private UWBWebService uwbWebService;
+
+    public String getUwbSocket() {
+        return uwbSocket;
+    }
+
+    public void setUwbSocket(String uwbSocket) {
+        this.uwbSocket = uwbSocket;
+    }
+
+    public String getUwbUsr() {
+        return uwbUsr;
+    }
+
+    public void setUwbUsr(String uwbUsr) {
+        this.uwbUsr = uwbUsr;
+    }
+
+    public String getUwbPwd() {
+        return uwbPwd;
+    }
+
+    public void setUwbPwd(String uwbPwd) {
+        this.uwbPwd = uwbPwd;
+    }
+
+    @Bean
+    public WebSocketClient webSocketClient() throws URISyntaxException {
+        String ws = this.getUwbSocket();
+        UWBSocketClient webSocketClient = new UWBSocketClient(new URI(ws));
+        UWBAuth uwbAuth = authUWB();
+        if (ObjectUtils.isEmpty(uwbAuth)) {
+            return null;
+        }
+        webSocketClient.setAuthToken(uwbAuth);
+        webSocketClient.connect();
+        Timer t = new Timer();
+        t.scheduleAtFixedRate(new TimerTask() {
+            @Override
+            public void run() {
+                if (webSocketClient.isClosed()) {
+                    UWBAuth uwbAuth = authUWB();
+                    if (ObjectUtils.isEmpty(uwbAuth)) {
+                        return;
+                    }
+                    webSocketClient.setAuthToken(uwbAuth);
+                    webSocketClient.reconnect();
+                }
+            }
+        }, 1000, 5000);
+        return webSocketClient;
+    }
+
+    private UWBAuth authUWB() {
+        Map map = uwbWebService.exchangeToken(new HashMap<String, Object>() {
+            {
+                {
+                    put("username", uwbUsr);
+                    put("password", uwbPwd);
+                    put("isfresh", 1);
+                }
+            }
+        });
+        Integer code = MapUtil.getInt(map, "code", 400);
+        if (code != 200) {
+            log.error("获取token失败");
+            return null;
+        }
+        JSONObject data = MapUtil.get(map, "data", JSONObject.class);
+        UWBAuth uwbAuth = new UWBAuth();
+        String accessToken = data.getString("access_token");
+        if (StringUtils.isBlank(accessToken)) {
+            log.error("获取token失败{}", data);
+            return null;
+        }
+        uwbAuth.setAccessToken(data.getString("access_token"));
+        uwbAuth.setRegister(Long.toString(DateTimeUtil.timestampMillis()));
+        return uwbAuth;
+    }
+
+}

+ 20 - 0
bd-location/src/main/java/com/ruoyi/web/core/config/forest/UWBService.java

@@ -0,0 +1,20 @@
+package com.ruoyi.web.core.config.forest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.dtflys.forest.annotation.BindingVar;
+import com.dtflys.forest.reflection.ForestMethod;
+import com.ruoyi.web.core.config.UWBCfg;
+
+@Service("uwbService")
+public class UWBService {
+    @Autowired
+    private UWBCfg uwbCfg;
+
+    @BindingVar("uwbBaseUrl")
+    public String getBaseUrl(ForestMethod method) {
+        return uwbCfg.getUwbHost();
+    }
+
+}

+ 7 - 1
bd-location/src/main/resources/application-druid.yml

@@ -28,7 +28,7 @@ spring:
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://172.192.10.105:30002/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://172.192.10.105:30002/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
         username: root
         password: root
       # 从库数据源
@@ -102,3 +102,9 @@ mqtt:
 bd:
   mqtt:
     enabled: true
+  uwb:
+    enabled: true
+    uwb-socket: ws://172.192.13.77:2223/socket/websocket/pollingArea
+    uwb-usr: admin
+    uwb-pwd: admin123
+    uwb-host: http://172.192.13.77:2223

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

@@ -28,7 +28,7 @@ spring:
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://192.168.0.100:13306/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://192.168.0.100:13306/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
         username: root
         password: ct!QAZ
       # 从库数据源

+ 1 - 1
bd-location/src/main/resources/application-k8s.yml

@@ -32,7 +32,7 @@ spring:
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://200.200.19.121:31000/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://200.200.19.121:31000/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
         username: root
         password: root
       # 从库数据源

+ 1 - 1
bd-location/src/main/resources/application-prod.yml

@@ -28,7 +28,7 @@ spring:
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://127.0.0.1:3306/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3306/hs_cps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
         username: hscps
         password: hscps2024
       # 从库数据源

+ 82 - 0
bd-location/src/main/resources/mapper/bd/BdDevcTrailMapper.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.bd.mapper.BdDevcTrailMapper">
+    
+    <resultMap type="BdDevcTrail" id="BdDevcTrailResult">
+        <result property="id"    column="id"    />
+        <result property="devcKey"    column="devc_key"    />
+        <result property="dt"    column="dt"    />
+        <result property="poly"    column="poly"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateBy"    column="update_by"    />
+    </resultMap>
+
+    <sql id="selectBdDevcTrailVo">
+        select id, devc_key, dt, poly, update_time, create_time, create_by, update_by from bd_devc_trail
+    </sql>
+
+    <select id="selectBdDevcTrailList" parameterType="BdDevcTrail" resultMap="BdDevcTrailResult">
+        <include refid="selectBdDevcTrailVo"/>
+        <where>  
+            <if test="devcKey != null  and devcKey != ''"> and devc_key = #{devcKey}</if>
+            <if test="dt != null  and dt != ''"> and dt = #{dt}</if>
+            <if test="poly != null  and poly != ''"> and poly = #{poly}</if>
+        </where>
+    </select>
+    
+    <select id="selectBdDevcTrailById" parameterType="Long" resultMap="BdDevcTrailResult">
+        <include refid="selectBdDevcTrailVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertBdDevcTrail" parameterType="BdDevcTrail" useGeneratedKeys="true" keyProperty="id">
+        insert into bd_devc_trail
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="devcKey != null">devc_key,</if>
+            <if test="dt != null">dt,</if>
+            <if test="poly != null">poly,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="devcKey != null">#{devcKey},</if>
+            <if test="dt != null">#{dt},</if>
+            <if test="poly != null">#{poly},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+         </trim>
+    </insert>
+
+    <update id="updateBdDevcTrail" parameterType="BdDevcTrail">
+        update bd_devc_trail
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="devcKey != null">devc_key = #{devcKey},</if>
+            <if test="dt != null">dt = #{dt},</if>
+            <if test="poly != null">poly = #{poly},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteBdDevcTrailById" parameterType="Long">
+        delete from bd_devc_trail where id = #{id}
+    </delete>
+
+    <delete id="deleteBdDevcTrailByIds" parameterType="String">
+        delete from bd_devc_trail where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 35 - 0
bd-location/src/main/resources/mapper/bd/BdDevcTrailUwbMapper.xml

@@ -94,4 +94,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <insert id="saveObjTail" parameterType="String">
+        SET SESSION group_concat_max_len = 1024000;
+        INSERT INTO bd_devc_trail (devc_key, dt, poly, update_time, create_time)
+        SELECT devc_key, dt, poly, NOW(), NOW()
+        FROM (SELECT devc_key,
+                     dt,
+                     concat(
+                             '[',
+                             GROUP_CONCAT(
+                                     CONCAT(
+                                             '[',
+                                             lng,
+                                             ',',
+                                             lat,
+                                             ',',
+                                             COALESCE(altitude, '-1'),
+                                             ',',
+                                             step_index,
+                                             ',',
+                                             COALESCE(room_index, '-1'),
+                                             ']'
+                                         ) ORDER BY
+			step_index SEPARATOR ','
+                                 ),
+                             ']'
+                         ) AS poly
+              FROM bd_devc_trail_uwb
+              WHERE dt = #{dt}
+              GROUP BY devc_key,
+                       dt) res ON DUPLICATE KEY
+        UPDATE poly =
+        VALUES (poly), update_time =
+        VALUES (update_time);
+    </insert>
 </mapper>

+ 16 - 1
pom.xml

@@ -31,11 +31,13 @@
         <poi.version>4.1.2</poi.version>
         <velocity.version>2.3</velocity.version>
         <jwt.version>0.9.1</jwt.version>
-        <forest.version>1.5.9</forest.version>
+        <forest.version>1.5.36</forest.version>
         <cffu.version>1.0.0-Alpha19</cffu.version>
         <jts.version>1.18.2</jts.version>
         <mqttstarter.version>2.3.7</mqttstarter.version>
         <math.version>3.6.1</math.version>
+        <hutool.version>5.8.26</hutool.version>
+        <java.ws.version>1.5.2</java.ws.version>
     </properties>
 
     <!-- 依赖声明 -->
@@ -212,6 +214,19 @@
                 <artifactId>commons-math3</artifactId>
                 <version>${math.version}</version>
             </dependency>
+            <dependency>
+                <groupId>cn.hutool</groupId>
+                <artifactId>hutool-bom</artifactId>
+                <version>${hutool.version}</version>
+                <type>pom</type>
+                <!-- 注意这里是import -->
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.java-websocket</groupId>
+                <artifactId>Java-WebSocket</artifactId>
+                <version>${java.ws.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

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

@@ -7,7 +7,7 @@ spring:
     # 端口,默认为6379
     port: 30013
     # 数据库索引
-    database: 1
+    database: 4
     # 密码
     password:
     # 连接超时时间

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -52,7 +52,7 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-    active: hm
+    active: druid
   # 文件上传
   servlet:
     multipart:

+ 5 - 0
ruoyi-common/pom.xml

@@ -127,6 +127,11 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-math3</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 38 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/ExpressUtil.java

@@ -0,0 +1,38 @@
+package com.ruoyi.common.utils;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.map.MapUtil;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.expression.Expression;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public final class ExpressUtil {
+    public static <T> List<Map<String, Object>> hitExpress(T obj, List<Map<String, Object>> indexRangeList) {
+        if (CollectionUtils.isEmpty(indexRangeList)) {
+            return null;
+        }
+        SpelExpressionParser spelExpressionParser = new SpelExpressionParser();
+        List<Map<String, Object>> result = new ArrayList<>();
+        Map<String, Object> map = new HashMap<>();
+        BeanUtil.beanToMap(obj, map, false, false);
+        String express;
+        String indexName;
+        Expression expression;
+        Boolean eval;
+        for (Map<String, Object> stringObjectMap : indexRangeList) {
+            indexName = MapUtil.getStr(stringObjectMap, "indexName");
+            express = String.format("%s < ['indexUpperLimit'] && %s >= ['indexLowerLimit']", map.get(indexName), map.get(indexName));
+            expression = spelExpressionParser.parseExpression(express);
+            eval = expression.getValue(stringObjectMap, Boolean.class);
+            if (Boolean.FALSE.equals(eval)) {
+                result.add(stringObjectMap);
+            }
+        }
+        return result;
+    }
+}

+ 22 - 0
ruoyi-ui/.env.console

@@ -0,0 +1,22 @@
+# 页面标题
+VUE_APP_TITLE = 交通强国工作台
+
+# 开发环境配置
+ENV = 'development'
+
+# 若依管理系统/开发环境
+VUE_APP_BASE_API = '/dev-api'
+
+VUE_APP_BASE_URL = 'http://127.0.0.1:18080/tfc'
+
+VUE_APP_WS_URL = 'ws://127.0.0.1:18080/tfc'
+
+VUE_APP_BD_BASE_API = '/dev-db-api'
+
+VUE_APP_BD_BASE_URL = 'http://200.200.19.253:31838/bdgis'
+
+# 3D图层开关
+VUE_APP_3D_SWITCH = false
+
+# 路由懒加载
+VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 1 - 0
ruoyi-ui/package.json

@@ -6,6 +6,7 @@
   "license": "MIT",
   "scripts": {
     "dev": "vue-cli-service serve",
+    "cs": "vue-cli-service serve --mode console",
     "test": "vue-cli-service serve --mode test",
     "build:prod": "vue-cli-service build",
     "build:stage": "vue-cli-service build --mode staging",

+ 44 - 0
ruoyi-ui/src/api/bd/devcTrail.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询设备轨迹列表
+export function listDevcTrail(query) {
+  return request({
+    url: '/bd/devcTrail/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询设备轨迹详细
+export function getDevcTrail(id) {
+  return request({
+    url: '/bd/devcTrail/' + id,
+    method: 'get'
+  })
+}
+
+// 新增设备轨迹
+export function addDevcTrail(data) {
+  return request({
+    url: '/bd/devcTrail',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改设备轨迹
+export function updateDevcTrail(data) {
+  return request({
+    url: '/bd/devcTrail',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除设备轨迹
+export function delDevcTrail(id) {
+  return request({
+    url: '/bd/devcTrail/' + id,
+    method: 'delete'
+  })
+}

+ 1 - 1
ruoyi-ui/src/views/bd/index.scss

@@ -38,7 +38,7 @@
     position: absolute;
     top: $header-height;
     right: 14px;
-    width: 22%;
+    width: 25%;
     box-sizing: border-box;
     background: #060624ba;
     border-radius: 10px;

+ 36 - 0
ruoyi-ui/src/views/bd/location/index.scss

@@ -0,0 +1,36 @@
+.devc-location-container {
+  .header-ctrl {
+    margin-bottom: 10px;
+    .el-date-editor{
+      margin-left: 10px;
+      .el-input__inner{
+        background-color: transparent;
+        color: #fefefe;
+        border: 1px solid #dcdfe663;
+      }
+      &.el-date-editor--datetimerange.el-input__inner{
+        background-color: transparent;
+        border: 1px solid #dcdfe663;
+        width: 300px;
+        .el-range-input{
+          background-color: transparent;
+          color: #fefefe;
+        }
+      }
+      .el-range-separator{
+        color: #fefefe;
+      }
+    }
+    .el-radio-button {
+      cursor: pointer;
+
+      &:not(.is-active) {
+        .el-radio-button__inner {
+          background-color: transparent;
+          border-color: #dcdfe663;
+          color: #fefefe;
+        }
+      }
+    }
+  }
+}

+ 127 - 34
ruoyi-ui/src/views/bd/location/index.vue

@@ -1,19 +1,49 @@
 <template>
   <pannel class="devc-location-container">
     <template v-slot:icon>
-      <svg-icon icon-class="bd_location" />
+      <svg-icon icon-class="bd_location"/>
     </template>
     <template v-slot:title>
       轨迹查询
     </template>
     <template v-slot:action>
       <i
-          class="el-icon-delete-location"
-          title="清空所有轨迹"
-          @click="clearAll"
+        class="el-icon-delete-location"
+        title="清空所有轨迹"
+        @click="clearAll"
       />
     </template>
     <template v-slot:content>
+      <div class="header-ctrl">
+        <el-radio-group v-model="dateType" size="mini" @change="onDateTypeChange">
+          <template v-for="item in Object.keys(DateTypeRadio)">
+            <el-radio-button :label="item">{{ DateTypeRadio[item].name }}</el-radio-button>
+          </template>
+        </el-radio-group>
+        <el-date-picker
+          v-if="dateType === DateTypeRadio.day.key"
+          key="day"
+          v-model="selectDate"
+          align="right"
+          type="date"
+          placeholder="选择日期"
+          :picker-options="pickerOptions"
+          size="mini"
+        >
+        </el-date-picker>
+        <el-date-picker
+          key="cust-day"
+          format="yyyy-MM-dd HH:mm"
+          v-if="dateType === DateTypeRadio.cust.key"
+          v-model="selectDate"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          size="mini"
+        >
+        </el-date-picker>
+      </div>
       <div class="location-list">
         <div class="list-item">
           <span class="over-flow-hidden" style="width: 40%">
@@ -24,31 +54,14 @@
           </span>
           <span class="over-flow-hidden" style="width: 20%">
             <i
-                :class="playItem[1]&&playItem[1].play ? 'el-icon-video-pause':'el-icon-video-play'"
-                :title="playItem[1]&&playItem[1].play ? '暂停': '开始播放' "
-                @click="()=>onLocationPlay({key:1})"
+              :class="playItem[1]&&playItem[1].play ? 'el-icon-video-pause':'el-icon-video-play'"
+              :title="playItem[1]&&playItem[1].play ? '暂停': '开始播放' "
+              @click="()=>onLocationPlay({key:1})"
             />
-            <i class="el-icon-refresh-left" title="重播" @click="()=>replayLocation({key:1})" />
-            <i class="el-icon-circle-close" title="清空轨迹" @click="()=>clearLocation({key:1})" />
+            <i class="el-icon-refresh-left" title="重播" @click="()=>replayLocation({key:1})"/>
+            <i class="el-icon-circle-close" title="清空轨迹" @click="()=>clearLocation({key:1})"/>
           </span>
         </div>
-        <!--        <div class="list-item">-->
-        <!--          <span class="over-flow-hidden" style="width: 40%">-->
-        <!--            定位设备1定位设备-->
-        <!--          </span>-->
-        <!--          <span class="over-flow-hidden" style="width: 40%">-->
-        <!--            2024-08-21 15:30-->
-        <!--          </span>-->
-        <!--          <span class="over-flow-hidden" style="width: 20%">-->
-        <!--            <i-->
-        <!--                :class="playItem[2]&&playItem[2].play ? 'el-icon-video-pause':'el-icon-video-play'"-->
-        <!--                :title="playItem[2]&&playItem[2].play ? '暂停': '开始播放' "-->
-        <!--                @click="()=>onLocationPlay({key:2})"-->
-        <!--            />-->
-        <!--             <i class="el-icon-refresh-left" title="重播" @click="()=>replayLocation({key:2})" />-->
-        <!--            <i class="el-icon-circle-close" title="清空轨迹" @click="()=>clearLocation({key:2})" />-->
-        <!--          </span>-->
-        <!--        </div>-->
       </div>
     </template>
   </pannel>
@@ -58,12 +71,50 @@
 
 import Pannel from '@/views/bd/pannel/index.vue';
 
+const DateTypeRadio = {
+  day: {
+    key: 'day',
+    name: '日',
+  },
+  cust: {
+    key: 'cust',
+    name: '自定义',
+  }
+}
 export default {
   name: 'location',
-  components: { Pannel },
+  components: {Pannel},
   data() {
     return {
+      DateTypeRadio,
       playItem: {},
+      selectDate: new Date(),
+      dateType: DateTypeRadio.day.key,
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() > Date.now();
+        },
+        shortcuts: [{
+          text: '今天',
+          onClick(picker) {
+            picker.$emit('pick', new Date());
+          }
+        }, {
+          text: '昨天',
+          onClick(picker) {
+            const date = new Date();
+            date.setTime(date.getTime() - 3600 * 1000 * 24);
+            picker.$emit('pick', date);
+          }
+        }, {
+          text: '一周前',
+          onClick(picker) {
+            const date = new Date();
+            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', date);
+          }
+        }]
+      },
     };
   },
   // 组件卸载前清空图层信息
@@ -71,12 +122,53 @@ export default {
     this.clearAll();
   },
   created() {
+    this.init();
   },
   methods: {
+    init() {
+      debugger
+
+      this.socket = new WebSocket(`ws://172.192.13.77:2223/socket/websocket/pollingArea`);
+
+      this.socket.onopen = () => {
+        this.socket.send(JSON.stringify({"register":"1731296055163","token":"9358d080-03d4-423c-91d4-d4d2a391183d"}));
+        console.log('连接成功:', this.socket);
+
+      };
+      // 监听socket错误信息
+      this.socket.onerror = (e) => {
+        console.log('%c FXY', 'color:#f6b2b1;font-size:50px', e);
+        console.log('socket连接失败');
+      };
+      // 监听socket关闭监听
+      this.socket.onclose = () => {
+        console.log('socket连接关闭');
+      };
+      this.socket.onmessage = (a) => {
+        const data = JSON.parse(a.data);
+        console.log(">>>>>>>>>",data);
+        if (data && data.message === "handshake"){
+          // tagId要去掉前缀0
+          this.socket.send(JSON.stringify({"key": "1731296055163","tagId": "847F3", "token": "9358d080-03d4-423c-91d4-d4d2a391183d"}));
+        }
+      };
+    },
+    onDateTypeChange(e, eh) {
+      if (e === DateTypeRadio.day.key) {
+        this.selectDate = new Date();
+      } else if (e === DateTypeRadio.cust.key) {
+        const date = new Date();
+        date.setTime(date.getTime() - 3600 * 1000 * 24);
+        this.selectDate = [date, new Date()];
+      }
+    },
+    getDevcTrail() {
+
+    },
     loaded(map) {
       console.log(map);
     },
-    onLocationPlay({ key }) {
+    onLocationPlay({key}) {
       if (this.playItem[key]) {
         if (this.playItem[key].play) {
           bdmap.comp.Trajectory.trajectoryPause(this.playItem[key].line);
@@ -175,14 +267,14 @@ export default {
       bdmap.comp.Trajectory.trajectoryPlay(playLine);
       return playLine;
     },
-    replayLocation({ key }) {
+    replayLocation({key}) {
       if (this.playItem[key] && this.playItem[key].line) {
         bdmap.comp.Trajectory.trajectoryCancel(this.playItem[key].line);
         this.playItem[key].play = false;
       }
 
     },
-    removeLine({ key }) {
+    removeLine({key}) {
       if (this.playItem[key] && this.playItem[key].line) {
         bdmap.comp.Trajectory.trajectoryRemove(this.playItem[key].line);
         delete this.playItem[key];
@@ -192,16 +284,17 @@ export default {
     clearAll() {
       Object.keys(this.playItem).forEach(keyItem => {
         if (this.playItem[keyItem] && this.playItem[keyItem].line) {
-          this.removeLine({ key: keyItem });
+          this.removeLine({key: keyItem});
         }
       });
       this.playItem = {};
     },
-    clearLocation({ key }) {
-      this.removeLine({ key });
+    clearLocation({key}) {
+      this.removeLine({key});
       this.playItem = {};
     },
+
   },
 };
 </script>
-<style lang="scss" src="./index.scss" />
+<style lang="scss" src="./index.scss"/>

+ 2 - 2
ruoyi-ui/src/views/bd/rooms/index.vue

@@ -17,13 +17,13 @@ const Layers = {
     id: 'cyy',
     bizId: 2,
     label: '创研院',
-    layer: "http://bd.xt.wenhq.top:8083/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=bdlayers:bdl_cyy_pingmian&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&Format=image/jpeg&TILECOL={x}&TILEROW={y}",
+    layer: "http://bd.xt.wenhq.top:8083/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=bdlayers:bdl_cyy_pingmian&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&Format=image/png&TILECOL={x}&TILEROW={y}",
   },
   cyy1: {
     id: 'cyy1',
     bizId: 1,
     label: '创研院1',
-    layer: "http://bd.xt.wenhq.top:8083/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=bdlayers:bdl_cyy_pingmian&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&Format=image/jpeg&TILECOL={x}&TILEROW={y}",
+    layer: "http://bd.xt.wenhq.top:8083/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=bdlayers:bdl_cyy_pingmian&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&Format=image/png&TILECOL={x}&TILEROW={y}",
   }
 }
 export default {