chen.cheng 4 mēneši atpakaļ
vecāks
revīzija
26ec2eadbf
22 mainītis faili ar 361 papildinājumiem un 106 dzēšanām
  1. 15 6
      bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/BDApplication.java
  2. 0 2
      bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/web/controller/cons/ConsUnitInfoController.java
  3. 7 0
      bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/web/controller/cons/PileMachineInfoController.java
  4. 2 0
      bd-park/park-backend/park-application/src/main/resources/application.yml
  5. 2 1
      bd-park/park-backend/park-application/src/main/resources/logback.xml
  6. 1 1
      bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/SpingMqttApplication.java
  7. 12 1
      bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/controller/TopicController.java
  8. 0 7
      bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/core/TopicMsgEngine.java
  9. 1 1
      bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/handle/RootMsgHandler.java
  10. 0 59
      bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/model/MqttRequest.java
  11. 2 2
      bd-park/park-backend/park-collect/src/main/resources/application-locale.yml
  12. 1 1
      bd-park/park-backend/park-collect/src/main/resources/logback.xml
  13. 27 0
      bd-park/park-backend/park-common/pom.xml
  14. 163 0
      bd-park/park-backend/park-common/src/main/java/com/huashe/park/common/geo/CoordinateUtil.java
  15. 1 1
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/ConsUnitInfoServiceImpl.java
  16. 21 1
      bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/PileMachineInfoServiceImpl.java
  17. 45 0
      bd-park/park-backend/park-domain/src/main/java/com/huashe/park/domain/dto/cons/MqttRequest.java
  18. 14 0
      bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/cfg/forest/CollectMqttForestCfg.java
  19. 3 3
      bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/cfg/forest/CustomForestCfg.java
  20. 14 0
      bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/mqtt/CollectMqttService.java
  21. 0 20
      bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/uwb/CADService.java
  22. 30 0
      bd-park/park-backend/pom.xml

+ 15 - 6
bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/BDApplication.java

@@ -1,23 +1,32 @@
 package com.huashe.park.application;
 
-import com.dtflys.forest.springboot.annotation.ForestScan;
-import com.huashe.park.infrastructure.socket.cfg.EnableSocketServer;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.context.annotation.ComponentScan;
 
+import com.dtflys.forest.springboot.annotation.ForestScan;
+import com.huashe.park.infrastructure.socket.cfg.EnableSocketServer;
+
 /**
  * 启动程序
  *
  * @author ruoyi
  */
-@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
-@ComponentScan(basePackages = {"com.ruoyi", "com.huashe.park"})
+@SpringBootApplication(exclude = {
+    DataSourceAutoConfiguration.class
+})
+@ComponentScan(basePackages = {
+    "com.ruoyi", "com.huashe.park"
+})
 @MapperScan("com.huashe.park.core.mapper")
