Browse Source

无人机有VR采集数据推送接口

bihs 1 week ago
parent
commit
ab7a3e5a3c

+ 25 - 5
src/main/java/com/sooka/sponest/monitor/uav/controller/CentermonitorTUavController.java

@@ -11,7 +11,9 @@ import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.sooka.sponest.monitor.remoteapi.service.center.system.RemoteService;
 import com.sooka.sponest.monitor.uav.domain.CentermonitorTUav;
+import com.sooka.sponest.monitor.uav.domain.CentermonitorTUavFile;
 import com.sooka.sponest.monitor.uav.domain.dto.CentermonitorTUavDTO;
+import com.sooka.sponest.monitor.uav.mapper.CentermonitorTUavFileMapper;
 import com.sooka.sponest.monitor.uav.service.ICentermonitorTUavService;
 import com.sooka.sponest.monitor.websocket.WebSocketUsers;
 import org.apache.http.HttpEntity;
@@ -35,10 +37,12 @@ import javax.annotation.Resource;
 import javax.net.ssl.SSLContext;
 import javax.servlet.http.HttpServletResponse;
 import javax.websocket.*;
-import java.io.IOException;
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -58,6 +62,9 @@ public class CentermonitorTUavController extends BaseController {
     @Resource
     private RemoteService remoteService;
 
+    @Resource
+    private CentermonitorTUavFileMapper centermonitorTUavFileMapper;
+
     private static final Logger log = LoggerFactory.getLogger(CentermonitorTUavController.class);
 
     @Value("${sooka.uav_server.username}")
@@ -684,7 +691,7 @@ public class CentermonitorTUavController extends BaseController {
             log.error("发生未知异常", e);
         }
         //todo websocket
-        WebSocketUsers.sendMessageToUsersByText(JSON.toJSONString(AjaxResult.success("10002",new ArrayList<>())));
+        WebSocketUsers.sendMessageToUsersByText(JSON.toJSONString(AjaxResult.success("10002", new ArrayList<>())));
         return AjaxResult.success("操作成功,暂无数据");
     }
 
