| | |
| | | |
| | | class ClueByArea { |
| | | var sceneInfo: SceneInfo? = null |
| | | var address: String? = null |
| | | var clueByFactorList: MutableList<ClueByFactor>? = null |
| | | } |
| | | |
| | |
| | | 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 -> |
| | |
| | | |
| | | 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 |
| | | } |
| | | } |