From e133600480d5f688a8375db7708fe531b4726f4a Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 07 二月 2025 17:38:38 +0800
Subject: [PATCH] 1. 新增卫星网格拆分、遥测数据拆分映射功能

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
index 97e4c67..1caf954 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
@@ -1,6 +1,7 @@
 package com.flightfeather.uav.lightshare.service.impl
 
 import com.flightfeather.uav.biz.satellite.SatelliteDataMix
+import com.flightfeather.uav.biz.satellite.SatelliteGridManage
 import com.flightfeather.uav.common.exception.BizException
 import com.flightfeather.uav.common.utils.FileExchange
 import com.flightfeather.uav.domain.entity.GridAod
@@ -43,6 +44,10 @@
         return DataHead(pageInfo.pageNum, pageInfo.pages) to res
     }
 
+    override fun deleteGridGroup(groupId: Int) {
+        satelliteGridRep.deleteGridGroup(groupId)
+    }
+
     override fun fetchGridCell(groupId: Int): List<GridCell?> {
         return satelliteGridRep.fetchGridCell(groupId)
     }
@@ -71,7 +76,7 @@
         // 1. 鏍规嵁鏁版嵁涓婚敭id鏁扮粍锛屾煡璇㈣缁勫悎涓嬫槸鍚﹀凡鏈夋暟鎹瀺鍚堣褰�
         val exist = satelliteGridRep.fetchGridData(GridData().apply {
             type = 1
-            mixDataId = dataIdList.joinToString(",")
+            mixDataId = dataIdList.sorted().joinToString(",")
         })
         // 2. 鑻ヨ瀺鍚堟暟鎹凡瀛樺湪锛岀洿鎺ヨ繑鍥�
         return exist.ifEmpty {
@@ -204,4 +209,33 @@
         }
         return true
     }
+
+    override fun calGridVertex(groupId: Int): List<GridCell?> {
+        val cellList = satelliteGridRep.fetchGridCell(groupId)
+        val vertexList = SatelliteGridManage.calGridVertex(cellList.map {
+            if (it?.longitude == null || it.latitude == null) {
+                throw BizException("鍗槦閬ユ祴缃戞牸璁$畻椤剁偣鍧愭爣鐐瑰け璐ワ紝瀛樺湪涓績鐐瑰潗鏍囦负绌虹殑鎯呭喌")
+            }
+            it.longitude?.toDouble()!! to it.latitude?.toDouble()!!
+        })
+
+        cellList.forEachIndexed { i, c ->
+            val v = vertexList[i]
+            c?.point1Lon = v.point1Lon.toBigDecimal()
+            c?.point1Lat = v.point1Lat.toBigDecimal()
+
+            c?.point2Lon = v.point2Lon.toBigDecimal()
+            c?.point2Lat = v.point2Lat.toBigDecimal()
+
+            c?.point3Lon = v.point3Lon.toBigDecimal()
+            c?.point3Lat = v.point3Lat.toBigDecimal()
+
+            c?.point4Lon = v.point4Lon.toBigDecimal()
+            c?.point4Lat = v.point4Lat.toBigDecimal()
+        }
+
+        satelliteGridRep.updateGridCellBatch(cellList)
+
+        return cellList
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3