-@ForestScan(basePackages = {"com.huashe.park.infrastructure.uwb"})
-@EnableSocketServer(basePackages = {"com.huashe.park.infrastructure.socket.server"})
+@ForestScan(basePackages = {
+    "com.huashe.park.infrastructure.uwb", "com.huashe.park.infrastructure.mqtt"
+})
+@EnableSocketServer(basePackages = {
+    "com.huashe.park.infrastructure.socket.server"
+})
 public class BDApplication {
     public static void main(String[] args) {
         // System.setProperty("spring.devtools.restart.enabled", "false");

+ 0 - 2
bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/web/controller/cons/ConsUnitInfoController.java

@@ -22,14 +22,12 @@ import com.huashe.park.common.i18n.MessageUtils;
 import com.huashe.park.core.service.IConsUnitInfoService;
 import com.huashe.park.domain.dto.cons.ConsUnitMachine;
 import com.huashe.park.domain.entity.ConsUnitInfo;
-import com.huashe.park.infrastructure.cfg.forest.CADForestCfg;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringMatchUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.system.service.ISysConfigService;
 
 /**
  * 施工单元Controller

+ 7 - 0
bd-park/park-backend/park-application/src/main/java/com/huashe/park/application/web/controller/cons/PileMachineInfoController.java

@@ -11,6 +11,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.util.CollectionUtils;
+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;
@@ -189,4 +190,10 @@ public class PileMachineInfoController extends BaseController {
     public AjaxResult qryMachineLatestIndex(@Param("machineId") Long machineId) {
         return AjaxResult.success(pileHoleIndexRealtimeService.selectMachineLatestIndex(machineId));
     }
+
+    @Log(title = "施工桩机", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{id}")
+    public AjaxResult remove(@PathVariable("id") Long id) {
+        return toAjax(pileMachineInfoService.deletePileMachineInfoById(id));
+    }
 }

+ 2 - 0
bd-park/park-backend/park-application/src/main/resources/application.yml

@@ -100,6 +100,8 @@ forest:
     cad:
       cad-biz-param: cad.biz.param
       cad-server: http://127.0.0.1:18080
+    collect-mqtt:
+      url: http://127.0.0.1:9203/pkc-collect
 # token配置
 token:
   # 令牌自定义标识

+ 2 - 1
bd-park/park-backend/park-application/src/main/resources/logback.xml

@@ -3,7 +3,8 @@
     <!-- 日志存放路径 -->
     <property name="log.path" value="/opt/project/ruoyi/ruoyi-backend/app-logs"/>
     <!-- 日志输出格式 -->
-    <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
+    <property name="log.pattern"
+              value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
 
     <!-- 控制台输出 -->
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">

+ 1 - 1
bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/SpingMqttApplication.java

@@ -34,7 +34,7 @@ import com.dtflys.forest.springboot.annotation.ForestScan;
 })
 @MapperScan("com.huashe.park.core.mapper")
 @ForestScan(basePackages = {
-    "com.huashe.park.infrastructure.uwb"
+    "com.huashe.park.infrastructure.uwb", "com.huashe.park.infrastructure.mqtt"
 })
 @EnableAsync
 public class SpingMqttApplication {

+ 12 - 1
bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/controller/TopicController.java

@@ -6,8 +6,10 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.huashe.park.collect.core.MqttMessageHandler;
 import com.huashe.park.collect.core.MqttTemplate;
-import com.huashe.park.collect.model.MqttRequest;
+import com.huashe.park.domain.dto.cons.MqttRequest;
+import com.huashe.park.common.SpringBeanUtils;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.core.controller.BaseController;
 
@@ -48,4 +50,13 @@ public class TopicController extends BaseController {
         mqttTemplate.sendByte(jsonObject.getTopic(), jsonObject.getTopic() + "/machine/piling/result", bytes,
             jsonObject.getQos(), jsonObject.isRetained());
     }
+
+    @PostMapping("/new/topic")
+    @Anonymous
+    public void newTopic(@RequestBody MqttRequest mqttRequest) {
+        MqttMessageHandler bean = SpringBeanUtils.getBean(mqttRequest.getHandleBean());
+        mqttTemplate.subscribe(mqttRequest.getClientKey(), mqttRequest.getClientKey(), mqttRequest.getClientSecret(),
+            mqttRequest.getTopic(), mqttRequest.getQos(), bean);
+    }
+
 }

+ 0 - 7
bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/core/TopicMsgEngine.java

@@ -58,13 +58,6 @@ public abstract class TopicMsgEngine implements ITopicListener, MqttMessageHandl
                     }
                     catch (InterruptedException e) {
                         logger.error("{} error", this.engineName, e);
-                        // 重置中断状态
-                        Thread.currentThread().interrupt();
-                        // 根据业务逻辑决定是否继续执行
-                        if (Thread.currentThread().isInterrupted()) {
-                            logger.error("任务已中断,不再继续执行");
-                            break;
-                        }
                     }
                 }
             });

+ 1 - 1
bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/handle/RootMsgHandler.java

@@ -44,7 +44,7 @@ import com.huashe.park.domain.entity.MachineProcessResult;
  * @see [相关类/方法]
  * @since [产品/模块版本]
  */
-@Service
+@Service("RootMsgHandler")
 public class RootMsgHandler extends TopicMsgEngine {
 
     @Autowired

+ 0 - 59
bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/model/MqttRequest.java

@@ -1,59 +0,0 @@
-/*
- * 文 件 名:  MqttRequest
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lvwenbin
- * 修改时间:  2024/5/6
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.park.collect.model;
-
-/**
- * 发送请求
- * <功能详细描述>
- *
- * @author lvwenbin
- * @version [版本号, 2024/5/6]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class MqttRequest {
-    private String topic;
-    private String payload;
-    private int qos;
-    private boolean retained;
-
-    public String getTopic() {
-        return topic;
-    }
-
-    public void setTopic(String topic) {
-        this.topic = topic;
-    }
-
-    public String getPayload() {
-        return payload;
-    }
-
-    public void setPayload(String payload) {
-        this.payload = payload;
-    }
-
-    public int getQos() {
-        return qos;
-    }
-
-    public void setQos(int qos) {
-        this.qos = qos;
-    }
-
-    public boolean isRetained() {
-        return retained;
-    }
-
-    public void setRetained(boolean retained) {
-        this.retained = retained;
-    }
-}

+ 2 - 2
bd-park/park-backend/park-collect/src/main/resources/application-locale.yml

@@ -1,7 +1,7 @@
 ## MQTT##
 aliyun:
   mqtt:
-    uri: tcp://8.219.137.9:1883
+    uri: tcp://200.200.19.121:31005
 
 
 # 数据源配置
@@ -11,7 +11,7 @@ spring:
     # 地址
     host: 127.0.0.1
     # 端口,默认为6379
-    port: 6379
+    port: 16379
     # 数据库索引
     database: 1
     # 密码

+ 1 - 1
bd-park/park-backend/park-collect/src/main/resources/logback.xml

@@ -3,7 +3,7 @@
     <!-- 日志存放路径 -->
 	<property name="log.path" value="/opt/project/ruoyi/ruoyi-backend/collect-logs" />
     <!-- 日志输出格式 -->
-	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
+	<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 
 	<!-- 控制台输出 -->
 	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">

+ 27 - 0
bd-park/park-backend/park-common/pom.xml

@@ -144,6 +144,33 @@
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-core</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-api</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.media</groupId>
+                    <artifactId>jai_core</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>jgridshift</groupId>
+                    <artifactId>jgridshift</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-pool</groupId>
+                    <artifactId>commons-pool</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>net.sf.geographiclib</groupId>
+                    <artifactId>GeographicLib-Java</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-epsg-hsql</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 163 - 0
bd-park/park-backend/park-common/src/main/java/com/huashe/park/common/geo/CoordinateUtil.java

@@ -0,0 +1,163 @@
+package com.huashe.park.common.geo;
+
+import org.geotools.geometry.jts.JTS;
+import org.geotools.referencing.CRS;
+import org.locationtech.jts.geom.Coordinate;
+import org.opengis.referencing.FactoryException;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.operation.MathTransform;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class CoordinateUtil {
+    // 2000坐标转wgs84坐标
+    public static Double[] getCoordinate(Double x, Double y) {
+        Double[] res = new Double[2];
+        Coordinate tar = null;
+        try {
+            // 封装点,这个是通用的,也可以用POINT(y,x)
+            // private static WKTReader reader = new WKTReader( geometryFactory );
+            Coordinate sour = new Coordinate(y, x);
+            // 这里要选择转换的坐标系是可以随意更换的
+            CoordinateReferenceSystem source = CRS.decode("EPSG:4549");
+            CoordinateReferenceSystem target = CRS.decode("EPSG:4326");
+            // 建立转换,下面两个我屏掉的转换方式会报出需要3/7参数的异常
+            // MathTransform mathTransform = CRS.findMathTransform(source, target);
+            // MathTransform mathTransform1 = CRS.findMathTransform(source, target, false);
+            MathTransform transform = CRS.findMathTransform(source, target, true);
+            tar = new Coordinate();
+            // 转换
+            JTS.transform(sour, tar, transform);
+        }
+        catch (FactoryException | org.opengis.referencing.operation.TransformException e) {
+            e.printStackTrace();
+        }
+        String[] split = (tar.toString().substring(1, tar.toString().length() - 1)).split(",");
+        // 经纬度精度
+        DecimalFormat fm = new DecimalFormat("0.0000000");
+        res[0] = Double.valueOf(fm.format(Double.valueOf(split[0])));
+        res[1] = Double.valueOf(fm.format(Double.valueOf(split[1])));
+        return res;
+    }
+
+    /**
+     * wgs84坐标转2000坐标
+     * 
+     * @param B 纬度
+     * @param L 经度
+     * @param degree 角度,即所用的地图是几度的,列如CGCS2000_3_Degree_GK_CM_120E 表示该地 图是3度的
+     * @return
+     */
+    private Map<String, Double> GetXY(double B, double L, double degree) {
+        Map<String, Double> map = new HashMap<>();
+        double[] xy = new double[] {
+            0.0D, 0.0D
+        };
+        double a = 6378137.0D;
+        double b = 6356752.314245179D;
+        double e = 0.081819190842621D;
+        double eC = 0.0820944379496957D;
+        double L0 = 0.0D;
+        int n;
+        if (degree == 6.0D) {
+            n = (int) Math.round((L + degree / (double) 2) / degree);
+            L0 = degree * (double) n - degree / (double) 2;
+        }
+        else {
+            n = (int) Math.round(L / degree);
+            L0 = degree * (double) n;
+        }
+
+        double radB = B * 3.141592653589793D / (double) 180;
+        double radL = L * 3.141592653589793D / (double) 180;
+        double deltaL = (L - L0) * 3.141592653589793D / (double) 180;
+        double N = a * a / b / Math.sqrt((double) 1 + eC * eC * Math.cos(radB) * Math.cos(radB));
+        double C1 = 1.0D + 0.75D * e * e + 0.703125D * Math.pow(e, 4.0D) + 0.68359375D * Math.pow(e, 6.0D)
+            + 0.67291259765625D * Math.pow(e, 8.0D);
+        double C2 = 0.75D * e * e + 0.9375D * Math.pow(e, 4.0D) + 1.025390625D * Math.pow(e, 6.0D)
+            + 1.07666015625D * Math.pow(e, 8.0D);
+        double C3 = 0.234375D * Math.pow(e, 4.0D) + 0.41015625D * Math.pow(e, 6.0D)
+            + 0.538330078125D * Math.pow(e, 8.0D);
+        double C4 = 0.068359375D * Math.pow(e, 6.0D) + 0.15380859375D * Math.pow(e, 8.0D);
+        double C5 = 0.00240325927734375D * Math.pow(e, 8.0D);
+        double t = Math.tan(radB);
+        double eta = eC * Math.cos(radB);
+        double X = a * ((double) 1 - e * e)
+            * (C1 * radB - C2 * Math.sin((double) 2 * radB) / (double) 2 + C3 * Math.sin((double) 4 * radB) / (double) 4
+                - C4 * Math.sin((double) 6 * radB) / (double) 6 + C5 * Math.sin((double) 8 * radB));
+        xy[0] = X + N * Math.sin(radB) * Math.cos(radB) * Math.pow(deltaL, 2.0D)
+            * ((double) 1
+                + Math.pow(deltaL * Math.cos(radB), 2.0D)
+                    * ((double) 5 - t * t + (double) 9 * eta * eta + (double) 4 * Math.pow(eta, 4.0D)) / (double) 12
+                + Math.pow(deltaL * Math.cos(radB), 4.0D) * ((double) 61 - (double) 58 * t * t + Math.pow(t, 4.0D))
+                    / (double) 360)
+            / (double) 2;
+        xy[1] = N * deltaL * Math.cos(radB)
+            * ((double) 1 + Math.pow(deltaL * Math.cos(radB), 2.0D) * ((double) 1 - t * t + eta * eta) / (double) 6
+                + Math.pow(deltaL * Math.cos(radB), 4.0D) * ((double) 5 - (double) 18 * t * t + Math.pow(t, 4.0D)
+                    - (double) 14 * eta * eta - (double) 58 * eta * eta * t * t) / (double) 120)
+            + (double) 500000;
+        // return "纬度Y:"+xy[0]+"---经度X"+xy[1];
+        map.put("X", xy[1]);
+        map.put("Y", xy[0]);
+        return map;
+    }
+
+    // 度分秒地理位置转wgs84坐标
+    private String getPosition(String position) {
+        String[] degree = position.split("\\°");
+        if (degree.length == 1) {
+            return position;
+        }
+        String d = degree[0];
+        String[] one = degree[1].split("\\′");
+        String a = one[0];
+        if (!a.contains(".")) {
+            if (a.substring(0, 1).equals("0")) {
+                a = a.substring(1);
+            }
+        }
+        else if (a.contains(".") && a.split("\\.").length > 1) {
+            a = a.substring(1);
+        }
+        String[] two = one[1].split("\\″");
+        String b = two[0];
+        if (!b.contains(".")) {
+            if (b.substring(0, 1).equals("0")) {
+                b = b.substring(1);
+            }
+        }
+        else if (b.contains(".") && b.split("\\.").length > 1) {
+            if (b.substring(0, 1).equals("0")) {
+                b = b.substring(1);
+            }
+        }
+        BigDecimal fen = new BigDecimal(a);
+        BigDecimal miao = new BigDecimal(b);
+        BigDecimal du = new BigDecimal(d);
+        // float f = Float.valueOf(a)+ Float.valueOf(Float.valueOf(b)/60);
+        // float du = Float.valueOf(f/60)+Float.valueOf(d);
+        BigDecimal add = fen.add(miao.divide(new BigDecimal("60"), 6, BigDecimal.ROUND_HALF_UP))
+            .divide(new BigDecimal("60"), 6, BigDecimal.ROUND_HALF_UP).add(du);
+        return String.valueOf(add);
+    }
+
+    private boolean isDouble(String str1, String str2) {
+        try {
+            Double.parseDouble(str1);
+            Double.parseDouble(str2);
+            return true;
+        }
+        catch (NumberFormatException ex) {
+        }
+        return false;
+    }
+
+    public static void main(String[] args) {
+        System.out.println(Arrays.toString(getCoordinate(2833742.70380015070,582577.02485382770)));
+    }
+}

+ 1 - 1
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/ConsUnitInfoServiceImpl.java

@@ -318,7 +318,7 @@ public class ConsUnitInfoServiceImpl implements IConsUnitInfoService {
         // 使用 Java Stream API 将 ancestors 字符串按逗号分割,并去除重复项
         List<String> unitIds = ancestors.stream().flatMap(s -> Arrays.stream(s.split(","))).distinct()
             .collect(Collectors.toList());
-        if(CollectionUtils.isEmpty(unitIds)){
+        if (CollectionUtils.isEmpty(unitIds)) {
             throw new ServiceException(MessageUtils.message("machine.not.assign.task"));
         }
         return consUnitInfoMapper.qryConsUnitInfoByIds(unitIds);

+ 21 - 1
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/PileMachineInfoServiceImpl.java

@@ -6,6 +6,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import javax.annotation.Resource;
+
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,13 +27,16 @@ import com.huashe.park.core.service.IProjectCoordinateInfoService;
 import com.huashe.park.domain.dto.cons.ConsPileHoleInfoVO;
 import com.huashe.park.domain.dto.cons.ConstUnitNode;
 import com.huashe.park.domain.dto.cons.MachineBiz;
+import com.huashe.park.domain.dto.cons.MqttRequest;
 import com.huashe.park.domain.entity.ConsPileHoleInfo;
 import com.huashe.park.domain.entity.ConsUnitInfo;
 import com.huashe.park.domain.entity.ConsUnitMachineRel;
 import com.huashe.park.domain.entity.PileMachineInfo;
 import com.huashe.park.domain.entity.ProjectCoordinateInfo;
+import com.huashe.park.infrastructure.mqtt.CollectMqttService;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.thread.ThreadUtil;
 
 /**
  * 施工桩机信息Service业务层处理
@@ -62,6 +67,9 @@ public class PileMachineInfoServiceImpl implements IPileMachineInfoService {
     @Autowired
     private RedisProxy redisProxy;
 
+    @Resource
+    private CollectMqttService collectMqttService;
+
     private static final String CACHE_KEY = "consPileMachineInfo:byteId:%s";
 
     /**
@@ -109,7 +117,19 @@ public class PileMachineInfoServiceImpl implements IPileMachineInfoService {
     public int insertPileMachineInfo(PileMachineInfo pileMachineInfo) {
         pileMachineInfo.setPwd(pileMachineInfo.getSn() + "381.2371");
         pileMachineInfo.setByteId(byte8Id.generate());
-        return pileMachineInfoMapper.insertPileMachineInfo(pileMachineInfo);
+        int i = pileMachineInfoMapper.insertPileMachineInfo(pileMachineInfo);
+        if (i > 0) {
+            ThreadUtil.execAsync(() -> {
+                collectMqttService.newTopic(new MqttRequest() {
+                    {
+                        setClientKey(pileMachineInfo.getProductKey());
+                        setClientSecret(pileMachineInfo.getDeviceSecret());
+                        setTopic(pileMachineInfo.getTopic());
+                    }
+                });
+            });
+        }
+        return i;
     }
 
     /**

+ 45 - 0
bd-park/park-backend/park-domain/src/main/java/com/huashe/park/domain/dto/cons/MqttRequest.java

@@ -0,0 +1,45 @@
+/*
+ * 文 件 名:  MqttRequest
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2024/5/6
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.park.domain.dto.cons;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 发送请求 <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2024/5/6]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Data
+@NoArgsConstructor
+public class MqttRequest implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String topic;
+
+    private String payload;
+
+    private int qos = 0;
+
+    private boolean retained = false;
+
+    private String clientKey;
+
+    private String clientSecret;
+
+    private String handleBean = "RootMsgHandler";
+
+}

+ 14 - 0
bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/cfg/forest/CollectMqttForestCfg.java

@@ -0,0 +1,14 @@
+package com.huashe.park.infrastructure.cfg.forest;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import lombok.Data;
+
+@Configuration
+@ConfigurationProperties(prefix = "forest.custom.collect-mqtt")
+@Data
+public class CollectMqttForestCfg {
+
+    private String url;
+}

+ 3 - 3
bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/cfg/forest/CustomForestCfg.java

@@ -26,7 +26,7 @@ public class CustomForestCfg {
     private UWBForestCfg uwbForestCfg;
 
     @Autowired
-    private CADForestCfg cadForestCfg;
+    private CollectMqttForestCfg collectMqttForestCfg;
 
     @BindingVar("uwbBaseUrl")
     public String getBaseUrl(ForestMethod method) {
@@ -38,9 +38,9 @@ public class CustomForestCfg {
         return holiday;
     }
 
-    @BindingVar("cadBaseUrl")
+    @BindingVar("collectMqtt")
     public String getCadBaseUrl(ForestMethod method) {
-        return cadForestCfg.getCadServer();
+        return collectMqttForestCfg.getUrl();
     }
 
 }

+ 14 - 0
bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/mqtt/CollectMqttService.java

@@ -0,0 +1,14 @@
+package com.huashe.park.infrastructure.mqtt;
+
+import java.util.Map;
+
+import com.dtflys.forest.annotation.BaseRequest;
+import com.dtflys.forest.annotation.JSONBody;
+import com.dtflys.forest.annotation.Post;
+import com.huashe.park.domain.dto.cons.MqttRequest;
+
+@BaseRequest(baseURL = "{collectMqtt}")
+public interface CollectMqttService {
+    @Post(url = "/topic/new/topic")
+    Map newTopic(@JSONBody MqttRequest request);
+}

+ 0 - 20
bd-park/park-backend/park-infrastructure/src/main/java/com/huashe/park/infrastructure/uwb/CADService.java

@@ -1,20 +0,0 @@
-package com.huashe.park.infrastructure.uwb;
-
-import java.io.File;
-import java.util.Map;
-
-import com.dtflys.forest.annotation.BaseRequest;
-import com.dtflys.forest.annotation.DataFile;
-import com.dtflys.forest.annotation.Post;
-import com.dtflys.forest.callback.OnProgress;
-import com.dtflys.forest.extensions.DownloadFile;
-
-@BaseRequest(baseURL = "{cadBaseUrl}")
-public interface CADService {
-    @Post(url = "/download")
-    @DownloadFile(dir = "${0}", filename = "${1}")
-    File downloadFile(String dir, String filename, @DataFile("file") File file, OnProgress onProgress);
-
-    @Post(url = "/upload")
-    Map analysisCad(@DataFile("dwg_file") File file);
-}

+ 30 - 0
bd-park/park-backend/pom.xml

@@ -58,6 +58,7 @@
         <fastexcel.version>1.1.0</fastexcel.version>
         <paho.version>1.2.5</paho.version>
         <common.collect>4.4</common.collect>
+        <geotools.version>20.0</geotools.version>
     </properties>
 
     <!-- 依赖声明 -->
@@ -372,6 +373,35 @@
                 <artifactId>commons-collections4</artifactId>
                 <version>${common.collect}</version>
             </dependency>
+
+            <dependency>
+                <groupId>org.geotools</groupId>
+                <artifactId>gt-api</artifactId>
+                <version>${geotools.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.media</groupId>
+                        <artifactId>jai_core</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>jgridshift</groupId>
+                        <artifactId>jgridshift</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>commons-pool</groupId>
+                        <artifactId>commons-pool</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>net.sf.geographiclib</groupId>
+                        <artifactId>GeographicLib-Java</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.geotools</groupId>
+                <artifactId>gt-epsg-hsql</artifactId>
+                <version>${geotools.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <repositories>