From eb3dd00b0b7fcda477229d518d250f9c842b790b Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 21 十月 2025 17:45:44 +0800
Subject: [PATCH] 2025.10.21 1. 走航季度报告相关数据计算逻辑调整
---
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt | 45 +++++++++++++++++++++++++++++++++++++++++----
1 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
index f90a5e6..771ff89 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
@@ -8,10 +8,13 @@
import com.flightfeather.uav.biz.dataprocess.AverageUtil
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
-import com.flightfeather.uav.repository.AirDataRepository
+import com.flightfeather.uav.domain.repository.AirDataRep
import com.flightfeather.uav.socket.eunm.UWDeviceType
import com.github.pagehelper.PageHelper
import org.apache.poi.xssf.streaming.SXSSFWorkbook
@@ -33,13 +36,16 @@
@Service
class RealTimeDataServiceImpl(
private val realTimeDataMapper: RealTimeDataMapper,
- private val airDataRepository: AirDataRepository,
+ private val airDataRep: AirDataRep,
private val realTimeDataVehicleMapper: RealTimeDataVehicleMapper,
private val realTimeDataUavMapper: RealTimeDataUavMapper,
private val realTimeDataGridMapper: RealTimeDataGridMapper,
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}")
@@ -50,6 +56,7 @@
private val fileExchange = FileExchange()
override fun getSecondData(
+ deviceType: String?,
deviceCode: String?,
startTime: String?,
endTime: String?,
@@ -66,7 +73,12 @@
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 {
@@ -179,6 +191,31 @@
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> {
@@ -358,7 +395,7 @@
println("褰撳墠椤垫暟锛�$page")
val dataList = res.data ?: emptyList()
val result = epwDataPrep.mDataPrep2(dataList)
- count += airDataRepository.savePrepData2(result)
+ count += airDataRep.savePrepData2(result).size
page++
}
--
Gitblit v1.9.3