| | |
| | | import com.flightfeather.uav.domain.mapper.* |
| | | import com.flightfeather.uav.domain.repository.MissionRep |
| | | import com.flightfeather.uav.domain.repository.RealTimeDataRep |
| | | import com.flightfeather.uav.domain.repository.SegmentInfoRep |
| | | import com.flightfeather.uav.lightshare.bean.* |
| | | import com.flightfeather.uav.lightshare.service.RealTimeDataService |
| | | import com.flightfeather.uav.model.epw.EPWDataPrep |
| | |
| | | private val missionMapper: MissionMapper, |
| | | private val missionRep: MissionRep, |
| | | private val realTimeDataRep: RealTimeDataRep, |
| | | private val segmentInfoRep: SegmentInfoRep, |
| | | ) : RealTimeDataService { |
| | | |
| | | @Value("\${filePath}") |
| | |
| | | override fun getSegmentData(missionCode: String): List<List<DataVo>> { |
| | | val mission = missionRep.findOne(missionCode) ?: throw BizException("任务不存在") |
| | | val data = realTimeDataRep.fetchData(mission) |
| | | return TrackSegment.segmentWithRoad(data).map { it.map { b -> b.toDataVo() } } |
| | | |
| | | val segInfo = SegmentInfo().apply { this.missionCode = missionCode } |
| | | val segList = segmentInfoRep.findList(segInfo) |
| | | // return TrackSegment.segmentWithRoad(data).map { it.map { b -> b.toDataVo() } } |
| | | val res = mutableListOf<MutableList<DataVo>>() |
| | | res.add(mutableListOf()) |
| | | var index = 0 |
| | | data.forEach { |
| | | if (it.dataTime == null) return@forEach |
| | | if (it.dataTime!! <= segList[index]?.endTime) { |
| | | res[index].add(it.toDataVo()) |
| | | if (it.dataTime!! == segList[index]?.endTime) { |
| | | index++ |
| | | res.add(mutableListOf()) |
| | | } |
| | | } |
| | | } |
| | | // 移除最后一个空集合 |
| | | if (res.last().isEmpty()) res.removeLast() |
| | | return res |
| | | } |
| | | |
| | | override fun importData(file: MultipartFile): BaseResponse<DataImportResult> { |