From 94fee0b511279679b43e210878d3d36e5a14384b Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 30 九月 2025 09:14:10 +0800
Subject: [PATCH] 2025.9.30 1. 新增走航任务统计功能

---
 src/main/kotlin/com/flightfeather/uav/model/BaseSection.kt |   50 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/model/BaseSection.kt b/src/main/kotlin/com/flightfeather/uav/model/BaseSection.kt
index 01a3310..71deb4c 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/BaseSection.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/BaseSection.kt
@@ -1,9 +1,55 @@
 package com.flightfeather.uav.model
 
+import com.flightfeather.uav.lightshare.bean.DataVo
+
 /**
- * 缁熻鍒嗘鎴潰
+ * 缁熻鍒嗙被
  * 鍚屼竴绫诲瀷鐨勭洃娴嬪洜瀛愭寜鐓ф煇涓�灞炴�ц繘琛屽垎娈电患鍚堢粺璁★紝杈撳嚭缁熻缁撴灉锛�
  * 甯歌鐨勫鎸夌収鏃堕棿杩涜鍒嗘缁熻
  */
-abstract class BaseSection {
+abstract class BaseSection<M : BaseMData, S : BaseSOP> {
+
+    // 鍖洪棿闃堝��
+    abstract val sectionValues: List<Double>
+
+    // 鍖洪棿瀵瑰簲绫诲瀷
+    abstract val sectionType: List<String>
+
+    // 甯搁┗鏍囩
+    open val constType = listOf<String>()
+
+    abstract val tagClz: Class<out BaseTag>
+
+    fun filter(mData: M, sop: S, effect: BaseEffect) {
+        val v = onSectionValue(mData, sop, effect)
+        val type = sectionCal(v)
+        val tag = tagClz.newInstance()
+        tag.level = type.first
+        tag.levelName = type.second
+        effect.tag.add(tag)
+
+        var level = sectionType.size
+        constType.forEach {
+            val cTag = tagClz.newInstance()
+            cTag.level = level
+            cTag.levelName = it
+            effect.tag.add(cTag)
+            level++
+        }
+    }
+
+    abstract fun onSectionValue(mData: M, sop: S, effect: BaseEffect): Double
+
+    /**
+     * 绫诲瀷绛涢��
+     * @param value 褰卞搷鍥犵礌鐨勫��
+     */
+    private fun sectionCal(value: Double): Pair<Int, String> {
+        for (i in sectionValues.indices) {
+            if (value < sectionValues[i]) {
+                return Pair(i, sectionType[i])
+            }
+        }
+        return Pair(sectionType.lastIndex, sectionType.last())
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3