From b10c22af595bd995e56946bff63b8f2f984b13e8 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 14 八月 2025 17:25:05 +0800
Subject: [PATCH] 2025.8.14 1. 动态溯源模块添加滑动平均异常计算(调试中)

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt
index d64872d..f8ad2c7 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt
@@ -1,13 +1,17 @@
 package com.flightfeather.uav.lightshare.service.impl
 
 import com.flightfeather.uav.biz.FactorFilter
+import com.flightfeather.uav.biz.dataanalysis.BaseExceptionResult
 import com.flightfeather.uav.biz.dataanalysis.ExceptionAnalysisController
 import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
+import com.flightfeather.uav.biz.sourcetrace.model.BasePollutedMsg
 import com.flightfeather.uav.common.exception.BizException
 import com.flightfeather.uav.common.location.LocationRoadNearby
+import com.flightfeather.uav.common.utils.GsonUtils
 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.domain.repository.SourceTraceRep
 import com.flightfeather.uav.lightshare.service.DataAnalysisService
 import com.flightfeather.uav.socket.eunm.FactorType
 import org.springframework.stereotype.Service
@@ -23,6 +27,7 @@
     private val realTimeDataRep: RealTimeDataRep,
     private val locationRoadNearby: LocationRoadNearby,
     private val segmentInfoRep: SegmentInfoRep,
+    private val sourceTraceRep: SourceTraceRep
 ) : DataAnalysisService {
 
     override fun pollutionTrace(missionCode: String): List<ExceptionResult> {
@@ -44,4 +49,11 @@
                 .create()
         )
     }
+
+    override fun fetchHistory(missionCode: String): String {
+        val mission = missionRep.findOne(missionCode) ?: throw BizException("璧拌埅浠诲姟涓嶅瓨鍦�")
+
+        val res = sourceTraceRep.fetchList(mission.deviceCode, mission.startTime, mission.endTime)
+        return GsonUtils.gson.toJson(res)
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3