From 538ba7a3bbc682f4537f1dd34f93feb2cf56b08e Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 14 十月 2025 17:32:04 +0800 Subject: [PATCH] 2025.10.14 1. 新增数据统计颗粒度选项,可选秒级数据、分钟数据进行数据统计 2. 典型隐患区域统计新增按照污染溯源区域进行分类统计的功能 --- src/main/kotlin/com/flightfeather/uav/biz/report/MissionRiskArea.kt | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 51 insertions(+), 1 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionRiskArea.kt b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionRiskArea.kt index 38eef5b..570e3b8 100644 --- a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionRiskArea.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionRiskArea.kt @@ -15,6 +15,7 @@ class ClueByArea { var sceneInfo: SceneInfo? = null + var address: String? = null var clueByFactorList: MutableList<ClueByFactor>? = null } @@ -23,7 +24,13 @@ var clues: MutableList<PollutedClue>? = null } - fun generateClueByRiskArea(keyScenes: List<SceneInfo?>, pollutedClues: List<PollutedClue?>): List<ClueByArea> { + /** + * 鐢熸垚璧拌埅鍏稿瀷闅愭偅鍖哄煙锛屾牴鎹叧閿満鏅垪琛ㄨ繘琛屽垎缁� + * @param keyScenes 鍏抽敭鍦烘櫙鍒楄〃 + * @param pollutedClues 姹℃煋绾跨储鍒楄〃 + * @return 鎸夊尯鍩熷拰鍥犲瓙鍒嗙粍鐨勬薄鏌撶嚎绱� + */ + fun generateClueByKeyRiskScene(keyScenes: List<SceneInfo?>, pollutedClues: List<PollutedClue?>): List<ClueByArea> { val result = mutableListOf<ClueByArea>() pollutedClues.forEach { pollutedClue -> @@ -83,4 +90,47 @@ return result } + + /** + * 鐢熸垚璧拌埅鍏稿瀷闅愭偅鍖哄煙锛屾牴鎹薄鏌撶嚎绱㈡函婧愬湴鍧�杩涜鍒嗙粍 + * @param pollutedClues 姹℃煋绾跨储鍒楄〃 + * @return 鎸夊尯鍩熷拰鍥犲瓙鍒嗙粍鐨勬薄鏌撶嚎绱� + */ + fun generateClueByRiskArea(pollutedClues: List<PollutedClue?>): List<ClueByArea> { + val result = mutableListOf<ClueByArea>() + + pollutedClues.forEach { pollutedClue -> + if (pollutedClue == null) return@forEach + val dataList = pollutedClue.pollutedData?.dataList ?: emptyList() + if (dataList.isEmpty()) return@forEach + + // 鎸夋薄鏌撴函婧愬湴鍧�鍜屽洜瀛愬垎缁勭嚎绱� + pollutedClue.pollutedArea?.address?.let { address -> + var clueByArea = result.find { it.address == address } + if (clueByArea == null) { + clueByArea = ClueByArea().apply { + this.address = address + this.clueByFactorList = mutableListOf() + } + result.add(clueByArea) + } + + val firstFactorType = pollutedClue.pollutedData?.statisticMap?.keys?.first() + val afType = AggregatedFactorType.getAFType(firstFactorType) + val factorName = afType?.des ?: firstFactorType?.des + var clueByFactor = clueByArea.clueByFactorList?.find { it.factor == factorName } + if (clueByFactor == null) { + clueByFactor = ClueByFactor().apply { + this.factor = factorName + this.clues = mutableListOf() + } + clueByArea.clueByFactorList?.add(clueByFactor) + } + + clueByFactor.clues?.add(pollutedClue) + } + } + + return result + } } \ No newline at end of file -- Gitblit v1.9.3