From 5b0d58c3f7f35f61c0a0437bac3ff708db57fe61 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 18 七月 2024 17:34:16 +0800
Subject: [PATCH] 1. 修正实时走航数据平滑处理算法,PM2.5、PM10、VOC采用新的修正算法

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 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..057472d 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
@@ -6,8 +6,12 @@
 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
@@ -40,6 +44,9 @@
     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}")
@@ -181,6 +188,31 @@
         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 f = ByteArrayInputStream(file.bytes)
         fileExchange.exchangeBoatData("0c0000000001", f).forEach {

--
Gitblit v1.9.3