From 2bf337ab074f1c047c4f4e4df29ed994d3decaf1 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 17 九月 2019 13:57:32 +0800
Subject: [PATCH] 修改一些属性及类的命名

---
 src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt |   44 ++++++++++++++++++++++++++++++++++----------
 1 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt b/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt
index 4abd7af..b3ba4d2 100644
--- a/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt
@@ -4,9 +4,7 @@
 import com.flightfeather.obd.domain.mapper.ObdDataMapper
 import com.flightfeather.obd.lightshare.bean.ObdDataVo
 import com.flightfeather.obd.repository.ObdDataRepository
-import com.flightfeather.obd.socket.bean.EngineDataFlow
-import com.flightfeather.obd.socket.bean.ObdPackageData
-import com.flightfeather.obd.socket.bean.SupplementDataFlow
+import com.flightfeather.obd.socket.bean.*
 import com.flightfeather.obd.socket.eunm.ObdCommandUnit
 import com.github.pagehelper.PageHelper
 import org.springframework.beans.BeanUtils
@@ -50,11 +48,19 @@
 
     override fun saveObdData(packageData: ObdPackageData): Boolean {
         val obdData = ObdData().apply {
-            obdVin = packageData.vinCode
+            obdVin = packageData.deviceCode
         }
         when (packageData.commandUnit) {
             ObdCommandUnit.CarRegister.value -> {
-
+                packageData.dataUnit.forEach {
+                    when (it) {
+                        is CarRegisterData -> {
+                            obdData.apply {
+                                obdTime = it.time
+                            }
+                        }
+                    }
+                }
             }
             ObdCommandUnit.RealTimeData.value,
             ObdCommandUnit.ReplacementData.value -> {
@@ -65,14 +71,15 @@
                                 obdTime = it.time
                                 obdProtocol = it.obdProtocol
                                 obdMil = it.obdMil
-                                obdIdCode = it.obdSoftwareCode
+                                obdIdCode = it.obdCrn
                                 obdVerificationCode = it.obdCvn
                                 obdFaultCodeNum = it.obdFaultCodeNum
                                 obdFaultCode = it.obdFaultCode
                             }
                         }
-                        is EngineDataFlow -> {
+                        is EngineDataStream -> {
                             obdData.apply {
+                                obdTime = it.time
                                 obdLng = it.obdLong
                                 obdLat = it.obdLat
                                 obdSpeed = it.obdSpeed?.toInt()
@@ -94,8 +101,9 @@
                                 obdTotalMileage = it.obdTotalMileage
                             }
                         }
-                        is SupplementDataFlow -> {
+                        is SupplementDataStream -> {
                             obdData.apply {
+                                obdTime = it.time
                                 obdEngineTorqueMode = it.obdEngineTorqueMode?.toString()
                                 obdAcceleratorPedal = it.obdAcceleratorPedal
                                 obdTotalOilConsumption = it.obdTotalOilConsumption
@@ -111,10 +119,26 @@
 
             }
             ObdCommandUnit.CarLogOut.value -> {
-
+                packageData.dataUnit.forEach {
+                    when (it) {
+                        is CarLogOutData -> {
+                            obdData.apply {
+                                obdTime = it.time
+                            }
+                        }
+                    }
+                }
             }
             ObdCommandUnit.TimeCalibration.value -> {
-
+                packageData.dataUnit.forEach {
+                    when (it) {
+                        is TimeCalibrationData -> {
+                            obdData.apply {
+                                obdTime = it.time
+                            }
+                        }
+                    }
+                }
             }
         }
 

--
Gitblit v1.9.3