From 698f8f0f22af4c66581ce284407e986ca036aec6 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 23 一月 2025 17:10:26 +0800
Subject: [PATCH] 1. 网格细分逻辑(编写中)

---
 src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java                                 |   48 +++++++
 src/main/kotlin/com/flightfeather/uav/lightshare/eunm/GridType.kt                                  |   14 ++
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt |   14 +
 src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java                                  |   48 ++++++++
 src/main/resources/mapper/GridCellMapper.xml                                                       |    6 
 src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt                         |   95 +++++++++------
 src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt       |    4 
 src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt                        |    8 
 src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt          |    7 +
 src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt                        |    8 +
 /dev/null                                                                                          |    8 -
 src/main/resources/generator/generatorConfig.xml                                                   |   13 +
 src/test/kotlin/com/flightfeather/uav/Test.kt                                                      |    9 +
 src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt                        |    6 
 src/main/kotlin/com/flightfeather/uav/domain/repository/ElectricRep.kt                             |   11 +
 src/main/kotlin/com/flightfeather/uav/domain/repository/impl/AirDataRepImpl.kt                     |   11 -
 src/main/kotlin/com/flightfeather/uav/domain/repository/AirDataRep.kt                              |    5 
 src/main/kotlin/com/flightfeather/uav/domain/repository/impl/ElectricRepImpl.kt                    |    6 
 src/main/kotlin/com/flightfeather/uav/lightshare/eunm/SatelliteDataType.kt                         |    4 
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt           |    7 
 src/main/resources/mapper/GridGroupMapper.xml                                                      |    4 
 21 files changed, 250 insertions(+), 86 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt b/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt
index 0322e9a..783ceb6 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt
@@ -64,12 +64,14 @@
     }
 
     /**
-     * 鎷嗗垎缃戞牸涓虹粏鍒嗙綉鏍�
+     * 鎷嗗垎缃戞牸涓虹粏鍒嗙綉鏍硷紝鎵�鏈夌綉鏍煎簲璇ユ槸鐩稿悓杈归暱鐨勬鏂瑰舰
      * 鏍规嵁鐩镐技鐭╁舰鐨勫師鐞嗭紝鍙互鍒嗗埆鎸夋瘮渚嬪緱鍒版瘡涓粏鍒嗙綉鏍肩殑缁忕含搴�
      * @param gridCellList 鍘熷缃戞牸鏁扮粍
      * @param scale 鎷嗗垎鐨勭郴鏁帮紝渚嬪 2锛岃〃绀哄皢鍘熸湁缃戞牸鎸夎竟闀跨殑 1/2 鎷嗗垎鎴� 2 * 2 鐨�4涓綉鏍�
+     * @param groupId 缁嗗垎鍚庣殑缃戞牸鎵�灞炵殑缃戞牸缁刬d
+     * @return
      */
