| | |
| | | import com.flightfeather.uav.domain.entity.Mission |
| | | import com.flightfeather.uav.domain.repository.RealTimeDataRep |
| | | import com.flightfeather.uav.domain.repository.SegmentInfoRep |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | |
| | | * 数据异常分析控制器 |
| | | */ |
| | | @Component |
| | | class ExceptionAnalysisController( |
| | | class ExceptionAnalysisController( |
| | | private val realTimeDataRep: RealTimeDataRep, |
| | | private val locationRoadNearby: LocationRoadNearby, |
| | | private val segmentInfoRep: SegmentInfoRep, |
| | |
| | | val result = mutableListOf<ExceptionResult>() |
| | | taskList.forEach { it.init() } |
| | | // 轮询数据,计算各个异常 |
| | | realTimeDataRep.fetchData(mission.deviceCode, mission.startTime, mission.endTime).forEach { d -> |
| | | realTimeDataRep.fetchData(UWDeviceType.fromValue(mission.deviceType), |
| | | mission.deviceCode, |
| | | mission.startTime, |
| | | mission.endTime |
| | | ).forEach { d -> |
| | | taskList.forEach { it.onNextData(d) } |
| | | } |
| | | // 各个异常分析分别结束 |
| | |
| | | private fun road(r: ExceptionResult) { |
| | | val sT = LocalDateTime.ofInstant(r.startDate?.toInstant(), ZoneId.systemDefault()) |
| | | val eT = LocalDateTime.ofInstant(r.endDate?.toInstant(), ZoneId.systemDefault()) |
| | | val segments = segmentInfoRep.findPeriod(sT, eT) |
| | | val segments = segmentInfoRep.findPeriod(r.missionCode, sT, eT) |
| | | var txt = "" |
| | | val size = segments.size |
| | | segments.forEachIndexed { i, s -> |