| | |
| | | var exceptionData = mutableListOf<BaseRealTimeData>() |
| | | var historyData = mutableListOf<BaseRealTimeData>() |
| | | exceptions.forEach { e -> |
| | | // 将采样时间最早的作为开始数据 |
| | | if (startData == null) { |
| | | startData = e.second.startData |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // 将采样时间最晚的作为结束数据 |
| | | if (endData == null) { |
| | | endData = e.second.endData |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // 将所有异常数据去重合并 |
| | | if (exceptionData.isEmpty()) { |
| | | exceptionData = e.second.exceptionData |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // 将所有历史数据去重合并 |
| | | if (historyData.isEmpty()) { |
| | | historyData = e.second.historyData |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | // 按照采样时间升序排列 |
| | | exceptionData.sortBy { it.dataTime } |
| | | historyData.sortBy { it.dataTime } |
| | | |
| | | val factorList = exceptions.map { it.first } |
| | | // 获取去重后的监测因子类型 |
| | | val factorList = exceptions.map { it.first }.distinct() |
| | | pollutedData = PollutedData( |
| | | startData!!, endData, factorList, exceptionData, historyData, eType, windLevelCondition |
| | | ) |