From 20b8d870efbbb89564b599561fc69202ba41223f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 10 四月 2026 13:36:42 +0800
Subject: [PATCH] 2026.4.10 1. 修复采样时间超过当前时间的数据依旧能存入数据库的bug
---
src/test/kotlin/com/flightfeather/uav/socket/UnderwayProcessorTest.kt | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/test/kotlin/com/flightfeather/uav/socket/UnderwayProcessorTest.kt b/src/test/kotlin/com/flightfeather/uav/socket/UnderwayProcessorTest.kt
index cfa3b78..b93118e 100644
--- a/src/test/kotlin/com/flightfeather/uav/socket/UnderwayProcessorTest.kt
+++ b/src/test/kotlin/com/flightfeather/uav/socket/UnderwayProcessorTest.kt
@@ -2,18 +2,40 @@
import com.flightfeather.uav.socket.processor.UnderwayProcessor
import org.junit.Test
+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.nio.file.Files
+import java.nio.file.Paths
/**
* @author riku
* Date: 2019/9/16
*/
+@RunWith(SpringRunner::class)
+@SpringBootTest
class UnderwayProcessorTest {
- private val messageManager = UnderwayProcessor()
+ @Autowired
+ lateinit var messageManager: UnderwayProcessor
@Test
fun bccCheck() {
- val s = "23 23 2 31 37 36 39 31 35 33 31 39 30 39 31 32 30 30 30 36 1 1 0 42 13 9 f 12 34 8 2 0 8b 1c 0 d8 0 0 12 d8 9 6c 0 c8 0 b4 0 0 66 0 0 0 0 0 0 73 0 0 0 b9 4 32 0 2e d8 c4 0 0 0 0 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f6"
- println(messageManager.bccCheck(s))
+ listOf(
+ "01 04 0a 00 00 00 00 01 12 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 00 0c",
+ "01 05 0a 00 00 00 00 01 52 00 05 af 00 cb f7 03 45 84 02 a1 65 00 71 92 01 ec 04 00 b7 9b 01 6e 0f 00 aa 9c 01 6b c4 00 0c 00 00 0d 00 00 1b 10 00 34 08 05 d3 1c 05 d4 7f 00 00 00 00 00 00 56 00 00 00 00 45 00 00 00 00 4e 00 00 00 50 01 06 08 0c 29 00 00 00 00 00 00 00 00 00 64"
+ ).forEach {
+ messageManager.dealStringMsg(it, null)
+ }
+// println(messageManager.bccCheck(s))
+// val lines = Files.readAllLines(Paths.get("C:\\Users\\feiyu\\Desktop\\data-2026-04-10-10-03-14.txt"))
+// println("鏁版嵁閲忥細${lines.size - 1}")
+// lines.forEach {
+// val msg = it.split("data=> ")[1]
+// messageManager.dealStringMsg(msg, null)
+// Thread.sleep(4000)
+// }
}
}
\ No newline at end of file
--
Gitblit v1.9.3