From d978297ae85b2d7453054e616bbbe87bfabe9cbe Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期一, 12 七月 2021 17:38:09 +0800 Subject: [PATCH] 1. 新增用电量数据查询接口 2. 调整污染权重算法 --- src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataVo.kt | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 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..9696b02 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,9 @@ package com.flightfeather.uav.lightshare.bean 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 +21,41 @@ 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 { + 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 { + val name = it.factorName ?: "" + list.add(name) + list.add("$name(鐗╃悊閲�)") + } + return list.toTypedArray() + } +} \ No newline at end of file -- Gitblit v1.9.3