From 94fee0b511279679b43e210878d3d36e5a14384b Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 30 九月 2025 09:14:10 +0800 Subject: [PATCH] 2025.9.30 1. 新增走航任务统计功能 --- src/main/kotlin/com/flightfeather/uav/biz/datafetch/ShenXinDataFetch.kt | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/biz/datafetch/ShenXinDataFetch.kt b/src/main/kotlin/com/flightfeather/uav/biz/datafetch/ShenXinDataFetch.kt index 98c498f..5a76f07 100644 --- a/src/main/kotlin/com/flightfeather/uav/biz/datafetch/ShenXinDataFetch.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/datafetch/ShenXinDataFetch.kt @@ -2,6 +2,7 @@ import com.flightfeather.uav.common.exception.BizException import com.flightfeather.uav.common.net.ShenXinService +import com.flightfeather.uav.domain.entity.BaseRealTimeData import com.flightfeather.uav.domain.entity.Mission import com.flightfeather.uav.domain.repository.MissionRep import com.flightfeather.uav.domain.repository.RealTimeDataRep @@ -25,16 +26,17 @@ private val deviceStatusMap = ConcurrentHashMap<String, Boolean>() // 璧拌埅浠诲姟鏄惁姝e湪鑾峰彇鏁版嵁 private val missionStatusMap = ConcurrentHashMap<String, Boolean>() + /** * 鑾峰彇鏈�鏂扮殑鏁版嵁 * @param deviceType 璁惧绫诲瀷 * @param code 璁惧缂栧彿 */ - private fun fetchLatestData(deviceType: UWDeviceType, code: String) { + private fun fetchLatestData(deviceType: UWDeviceType, code: String): List<BaseRealTimeData> { if (deviceStatusMap.containsKey(code)) { // 璁惧姝e湪鑾峰彇瀹炴椂鏁版嵁锛屽垯鐩存帴杩斿洖锛屾斁寮冩湰娆¤姹� if (deviceStatusMap[code] == true) { - return + return emptyList() } // 鍚﹀垯寮�濮嬭幏鍙栨暟鎹紝淇敼鐘舵�佷负true else { @@ -57,6 +59,7 @@ if (data.isNotEmpty()) { realTimeDataRep.saveData(deviceType, data) } + return data } finally { // 璁惧瀹屾垚鏁版嵁鑾峰彇鍚庯紝淇敼鐘舵�佷负false deviceStatusMap[code] = false @@ -66,13 +69,15 @@ /** * 鑾峰彇缁欏畾鏃堕棿鑼冨洿鍐呯殑鏁版嵁 */ - fun fetchLatestData(deviceType: UWDeviceType, code: String, sTime: LocalDateTime?, eTime: LocalDateTime?) { + fun fetchLatestData(deviceType: UWDeviceType, code: String, sTime: LocalDateTime?, eTime: LocalDateTime?) + : List<BaseRealTimeData> { if (sTime != null && eTime != null) { val data = ShenXinService.fetchData(code, sTime, eTime) realTimeDataRep.deleteData(deviceType, code, sTime, eTime) realTimeDataRep.saveData(deviceType, data) + return data } else if (sTime == null && eTime == null) { - fetchLatestData(deviceType, code) + return fetchLatestData(deviceType, code) } else { throw BizException("寮�濮嬪拰缁撴潫鏃堕棿闇�瑕侀兘鐪佺暐鎴栬�呴兘濉啓") } -- Gitblit v1.9.3