From 275ad59f206d9bc1801b28daeb31b4207f609ce3 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期四, 02 一月 2025 09:10:09 +0800
Subject: [PATCH] 1. 修改网格组数据导入接口返回值为bool 2. 修改网格组数据批量更新 使用Transactional注解

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
index db1be82..6ae9e79 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
@@ -10,7 +10,6 @@
 import com.flightfeather.uav.domain.repository.SatelliteGridRep
 import com.flightfeather.uav.lightshare.bean.AreaVo
 import com.flightfeather.uav.lightshare.bean.DataHead
-import com.flightfeather.uav.lightshare.bean.GridDataImportResult
 import com.flightfeather.uav.lightshare.service.SatelliteTelemetryService
 import com.github.pagehelper.PageHelper
 import org.springframework.stereotype.Service
@@ -53,7 +52,7 @@
         return satelliteGridRep.fetchGridDataDetail(dataId, groupId, cellId)
     }
 
-    override fun importGridData(groupId: Int, dataTime: LocalDateTime?, update: Boolean, file: MultipartFile): GridDataImportResult? {
+    override fun importGridData(groupId: Int, dataTime: LocalDateTime?, update: Boolean, file: MultipartFile): Boolean? {
         // 鍥犱负鏄鍏ュ崼鏄熼仴娴嬫暟鎹� type濮嬬粓涓�0
         val type = 0
         // 棣栧厛鍒ゆ柇鏂囦欢绫诲瀷锛屾枃浠剁被鍨嬩笉鏄痻lsx鐩存帴鎶ラ敊
@@ -65,7 +64,7 @@
         val gridData = satelliteGridRep.fetchGridData(groupId, dataTime, type)
         // 灏嗙敤鎴峰鍏ョ殑鏂囦欢杞崲涓烘暟鎹�
         // 杞崲鐨勮繃绋嬮渶瑕佺綉鏍煎崟鍏冩牸鏁版嵁 浠ュ垽鏂綉鏍煎崟鍏冩牸鏄惁鍦ㄦ纭殑鑼冨洿鍐�
-        val gridCellsInDBSet = satelliteGridRep.fetchGridCell(groupId).asSequence().map { it?.id ?: -1 }.toSet()
+        val gridCellsInDBSet = satelliteGridRep.fetchGridCell(groupId).map { it?.id ?: -1 }.toSet()
         val importData
                 = fileExchange.exchangeGridData(ByteArrayInputStream(file.bytes), gridCellsInDBSet)
         if (update) {
@@ -78,7 +77,7 @@
                 it.groupId = gridData[0]?.groupId
             }
             satelliteGridRep.updatePM25Batch(importData)
-            return GridDataImportResult(true, "瑕嗙洊鎴愬姛")
+            return true
         }else {
             // 鐢ㄦ埛闇�瑕佹墽琛屾彃鍏�
             if (gridData.isNotEmpty()) {
@@ -90,7 +89,7 @@
                 ?.let { Date(it) }
             gridDataEntity.type = type.toByte()
             satelliteGridRep.insertGridDataAndDetail(gridDataEntity, importData)
-            return GridDataImportResult(true, "瀵煎叆鎴愬姛")
+            return true
         }
     }
 
@@ -120,7 +119,7 @@
         dataTime: LocalDateTime?,
         update: Boolean,
         file: MultipartFile
-    ): GridDataImportResult? {
+    ): Boolean? {
         // 棣栧厛鍒ゆ柇鏂囦欢绫诲瀷锛屾枃浠剁被鍨嬩笉鏄痻lsx鐩存帴鎶ラ敊
         if (!file.contentType!!.startsWith("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {
             throw BizException("鏂囦欢绫诲瀷閿欒锛岃涓婁紶xlsx绫诲瀷鏂囦欢")
@@ -130,7 +129,7 @@
         val gridAod = satelliteGridRep.fetchGridAod(groupId, dataTime)
         // 灏嗙敤鎴峰鍏ョ殑鏂囦欢杞崲涓烘暟鎹�
         // 杞崲鐨勮繃绋嬮渶瑕佺綉鏍煎崟鍏冩牸鏁版嵁 浠ュ垽鏂綉鏍煎崟鍏冩牸鏄惁鍦ㄦ纭殑鑼冨洿鍐�
-        val gridCellsInDBSet = satelliteGridRep.fetchGridCell(groupId).asSequence().map { it?.id ?: -1 }.toSet()
+        val gridCellsInDBSet = satelliteGridRep.fetchGridCell(groupId).map { it?.id ?: -1 }.toSet()
         val importAod
                 = fileExchange.exchangeGridAod(ByteArrayInputStream(file.bytes), gridCellsInDBSet)
         if (update) {
@@ -143,7 +142,7 @@
                 it.groupId = gridAod[0]?.groupId
             }
             satelliteGridRep.updateGridAodBatch(importAod)
-            return GridDataImportResult(true, "瑕嗙洊鎴愬姛")
+            return true
         }else {
             // 鐢ㄦ埛闇�瑕佹墽琛屾彃鍏�
             if (gridAod.isNotEmpty()) {
@@ -154,7 +153,7 @@
             gridAodEntity.dataTime = dataTime?.atZone(ZoneId.systemDefault())?.toInstant()?.toEpochMilli()
                 ?.let { Date(it) }
             satelliteGridRep.insertGridAodAndDetail(gridAodEntity, importAod)
-            return GridDataImportResult(true, "瀵煎叆鎴愬姛")
+            return true
         }
     }
 

--
Gitblit v1.9.3