From 5c570cef0cdefd4103b0d447f6505d4430807128 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 23 九月 2019 14:55:49 +0800
Subject: [PATCH] 删除原obd_data表的数据存储

---
 src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt b/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt
index 139051c..ecc85ab 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt
@@ -4,11 +4,9 @@
 import com.flightfeather.obd.socket.decoder.DataUnitDecoder
 import com.flightfeather.obd.socket.decoder.RealTimeDataDecoder
 import com.flightfeather.obd.socket.eunm.ObdDataType
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
+import org.slf4j.LoggerFactory
 import java.lang.StringBuilder
 import java.util.*
-import javax.annotation.PostConstruct
 
 /**
  * @author riku
@@ -16,6 +14,7 @@
  */
 class DataUnitDecoderImpl : DataUnitDecoder {
 
+    private val logger = LoggerFactory.getLogger(javaClass.name)
     private var realTimeDataDecoder: RealTimeDataDecoder = RealTimeDataDecoderImpl()
 
     override fun getCarRegisterData(b: List<String>): List<CarRegisterData> {
@@ -72,8 +71,8 @@
             if (data.isNotEmpty()) {
                 val r = when (data[0].toInt(16)) {
                     ObdDataType.ObdData.value -> realTimeDataDecoder.getObdData(time, serialNum, data)
-                    ObdDataType.EngineDataFlow.value -> realTimeDataDecoder.getEngineDataFlow(time, serialNum, data)
-                    ObdDataType.SupplementDataFlow.value -> realTimeDataDecoder.getSupplementDataFlow(time, serialNum, data)
+                    ObdDataType.EngineDataFlow.value -> realTimeDataDecoder.getEngineDataStream(time, serialNum, data)
+                    ObdDataType.SupplementDataFlow.value -> realTimeDataDecoder.getSupplementDataStream(time, serialNum, data)
                     else -> null
                 }
 
@@ -84,6 +83,10 @@
                 for (i in 0 until data.size) {
                     if (dataList.isNotEmpty()) dataList.removeAt(0)
                 }
+            }else if (dataList.isNotEmpty()) {
+                //鎸夌収瑙勫垯娌℃湁鍙栧埌淇℃伅浣擄紝骞朵笖鍘熸暟鎹笉涓虹┖锛岃〃绀哄師鏁版嵁鏍煎紡閿欒锛岄��鍑哄惊鐜�
+                logger.error("-------鏁版嵁淇℃伅娴佹垨琛ュ厖鏁版嵁娴佹牸寮忛敊璇�")
+                break
             }
         }
 
@@ -116,6 +119,7 @@
         val sec = b[5].toInt(16)
         val cal  = Calendar.getInstance().apply {
             set(year, month - 1, day, hour, min, sec)
+            set(Calendar.MILLISECOND, 0)
         }
 
         return cal.time

--
Gitblit v1.9.3