From 74ffc8ebf3a25d2e3cee758954ce6efc163cb864 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 02 十二月 2021 16:11:57 +0800
Subject: [PATCH] 1. 用电量日分析

---
 src/main/kotlin/com/flightfeather/uav/model/epw/EPWModel.kt |   47 ++++++++++++++++++++++-------------------------
 1 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWModel.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWModel.kt
index be8689e..2428a7b 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWModel.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWModel.kt
@@ -1,7 +1,9 @@
 package com.flightfeather.uav.model.epw
 
-import com.flightfeather.uav.domain.entity.Company
+import com.flightfeather.uav.lightshare.bean.CompanySOP
 import com.flightfeather.uav.lightshare.bean.DataVo
+import com.flightfeather.uav.model.*
+import com.flightfeather.uav.socket.eunm.FactorType
 import java.math.BigDecimal
 
 /**
@@ -9,30 +11,25 @@
  * 鏍规嵁璧拌埅鐩戞祴鏁版嵁锛岀粨鍚堥閫熴�侀鍚戙�佺洃娴嬬偣涓庝紒涓氱殑鐩稿浣嶇疆绛夊洜绱狅紝璁$畻浼佷笟瀵圭洃娴嬪尯鍩熺殑褰卞搷绋嬪害
  * @author riku
  */
-class EPWModel {
+class EPWModel : BaseModel<DataVo, CompanySOP>() {
 
-//    private val windDirWeight = WindDirWeight()
-//    private val windDisWeight = WindDisWeight()
-
-    private lateinit var datas: List<DataVo>
-    private lateinit var sources: List<Company>
-
-    fun execute() {
-        datas.forEach d@{d ->
-            if (d.lng == null || d.lng == 0.0 || d.lat == null || d.lat == 0.0) {
-                return@d
-            }
-
-            sources.forEach s@ { s ->
-                // 缁忕含搴︽湁鏁堟�у垽鏂�
-                if (s.ciLongitude == null || s.ciLongitude == BigDecimal(0) || s.ciLatitude == null || s.ciLatitude == BigDecimal(0)) {
-                    return@s
-                }
-
-                val p1 = Pair(d.lng!!, d.lat!!)
-                val p2 = Pair(s.ciLongitude.toDouble(), s.ciLatitude.toDouble())
-//                windDirWeight.getWeight(p1, p2)
-            }
+    // 榛樿鐩戞祴鐐圭粡绾害
+    var defaultLocation: Pair<Double, Double>? = null
+        set(value) {
+            weights = listOf(WindDirWeight(value), WindDisWeight(value))
         }
-    }
+
+    override var dataPrep: BaseDataPrep<DataVo, CompanySOP> = EPWDataPrep()
+
+    override var factorTypes: List<FactorType> = WeightType.weightType
+
+    override var weights: List<BaseWeight<DataVo, CompanySOP>> = listOf(WindDirWeight(defaultLocation), WindDisWeight(defaultLocation))
+
+    override var sections: List<BaseSection<DataVo, CompanySOP>> = listOf(TimeSection())
+
+    override fun mDataCheck(m: DataVo): Boolean = !(m.lng == null || m.lng == 0.0 || m.lat == null || m.lat == 0.0)
+
+    override fun sopCheck(s: CompanySOP): Boolean =
+        !(s.ciLongitude == null || s.ciLongitude == BigDecimal(0) || s.ciLatitude == null || s.ciLatitude == BigDecimal(0))
+
 }
\ No newline at end of file

--
Gitblit v1.9.3