feiyu02
2025-07-03 c56e1e74426238939f229f0005828d05089715ff
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt
@@ -59,6 +59,7 @@
        historyDataList.addAll(historyData.map { it.toDataVo() })
        calPer()
        calRate()
    }
    var deviceCode: String? = null
@@ -85,6 +86,8 @@
    var percentage: Double? = null
    // 因子量级平均变化幅度
    var avgPer: Double? = null
    // 因子量级平均变化速率
    var avgRate: Double? = null
    // 发生次数
    var times: Int? = null
@@ -108,4 +111,19 @@
        }
        avgPer = total / (list.size - 1)
    }
    private fun calRate() {
        val list = dataList
//        list.add(startData)
//        list.addAll(dataList)
        if (list.size < 2) return
        var total = .0
        for (i in 0 until list.size - 1) {
            val p = list[i]?.getByFactorType(selectedFactor!!.main)!!
            val n = list[i + 1]?.getByFactorType(selectedFactor!!.main)!!
            total += (n - p) / 4
        }
        avgRate = total / (list.size - 1)
    }
}