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/lightshare/bean/DataVo.kt |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataVo.kt
index c3b6f14..7ac9d4b 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataVo.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataVo.kt
@@ -1,7 +1,10 @@
 package com.flightfeather.uav.lightshare.bean
 
+import com.fasterxml.jackson.annotation.JsonIgnore
 import com.fasterxml.jackson.annotation.JsonInclude
+import com.flightfeather.uav.model.BaseMData
 import com.flightfeather.uav.socket.bean.AirData
+import com.flightfeather.uav.socket.eunm.FactorType
 
 /**
  * @author riku
@@ -19,4 +22,45 @@
         var lng: Double? = null,
         //绾害
         var lat: Double? = null
-)
\ No newline at end of file
+) : BaseMData() {
+        override fun getFactorData(type: FactorType): Double? {
+                if (values == null) throw IllegalStateException(this.javaClass.name + ": 鐩戞祴鏁版嵁鏁扮粍涓簄ull")
+                for (d in values!!) {
+                        if (d.factorName == type.name) {
+                                return d.factorData
+                        }
+                }
+                return null
+        }
+
+        fun toRowContent(): Array<Any> {
+                val row = mutableListOf<Any>()
+                row.add(deviceCode ?: "")
+                row.add(time ?: "")
+                row.add(lng ?: -1.0)
+                row.add(lat ?: -1.0)
+                values?.forEach {
+                        if (FactorType.outputFactor(it.factorName)) {
+                                row.add(it.factorData ?: -1.0)
+//                                row.add(it.physicalQuantity ?: -1.0)
+                        }
+                }
+                return row.toTypedArray()
+        }
+
+        fun toRowTitle(): Array<String> {
+                val list = mutableListOf<String>()
+                list.add("缂栧彿")
+                list.add("閲囨牱鏃堕棿")
+                list.add("缁忓害")
+                list.add("绾害")
+                values?.forEach {
+                        if (FactorType.outputFactor(it.factorName)) {
+                                val name = it.factorName ?: ""
+                                list.add(name)
+//                        list.add("$name(鐗╃悊閲�)")
+                        }
+                }
+                return list.toTypedArray()
+        }
+}
\ No newline at end of file

--
Gitblit v1.9.3