-    fun splitGrid(gridCellList: List<GridCell>, scale: Int): List<GridCell> {
+    fun splitGrid(gridCellList: List<GridCell?>, scale: Int, groupId:Int): List<GridCell?> {
         if (scale <= 0) throw IllegalArgumentException("缃戞牸鎷嗗垎鐨勬暟閲忎笉鑳藉皬浜�1")
         // 鎷嗗垎绯绘暟涓�1锛屽垯琛ㄧず涓嶆媶鍒�
         if (scale == 1) return gridCellList
@@ -79,7 +81,7 @@
 
         // 鏍规嵁鍑芥暟[calGridVertex]鐢熸垚鐨勭綉鏍�4涓《鐐瑰潗鏍囷紝浠ヤ笂鍖椾笅鍗楀乏瑗垮彸涓滄柟鍚戜负鏍囧噯
         // 璁$畻棣栦釜缃戞牸涓績鍧愭爣鐐瑰垎鍒拰4涓《鐐圭殑缁忕含搴﹀樊鍊�
-        val p = gridCellList[0]
+        val p = gridCellList.find { it != null }!!
         // 锛堥�氳繃杩戜技骞抽潰鍧愭爣绯荤殑鏂瑰紡锛夋牴鎹崟涓師濮嬬綉鏍肩殑4涓《鐐瑰潗鏍囷紝鍒嗗埆纭畾浠ヤ笅涓夌粍鍧愭爣鐐逛箣闂寸殑缁忕含搴﹀崟浣嶅亸绉婚噺
         val p1 = p.point1Lon to p.point1Lat
         val p2 = p.point2Lon to p.point2Lat
@@ -98,48 +100,63 @@
         val dxC = (p.longitude - p1.first) / scale.toBigDecimal()
         val dyC = (p.latitude - p1.second) / scale.toBigDecimal()
 
-        // 缃戞牸琛屽惊鐜�
-        for (row in 0 until scale) {
-            val newGridCell1 = GridCell()
+        // 缃戞牸绱㈠紩
+        var cellIndex = 0
 
-            // 纭畾姣忎竴琛岄涓粏鍒嗙綉鏍肩殑涓績鍧愭爣鍜�4涓《鐐瑰潗鏍�
-            // 宸︿笂瑙掗《鐐规牴鎹墍鍦ㄨ鏁板湪鍘熷缃戞牸椤剁偣鍩虹涓婂鍔犲亸绉婚噺
-            newGridCell1.point1Lon = p1.first + dx1 * row.toBigDecimal()
-            newGridCell1.point1Lat = p1.second + dy1 * row.toBigDecimal()
-            // 宸︿笅瑙掗《鐐规牴鎹墍鍦ㄨ鏁板湪鍘熷缃戞牸椤剁偣鍩虹涓婂鍔犲亸绉婚噺锛堟瘮宸︿笂瑙掗《鐐瑰涓�涓亸绉伙級
-            newGridCell1.point3Lon = p1.first + dx1 * (row + 1).toBigDecimal()
-            newGridCell1.point3Lat = p1.second + dy1 * (row + 1).toBigDecimal()
-            // 鍙充笂瑙掗《鐐瑰湪缁嗗垎缃戞牸宸︿笂瑙掔殑鍩虹涓婂鍔犵浉搴旂殑鍋忕Щ閲�
-            newGridCell1.point2Lon = newGridCell1.point1Lon + dx2
-            newGridCell1.point2Lat = newGridCell1.point1Lat + dy2
-            // 鍙充笅瑙掗《鐐瑰湪缁嗗垎缃戞牸宸︿笅瑙掔殑鍩虹涓婂鍔犵浉搴旂殑鍋忕Щ閲�
-            newGridCell1.point4Lon = newGridCell1.point3Lon + dx3
-            newGridCell1.point4Lat = newGridCell1.point3Lat + dy3
-            // 涓績鐐瑰湪缁嗗垎缃戞牸宸︿笂瑙掔殑鍩虹涓婂鍔犲浐瀹氬亸绉婚噺
-            newGridCell1.longitude = newGridCell1.point1Lon + dxC
-            newGridCell1.latitude = newGridCell1.point1Lat + dyC
+        // 瀵圭綉鏍肩粍鍐呯殑鎵�鏈夌綉鏍艰繘琛岀綉鏍肩粏鍒�
+        gridCellList.forEach { g ->
+            if (g == null) return@forEach
 
-            // 鍔犲叆缁撴灉闆嗗悎
-            newGridCellList.add(newGridCell1)
+            // 缃戞牸琛屽惊鐜�
+            for (row in 0 until scale) {
+                val newGridCell1 = GridCell()
 
-            // 缃戞牸鍒楀惊鐜�(浠庣2鍒楀紑濮�)
-            for (col in 1 until scale) {
-                val newGridCell = GridCell()
-                newGridCell.point1Lon = newGridCell1.point1Lon + dx2 * col.toBigDecimal()
-                newGridCell.point1Lat = newGridCell1.point1Lat + dy2 * col.toBigDecimal()
-                newGridCell.point2Lon = newGridCell1.point2Lon + dx2 * col.toBigDecimal()
-                newGridCell.point2Lat = newGridCell1.point2Lat + dy2 * col.toBigDecimal()
-                newGridCell.point3Lon = newGridCell1.point3Lon + dx3 * col.toBigDecimal()
-                newGridCell.point3Lat = newGridCell1.point3Lat + dy3 * col.toBigDecimal()
-                newGridCell.point4Lon = newGridCell1.point4Lon + dx3 * col.toBigDecimal()
-                newGridCell.point4Lat = newGridCell1.point4Lat + dy3 * col.toBigDecimal()
-                newGridCell.longitude = newGridCell.point1Lon + dxC
-                newGridCell.latitude = newGridCell.point1Lat + dyC
+                // 纭畾姣忎竴琛岄涓粏鍒嗙綉鏍肩殑涓績鍧愭爣鍜�4涓《鐐瑰潗鏍�
+                // 宸︿笂瑙掗《鐐规牴鎹墍鍦ㄨ鏁板湪鍘熷缃戞牸椤剁偣鍩虹涓婂鍔犲亸绉婚噺
+                newGridCell1.point1Lon = g.point1Lon + dx1 * row.toBigDecimal()
+                newGridCell1.point1Lat = g.point1Lat + dy1 * row.toBigDecimal()
+                // 宸︿笅瑙掗《鐐规牴鎹墍鍦ㄨ鏁板湪鍘熷缃戞牸椤剁偣鍩虹涓婂鍔犲亸绉婚噺锛堟瘮宸︿笂瑙掗《鐐瑰涓�涓亸绉伙級
+                newGridCell1.point3Lon = g.point1Lon + dx1 * (row + 1).toBigDecimal()
+                newGridCell1.point3Lat = g.point1Lat + dy1 * (row + 1).toBigDecimal()
+                // 鍙充笂瑙掗《鐐瑰湪缁嗗垎缃戞牸宸︿笂瑙掔殑鍩虹涓婂鍔犵浉搴旂殑鍋忕Щ閲�
+                newGridCell1.point2Lon = newGridCell1.point1Lon + dx2
+                newGridCell1.point2Lat = newGridCell1.point1Lat + dy2
+                // 鍙充笅瑙掗《鐐瑰湪缁嗗垎缃戞牸宸︿笅瑙掔殑鍩虹涓婂鍔犵浉搴旂殑鍋忕Щ閲�
+                newGridCell1.point4Lon = newGridCell1.point3Lon + dx3
+                newGridCell1.point4Lat = newGridCell1.point3Lat + dy3
+                // 涓績鐐瑰湪缁嗗垎缃戞牸宸︿笂瑙掔殑鍩虹涓婂鍔犲浐瀹氬亸绉婚噺
+                newGridCell1.longitude = newGridCell1.point1Lon + dxC
+                newGridCell1.latitude = newGridCell1.point1Lat + dyC
 
-                newGridCellList.add(newGridCell)
+                newGridCell1.groupId = groupId
+                newGridCell1.cellIndex = ++cellIndex
+                newGridCell1.fatherCellIndex = g.cellIndex
+
+                // 鍔犲叆缁撴灉闆嗗悎
+                newGridCellList.add(newGridCell1)
+
+                // 缃戞牸鍒楀惊鐜�(浠庣2鍒楀紑濮�)
+                for (col in 1 until scale) {
+                    val newGridCell = GridCell()
+                    newGridCell.point1Lon = newGridCell1.point1Lon + dx2 * col.toBigDecimal()
+                    newGridCell.point1Lat = newGridCell1.point1Lat + dy2 * col.toBigDecimal()
+                    newGridCell.point2Lon = newGridCell1.point2Lon + dx2 * col.toBigDecimal()
+                    newGridCell.point2Lat = newGridCell1.point2Lat + dy2 * col.toBigDecimal()
+                    newGridCell.point3Lon = newGridCell1.point3Lon + dx3 * col.toBigDecimal()
+                    newGridCell.point3Lat = newGridCell1.point3Lat + dy3 * col.toBigDecimal()
+                    newGridCell.point4Lon = newGridCell1.point4Lon + dx3 * col.toBigDecimal()
+                    newGridCell.point4Lat = newGridCell1.point4Lat + dy3 * col.toBigDecimal()
+                    newGridCell.longitude = newGridCell.point1Lon + dxC
+                    newGridCell.latitude = newGridCell.point1Lat + dyC
+
+                    newGridCell.groupId = groupId
+                    newGridCell.cellIndex = ++cellIndex
+                    newGridCell.fatherCellIndex = g.cellIndex
+
+                    newGridCellList.add(newGridCell)
+                }
             }
         }
-
         return newGridCellList
     }
 
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java
index b55bf51..16e1d75 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java
+++ b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridCell.java
@@ -9,10 +9,22 @@
     private Integer id;
 
     /**
+     * 缃戞牸绱㈠紩
+     */
+    @Column(name = "cell_index")
+    private Integer cellIndex;
+
+    /**
      * 鎵�灞炵綉鏍煎垎缁刬d
      */
     @Column(name = "group_id")
     private Integer groupId;
+
+    /**
+     * 鎵�灞炰笂绾х綉鏍肩殑绱㈠紩id,濡傛灉娌℃湁鍒欎负null
+     */
+    @Column(name = "father_cell_index")
+    private Integer fatherCellIndex;
 
     /**
      * 缁忓害
@@ -87,6 +99,24 @@
     }
 
     /**
+     * 鑾峰彇缃戞牸绱㈠紩
+     *
+     * @return cell_index - 缃戞牸绱㈠紩
+     */
+    public Integer getCellIndex() {
+        return cellIndex;
+    }
+
+    /**
+     * 璁剧疆缃戞牸绱㈠紩
+     *
+     * @param cellIndex 缃戞牸绱㈠紩
+     */
+    public void setCellIndex(Integer cellIndex) {
+        this.cellIndex = cellIndex;
+    }
+
+    /**
      * 鑾峰彇鎵�灞炵綉鏍煎垎缁刬d
      *
      * @return group_id - 鎵�灞炵綉鏍煎垎缁刬d
@@ -105,6 +135,24 @@
     }
 
     /**
+     * 鑾峰彇鎵�灞炰笂绾х綉鏍肩殑绱㈠紩id,濡傛灉娌℃湁鍒欎负null
+     *
+     * @return father_cell_index - 鎵�灞炰笂绾х綉鏍肩殑绱㈠紩id,濡傛灉娌℃湁鍒欎负null
+     */
+    public Integer getFatherCellIndex() {
+        return fatherCellIndex;
+    }
+
+    /**
+     * 璁剧疆鎵�灞炰笂绾х綉鏍肩殑绱㈠紩id,濡傛灉娌℃湁鍒欎负null
+     *
+     * @param fatherCellIndex 鎵�灞炰笂绾х綉鏍肩殑绱㈠紩id,濡傛灉娌℃湁鍒欎负null
+     */
+    public void setFatherCellIndex(Integer fatherCellIndex) {
+        this.fatherCellIndex = fatherCellIndex;
+    }
+
+    /**
      * 鑾峰彇缁忓害
      *
      * @return longitude - 缁忓害
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
index 8d3bd89..9772b6e 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
+++ b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
@@ -41,6 +41,16 @@
     private Date createTime;
 
     /**
+     * 缃戞牸杈归暱锛堝崟浣嶏細绫筹級
+     */
+    private Double length;
+
+    /**
+     * 缃戞牸绫诲瀷锛宱rigin锛氬師濮嬬綉鏍硷紱sub锛氬瓙缃戞牸锛堢粏鍒嗙綉鏍硷級
+     */
+    private String type;
+
+    /**
      * @return id
      */
     public Integer getId() {
@@ -171,7 +181,7 @@
     }
 
     /**
-     * @return towm_name
+     * @return town_name
      */
     public String getTownName() {
         return townName;
@@ -197,4 +207,40 @@
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    /**
+     * 鑾峰彇缃戞牸杈归暱锛堝崟浣嶏細绫筹級
+     *
+     * @return length - 缃戞牸杈归暱锛堝崟浣嶏細绫筹級
+     */
+    public Double getLength() {
+        return length;
+    }
+
+    /**
+     * 璁剧疆缃戞牸杈归暱锛堝崟浣嶏細绫筹級
+     *
+     * @param length 缃戞牸杈归暱锛堝崟浣嶏細绫筹級
+     */
+    public void setLength(Double length) {
+        this.length = length;
+    }
+
+    /**
+     * 鑾峰彇缃戞牸绫诲瀷锛宱rigin锛氬師濮嬬綉鏍硷紱sub锛氬瓙缃戞牸锛堢粏鍒嗙綉鏍硷級
+     *
+     * @return type - 缃戞牸绫诲瀷锛宱rigin锛氬師濮嬬綉鏍硷紱sub锛氬瓙缃戞牸锛堢粏鍒嗙綉鏍硷級
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * 璁剧疆缃戞牸绫诲瀷锛宱rigin锛氬師濮嬬綉鏍硷紱sub锛氬瓙缃戞牸锛堢粏鍒嗙綉鏍硷級
+     *
+     * @param type 缃戞牸绫诲瀷锛宱rigin锛氬師濮嬬綉鏍硷紱sub锛氬瓙缃戞牸锛堢粏鍒嗙綉鏍硷級
+     */
+    public void setType(String type) {
+        this.type = type == null ? null : type.trim();
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/AirDataRep.kt
similarity index 83%
rename from src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt
rename to src/main/kotlin/com/flightfeather/uav/domain/repository/AirDataRep.kt
index 3f6666d..1460a05 100644
--- a/src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/AirDataRep.kt
@@ -1,14 +1,15 @@
-package com.flightfeather.uav.repository
+package com.flightfeather.uav.domain.repository
 
 import com.flightfeather.uav.domain.entity.RealTimeData
 import com.flightfeather.uav.lightshare.bean.DataVo
 import com.flightfeather.uav.socket.bean.AirDataPackage
 
 /**
+ * 璧拌埅鐩戞祴鏁版嵁鏁版嵁搴撶鐞�
  * @author riku
  * Date: 2020/6/11
  */
-interface AirDataRepository {
+interface AirDataRep {
 
     /**
      * 鍘熷鏁版嵁浠son鏍煎紡瀛樺偍
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/ElectricRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/ElectricRep.kt
new file mode 100644
index 0000000..77b4a4c
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/ElectricRep.kt
@@ -0,0 +1,11 @@
+package com.flightfeather.uav.domain.repository
+
+import com.flightfeather.uav.socket.bean.ElectricMessage
+
+/**
+ * 鐢ㄧ數閲忔暟鎹簱鐩稿叧鎿嶄綔
+ */
+interface ElectricRep {
+
+    fun saveData(electricMessage: ElectricMessage): Int
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
index a8ae70e..4c35033 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
@@ -38,6 +38,14 @@
         })
     }
 
+    fun fetchGridGroup(id: Int): GridGroup? {
+        return gridGroupMapper.selectByPrimaryKey(id)
+    }
+
+    fun fetchGridGroup(gridGroup: GridGroup): List<GridGroup?> {
+        return gridGroupMapper.select(gridGroup)
+    }
+
     fun fetchGridCell(groupId: Int): List<GridCell?> {
         return gridCellMapper.selectByExample(Example(GridCell::class.java).apply {
             createCriteria().andEqualTo("groupId", groupId)
diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/impl/AirDataRepImpl.kt
similarity index 97%
rename from src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt
rename to src/main/kotlin/com/flightfeather/uav/domain/repository/impl/AirDataRepImpl.kt
index 33b0734..6f2bdc1 100644
--- a/src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/impl/AirDataRepImpl.kt
@@ -1,10 +1,10 @@
-package com.flightfeather.uav.repository.impl
+package com.flightfeather.uav.domain.repository.impl
 
 import com.flightfeather.uav.common.utils.GsonUtils
 import com.flightfeather.uav.domain.entity.*
 import com.flightfeather.uav.domain.mapper.*
 import com.flightfeather.uav.lightshare.bean.DataVo
-import com.flightfeather.uav.repository.AirDataRepository
+import com.flightfeather.uav.domain.repository.AirDataRep
 import com.flightfeather.uav.socket.bean.AirData
 import com.flightfeather.uav.socket.bean.AirDataPackage
 import com.flightfeather.uav.socket.eunm.FactorType
@@ -16,23 +16,20 @@
 import java.math.BigDecimal
 import java.text.SimpleDateFormat
 import java.time.LocalDateTime
-import java.time.ZoneId
 import java.util.*
-import kotlin.math.abs
-import kotlin.math.sqrt
 
 /**
  * @author riku
  * Date: 2020/6/11
  */
 @Repository
-class AirDataRepositoryImpl(
+class AirDataRepImpl(
     private val realTimeDataMapper: RealTimeDataMapper,
     private val realTimeDataVehicleMapper: RealTimeDataVehicleMapper,
     private val realTimeDataUavMapper: RealTimeDataUavMapper,
     private val realTimeDataGridMapper: RealTimeDataGridMapper,
     private val factorCalibrationMapper: FactorCalibrationMapper
-): AirDataRepository {
+): AirDataRep {
 
     // FIXME: 2021/10/25 涓存椂杞﹁浇鏁版嵁锛岀敱浜庢棤浜烘満閮ㄥ垎鐩戞祴鍥犲瓙鏁版嵁鏃犳晥锛屽洜姝ゆ殏鏃堕噰鐢ㄨ溅杞芥暟鎹綔涓哄~鍏�
     private val tmpVehicleDataList = mutableListOf<BaseRealTimeData>()
diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/ElectricDapImpl.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/impl/ElectricRepImpl.kt
similarity index 83%
rename from src/main/kotlin/com/flightfeather/uav/repository/impl/ElectricDapImpl.kt
rename to src/main/kotlin/com/flightfeather/uav/domain/repository/impl/ElectricRepImpl.kt
index d853089..b883fda 100644
--- a/src/main/kotlin/com/flightfeather/uav/repository/impl/ElectricDapImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/impl/ElectricRepImpl.kt
@@ -1,14 +1,14 @@
-package com.flightfeather.uav.repository.impl
+package com.flightfeather.uav.domain.repository.impl
 
 import com.flightfeather.uav.domain.entity.ElectricMinuteValue
 import com.flightfeather.uav.domain.mapper.ElectricMinuteValueMapper
-import com.flightfeather.uav.repository.ElectricRepository
+import com.flightfeather.uav.domain.repository.ElectricRep
 import com.flightfeather.uav.socket.bean.ElectricMessage
 import org.springframework.stereotype.Repository
 import java.util.*
 
 @Repository
-class ElectricDapImpl(val electricMinuteValueMapper: ElectricMinuteValueMapper) : ElectricRepository {
+class ElectricRepImpl(val electricMinuteValueMapper: ElectricMinuteValueMapper) : ElectricRep {
     override fun saveData(electricMessage: ElectricMessage): Int {
         val minuteValue = ElectricMinuteValue().apply {
             mvStatCode = electricMessage.mn
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/GridType.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/GridType.kt
new file mode 100644
index 0000000..b87a4c2
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/GridType.kt
@@ -0,0 +1,14 @@
+package com.flightfeather.uav.lightshare.eunm
+
+/**
+ * 鍗槦閬ユ祴缃戞牸绫诲瀷
+ * @date 2025/1/21
+ * @author feiyu02
+ */
+enum class GridType {
+    // 鍘熷缃戞牸
+    Origin(),
+
+    // 瀛愮綉鏍硷紙缁嗗垎缃戞牸)
+    Sub()
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/SatelliteDataType.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/SatelliteDataType.kt
index c05a840..fea796d 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/SatelliteDataType.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/eunm/SatelliteDataType.kt
@@ -9,5 +9,7 @@
     // 鍘熷鏁版嵁
     Original(0),
     // 铻嶅悎鏁版嵁
-    Mix(1)
+    Mix(1),
+    // 缁嗗垎缃戞牸鏁版嵁
+    Sub(2),
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
index 26073dc..17b7c44 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
@@ -15,5 +15,10 @@
      */
     fun calGridVertex(groupId: Int): List<GridCell?>
 
-    fun splitGrid(groupId: Int): List<GridCell?>
+    /**
+     * 灏嗙綉鏍肩粍杩涜缁嗗垎
+     * @param groupId 缃戞牸缁勭储寮昳d
+     * @param scale 鎷嗗垎鐨勭郴鏁帮紝渚嬪 2锛岃〃绀哄皢鍘熸湁缃戞牸鎸夎竟闀跨殑 1/2 鎷嗗垎鎴� 2 * 2 鐨�4涓綉鏍�
+     */
+    fun splitGrid(groupId: Int, scale: Int): List<GridCell?>
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
index 4bf03aa..8648d99 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
@@ -6,7 +6,6 @@
 import com.flightfeather.uav.common.utils.ExcelUtil
 import com.flightfeather.uav.common.utils.FileExchange
 import com.flightfeather.uav.biz.dataprocess.AverageUtil
-import com.flightfeather.uav.common.location.TrackSegment
 import com.flightfeather.uav.domain.entity.*
 import com.flightfeather.uav.domain.mapper.*
 import com.flightfeather.uav.domain.repository.MissionRep
@@ -15,7 +14,7 @@
 import com.flightfeather.uav.lightshare.bean.*
 import com.flightfeather.uav.lightshare.service.RealTimeDataService
 import com.flightfeather.uav.model.epw.EPWDataPrep
-import com.flightfeather.uav.repository.AirDataRepository
+import com.flightfeather.uav.domain.repository.AirDataRep
 import com.flightfeather.uav.socket.eunm.UWDeviceType
 import com.github.pagehelper.PageHelper
 import org.apache.poi.xssf.streaming.SXSSFWorkbook
@@ -37,7 +36,7 @@
 @Service
 class RealTimeDataServiceImpl(
     private val realTimeDataMapper: RealTimeDataMapper,
-    private val airDataRepository: AirDataRepository,
+    private val airDataRep: AirDataRep,
     private val realTimeDataVehicleMapper: RealTimeDataVehicleMapper,
     private val realTimeDataUavMapper: RealTimeDataUavMapper,
     private val realTimeDataGridMapper: RealTimeDataGridMapper,
@@ -396,7 +395,7 @@
             println("褰撳墠椤垫暟锛�$page")
             val dataList = res.data ?: emptyList()
             val result = epwDataPrep.mDataPrep2(dataList)
-            count += airDataRepository.savePrepData2(result)
+            count += airDataRep.savePrepData2(result)
             page++
         }
 
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 9fcf324..1d0acf1 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
@@ -3,12 +3,13 @@
 import com.flightfeather.uav.biz.satellite.SatelliteGridManage
 import com.flightfeather.uav.common.exception.BizException
 import com.flightfeather.uav.domain.entity.GridCell
+import com.flightfeather.uav.domain.entity.GridGroup
 import com.flightfeather.uav.domain.repository.SatelliteGridRep
 import com.flightfeather.uav.lightshare.service.SatelliteDataCalculateService
 import org.springframework.stereotype.Service
 
 /**
- *
+ * 鍗槦缃戞牸鍧愭爣鍙婄洃娴嬫暟鎹簩娆¤绠�
  * @date 2025/1/15
  * @author feiyu02
  */
@@ -45,7 +46,14 @@
         return cellList
     }
 
-    override fun splitGrid(groupId: Int): List<GridCell?> {
-        TODO("Not yet implemented")
+    override fun splitGrid(groupId: Int, scale: Int): List<GridCell?> {
+        // 妫�鏌ヨ缃戞牸涓嬭绉嶇被鐨勭粏鍒嗙綉鏍兼槸鍚﹀瓨鍦紝鑻ヤ笉瀛樺湪锛屽垯鏂板缓
+        satelliteGridRep.fetchGridGroup(groupId)
+        // 鑾峰彇鍏蜂綋缃戞牸淇℃伅
+        val cellList = satelliteGridRep.fetchGridCell(groupId)
+        // 鎸夌収缁欏畾鐨勬媶鍒嗙郴鏁拌繘琛屾媶鍒�
+//        val subCellList = SatelliteGridManage.splitGrid(cellList, scale)
+
+        return emptyList()
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/repository/ElectricRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/ElectricRepository.kt
deleted file mode 100644
index 8179ccb..0000000
--- a/src/main/kotlin/com/flightfeather/uav/repository/ElectricRepository.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.flightfeather.uav.repository
-
-import com.flightfeather.uav.socket.bean.ElectricMessage
-
-interface ElectricRepository {
-
-    fun saveData(electricMessage: ElectricMessage): Int
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt b/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt
index 7476e3e..7926c38 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt
@@ -1,6 +1,6 @@
 package com.flightfeather.uav.socket.processor
 
-import com.flightfeather.uav.repository.ElectricRepository
+import com.flightfeather.uav.domain.repository.ElectricRep
 import com.flightfeather.uav.socket.bean.BaseMessage
 import com.flightfeather.uav.socket.bean.ElectricMessage
 import com.flightfeather.uav.socket.decoder.ElectricDataDecoder
@@ -20,7 +20,7 @@
     }
 
     @Autowired
-    lateinit var electricRepository: ElectricRepository
+    lateinit var electricRep: ElectricRep
 
     @Autowired
     lateinit var electricDataDecoder: ElectricDataDecoder
@@ -42,7 +42,7 @@
 
     private fun saveToDataBase(message: BaseMessage, msg: String) {
         if (message is ElectricMessage && message.mn.isNotBlank()) {
-            instance.electricRepository.saveData(message)
+            instance.electricRep.saveData(message)
         }
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt b/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
index 48ac7bb..201bfe4 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
@@ -1,7 +1,7 @@
 package com.flightfeather.uav.socket.processor
 
 import com.flightfeather.uav.model.epw.EPWDataPrep
-import com.flightfeather.uav.repository.AirDataRepository
+import com.flightfeather.uav.domain.repository.AirDataRep
 import com.flightfeather.uav.socket.bean.AirDataPackage
 import com.flightfeather.uav.socket.decoder.AirDataDecoder
 import com.flightfeather.uav.socket.decoder.DataPackageDecoder
@@ -30,7 +30,7 @@
     }
 
     @Autowired
-    lateinit var airDataRepository: AirDataRepository
+    lateinit var airDataRep: AirDataRep
 
     private val airDataDecoder = AirDataDecoder.instance
     private val dataPackageDecoder = DataPackageDecoder()
@@ -66,7 +66,7 @@
         when (dataPackage.commandUnit) {
             AirCommandUnit.AirData.value -> {
                 // 浠son鏍煎紡瀛樺偍鍘熷鏁版嵁
-                instance.airDataRepository.saveAirData(dataPackage)
+                instance.airDataRep.saveAirData(dataPackage)
                 // 杩涜棰勫鐞嗗悗锛屽瓨鍌ㄨ嚦瀵瑰簲鏁版嵁琛�
                 if (!dataProcessMap.containsKey(dataPackage.deviceCode)) {
                     // 姣忓彴璁惧鏈夊崟鐙殑鏁版嵁棰勫鐞嗗璞�
@@ -74,7 +74,7 @@
                 }
                 dataProcessMap[dataPackage.deviceCode]?.run {
                     val list = this.mDataPrep2(dataPackage)// 鏁版嵁骞虫粦澶勭悊
-                    instance.airDataRepository.savePrepData2(list)// 鎸夌収璁惧绫诲瀷瀛樺偍鑷冲搴旀暟鎹〃
+                    instance.airDataRep.savePrepData2(list)// 鎸夌収璁惧绫诲瀷瀛樺偍鑷冲搴旀暟鎹〃
                 }
             }
         }
diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml
index 44b010d..469419f 100644
--- a/src/main/resources/generator/generatorConfig.xml
+++ b/src/main/resources/generator/generatorConfig.xml
@@ -25,9 +25,14 @@
             <property name="suppressAllComments" value="true"/>
         </commentGenerator>
         <!--鏁版嵁搴撻摼鎺RL锛岀敤鎴峰悕銆佸瘑鐮� -->
-        <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai"
-						userId="remoteU1"
-						password="eSoF8DnzfGTlhAjE">
+<!--        <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai"-->
+<!--						userId="remoteU1"-->
+<!--						password="eSoF8DnzfGTlhAjE">-->
+<!--        </jdbcConnection>-->
+        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
+                        connectionURL="jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai"
+                        userId="root"
+                        password="123456">
         </jdbcConnection>
         <javaTypeResolver>
             <property name="forceBigDecimals" value="false"/>
@@ -61,7 +66,7 @@
 <!--        <table tableName="real_time_data_grid_opt" domainObjectName="RealTimeDataGridOpt" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="scene_info" domainObjectName="SceneInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="segment_info" domainObjectName="SegmentInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
-<!--        <table tableName="grid_group" domainObjectName="GridGroup" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <table tableName="grid_group" domainObjectName="GridGroup" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
         <table tableName="grid_cell" domainObjectName="GridCell" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
 <!--        <table tableName="grid_data" domainObjectName="GridData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="grid_data_detail" domainObjectName="GridDataDetail" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
diff --git a/src/main/resources/mapper/GridCellMapper.xml b/src/main/resources/mapper/GridCellMapper.xml
index 22c0623..1b176c4 100644
--- a/src/main/resources/mapper/GridCellMapper.xml
+++ b/src/main/resources/mapper/GridCellMapper.xml
@@ -6,7 +6,9 @@
       WARNING - @mbg.generated
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="cell_index" jdbcType="INTEGER" property="cellIndex" />
     <result column="group_id" jdbcType="INTEGER" property="groupId" />
+    <result column="father_cell_index" jdbcType="INTEGER" property="fatherCellIndex" />
     <result column="longitude" jdbcType="DECIMAL" property="longitude" />
     <result column="latitude" jdbcType="DECIMAL" property="latitude" />
     <result column="point1_lon" jdbcType="DECIMAL" property="point1Lon" />
@@ -22,7 +24,7 @@
     <!--
       WARNING - @mbg.generated
     -->
-    id, group_id, longitude, latitude, point1_lon, point1_lat, point2_lon, point2_lat, 
-    point3_lon, point3_lat, point4_lon, point4_lat
+    id, cell_index, group_id, father_cell_index, longitude, latitude, point1_lon, point1_lat, 
+    point2_lon, point2_lat, point3_lon, point3_lat, point4_lon, point4_lat
   </sql>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/GridGroupMapper.xml b/src/main/resources/mapper/GridGroupMapper.xml
index b0e9e5a..8f2ec4b 100644
--- a/src/main/resources/mapper/GridGroupMapper.xml
+++ b/src/main/resources/mapper/GridGroupMapper.xml
@@ -16,12 +16,14 @@
     <result column="town_code" jdbcType="VARCHAR" property="townCode" />
     <result column="town_name" jdbcType="VARCHAR" property="townName" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="length" jdbcType="DOUBLE" property="length" />
+    <result column="type" jdbcType="VARCHAR" property="type" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
     id, name, province_code, province_name, city_code, city_name, district_code, district_name, 
-    town_code, town_name, create_time
+    town_code, town_name, create_time, length, type
   </sql>
 </mapper>
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/uav/Test.kt b/src/test/kotlin/com/flightfeather/uav/Test.kt
index 99f1d8b..77ad87b 100644
--- a/src/test/kotlin/com/flightfeather/uav/Test.kt
+++ b/src/test/kotlin/com/flightfeather/uav/Test.kt
@@ -4,10 +4,12 @@
 import com.flightfeather.uav.common.utils.FileExchange
 import com.flightfeather.uav.common.utils.FileUtil
 import com.flightfeather.uav.domain.entity.Company
+import com.flightfeather.uav.lightshare.eunm.SatelliteDataType
 import com.flightfeather.uav.socket.bean.DataUnit
 import com.flightfeather.uav.socket.decoder.AirDataDecoder
 import com.flightfeather.uav.socket.eunm.AirCommandUnit
 import com.google.gson.Gson
+import org.jetbrains.kotlin.konan.util.visibleName
 import org.junit.Test
 import java.io.File
 import java.io.FileOutputStream
@@ -127,6 +129,11 @@
 
     @Test
     fun foo17() {
-        val a = listOf(1, 2, 3)
+        println(SatelliteDataType.Original.name)
+        println(SatelliteDataType.Original.value)
+        println(SatelliteDataType.Original.ordinal)
+        println(SatelliteDataType.Original.toString())
+        println(SatelliteDataType.Original.visibleName)
+        println(SatelliteDataType.Original)
     }
 }
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
index 3c28e3b..1d70ec0 100644
--- a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
+++ b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
@@ -3,7 +3,7 @@
 import com.flightfeather.uav.domain.entity.RealTimeDataVehicle
 import com.flightfeather.uav.domain.mapper.RealTimeDataVehicleMapper
 import com.flightfeather.uav.lightshare.service.RealTimeDataService
-import com.flightfeather.uav.repository.impl.AirDataRepositoryImpl
+import com.flightfeather.uav.domain.repository.impl.AirDataRepImpl
 import org.junit.Test
 
 import org.junit.runner.RunWith
@@ -24,7 +24,7 @@
     lateinit var realTimeDataVehicleMapper: RealTimeDataVehicleMapper
 
     @Autowired
-    lateinit var airDataRepository: AirDataRepositoryImpl
+    lateinit var airDataRepository: AirDataRepImpl
 
     @Test
     fun outToExcel() {

--
Gitblit v1.9.3