| | |
| | | import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig |
| | | import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult |
| | | import com.flightfeather.uav.biz.dataanalysis.model.ExceptionSetting |
| | | import com.flightfeather.uav.common.location.LocationRoadNearby |
| | | import com.flightfeather.uav.domain.entity.Mission |
| | | import com.flightfeather.uav.domain.repository.RealTimeDataRep |
| | | import org.springframework.stereotype.Component |
| | |
| | | @Component |
| | | class ExceptionAnalysisController( |
| | | private val realTimeDataRep: RealTimeDataRep, |
| | | private val locationRoadNearby: LocationRoadNearby, |
| | | ) { |
| | | |
| | | var running = false |
| | |
| | | private fun initTask(config: DataAnalysisConfig) { |
| | | taskList.clear() |
| | | taskList.apply { |
| | | // add(ExceptionDataExceed(config)) |
| | | // add(ExceptionValueMutation(config)) |
| | | add(ExceptionDataExceed(config)) |
| | | add(ExceptionValueMutation(config)) |
| | | add(ExceptionSlideAverage(config)) |
| | | } |
| | | } |
| | | |
| | | fun run(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> { |
| | | running = true |
| | | val config = DataAnalysisConfig(mission, ExceptionSetting(), 8, factorFilter) |
| | | val config = DataAnalysisConfig(mission, ExceptionSetting(), factorFilter) |
| | | initTask(config) |
| | | |
| | | val result = mutableListOf<ExceptionResult>() |
| | |
| | | } |
| | | // 各个异常分析分别结束 |
| | | taskList.forEach { it.onDone() } |
| | | // 存储分析结果 |
| | | |
| | | taskList.forEach { |
| | | // 查询异常周边可能污染源 |
| | | it.resultList.forEach { r-> |
| | | if (r.longitude != null && r.latitude != null) { |
| | | val sceneList = locationRoadNearby.searchByRadius( |
| | | r.longitude!!.toDouble() to r.latitude!!.toDouble(), config.radius) |
| | | if (sceneList.isNotEmpty()) { |
| | | val idList = mutableListOf<String>() |
| | | val nameList = mutableListOf<String>() |
| | | sceneList.forEach { s-> |
| | | idList.add(s?.guid?:"") |
| | | nameList.add(s?.name ?: "") |
| | | } |
| | | r.relatedSceneId = idList |
| | | r.relatedSceneName = nameList |
| | | } |
| | | } |
| | | } |
| | | // 存储分析结果 |
| | | result.addAll(it.resultList) |
| | | } |
| | | running = false |