From dacef58ee7c44dffdd40cb646435c2993ad7a217 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 21 二月 2025 17:20:00 +0800
Subject: [PATCH] 1. 新增坐标点是否在多边形内部的判定算法并测试

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
index d69174c..7358603 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
@@ -6,6 +6,8 @@
 import com.flightfeather.uav.domain.entity.GridData
 import com.flightfeather.uav.domain.entity.GridDataDetail
 import com.flightfeather.uav.domain.entity.GridGroup
+import com.flightfeather.uav.domain.repository.MissionRep
+import com.flightfeather.uav.domain.repository.RealTimeDataRep
 import com.flightfeather.uav.domain.repository.SatelliteGridRep
 import com.flightfeather.uav.lightshare.eunm.GridType
 import com.flightfeather.uav.lightshare.eunm.SatelliteDataType
@@ -22,7 +24,11 @@
  * @author feiyu02
  */
 @Service
-class SatelliteDataCalculateServiceImpl(private val satelliteGridRep: SatelliteGridRep) : SatelliteDataCalculateService {
+class SatelliteDataCalculateServiceImpl(
+    private val satelliteGridRep: SatelliteGridRep,
+    private val realTimeDataRep: RealTimeDataRep,
+    private val missionRep: MissionRep,
+) : SatelliteDataCalculateService {
 
 
     override fun calGridVertex(groupId: Int): List<GridCell?> {
@@ -125,4 +131,28 @@
 
         return subGridDataDetailList
     }
+
+    @Transactional
+    override fun dataFusion(missionCode: String, groupId: Int): List<GridDataDetail?> {
+        // 鏌ヨ璧拌埅浠诲姟鍙婂搴旇蛋鑸洃娴嬫暟鎹�
+        val mission = missionRep.findOne(missionCode) ?: throw BizException("浠诲姟涓嶅瓨鍦�")
+        val data = realTimeDataRep.fetchData(mission)
+
+        // 鍒涘缓铻嶅悎鏁版嵁绱㈠紩瀵硅薄
+        val newGridData = GridData().apply {
+            this.groupId = groupId
+            dataTime = mission.startTime
+            type = SatelliteDataType.Monitor.value.toByte()
+        }
+        satelliteGridRep.insertGridData(newGridData)
+
+        // 鏌ヨ缃戞牸鍗曞厓鏍间俊鎭�
+        val gridCellList = satelliteGridRep.fetchGridCell(groupId)
+
+        // 灏嗚蛋鑸暟鎹拰鍗槦缃戞牸杩涜铻嶅悎璁$畻
+        val gridDataDetailList = SatelliteGridManage.dataFusion(data, newGridData, gridCellList)
+        satelliteGridRep.insertGridDataDetail(gridDataDetailList)
+
+        return gridDataDetailList
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3