| | |
| | | import com.flightfeather.uav.common.utils.ExcelUtil |
| | | import com.flightfeather.uav.common.utils.FileExchange |
| | | import com.flightfeather.uav.biz.dataprocess.AverageUtil |
| | | import com.flightfeather.uav.common.location.TrackSegment |
| | | import com.flightfeather.uav.domain.entity.* |
| | | 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 realTimeDataGridOptMapper: RealTimeDataGridOptMapper, |
| | | private val realTimeDataGridMinMapper: RealTimeDataGridMinMapper, |
| | | private val missionMapper: MissionMapper, |
| | | private val missionRep: MissionRep, |
| | | private val realTimeDataRep: RealTimeDataRep, |
| | | private val segmentInfoRep: SegmentInfoRep, |
| | | ) : RealTimeDataService { |
| | | |
| | | @Value("\${filePath}") |
| | |
| | | private val fileExchange = FileExchange() |
| | | |
| | | override fun getSecondData( |
| | | deviceType: String?, |
| | | deviceCode: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | |
| | | var pages = 0 |
| | | val result = mutableListOf<DataVo>() |
| | | |
| | | when (UWDeviceType.getType(deviceCode)) { |
| | | val _deviceType = if (deviceType != null) { |
| | | UWDeviceType.fromValue(deviceType) |
| | | } else { |
| | | UWDeviceType.getType(deviceCode) |
| | | } |
| | | when (_deviceType) { |
| | | UWDeviceType.VEHICLE -> { |
| | | val pageInfo = PageHelper.startPage<RealTimeDataVehicle>(_page, _perPage) |
| | | realTimeDataVehicleMapper.selectByExample(Example(RealTimeDataVehicle::class.java).apply { |
| | |
| | | example.createCriteria().andEqualTo("deviceCode", deviceCode) |
| | | .andGreaterThan("dataTime", updateTime) |
| | | example.orderBy("dataTime") |
| | | } |
| | | |
| | | override fun getSegmentData(missionCode: String): List<List<DataVo>> { |
| | | val mission = missionRep.findOne(missionCode) ?: throw BizException("任务不存在") |
| | | val data = realTimeDataRep.fetchData(mission) |
| | | |
| | | 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> { |
| | |
| | | val averageUtil = AverageUtil<RealTimeDataGridOpt, RealTimeDataGridMin>({ d -> |
| | | minFormatter.format(d.dataTime) |
| | | }, { list -> |
| | | list.avg() |
| | | list.avg() as RealTimeDataGridMin |
| | | }) |
| | | |
| | | while (total == -1 || page <= total) { |