riku
2019-09-16 6f6c35f0e0881d2bbf32ad62f6c59f0ab1504854
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 -> {
@@ -73,6 +79,7 @@
                        }
                        is EngineDataFlow -> {
                            obdData.apply {
                                obdTime = it.time
                                obdLng = it.obdLong
                                obdLat = it.obdLat
                                obdSpeed = it.obdSpeed?.toInt()
@@ -96,6 +103,7 @@
                        }
                        is SupplementDataFlow -> {
                            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
                            }
                        }
                    }
                }
            }
        }