From b77a69357da82a965cd63e76e8ceaf625ec4009b Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 15 七月 2021 16:37:47 +0800 Subject: [PATCH] 1. 新增信访信息获取接口 2. 新增用电量信息获取接口 3. 新增风险评估结果接口 4. 新增污染权重实时分析接口 --- src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt index ed0a404..5da6409 100644 --- a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt +++ b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt @@ -21,6 +21,8 @@ // emptyList<String>() WeightType.prep + private val lastData = mutableListOf<DataVo>() + override fun mDataPrep(mDataList: List<DataVo>): List<DataVo> { mDataList.forEach { it.values?.forEach v@{a -> @@ -40,6 +42,9 @@ // } var i = ncal + if (lastData.isNotEmpty()) { + i = 0 + } while (i < mDataList.size) { for (y in mDataList[i].values?.indices ?: 0..0) { val it = mDataList[i].values?.get(y) ?: continue @@ -49,7 +54,14 @@ it.factorData ?: continue if (it.factorData!! > vMax) { - val list = mDataList.subList(i - ncal, i) + val lastDataIndex = i + val thisIndex = if (i-ncal<0) 0 else i - ncal + val list = mutableListOf<DataVo>() + if (lastDataIndex < lastData.size) { + list.addAll(lastData.subList(lastDataIndex, lastData.lastIndex + 1)) + } + list.addAll(mDataList.subList(thisIndex, i)) + // 鍘婚櫎鏃犳晥鍊肩殑骞冲潎 val avg = average(list, it.factorName) // 鍘婚櫎鏃犳晥鍊肩殑鏍囧噯宸� @@ -73,6 +85,12 @@ i++ } + lastData.clear() + val s = if ((mDataList.lastIndex - ncal + 1) < 0) 0 else mDataList.lastIndex - ncal + 1 + mDataList.subList(s, mDataList.lastIndex + 1).forEach { + lastData.add(it.copy()) + } + return mDataList } -- Gitblit v1.9.3