|
|
|
@ -151,18 +151,18 @@ class QueryDataActivity : BaseActivity() {
|
|
|
|
|
gasMap.forEach { (type, list) ->
|
|
|
|
|
val newMapList = mutableListOf<Gas>()
|
|
|
|
|
var startGas: Gas? = null
|
|
|
|
|
var gasValue = 0.0
|
|
|
|
|
var gasValue = 0f
|
|
|
|
|
var tempTime = 0L
|
|
|
|
|
var count = 0
|
|
|
|
|
list.forEachIndexed { index, gas ->
|
|
|
|
|
if (startGas == null) {
|
|
|
|
|
startGas = gas.copy()
|
|
|
|
|
tempTime = gas.time - ((gas.time - startTime) % intervalMs)
|
|
|
|
|
gasValue = 0.0
|
|
|
|
|
gasValue = 0f
|
|
|
|
|
count = 0
|
|
|
|
|
}
|
|
|
|
|
if (gas.time - tempTime > intervalMs) {
|
|
|
|
|
if (gasValue >= 0.0) {
|
|
|
|
|
if (gasValue >= 0f) {
|
|
|
|
|
startGas!!.gasValue = gasValue / count
|
|
|
|
|
startGas!!.time = tempTime
|
|
|
|
|
newMapList.add(startGas!!)
|
|
|
|
@ -177,7 +177,7 @@ class QueryDataActivity : BaseActivity() {
|
|
|
|
|
if (num > 0) {
|
|
|
|
|
for (i in num downTo 1) {
|
|
|
|
|
tempTime += intervalMs
|
|
|
|
|
newMapList.add(gas.copy(time = tempTime, gasValue = -1.0))
|
|
|
|
|
newMapList.add(gas.copy(time = tempTime, gasValue = -1.0f))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -187,7 +187,7 @@ class QueryDataActivity : BaseActivity() {
|
|
|
|
|
|
|
|
|
|
// 最后一个特殊处理
|
|
|
|
|
if (list.size - 1 == index) {
|
|
|
|
|
if (gasValue >= 0.0) {
|
|
|
|
|
if (gasValue >= 0f) {
|
|
|
|
|
startGas!!.gasValue = gasValue / count
|
|
|
|
|
startGas!!.time = tempTime
|
|
|
|
|
newMapList.add(startGas!!)
|
|
|
|
@ -201,7 +201,7 @@ class QueryDataActivity : BaseActivity() {
|
|
|
|
|
gasNewMap.forEach { (t, u) ->
|
|
|
|
|
newList.addAll(u)
|
|
|
|
|
}
|
|
|
|
|
newList = newList.filter { it.gasValue >= 0.0 } as MutableList<Gas>
|
|
|
|
|
newList = newList.filter { it.gasValue >= 0f } as MutableList<Gas>
|
|
|
|
|
newList.sortWith { o1, o2 ->
|
|
|
|
|
(o2.time - o1.time).toInt()
|
|
|
|
|
}
|
|
|
|
|