From b7b520bfe8b35683112284861f0dca8e645cbd56 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 31 十二月 2024 10:22:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/hc-satellite-data-import-1227_2'
---
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt | 150 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 139 insertions(+), 11 deletions(-)
diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
index 4845484..3c28e3b 100644
--- a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
+++ b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
@@ -1,17 +1,17 @@
package com.flightfeather.uav.lightshare.service.impl
-import com.flightfeather.uav.common.utils.DateUtil
+import com.flightfeather.uav.domain.entity.RealTimeDataVehicle
+import com.flightfeather.uav.domain.mapper.RealTimeDataVehicleMapper
import com.flightfeather.uav.lightshare.service.RealTimeDataService
+import com.flightfeather.uav.repository.impl.AirDataRepositoryImpl
import org.junit.Test
-import org.junit.Assert.*
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit4.SpringRunner
import java.io.File
import java.io.FileOutputStream
-import java.util.*
@RunWith(SpringRunner::class)
@SpringBootTest
@@ -20,17 +20,145 @@
@Autowired
lateinit var realTimeDataService: RealTimeDataService
+ @Autowired
+ lateinit var realTimeDataVehicleMapper: RealTimeDataVehicleMapper
+
+ @Autowired
+ lateinit var airDataRepository: AirDataRepositoryImpl
+
@Test
fun outToExcel() {
if (realTimeDataService is RealTimeDataServiceImpl) {
- val workbook = realTimeDataService.outToWorkbook("0a0000000001", "2021-07-05 00:00:00", "2021-07-06 23:59:59")
- val fileName = "姹℃煋婧簮鏉冮噸妯″瀷${DateUtil.instance.dateToString(Date(), "yyyy-MM-ddHHmmss")}.xls"
- val filePath = "E:\\宸ヤ綔\\寮�鍙慭\璧拌埅鐩戞祴\\鏍煎紡鍖栨暟鎹甛\$fileName"
- val out = FileOutputStream(File(filePath))
- workbook.write(out)
- workbook.close()
- out.flush()
- out.close()
+// val deviceCode = "0a0000000001"
+// val deviceCode = "0a0000000002"
+ val deviceCode = "0d0000000001"
+ val timeSet = listOf(
+// Pair("2021-06-10 00:00:00", "2021-06-30 23:59:59"),
+ Pair("2021-07-01 00:00:00", "2021-07-31 23:59:59"),
+ Pair("2021-08-01 00:00:00", "2021-08-31 23:59:59"),
+ Pair("2021-09-01 00:00:00", "2021-09-30 23:59:59"),
+// 缃戞牸鍖栫洃娴嬫瘡鏃�
+// Pair("2021-06-02 00:00:00", "2021-06-03 23:59:59"),
+// Pair("2021-06-04 00:00:00", "2021-06-05 23:59:59"),
+// Pair("2021-06-06 00:00:00", "2021-06-07 23:59:59"),
+// Pair("2021-06-08 00:00:00", "2021-06-09 23:59:59"),
+// Pair("2021-06-10 00:00:00", "2021-06-11 23:59:59"),
+// Pair("2021-06-12 00:00:00", "2021-06-13 23:59:59"),
+// Pair("2021-06-14 00:00:00", "2021-06-15 23:59:59"),
+// Pair("2021-06-16 00:00:00", "2021-06-17 23:59:59"),
+// Pair("2021-06-18 00:00:00", "2021-06-19 23:59:59"),
+// Pair("2021-06-20 17:00:00", "2021-06-21 23:59:59"),
+// Pair("2021-06-22 00:00:00", "2021-06-23 23:59:59"),
+// Pair("2021-06-24 00:00:00", "2021-06-25 23:59:59"),
+// Pair("2021-06-26 00:00:00", "2021-06-27 23:59:59"),
+// Pair("2021-06-28 00:00:00", "2021-06-29 23:59:59"),
+// Pair("2021-06-30 00:00:00", "2021-06-30 23:59:59"),
+
+// Pair("2021-07-01 00:00:00", "2021-07-02 23:59:59"),
+// Pair("2021-07-03 00:00:00", "2021-07-04 23:59:59"),
+// Pair("2021-07-05 00:00:00", "2021-07-06 23:59:59"),
+// Pair("2021-07-07 00:00:00", "2021-07-08 23:59:59"),
+// Pair("2021-07-09 00:00:00", "2021-07-10 23:59:59"),
+// Pair("2021-07-11 00:00:00", "2021-07-12 23:59:59"),
+// Pair("2021-07-13 00:00:00", "2021-07-14 23:59:59"),
+// Pair("2021-07-15 00:00:00", "2021-07-16 23:59:59"),
+// Pair("2021-07-17 00:00:00", "2021-07-18 23:59:59"),
+// Pair("2021-07-19 17:00:00", "2021-07-20 23:59:59"),
+// Pair("2021-07-21 00:00:00", "2021-07-22 23:59:59"),
+// Pair("2021-07-23 00:00:00", "2021-07-24 23:59:59"),
+// Pair("2021-07-25 00:00:00", "2021-07-26 23:59:59"),
+// Pair("2021-07-27 00:00:00", "2021-07-28 23:59:59"),
+// Pair("2021-07-29 00:00:00", "2021-07-30 23:59:59"),
+// Pair("2021-07-31 00:00:00", "2021-07-31 23:59:59"),
+
+// Pair("2021-08-01 00:00:00", "2021-08-02 23:59:59"),
+// Pair("2021-08-03 00:00:00", "2021-08-04 23:59:59"),
+// Pair("2021-08-05 00:00:00", "2021-08-06 23:59:59"),
+// Pair("2021-08-07 00:00:00", "2021-08-08 23:59:59"),
+// Pair("2021-08-09 00:00:00", "2021-08-10 23:59:59"),
+// Pair("2021-08-11 00:00:00", "2021-08-12 23:59:59"),
+// Pair("2021-08-13 00:00:00", "2021-08-14 23:59:59"),
+// Pair("2021-08-15 00:00:00", "2021-08-16 23:59:59"),
+// Pair("2021-08-17 00:00:00", "2021-08-18 23:59:59"),
+// Pair("2021-08-19 17:00:00", "2021-08-20 23:59:59"),
+// Pair("2021-08-21 00:00:00", "2021-08-22 23:59:59"),
+// Pair("2021-08-23 00:00:00", "2021-08-24 23:59:59"),
+// Pair("2021-08-25 00:00:00", "2021-08-26 23:59:59"),
+// Pair("2021-08-27 00:00:00", "2021-08-28 23:59:59"),
+// Pair("2021-08-29 00:00:00", "2021-08-30 23:59:59"),
+// Pair("2021-08-31 00:00:00", "2021-08-31 23:59:59"),
+
+// Pair("2021-09-01 00:00:00", "2021-09-02 23:59:59"),
+// Pair("2021-09-03 00:00:00", "2021-09-04 23:59:59"),
+// Pair("2021-09-05 00:00:00", "2021-09-06 23:59:59"),
+// Pair("2021-09-07 00:00:00", "2021-09-08 23:59:59"),
+// Pair("2021-09-09 00:00:00", "2021-09-10 23:59:59"),
+// Pair("2021-09-11 00:00:00", "2021-09-12 23:59:59"),
+// Pair("2021-09-13 00:00:00", "2021-09-14 23:59:59"),
+// Pair("2021-09-15 00:00:00", "2021-09-16 23:59:59"),
+// Pair("2021-09-17 00:00:00", "2021-09-18 23:59:59"),
+// Pair("2021-09-19 17:00:00", "2021-09-20 23:59:59"),
+// Pair("2021-09-21 00:00:00", "2021-09-22 23:59:59"),
+// Pair("2021-09-23 00:00:00", "2021-09-24 23:59:59"),
+// Pair("2021-09-25 00:00:00", "2021-09-26 23:59:59"),
+// Pair("2021-09-27 00:00:00", "2021-09-28 23:59:59"),
+// Pair("2021-09-29 00:00:00", "2021-09-30 23:59:59"),
+ )
+ timeSet.forEach {(s, e) ->
+ val workbook = realTimeDataService.outToWorkbook(deviceCode, s, e)
+ val fileName = "缃戞牸鍖栫洃娴媉${deviceCode}_${s.substring(0, 10).replace("-", ".")}-${e.substring(8, 10)}.xls"
+ val filePath = "E:\\宸ヤ綔\\寮�鍙慭\璧拌埅鐩戞祴\\鏍煎紡鍖栨暟鎹甛\$fileName"
+ val out = FileOutputStream(File(filePath))
+ workbook.write(out)
+ workbook.close()
+ out.flush()
+ out.close()
+ }
+ }
+ }
+
+ @Test
+ fun dataPreprocessing() {
+ val r = realTimeDataService.dataPreprocessing()
+ println(r.data)
+ }
+
+ @Test
+ fun averageData() {
+ val r = realTimeDataService.averageData()
+ println(r.data)
+ }
+
+ @Test
+ fun dataCalibration() {
+ val r = realTimeDataService.dataCalibration()
+ println(r.data)
+ }
+
+ @Test
+ fun dataTransform() {
+
+ var page = 1
+ var total = -1
+ var count = 0
+
+ while (total == -1 || page <= total) {
+ println("------杞﹁浇鏁版嵁杞崲start------")
+ val res = realTimeDataService.getOriginData("0a0000000001", "2021-01-01 00:00:00", "2021-10-25 15:37:21", page, 50000)
+ res.head?.let {
+ total = it.totalPage
+ }
+ if (page == 1) {
+ println("鎬婚〉鏁帮細$total")
+ }
+ println("褰撳墠椤垫暟锛�$page")
+ res.data?.forEach {vo ->
+ val d = RealTimeDataVehicle()
+ airDataRepository.dataTransform(vo, d)
+ realTimeDataVehicleMapper.insert(d)
+ count++
+ }
+ page++
}
}
}
\ No newline at end of file
--
Gitblit v1.9.3