@@ -747,7 +754,7 @@ public class CentermonitorTUavController extends BaseController {
      */
     //todo 未测试接口连通性
     @GetMapping("/getHangarRealTimeData")
-    public String getHangarRealTimeData(@RequestParam(value = "copterSn") String copterSn,@RequestParam(value = "boxSn") String boxSn) {
+    public String getHangarRealTimeData(@RequestParam(value = "copterSn") String copterSn, @RequestParam(value = "boxSn") String boxSn) {
         final CountDownLatch latch = new CountDownLatch(1);
         final StringBuilder response = new StringBuilder();
         try {
@@ -782,7 +789,7 @@ public class CentermonitorTUavController extends BaseController {
      */
     //todo 未测试接口连通性
     @GetMapping("/getHangarLog")
-    public String getHangarLog(@RequestParam(value = "copterSn") String copterSn,@RequestParam(value = "boxSn") String boxSn) {
+    public String getHangarLog(@RequestParam(value = "copterSn") String copterSn, @RequestParam(value = "boxSn") String boxSn) {
         final CountDownLatch latch = new CountDownLatch(1);
         final StringBuilder response = new StringBuilder();
         try {
@@ -912,4 +919,17 @@ public class CentermonitorTUavController extends BaseController {
         return AjaxResult.success(centermonitorTUavService.selectUavByUavId(uavId));
     }
 
+    /**
+     * 无人机有VR采集数据推送接口
+     */
+    @PostMapping("/uavVrResourcePush")
+    public void uavDataPush(@RequestBody cn.hutool.json.JSONObject json) {
+        log.info("uavVrResourcePush: " + json.toString());
+        CentermonitorTUavFile saveVo = new CentermonitorTUavFile();
+        Map<String,Object> map = (Map<String, Object>) json.get("result");
+        saveVo.setFileUrl(map.get("fileUrl").toString());
+        centermonitorTUavFileMapper.insertCentermonitorTUavFile(saveVo);
+    }
+
+
 }

+ 34 - 0
src/main/java/com/sooka/sponest/monitor/uav/domain/CentermonitorTUavFile.java

@@ -0,0 +1,34 @@
+package com.sooka.sponest.monitor.uav.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 无人机全景数据文件 centermonitor_t_uav_file
+ *
+ * @author ruoyi
+ * @date 2025-03-19
+ */
+@Data
+public class CentermonitorTUavFile {
+
+    /**
+     * 主键id
+     */
+    private Long id;
+
+    /**
+     * 全景数据文件地址
+     */
+    @Excel(name = "全景数据文件地址")
+    private String fileUrl;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+
+}

+ 48 - 0
src/main/java/com/sooka/sponest/monitor/uav/mapper/CentermonitorTUavFileMapper.java

@@ -0,0 +1,48 @@
+package com.sooka.sponest.monitor.uav.mapper;
+
+import com.sooka.sponest.monitor.uav.domain.CentermonitorTUavFile;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 无人机全景数据文件Mapper接口
+ *
+ * @author ruoyi
+ * @date 2025-03-19
+ */
+public interface CentermonitorTUavFileMapper {
+
+    /**
+     * 查询无人机全景数据文件
+     *
+     */
+    public CentermonitorTUavFile selectCentermonitorTUavFileById(Long id);
+
+    /**
+     * 查询无人机全景数据文件
+     */
+    public List<CentermonitorTUavFile> selectCentermonitorTUavFileList(CentermonitorTUavFile centermonitorTUavFile);
+
+    /**
+     * 新增无人机全景数据文件
+     */
+    public int insertCentermonitorTUavFile(CentermonitorTUavFile centermonitorTUavFile);
+
+    /**
+     * 修改无人机全景数据文件
+     */
+    public int updateCentermonitorTUavFile(CentermonitorTUavFile centermonitorTUavFile);
+
+    /**
+     * 删除无人机全景数据文件
+     */
+    public int deleteCentermonitorTUavFileById(Long id);
+
+    /**
+     * 批量删除无人机全景数据文件
+     */
+    public int deleteCentermonitorTUavFileByIds(Long[] ids);
+
+
+}

+ 55 - 0
src/main/resources/mapper/monitor/uav/CentermonitorTUavFileMapper.xml

@@ -0,0 +1,55 @@
+<?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.sooka.sponest.monitor.uav.mapper.CentermonitorTUavFileMapper">
+    
+    <resultMap type="CentermonitorTUavFile" id="CentermonitorTUavFileResult">
+        <result property="id"    column="id"    />
+        <result property="fileUrl"    column="file_url"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectCentermonitorTUavFileVo">
+        select id, file_url,create_time from centermonitor_t_uav_file
+    </sql>
+
+    <select id="selectCentermonitorTUavFileList" parameterType="CentermonitorTUavFile" resultMap="CentermonitorTUavFileResult">
+        <include refid="selectCentermonitorTUavFileVo"/>
+    </select>
+    
+    <select id="selectCentermonitorTUavFileById" parameterType="Long" resultMap="CentermonitorTUavFileResult">
+        <include refid="selectCentermonitorTUavFileVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCentermonitorTUavFile" parameterType="CentermonitorTUavFile" useGeneratedKeys="true" keyProperty="id">
+        insert into centermonitor_t_uav_file
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fileUrl != null">file_url,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fileUrl != null">#{fileUrl},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCentermonitorTUavFile" parameterType="CentermonitorTUavFile">
+        update centermonitor_t_uav_file
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fileUrl != null">file_url = #{fileUrl},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCentermonitorTUavFileById" parameterType="Long">
+        delete from centermonitor_t_uav_file where id = #{id}
+    </delete>
+
+    <delete id="deleteCentermonitorTUavFileByIds" parameterType="String">
+        delete from centermonitor_t_uav_file where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>