From e731486b50c4ea6e2d28f302df449b4bd0b2be57 Mon Sep 17 00:00:00 2001 From: Riku <risaku@163.com> Date: 星期一, 02 六月 2025 23:02:59 +0800 Subject: [PATCH] 1. 新增走航动态溯源功能 --- src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt | 85 +++++++++++++++++++++++++++++++++++++----- 1 files changed, 75 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt index 8ae7734..489e66a 100644 --- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt @@ -1,5 +1,9 @@ package com.flightfeather.uav.biz.sourcetrace.model +import com.flightfeather.uav.biz.FactorFilter +import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType +import com.flightfeather.uav.biz.sourcetrace.config.RTExcWindLevelConfig +import com.flightfeather.uav.common.utils.DateUtil import com.flightfeather.uav.domain.entity.BaseRealTimeData import com.flightfeather.uav.lightshare.bean.DataVo @@ -8,23 +12,74 @@ * @date 2025/5/27 * @author feiyu02 */ -class PollutedData { +class PollutedData() { /** - * - * 1. 杞1.5m/s鍙婁互涓嬶紝 - * 鍓嶅悗鍊间笂鍗囧箙搴﹀湪50%浠ヤ笂1娆★紝璁や负鏄复杩戝彂鐢�(50绫�) - * 鍓嶅悗鍊间笂鍗囧箙搴﹀湪20%浠ヤ笂1娆★紝璁や负鏄繙璺濈鍙戠敓锛�50绫� - 500绫筹級 - * 1.5 m/s鍙婁互涓嬶紝闈欑ǔ澶╂皵锛屼复杩戝彂鐢�(50绫�) - * 2. 1.6 - 7.9 m/s锛屽墠鍚庡�间笂鍗囧箙搴﹀湪20%浠ヤ笂3娆★紝璁や负鏄繙璺濈鍙戠敓锛�50绫� - 1鍏噷锛� - * 3. 8 - 13.8 m/s 浠ヤ笂锛屽墠鍚庡�间笂鍗囧箙搴﹀湪10%浠ヤ笂3娆★紝璁や负鏄繙璺濈鍙戠敓(50绫� - 2鍏噷) + * 9. 鍏宠仈鍥犲瓙 + * a) pm2.5銆乸m10鐗瑰埆楂橈紝涓よ�呭湪鍚勬儏鍐典笅鍚屾灞曠ず锛宲m2.5鍗爌m10鐨勬瘮閲嶅彉鍖栵紝姣旈噸瓒婇珮锛岃秺鏈夊彲鑳芥槸椁愰ギ + * b) pm10鐗瑰埆楂樸�乸m2.5杈冮珮锛屽ぇ棰楃矑鎵皹姹℃煋锛屽彧灞曠ずpm10锛宲m2.5鍗爌m10鐨勬瘮閲嶅彉鍖栵紝宸ュ湴涓轰富 + * c) VOC杈冮珮锛屽悓姣旇绠梡m2.5鐨勯噺绾э紝鍙兘瀛樺湪鍚屾鍋忛珮锛堟苯淇�佸姞娌圭珯锛�, 鍚屾璁$畻O3鏄惁鏈夐珮鍊� + * d) VOC杈冮珮锛屽浜庡姞娌圭珯锛堣溅杈嗘嫢鍫垫儏鍐碉級锛孋O涓�鑸緝楂�, 鍚屾璁$畻O3鏄惁鏈夐珮鍊� + * e) 姘哀鍖栧悎鐗╋紝涓�鑸敱浜庢満鍔ㄨ溅灏炬皵锛屽悓姝ヨ绠桟O */ + constructor( + start: BaseRealTimeData, + end: BaseRealTimeData?, + factor: FactorFilter.SelectedFactor, + exceptionData: List<BaseRealTimeData>, + eType: ExceptionType, + windLevelCondition: RTExcWindLevelConfig.WindLevelCondition, + ) : this() { + exception = eType.des + exceptionType = eType.value + factorId = factor.main.value + factorName = factor.main.des + subFactorId = factor.subs.map { it.value } + subFactorName = factor.subs.map { it.des } + selectedFactor = factor + + startTime = DateUtil.instance.dateToString(start.dataTime, DateUtil.DateStyle.HH_MM_SS) + endTime = DateUtil.instance.dateToString(end?.dataTime, DateUtil.DateStyle.HH_MM_SS) ?: startTime + startData = start.getByFactorType(factor.main) + endData = end?.getByFactorType(factor.main) ?: startData + + windSpeed = exceptionData.first().windSpeed?.toDouble() + percentage = windLevelCondition.mutationRate.first + times = windLevelCondition.countLimit + + exceptionData.forEach { + dataList.add(it) + dataVoList.add(it.toDataVo()) + } + + calPer() + } + + var deviceCode: String? = null + + var exception: String? = null + var exceptionType: Int? = null + + var factorId: Int? = null + var factorName: String? = null + var subFactorId: List<Int>? = null + var subFactorName: List<String>? = null + var selectedFactor: FactorFilter.SelectedFactor? = null + + var startTime: String? = null + var endTime: String? = null + + var startData: Float? = null + var endData: Float? = null + // 椋庨�� - var windSpeed: Float? = null + var windSpeed: Double? = null // 鍥犲瓙閲忕骇鍙樺寲骞呭害 - var percentage: Float? = null + var percentage: Double? = null + // 鍥犲瓙閲忕骇骞冲潎鍙樺寲骞呭害 + var avgPer: Double? = null // 鍙戠敓娆℃暟 var times: Int? = null @@ -32,4 +87,14 @@ // 寮傚父鐩戞祴鏁版嵁 var dataList: MutableList<BaseRealTimeData> = mutableListOf() var dataVoList: MutableList<DataVo> = mutableListOf() + + private fun calPer() { + if (dataList.size < 2) return + + var total = .0 + for (i in 0 until dataList.size - 1) { + total += dataList[i].getByFactorType(selectedFactor!!.main)!! + } + avgPer = total / (dataList.size - 1) + } } \ No newline at end of file -- Gitblit v1.9.3