From 1074bb5c8473dcb99d6edea5fa67ae7aa78af248 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 17 九月 2019 15:54:59 +0800
Subject: [PATCH] 1. 按照数据分类添加新的数据库表格 2. 完成数据分表存储逻辑并debug完成

---
 src/main/kotlin/com/flightfeather/obd/repository/CarLoginRepository.kt               |   15 
 src/main/kotlin/com/flightfeather/obd/repository/impl/ObdInfoDaoImpl.kt              |   55 +
 src/main/kotlin/com/flightfeather/obd/domain/mapper/DataStreamMapper.kt              |    8 
 src/main/kotlin/com/flightfeather/obd/repository/impl/CarLoginDaoImpl.kt             |   40 +
 src/main/kotlin/com/flightfeather/obd/socket/decoder/RealTimeDataDecoder.kt          |    2 
 src/main/kotlin/com/flightfeather/obd/repository/ObdInfoRepository.kt                |   18 
 src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt              |    6 
 src/main/resources/generator/generatorConfig.xml                                     |   11 
 src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogout.java                   |   92 +++
 src/main/kotlin/com/flightfeather/obd/domain/entity/OriginData.java                  |  108 +++
 src/main/kotlin/com/flightfeather/obd/repository/OriginDataRepository.kt             |   16 
 src/main/resources/mapper/CarLogoutMapper.xml                                        |   20 
 src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt     |    1 
 src/main/resources/mapper/ObdInfoMapper.xml                                          |   33 +
 src/main/kotlin/com/flightfeather/obd/socket/eunm/ObdDataType.kt                     |    2 
 src/main/kotlin/com/flightfeather/obd/repository/impl/CarLogoutDaoImpl.kt            |   37 +
 src/main/resources/mapper/CarLoginMapper.xml                                         |   21 
 src/main/kotlin/com/flightfeather/obd/repository/CarLogoutRepository.kt              |   15 
 src/main/kotlin/com/flightfeather/obd/domain/mapper/OriginDataMapper.kt              |    8 
 src/main/kotlin/com/flightfeather/obd/socket/bean/ObdInfo.kt                         |    4 
 src/main/kotlin/com/flightfeather/obd/domain/mapper/ObdInfoMapper.kt                 |    8 
 src/main/resources/mapper/DataStreamMapper.xml                                       |   52 +
 src/main/kotlin/com/flightfeather/obd/domain/entity/DataStream.java                  |  551 ++++++++++++++++++
 src/main/kotlin/com/flightfeather/obd/domain/entity/ObdInfo.java                     |  279 +++++++++
 src/main/kotlin/com/flightfeather/obd/socket/bean/EngineDataStream.kt                |    4 
 src/main/resources/mapper/OriginDataMapper.xml                                       |   32 +
 src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLoginMapper.kt                |    8 
 src/main/kotlin/com/flightfeather/obd/repository/impl/DataStreamDaoImpl.kt           |   76 ++
 src/main/kotlin/com/flightfeather/obd/repository/DataStreamRepository.kt             |   15 
 src/main/kotlin/com/flightfeather/obd/repository/impl/OriginDataDaoImpl.kt           |   29 
 src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogin.java                    |  109 +++
 src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/RealTimeDataDecoderImpl.kt |   12 
 src/test/kotlin/com/flightfeather/obd/socket/decoder/VehicleDataDecoderTest.kt       |   33 
 src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLogoutMapper.kt               |    8 
 src/main/kotlin/com/flightfeather/obd/socket/MessageManager.kt                       |   29 
 35 files changed, 1,712 insertions(+), 45 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogin.java b/src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogin.java
new file mode 100644
index 0000000..81b4662
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogin.java
@@ -0,0 +1,109 @@
+package com.flightfeather.obd.domain.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "obd_car_login")
+public class CarLogin {
+    @Id
+    private Integer id;
+
+    @Column(name = "obd_device_code")
+    private String obdDeviceCode;
+
+    @Column(name = "login_create_time")
+    private Date loginCreateTime;
+
+    @Column(name = "login_data_time")
+    private Date loginDataTime;
+
+    @Column(name = "login_serial_num")
+    private Integer loginSerialNum;
+
+    @Column(name = "login_sim_code")
+    private String loginSimCode;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return obd_device_code
+     */
+    public String getObdDeviceCode() {
+        return obdDeviceCode;
+    }
+
+    /**
+     * @param obdDeviceCode
+     */
+    public void setObdDeviceCode(String obdDeviceCode) {
+        this.obdDeviceCode = obdDeviceCode == null ? null : obdDeviceCode.trim();
+    }
+
+    /**
+     * @return login_create_time
+     */
+    public Date getLoginCreateTime() {
+        return loginCreateTime;
+    }
+
+    /**
+     * @param loginCreateTime
+     */
+    public void setLoginCreateTime(Date loginCreateTime) {
+        this.loginCreateTime = loginCreateTime;
+    }
+
+    /**
+     * @return login_data_time
+     */
+    public Date getLoginDataTime() {
+        return loginDataTime;
+    }
+
+    /**
+     * @param loginDataTime
+     */
+    public void setLoginDataTime(Date loginDataTime) {
+        this.loginDataTime = loginDataTime;
+    }
+
+    /**
+     * @return login_serial_num
+     */
+    public Integer getLoginSerialNum() {
+        return loginSerialNum;
+    }
+
+    /**
+     * @param loginSerialNum
+     */
+    public void setLoginSerialNum(Integer loginSerialNum) {
+        this.loginSerialNum = loginSerialNum;
+    }
+
+    /**
+     * @return login_sim_code
+     */
+    public String getLoginSimCode() {
+        return loginSimCode;
+    }
+
+    /**
+     * @param loginSimCode
+     */
+    public void setLoginSimCode(String loginSimCode) {
+        this.loginSimCode = loginSimCode == null ? null : loginSimCode.trim();
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogout.java b/src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogout.java
new file mode 100644
index 0000000..f951582
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/entity/CarLogout.java
@@ -0,0 +1,92 @@
+package com.flightfeather.obd.domain.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "obd_car_logout")
+public class CarLogout {
+    @Id
+    private Integer id;
+
+    @Column(name = "obd_device_code")
+    private String obdDeviceCode;
+
+    @Column(name = "logout_create_time")
+    private Date logoutCreateTime;
+
+    @Column(name = "logout_data_time")
+    private Date logoutDataTime;
+
+    @Column(name = "logout_serial_num")
+    private Integer logoutSerialNum;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return obd_device_code
+     */
+    public String getObdDeviceCode() {
+        return obdDeviceCode;
+    }
+
+    /**
+     * @param obdDeviceCode
+     */
+    public void setObdDeviceCode(String obdDeviceCode) {
+        this.obdDeviceCode = obdDeviceCode == null ? null : obdDeviceCode.trim();
+    }
+
+    /**
+     * @return logout_create_time
+     */
+    public Date getLogoutCreateTime() {
+        return logoutCreateTime;
+    }
+
+    /**
+     * @param logoutCreateTime
+     */
+    public void setLogoutCreateTime(Date logoutCreateTime) {
+        this.logoutCreateTime = logoutCreateTime;
+    }
+
+    /**
+     * @return logout_data_time
+     */
+    public Date getLogoutDataTime() {
+        return logoutDataTime;
+    }
+
+    /**
+     * @param logoutDataTime
+     */
+    public void setLogoutDataTime(Date logoutDataTime) {
+        this.logoutDataTime = logoutDataTime;
+    }
+
+    /**
+     * @return logout_serial_num
+     */
+    public Integer getLogoutSerialNum() {
+        return logoutSerialNum;
+    }
+
+    /**
+     * @param logoutSerialNum
+     */
+    public void setLogoutSerialNum(Integer logoutSerialNum) {
+        this.logoutSerialNum = logoutSerialNum;
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/entity/DataStream.java b/src/main/kotlin/com/flightfeather/obd/domain/entity/DataStream.java
new file mode 100644
index 0000000..38b0566
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/entity/DataStream.java
@@ -0,0 +1,551 @@
+package com.flightfeather.obd.domain.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "obd_data_stream")
+public class DataStream {
+    @Id
+    private Integer id;
+
+    @Column(name = "obd_device_code")
+    private String obdDeviceCode;
+
+    @Column(name = "obd_create_time")
+    private Date obdCreateTime;
+
+    @Column(name = "obd_data_time")
+    private Date obdDataTime;
+
+    @Column(name = "obd_serial_num")
+    private Integer obdSerialNum;
+
+    @Column(name = "obd_speed")
+    private Double obdSpeed;
+
+    @Column(name = "obd_air_pressure")
+    private Double obdAirPressure;
+
+    @Column(name = "obd_engine_torque")
+    private Double obdEngineTorque;
+
+    @Column(name = "obd_friction_torque")
+    private Double obdFrictionTorque;
+
+    @Column(name = "obd_engine_rpm")
+    private Double obdEngineRpm;
+
+    @Column(name = "obd_engine_fuel_flow")
+    private Double obdEngineFuelFlow;
+
+    @Column(name = "obd_scr_upstream_NOx")
+    private Double obdScrUpstreamNox;
+
+    @Column(name = "obd_scr_downstream_NOx")
+    private Double obdScrDownstreamNox;
+
+    @Column(name = "obd_remain_reactant")
+    private Double obdRemainReactant;
+
+    @Column(name = "obd_air_input")
+    private Double obdAirInput;
+
+    @Column(name = "obd_scr_input_temp")
+    private Double obdScrInputTemp;
+
+    @Column(name = "obd_scr_output_temp")
+    private Double obdScrOutputTemp;
+
+    @Column(name = "obd_DPF")
+    private Double obdDpf;
+
+    @Column(name = "obd_engine_coolant_temp")
+    private Double obdEngineCoolantTemp;
+
+    @Column(name = "obd_fuel_level")
+    private Double obdFuelLevel;
+
+    @Column(name = "obd_location_status")
+    private String obdLocationStatus;
+
+    @Column(name = "obd_long")
+    private Double obdLong;
+
+    @Column(name = "obd_lat")
+    private Double obdLat;
+
+    @Column(name = "obd_total_mileage")
+    private Double obdTotalMileage;
+
+    @Column(name = "obd_engine_torque_mode")
+    private Integer obdEngineTorqueMode;
+
+    @Column(name = "obd_accelerator_pedal")
+    private Double obdAcceleratorPedal;
+
+    @Column(name = "obd_total_oil_consumption")
+    private Double obdTotalOilConsumption;
+
+    @Column(name = "obd_urea_box_temp")
+    private Double obdUreaBoxTemp;
+
+    @Column(name = "obd_urea_volume")
+    private Double obdUreaVolume;
+
+    @Column(name = "obd_total_urea_consume")
+    private Double obdTotalUreaConsume;
+
+    @Column(name = "obd_DPF_temp")
+    private Double obdDpfTemp;
+
+    @Column(name = "obd_status")
+    private Boolean obdStatus;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return obd_device_code
+     */
+    public String getObdDeviceCode() {
+        return obdDeviceCode;
+    }
+
+    /**
+     * @param obdDeviceCode
+     */
+    public void setObdDeviceCode(String obdDeviceCode) {
+        this.obdDeviceCode = obdDeviceCode == null ? null : obdDeviceCode.trim();
+    }
+
+    /**
+     * @return obd_create_time
+     */
+    public Date getObdCreateTime() {
+        return obdCreateTime;
+    }
+
+    /**
+     * @param obdCreateTime
+     */
+    public void setObdCreateTime(Date obdCreateTime) {
+        this.obdCreateTime = obdCreateTime;
+    }
+
+    /**
+     * @return obd_data_time
+     */
+    public Date getObdDataTime() {
+        return obdDataTime;
+    }
+
+    /**
+     * @param obdDataTime
+     */
+    public void setObdDataTime(Date obdDataTime) {
+        this.obdDataTime = obdDataTime;
+    }
+
+    /**
+     * @return obd_serial_num
+     */
+    public Integer getObdSerialNum() {
+        return obdSerialNum;
+    }
+
+    /**
+     * @param obdSerialNum
+     */
+    public void setObdSerialNum(Integer obdSerialNum) {
+        this.obdSerialNum = obdSerialNum;
+    }
+
+    /**
+     * @return obd_speed
+     */
+    public Double getObdSpeed() {
+        return obdSpeed;
+    }
+
+    /**
+     * @param obdSpeed
+     */
+    public void setObdSpeed(Double obdSpeed) {
+        this.obdSpeed = obdSpeed;
+    }
+
+    /**
+     * @return obd_air_pressure
+     */
+    public Double getObdAirPressure() {
+        return obdAirPressure;
+    }
+
+    /**
+     * @param obdAirPressure
+     */
+    public void setObdAirPressure(Double obdAirPressure) {
+        this.obdAirPressure = obdAirPressure;
+    }
+
+    /**
+     * @return obd_engine_torque
+     */
+    public Double getObdEngineTorque() {
+        return obdEngineTorque;
+    }
+
+    /**
+     * @param obdEngineTorque
+     */
+    public void setObdEngineTorque(Double obdEngineTorque) {
+        this.obdEngineTorque = obdEngineTorque;
+    }
+
+    /**
+     * @return obd_friction_torque
+     */
+    public Double getObdFrictionTorque() {
+        return obdFrictionTorque;
+    }
+
+    /**
+     * @param obdFrictionTorque
+     */
+    public void setObdFrictionTorque(Double obdFrictionTorque) {
+        this.obdFrictionTorque = obdFrictionTorque;
+    }
+
+    /**
+     * @return obd_engine_rpm
+     */
+    public Double getObdEngineRpm() {
+        return obdEngineRpm;
+    }
+
+    /**
+     * @param obdEngineRpm
+     */
+    public void setObdEngineRpm(Double obdEngineRpm) {
+        this.obdEngineRpm = obdEngineRpm;
+    }
+
+    /**
+     * @return obd_engine_fuel_flow
+     */
+    public Double getObdEngineFuelFlow() {
+        return obdEngineFuelFlow;
+    }
+
+    /**
+     * @param obdEngineFuelFlow
+     */
+    public void setObdEngineFuelFlow(Double obdEngineFuelFlow) {
+        this.obdEngineFuelFlow = obdEngineFuelFlow;
+    }
+
+    /**
+     * @return obd_scr_upstream_NOx
+     */
+    public Double getObdScrUpstreamNox() {
+        return obdScrUpstreamNox;
+    }
+
+    /**
+     * @param obdScrUpstreamNox
+     */
+    public void setObdScrUpstreamNox(Double obdScrUpstreamNox) {
+        this.obdScrUpstreamNox = obdScrUpstreamNox;
+    }
+
+    /**
+     * @return obd_scr_downstream_NOx
+     */
+    public Double getObdScrDownstreamNox() {
+        return obdScrDownstreamNox;
+    }
+
+    /**
+     * @param obdScrDownstreamNox
+     */
+    public void setObdScrDownstreamNox(Double obdScrDownstreamNox) {
+        this.obdScrDownstreamNox = obdScrDownstreamNox;
+    }
+
+    /**
+     * @return obd_remain_reactant
+     */
+    public Double getObdRemainReactant() {
+        return obdRemainReactant;
+    }
+
+    /**
+     * @param obdRemainReactant
+     */
+    public void setObdRemainReactant(Double obdRemainReactant) {
+        this.obdRemainReactant = obdRemainReactant;
+    }
+
+    /**
+     * @return obd_air_input
+     */
+    public Double getObdAirInput() {
+        return obdAirInput;
+    }
+
+    /**
+     * @param obdAirInput
+     */
+    public void setObdAirInput(Double obdAirInput) {
+        this.obdAirInput = obdAirInput;
+    }
+
+    /**
+     * @return obd_scr_input_temp
+     */
+    public Double getObdScrInputTemp() {
+        return obdScrInputTemp;
+    }
+
+    /**
+     * @param obdScrInputTemp
+     */
+    public void setObdScrInputTemp(Double obdScrInputTemp) {
+        this.obdScrInputTemp = obdScrInputTemp;
+    }
+
+    /**
+     * @return obd_scr_output_temp
+     */
+    public Double getObdScrOutputTemp() {
+        return obdScrOutputTemp;
+    }
+
+    /**
+     * @param obdScrOutputTemp
+     */
+    public void setObdScrOutputTemp(Double obdScrOutputTemp) {
+        this.obdScrOutputTemp = obdScrOutputTemp;
+    }
+
+    /**
+     * @return obd_DPF
+     */
+    public Double getObdDpf() {
+        return obdDpf;
+    }
+
+    /**
+     * @param obdDpf
+     */
+    public void setObdDpf(Double obdDpf) {
+        this.obdDpf = obdDpf;
+    }
+
+    /**
+     * @return obd_engine_coolant_temp
+     */
+    public Double getObdEngineCoolantTemp() {
+        return obdEngineCoolantTemp;
+    }
+
+    /**
+     * @param obdEngineCoolantTemp
+     */
+    public void setObdEngineCoolantTemp(Double obdEngineCoolantTemp) {
+        this.obdEngineCoolantTemp = obdEngineCoolantTemp;
+    }
+
+    /**
+     * @return obd_fuel_level
+     */
+    public Double getObdFuelLevel() {
+        return obdFuelLevel;
+    }
+
+    /**
+     * @param obdFuelLevel
+     */
+    public void setObdFuelLevel(Double obdFuelLevel) {
+        this.obdFuelLevel = obdFuelLevel;
+    }
+
+    /**
+     * @return obd_location_status
+     */
+    public String getObdLocationStatus() {
+        return obdLocationStatus;
+    }
+
+    /**
+     * @param obdLocationStatus
+     */
+    public void setObdLocationStatus(String obdLocationStatus) {
+        this.obdLocationStatus = obdLocationStatus == null ? null : obdLocationStatus.trim();
+    }
+
+    /**
+     * @return obd_long
+     */
+    public Double getObdLong() {
+        return obdLong;
+    }
+
+    /**
+     * @param obdLong
+     */
+    public void setObdLong(Double obdLong) {
+        this.obdLong = obdLong;
+    }
+
+    /**
+     * @return obd_lat
+     */
+    public Double getObdLat() {
+        return obdLat;
+    }
+
+    /**
+     * @param obdLat
+     */
+    public void setObdLat(Double obdLat) {
+        this.obdLat = obdLat;
+    }
+
+    /**
+     * @return obd_total_mileage
+     */
+    public Double getObdTotalMileage() {
+        return obdTotalMileage;
+    }
+
+    /**
+     * @param obdTotalMileage
+     */
+    public void setObdTotalMileage(Double obdTotalMileage) {
+        this.obdTotalMileage = obdTotalMileage;
+    }
+
+    /**
+     * @return obd_engine_torque_mode
+     */
+    public Integer getObdEngineTorqueMode() {
+        return obdEngineTorqueMode;
+    }
+
+    /**
+     * @param obdEngineTorqueMode
+     */
+    public void setObdEngineTorqueMode(Integer obdEngineTorqueMode) {
+        this.obdEngineTorqueMode = obdEngineTorqueMode;
+    }
+
+    /**
+     * @return obd_accelerator_pedal
+     */
+    public Double getObdAcceleratorPedal() {
+        return obdAcceleratorPedal;
+    }
+
+    /**
+     * @param obdAcceleratorPedal
+     */
+    public void setObdAcceleratorPedal(Double obdAcceleratorPedal) {
+        this.obdAcceleratorPedal = obdAcceleratorPedal;
+    }
+
+    /**
+     * @return obd_total_oil_consumption
+     */
+    public Double getObdTotalOilConsumption() {
+        return obdTotalOilConsumption;
+    }
+
+    /**
+     * @param obdTotalOilConsumption
+     */
+    public void setObdTotalOilConsumption(Double obdTotalOilConsumption) {
+        this.obdTotalOilConsumption = obdTotalOilConsumption;
+    }
+
+    /**
+     * @return obd_urea_box_temp
+     */
+    public Double getObdUreaBoxTemp() {
+        return obdUreaBoxTemp;
+    }
+
+    /**
+     * @param obdUreaBoxTemp
+     */
+    public void setObdUreaBoxTemp(Double obdUreaBoxTemp) {
+        this.obdUreaBoxTemp = obdUreaBoxTemp;
+    }
+
+    /**
+     * @return obd_urea_volume
+     */
+    public Double getObdUreaVolume() {
+        return obdUreaVolume;
+    }
+
+    /**
+     * @param obdUreaVolume
+     */
+    public void setObdUreaVolume(Double obdUreaVolume) {
+        this.obdUreaVolume = obdUreaVolume;
+    }
+
+    /**
+     * @return obd_total_urea_consume
+     */
+    public Double getObdTotalUreaConsume() {
+        return obdTotalUreaConsume;
+    }
+
+    /**
+     * @param obdTotalUreaConsume
+     */
+    public void setObdTotalUreaConsume(Double obdTotalUreaConsume) {
+        this.obdTotalUreaConsume = obdTotalUreaConsume;
+    }
+
+    /**
+     * @return obd_DPF_temp
+     */
+    public Double getObdDpfTemp() {
+        return obdDpfTemp;
+    }
+
+    /**
+     * @param obdDpfTemp
+     */
+    public void setObdDpfTemp(Double obdDpfTemp) {
+        this.obdDpfTemp = obdDpfTemp;
+    }
+
+    /**
+     * @return obd_status
+     */
+    public Boolean getObdStatus() {
+        return obdStatus;
+    }
+
+    /**
+     * @param obdStatus
+     */
+    public void setObdStatus(Boolean obdStatus) {
+        this.obdStatus = obdStatus;
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/entity/ObdInfo.java b/src/main/kotlin/com/flightfeather/obd/domain/entity/ObdInfo.java
new file mode 100644
index 0000000..5c03927
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/entity/ObdInfo.java
@@ -0,0 +1,279 @@
+package com.flightfeather.obd.domain.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "obd_info")
+public class ObdInfo {
+    @Id
+    private Integer id;
+
+    @Column(name = "obd_device_code")
+    private String obdDeviceCode;
+
+    @Column(name = "obd_create_time")
+    private Date obdCreateTime;
+
+    @Column(name = "obd_data_time")
+    private Date obdDataTime;
+
+    @Column(name = "obd_serial_num")
+    private Integer obdSerialNum;
+
+    @Column(name = "obd_protocol")
+    private Integer obdProtocol;
+
+    @Column(name = "obd_mil")
+    private Integer obdMil;
+
+    @Column(name = "obd_diagnosis_support_status")
+    private String obdDiagnosisSupportStatus;
+
+    @Column(name = "obd_diagnosis_ready_status")
+    private String obdDiagnosisReadyStatus;
+
+    @Column(name = "obd_vin")
+    private String obdVin;
+
+    @Column(name = "obd_crn")
+    private String obdCrn;
+
+    @Column(name = "obd_cvn")
+    private String obdCvn;
+
+    @Column(name = "obd_iupr")
+    private String obdIupr;
+
+    @Column(name = "obd_fault_code_num")
+    private Integer obdFaultCodeNum;
+
+    @Column(name = "obd_fault_code")
+    private String obdFaultCode;
+
+    @Column(name = "obd_status")
+    private Boolean obdStatus;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return obd_device_code
+     */
+    public String getObdDeviceCode() {
+        return obdDeviceCode;
+    }
+
+    /**
+     * @param obdDeviceCode
+     */
+    public void setObdDeviceCode(String obdDeviceCode) {
+        this.obdDeviceCode = obdDeviceCode == null ? null : obdDeviceCode.trim();
+    }
+
+    /**
+     * @return obd_create_time
+     */
+    public Date getObdCreateTime() {
+        return obdCreateTime;
+    }
+
+    /**
+     * @param obdCreateTime
+     */
+    public void setObdCreateTime(Date obdCreateTime) {
+        this.obdCreateTime = obdCreateTime;
+    }
+
+    /**
+     * @return obd_data_time
+     */
+    public Date getObdDataTime() {
+        return obdDataTime;
+    }
+
+    /**
+     * @param obdDataTime
+     */
+    public void setObdDataTime(Date obdDataTime) {
+        this.obdDataTime = obdDataTime;
+    }
+
+    /**
+     * @return obd_serial_num
+     */
+    public Integer getObdSerialNum() {
+        return obdSerialNum;
+    }
+
+    /**
+     * @param obdSerialNum
+     */
+    public void setObdSerialNum(Integer obdSerialNum) {
+        this.obdSerialNum = obdSerialNum;
+    }
+
+    /**
+     * @return obd_protocol
+     */
+    public Integer getObdProtocol() {
+        return obdProtocol;
+    }
+
+    /**
+     * @param obdProtocol
+     */
+    public void setObdProtocol(Integer obdProtocol) {
+        this.obdProtocol = obdProtocol;
+    }
+
+    /**
+     * @return obd_mil
+     */
+    public Integer getObdMil() {
+        return obdMil;
+    }
+
+    /**
+     * @param obdMil
+     */
+    public void setObdMil(Integer obdMil) {
+        this.obdMil = obdMil;
+    }
+
+    /**
+     * @return obd_diagnosis_support_status
+     */
+    public String getObdDiagnosisSupportStatus() {
+        return obdDiagnosisSupportStatus;
+    }
+
+    /**
+     * @param obdDiagnosisSupportStatus
+     */
+    public void setObdDiagnosisSupportStatus(String obdDiagnosisSupportStatus) {
+        this.obdDiagnosisSupportStatus = obdDiagnosisSupportStatus == null ? null : obdDiagnosisSupportStatus.trim();
+    }
+
+    /**
+     * @return obd_diagnosis_ready_status
+     */
+    public String getObdDiagnosisReadyStatus() {
+        return obdDiagnosisReadyStatus;
+    }
+
+    /**
+     * @param obdDiagnosisReadyStatus
+     */
+    public void setObdDiagnosisReadyStatus(String obdDiagnosisReadyStatus) {
+        this.obdDiagnosisReadyStatus = obdDiagnosisReadyStatus == null ? null : obdDiagnosisReadyStatus.trim();
+    }
+
+    /**
+     * @return obd_vin
+     */
+    public String getObdVin() {
+        return obdVin;
+    }
+
+    /**
+     * @param obdVin
+     */
+    public void setObdVin(String obdVin) {
+        this.obdVin = obdVin == null ? null : obdVin.trim();
+    }
+
+    /**
+     * @return obd_crn
+     */
+    public String getObdCrn() {
+        return obdCrn;
+    }
+
+    /**
+     * @param obdCrn
+     */
+    public void setObdCrn(String obdCrn) {
+        this.obdCrn = obdCrn == null ? null : obdCrn.trim();
+    }
+
+    /**
+     * @return obd_cvn
+     */
+    public String getObdCvn() {
+        return obdCvn;
+    }
+
+    /**
+     * @param obdCvn
+     */
+    public void setObdCvn(String obdCvn) {
+        this.obdCvn = obdCvn == null ? null : obdCvn.trim();
+    }
+
+    /**
+     * @return obd_iupr
+     */
+    public String getObdIupr() {
+        return obdIupr;
+    }
+
+    /**
+     * @param obdIupr
+     */
+    public void setObdIupr(String obdIupr) {
+        this.obdIupr = obdIupr == null ? null : obdIupr.trim();
+    }
+
+    /**
+     * @return obd_fault_code_num
+     */
+    public Integer getObdFaultCodeNum() {
+        return obdFaultCodeNum;
+    }
+
+    /**
+     * @param obdFaultCodeNum
+     */
+    public void setObdFaultCodeNum(Integer obdFaultCodeNum) {
+        this.obdFaultCodeNum = obdFaultCodeNum;
+    }
+
+    /**
+     * @return obd_fault_code
+     */
+    public String getObdFaultCode() {
+        return obdFaultCode;
+    }
+
+    /**
+     * @param obdFaultCode
+     */
+    public void setObdFaultCode(String obdFaultCode) {
+        this.obdFaultCode = obdFaultCode == null ? null : obdFaultCode.trim();
+    }
+
+    /**
+     * @return obd_status
+     */
+    public Boolean getObdStatus() {
+        return obdStatus;
+    }
+
+    /**
+     * @param obdStatus
+     */
+    public void setObdStatus(Boolean obdStatus) {
+        this.obdStatus = obdStatus;
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/entity/OriginData.java b/src/main/kotlin/com/flightfeather/obd/domain/entity/OriginData.java
new file mode 100644
index 0000000..7f75057
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/entity/OriginData.java
@@ -0,0 +1,108 @@
+package com.flightfeather.obd.domain.entity;
+
+import javax.persistence.*;
+
+@Table(name = "obd_origin_data")
+public class OriginData {
+    @Id
+    private Integer id;
+
+    @Column(name = "obd_device_code")
+    private String obdDeviceCode;
+
+    @Column(name = "obd_terminal_software_version")
+    private Integer obdTerminalSoftwareVersion;
+
+    @Column(name = "obd_encryption_way")
+    private Integer obdEncryptionWay;
+
+    @Column(name = "obd_command_unit")
+    private Integer obdCommandUnit;
+
+    @Column(name = "obd_content")
+    private String obdContent;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return obd_device_code
+     */
+    public String getObdDeviceCode() {
+        return obdDeviceCode;
+    }
+
+    /**
+     * @param obdDeviceCode
+     */
+    public void setObdDeviceCode(String obdDeviceCode) {
+        this.obdDeviceCode = obdDeviceCode == null ? null : obdDeviceCode.trim();
+    }
+
+    /**
+     * @return obd_terminal_software_version
+     */
+    public Integer getObdTerminalSoftwareVersion() {
+        return obdTerminalSoftwareVersion;
+    }
+
+    /**
+     * @param obdTerminalSoftwareVersion
+     */
+    public void setObdTerminalSoftwareVersion(Integer obdTerminalSoftwareVersion) {
+        this.obdTerminalSoftwareVersion = obdTerminalSoftwareVersion;
+    }
+
+    /**
+     * @return obd_encryption_way
+     */
+    public Integer getObdEncryptionWay() {
+        return obdEncryptionWay;
+    }
+
+    /**
+     * @param obdEncryptionWay
+     */
+    public void setObdEncryptionWay(Integer obdEncryptionWay) {
+        this.obdEncryptionWay = obdEncryptionWay;
+    }
+
+    /**
+     * @return obd_command_unit
+     */
+    public Integer getObdCommandUnit() {
+        return obdCommandUnit;
+    }
+
+    /**
+     * @param obdCommandUnit
+     */
+    public void setObdCommandUnit(Integer obdCommandUnit) {
+        this.obdCommandUnit = obdCommandUnit;
+    }
+
+    /**
+     * @return obd_content
+     */
+    public String getObdContent() {
+        return obdContent;
+    }
+
+    /**
+     * @param obdContent
+     */
+    public void setObdContent(String obdContent) {
+        this.obdContent = obdContent == null ? null : obdContent.trim();
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLoginMapper.kt b/src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLoginMapper.kt
new file mode 100644
index 0000000..ece3241
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLoginMapper.kt
@@ -0,0 +1,8 @@
+package com.flightfeather.obd.domain.mapper
+
+import com.flightfeather.obd.domain.MyMapper
+import com.flightfeather.obd.domain.entity.CarLogin
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface CarLoginMapper : MyMapper<CarLogin>
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLogoutMapper.kt b/src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLogoutMapper.kt
new file mode 100644
index 0000000..6a7fc10
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/mapper/CarLogoutMapper.kt
@@ -0,0 +1,8 @@
+package com.flightfeather.obd.domain.mapper
+
+import com.flightfeather.obd.domain.MyMapper
+import com.flightfeather.obd.domain.entity.CarLogout
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface CarLogoutMapper : MyMapper<CarLogout>
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/mapper/DataStreamMapper.kt b/src/main/kotlin/com/flightfeather/obd/domain/mapper/DataStreamMapper.kt
new file mode 100644
index 0000000..4d4b20e
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/mapper/DataStreamMapper.kt
@@ -0,0 +1,8 @@
+package com.flightfeather.obd.domain.mapper
+
+import com.flightfeather.obd.domain.MyMapper
+import com.flightfeather.obd.domain.entity.DataStream
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface DataStreamMapper : MyMapper<DataStream>
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/mapper/ObdInfoMapper.kt b/src/main/kotlin/com/flightfeather/obd/domain/mapper/ObdInfoMapper.kt
new file mode 100644
index 0000000..8d39452
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/mapper/ObdInfoMapper.kt
@@ -0,0 +1,8 @@
+package com.flightfeather.obd.domain.mapper
+
+import com.flightfeather.obd.domain.MyMapper
+import com.flightfeather.obd.domain.entity.ObdInfo
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface ObdInfoMapper : MyMapper<ObdInfo>
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/domain/mapper/OriginDataMapper.kt b/src/main/kotlin/com/flightfeather/obd/domain/mapper/OriginDataMapper.kt
new file mode 100644
index 0000000..a3bde52
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/domain/mapper/OriginDataMapper.kt
@@ -0,0 +1,8 @@
+package com.flightfeather.obd.domain.mapper
+
+import com.flightfeather.obd.domain.MyMapper
+import com.flightfeather.obd.domain.entity.OriginData
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface OriginDataMapper : MyMapper<OriginData>
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/CarLoginRepository.kt b/src/main/kotlin/com/flightfeather/obd/repository/CarLoginRepository.kt
new file mode 100644
index 0000000..19898a1
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/CarLoginRepository.kt
@@ -0,0 +1,15 @@
+package com.flightfeather.obd.repository
+
+import com.flightfeather.obd.socket.bean.ObdPackageData
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+interface CarLoginRepository {
+
+    /**
+     * 淇濆瓨杞﹁締鐧诲叆淇℃伅
+     */
+    fun saveCarLogin(packageData: ObdPackageData): Boolean
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/CarLogoutRepository.kt b/src/main/kotlin/com/flightfeather/obd/repository/CarLogoutRepository.kt
new file mode 100644
index 0000000..937408d
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/CarLogoutRepository.kt
@@ -0,0 +1,15 @@
+package com.flightfeather.obd.repository
+
+import com.flightfeather.obd.socket.bean.ObdPackageData
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+interface CarLogoutRepository {
+
+    /**
+     * 淇濆瓨 杞﹁締鐧诲嚭鍏ヤ俊鎭�
+     */
+    fun saveCarLogout(packageData: ObdPackageData): Boolean
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/DataStreamRepository.kt b/src/main/kotlin/com/flightfeather/obd/repository/DataStreamRepository.kt
new file mode 100644
index 0000000..3270ce4
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/DataStreamRepository.kt
@@ -0,0 +1,15 @@
+package com.flightfeather.obd.repository
+
+import com.flightfeather.obd.socket.bean.ObdPackageData
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+interface DataStreamRepository {
+
+    /**
+     * 淇濆瓨 瀹炴椂淇℃伅鎴栬ˉ浼犱俊鎭� 涓殑 鏁版嵁娴佷俊鎭� 鍜� 琛ュ厖鏁版嵁娴�
+     */
+    fun saveDataStream(packageData: ObdPackageData): Boolean
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/ObdInfoRepository.kt b/src/main/kotlin/com/flightfeather/obd/repository/ObdInfoRepository.kt
new file mode 100644
index 0000000..fb07c09
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/ObdInfoRepository.kt
@@ -0,0 +1,18 @@
+package com.flightfeather.obd.repository
+
+import com.flightfeather.obd.socket.bean.ObdInfo
+import com.flightfeather.obd.socket.bean.ObdPackageData
+import com.flightfeather.obd.socket.bean.RealTimeData
+import com.flightfeather.obd.socket.bean.ReplacementData
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+interface ObdInfoRepository {
+
+    /**
+     * 淇濆瓨 瀹炴椂淇℃伅 @see [RealTimeData] 鎴栬ˉ浼犱俊鎭� @see [ReplacementData]  涓殑 obd 鏁版嵁 @see [ObdInfo]
+     */
+    fun saveObdInfo(packageData: ObdPackageData): Boolean
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/OriginDataRepository.kt b/src/main/kotlin/com/flightfeather/obd/repository/OriginDataRepository.kt
new file mode 100644
index 0000000..394ba62
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/OriginDataRepository.kt
@@ -0,0 +1,16 @@
+package com.flightfeather.obd.repository
+
+import com.flightfeather.obd.socket.bean.ObdPackageData
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+interface OriginDataRepository {
+
+    /**
+     * 淇濆瓨鍓嶇浼犺緭鐨勫師濮嬫暟鎹� @see [ObdPackageData]
+     */
+    fun saveOriginData(packageData: ObdPackageData, msg: String): Boolean
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/impl/CarLoginDaoImpl.kt b/src/main/kotlin/com/flightfeather/obd/repository/impl/CarLoginDaoImpl.kt
new file mode 100644
index 0000000..2142299
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/CarLoginDaoImpl.kt
@@ -0,0 +1,40 @@
+package com.flightfeather.obd.repository.impl
+
+import com.flightfeather.obd.domain.entity.CarLogin
+import com.flightfeather.obd.domain.mapper.CarLoginMapper
+import com.flightfeather.obd.repository.CarLoginRepository
+import com.flightfeather.obd.socket.bean.CarRegisterData
+import com.flightfeather.obd.socket.bean.ObdPackageData
+import com.flightfeather.obd.socket.eunm.ObdCommandUnit
+import org.springframework.stereotype.Repository
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+@Repository
+class CarLoginDaoImpl(val carLoginMapper: CarLoginMapper) : CarLoginRepository {
+
+    override fun saveCarLogin(packageData: ObdPackageData): Boolean {
+
+        return if (packageData.commandUnit == ObdCommandUnit.CarRegister.value) {
+            val carLogin = CarLogin().apply {
+                obdDeviceCode = packageData.deviceCode
+            }
+
+            packageData.dataUnit.forEach {
+                when (it) {
+                    is CarRegisterData -> carLogin.apply {
+                        loginDataTime = it.time
+                        loginSerialNum = it.serialNum
+                        loginSimCode = it.SIMCode
+                    }
+                }
+            }
+
+            carLoginMapper.insert(carLogin) == 1
+        } else {
+            false
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/impl/CarLogoutDaoImpl.kt b/src/main/kotlin/com/flightfeather/obd/repository/impl/CarLogoutDaoImpl.kt
new file mode 100644
index 0000000..303ff03
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/CarLogoutDaoImpl.kt
@@ -0,0 +1,37 @@
+package com.flightfeather.obd.repository.impl
+
+import com.flightfeather.obd.domain.entity.CarLogout
+import com.flightfeather.obd.domain.mapper.CarLogoutMapper
+import com.flightfeather.obd.repository.CarLogoutRepository
+import com.flightfeather.obd.socket.bean.CarLogOutData
+import com.flightfeather.obd.socket.bean.ObdPackageData
+import com.flightfeather.obd.socket.eunm.ObdCommandUnit
+import org.springframework.stereotype.Repository
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+@Repository
+class CarLogoutDaoImpl(val carLogoutMapper: CarLogoutMapper): CarLogoutRepository {
+    override fun saveCarLogout(packageData: ObdPackageData): Boolean {
+        return if (packageData.commandUnit == ObdCommandUnit.CarLogOut.value) {
+            val carLogout = CarLogout().apply {
+                obdDeviceCode = packageData.deviceCode
+            }
+
+            packageData.dataUnit.forEach {
+                when (it) {
+                    is CarLogOutData -> carLogout.apply {
+                        logoutDataTime = it.time
+                        logoutSerialNum = it.serialNum
+                    }
+                }
+            }
+
+            carLogoutMapper.insert(carLogout) == 1
+        } else {
+            false
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/impl/DataStreamDaoImpl.kt b/src/main/kotlin/com/flightfeather/obd/repository/impl/DataStreamDaoImpl.kt
new file mode 100644
index 0000000..12d1583
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/DataStreamDaoImpl.kt
@@ -0,0 +1,76 @@
+package com.flightfeather.obd.repository.impl
+
+import com.flightfeather.obd.domain.entity.DataStream
+import com.flightfeather.obd.domain.mapper.DataStreamMapper
+import com.flightfeather.obd.repository.DataStreamRepository
+import com.flightfeather.obd.socket.bean.EngineDataStream
+import com.flightfeather.obd.socket.bean.ObdPackageData
+import com.flightfeather.obd.socket.bean.ReplacementData
+import com.flightfeather.obd.socket.bean.SupplementDataStream
+import com.flightfeather.obd.socket.eunm.ObdCommandUnit
+import org.springframework.stereotype.Repository
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+@Repository
+class DataStreamDaoImpl(val dataStreamMapper: DataStreamMapper): DataStreamRepository {
+
+    override fun saveDataStream(packageData: ObdPackageData): Boolean {
+
+        return if (packageData.commandUnit == ObdCommandUnit.RealTimeData.value
+                || packageData.commandUnit == ObdCommandUnit.ReplacementData.value) {
+
+            val dataStream = DataStream().apply {
+                obdDeviceCode = packageData.deviceCode
+                obdStatus = packageData.commandUnit == ObdCommandUnit.ReplacementData.value
+            }
+
+            packageData.dataUnit.forEach {
+                dataStream.apply {
+                    obdDataTime = it.time
+                    obdSerialNum = it.serialNum
+                }
+                when (it) {
+                    is EngineDataStream -> dataStream.apply {
+                        //fixme 姝ゅ鐩稿悓灞炴�у彲鐢� [BeanUtil] 宸ュ叿鏉ュ揩閫熻祴鍊硷紝浣嗗洜涓哄苟涓嶆槸鍏ㄩ儴灞炴�ч兘鐩稿悓锛屽彲鑳藉鏄撲骇鐢熻瑙�
+                        obdSpeed = it.obdSpeed
+                        obdAirPressure = it.obdAirPressure
+                        obdEngineTorque = it.obdEngineTorque
+                        obdFrictionTorque = it.obdFrictionTorque
+                        obdEngineRpm = it.obdEngineRpm
+                        obdEngineFuelFlow = it.obdEngineFuelFlow
+                        obdScrUpstreamNox = it.obdScrUpstreamNox
+                        obdScrDownstreamNox = it.obdScrDownstreamNox
+                        obdRemainReactant = it.obdRemainReactant
+                        obdAirInput = it.obdAirInput
+                        obdScrInputTemp = it.obdScrInputTemp
+                        obdScrOutputTemp = it.obdScrOutputTemp
+                        obdDpf = it.obdDpf
+                        obdEngineCoolantTemp = it.obdEngineCoolantTemp
+                        obdFuelLevel = it.obdFuelLevel
+                        obdLocationStatus = it.obdLocationStatus?.toString(2)
+                        obdLong = it.obdLong
+                        obdLat = it.obdLat
+                        obdTotalMileage = it.obdTotalMileage
+                    }
+                    is SupplementDataStream -> dataStream.apply {
+                        obdEngineTorqueMode = it.obdEngineTorqueMode
+                        obdAcceleratorPedal = it.obdAcceleratorPedal
+                        obdTotalOilConsumption = it.obdTotalOilConsumption
+                        obdUreaBoxTemp = it.obdUreaBoxTemp
+                        obdUreaVolume = it.obdUreaVolume
+                        obdTotalUreaConsume = it.obdTotalUreaConsume
+                        obdDpfTemp = it.obdDpfTemp
+                    }
+                }
+            }
+
+            dataStreamMapper.insert(dataStream) == 1
+        } else {
+            false
+        }
+    }
+
+}
\ No newline at end of file
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 b3ba4d2..54eeee9 100644
--- a/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdDataDaoImpl.kt
@@ -66,7 +66,7 @@
             ObdCommandUnit.ReplacementData.value -> {
                 packageData.dataUnit.forEach {
                     when (it) {
-                        is com.flightfeather.obd.socket.bean.ObdData -> {
+                        is com.flightfeather.obd.socket.bean.ObdInfo -> {
                             obdData.apply {
                                 obdTime = it.time
                                 obdProtocol = it.obdProtocol
@@ -88,8 +88,8 @@
                                 obdFrictionTorque = it.obdFrictionTorque
                                 obdEngineRpm = it.obdEngineRpm?.toInt()
                                 obdStartFuelFlow = it.obdEngineFuelFlow
-                                obdScrUpstreamNo = it.obdScrUpstreamNo
-                                obdScrDownstreamNo = it.obdScrDownstreamNo
+                                obdScrUpstreamNo = it.obdScrUpstreamNox
+                                obdScrDownstreamNo = it.obdScrDownstreamNox
                                 obdRemainReactant = it.obdRemainReactant
                                 obdAirInput = it.obdAirInput
                                 obdScrInputTemp = it.obdScrInputTemp
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdInfoDaoImpl.kt b/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdInfoDaoImpl.kt
new file mode 100644
index 0000000..99fe315
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/ObdInfoDaoImpl.kt
@@ -0,0 +1,55 @@
+package com.flightfeather.obd.repository.impl
+
+import com.flightfeather.obd.domain.entity.ObdInfo
+import com.flightfeather.obd.domain.mapper.ObdInfoMapper
+import com.flightfeather.obd.repository.ObdInfoRepository
+import com.flightfeather.obd.socket.bean.ObdPackageData
+import com.flightfeather.obd.socket.eunm.ObdCommandUnit
+import org.springframework.stereotype.Repository
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+@Repository
+class ObdInfoDaoImpl(val obdInfoMapper: ObdInfoMapper) : ObdInfoRepository {
+
+    override fun saveObdInfo(packageData: ObdPackageData): Boolean {
+
+        return if (packageData.commandUnit == ObdCommandUnit.RealTimeData.value
+                || packageData.commandUnit == ObdCommandUnit.ReplacementData.value) {
+
+            val obdInfo = ObdInfo().apply {
+                obdDeviceCode = packageData.deviceCode
+                obdStatus = packageData.commandUnit == ObdCommandUnit.ReplacementData.value
+            }
+
+            packageData.dataUnit.forEach {
+                when (it) {
+                    is com.flightfeather.obd.socket.bean.ObdInfo -> {
+                        obdInfo.apply {
+                            obdDataTime = it.time
+                            obdSerialNum = it.serialNum
+                            obdProtocol = it.obdProtocol
+                            obdMil = it.obdMil
+                            obdDiagnosisSupportStatus = it.diagnosisSupportStatus
+                            obdDiagnosisReadyStatus = it.diagnosisReadyStatus
+                            obdVin = it.obdVin
+                            obdCrn = it.obdCrn
+                            obdCvn = it.obdCvn
+                            obdIupr = it.iupr
+                            obdFaultCodeNum = it.obdFaultCodeNum
+                            obdFaultCode = it.obdFaultCode
+                        }
+                    }
+                }
+            }
+
+            obdInfoMapper.insert(obdInfo) == 1
+        } else {
+            false
+        }
+
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/repository/impl/OriginDataDaoImpl.kt b/src/main/kotlin/com/flightfeather/obd/repository/impl/OriginDataDaoImpl.kt
new file mode 100644
index 0000000..1f7a35f
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/obd/repository/impl/OriginDataDaoImpl.kt
@@ -0,0 +1,29 @@
+package com.flightfeather.obd.repository.impl
+
+import com.flightfeather.obd.domain.entity.OriginData
+import com.flightfeather.obd.domain.mapper.OriginDataMapper
+import com.flightfeather.obd.repository.OriginDataRepository
+import com.flightfeather.obd.socket.bean.ObdPackageData
+import org.springframework.stereotype.Repository
+
+/**
+ * @author riku
+ * Date: 2019/9/17
+ */
+@Repository
+class OriginDataDaoImpl (val originDataMapper: OriginDataMapper): OriginDataRepository {
+
+    override fun saveOriginData(packageData: ObdPackageData, msg: String): Boolean {
+
+        val originData = OriginData().apply {
+            obdDeviceCode = packageData.deviceCode
+            obdTerminalSoftwareVersion = packageData.softwareVersion
+            obdEncryptionWay = packageData.encryptionWay
+            obdCommandUnit = packageData.commandUnit
+            obdContent = msg
+        }
+
+        return originDataMapper.insert(originData) == 1
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/socket/MessageManager.kt b/src/main/kotlin/com/flightfeather/obd/socket/MessageManager.kt
index 626194f..e413f7d 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/MessageManager.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/MessageManager.kt
@@ -1,10 +1,11 @@
 package com.flightfeather.obd.socket
 
 import com.flightfeather.obd.common.utils.FileUtil
-import com.flightfeather.obd.repository.ObdDataRepository
+import com.flightfeather.obd.repository.*
 import com.flightfeather.obd.socket.bean.ObdPackageData
 import com.flightfeather.obd.socket.decoder.VehicleDataDecoder
 import com.flightfeather.obd.socket.decoder.impl.DataPackageDecoderImpl
+import com.flightfeather.obd.socket.eunm.ObdCommandUnit
 import io.netty.channel.ChannelHandlerContext
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Component
@@ -27,6 +28,16 @@
 
     @Autowired
     lateinit var obdDataRepository: ObdDataRepository
+    @Autowired
+    lateinit var originDataRepository: OriginDataRepository
+    @Autowired
+    lateinit var obdInfoRepository: ObdInfoRepository
+    @Autowired
+    lateinit var dataStreamRepository: DataStreamRepository
+    @Autowired
+    lateinit var carLogoutRepository: CarLogoutRepository
+    @Autowired
+    lateinit var carLoginRepository: CarLoginRepository
 
     val vehicleDataDecoder = VehicleDataDecoder()
     val dataPackageDecoder = DataPackageDecoderImpl()
@@ -35,6 +46,11 @@
     fun init() {
         instance = this
         instance.obdDataRepository = this.obdDataRepository
+        instance.originDataRepository = this.originDataRepository
+        instance.obdInfoRepository = this.obdInfoRepository
+        instance.dataStreamRepository = this.dataStreamRepository
+        instance.carLogoutRepository = this.carLogoutRepository
+        instance.carLoginRepository = this.carLoginRepository
     }
 
     fun dealStringMsg(msg: String, ctx: ChannelHandlerContext?) {
@@ -45,7 +61,7 @@
             val packageData = vehicleDataDecoder.decode(msg)
             //淇濆瓨
             DeviceSession.saveDevice(packageData.deviceCode, ctx)
-            saveToDataBase(packageData)
+            saveToDataBase(packageData, msg)
         } else {
             println("------鏁版嵁BCC鏍¢獙澶辫触锛岃垗寮� [${SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())}]")
         }
@@ -62,8 +78,15 @@
     /**
      * 淇濆瓨鑷虫暟鎹簱
      */
-    fun saveToDataBase(packageData: ObdPackageData) {
+    fun saveToDataBase(packageData: ObdPackageData, msg: String) {
         instance.obdDataRepository.saveObdData(packageData)
+        instance.originDataRepository.saveOriginData(packageData, msg)
+        when (packageData.commandUnit) {
+            ObdCommandUnit.CarRegister.value -> instance.carLoginRepository.saveCarLogin(packageData)
+            ObdCommandUnit.RealTimeData.value,
+            ObdCommandUnit.ReplacementData.value -> instance.dataStreamRepository.saveDataStream(packageData)
+            ObdCommandUnit.CarLogOut.value-> instance.carLogoutRepository.saveCarLogout(packageData)
+        }
     }
 
     /**
diff --git a/src/main/kotlin/com/flightfeather/obd/socket/bean/EngineDataStream.kt b/src/main/kotlin/com/flightfeather/obd/socket/bean/EngineDataStream.kt
index 2a6dce2..82c3ea7 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/bean/EngineDataStream.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/bean/EngineDataStream.kt
@@ -19,8 +19,8 @@
     var obdFrictionTorque: Double? = null
     var obdEngineRpm: Double? = null
     var obdEngineFuelFlow: Double? = null
-    var obdScrUpstreamNo: Double? = null
-    var obdScrDownstreamNo: Double? = null
+    var obdScrUpstreamNox: Double? = null
+    var obdScrDownstreamNox: Double? = null
     var obdRemainReactant: Double? = null
     var obdAirInput: Double? = null
     var obdScrInputTemp: Double? = null
diff --git a/src/main/kotlin/com/flightfeather/obd/socket/bean/ObdData.kt b/src/main/kotlin/com/flightfeather/obd/socket/bean/ObdInfo.kt
similarity index 92%
rename from src/main/kotlin/com/flightfeather/obd/socket/bean/ObdData.kt
rename to src/main/kotlin/com/flightfeather/obd/socket/bean/ObdInfo.kt
index a53bcd7..dc2d4c4 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/bean/ObdData.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/bean/ObdInfo.kt
@@ -10,7 +10,7 @@
  * 瀹炴椂淇℃伅[RealTimeData] 涓殑obd鏁版嵁
  * 鏁版嵁绫诲瀷 @see [ObdDataType.ObdData]
  */
-class ObdData(
+class ObdInfo(
         time: Date?,
         serialNum: Int?
 ) : RealTimeData(time, serialNum) {
@@ -21,7 +21,7 @@
     var obdVin: String? = null
     var obdCrn: String? = null//杞欢鏍囧畾璇嗗埆鍙�
     var obdCvn: String? = null//鏍囧畾楠岃瘉鐮�
-    var IUPR:String?=null//瀹氫箟鍙傝�� SAE J 1979-DA 琛� G11
+    var iupr:String?=null//瀹氫箟鍙傝�� SAE J 1979-DA 琛� G11
     var obdFaultCodeNum: Int? = null//鏁呴殰鐮佹�绘暟: 鏈夋晥鍊艰寖鍥达細0~253锛屸��0xFE鈥濊〃绀烘棤鏁堛��
     var obdFaultCode: String? = null//鏁呴殰鐮佷俊鎭垪琛�: 姣忎釜鏁呴殰鐮佷负鍥涘瓧鑺傦紝鍙寜鏁呴殰瀹為檯椤哄簭杩涜鎺掑簭
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/obd/socket/decoder/RealTimeDataDecoder.kt b/src/main/kotlin/com/flightfeather/obd/socket/decoder/RealTimeDataDecoder.kt
index a724c1e..cbb74bb 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/decoder/RealTimeDataDecoder.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/decoder/RealTimeDataDecoder.kt
@@ -12,7 +12,7 @@
  */
 interface RealTimeDataDecoder {
 
-    fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdData?
+    fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdInfo?
 
     fun getEngineDataStream(time: Date?, serialNum: Int, b: List<String>): EngineDataStream?
 
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 02ad0de..0645f5a 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
@@ -116,6 +116,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
diff --git a/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/RealTimeDataDecoderImpl.kt b/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/RealTimeDataDecoderImpl.kt
index a1a4e22..ce920ae 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/RealTimeDataDecoderImpl.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/RealTimeDataDecoderImpl.kt
@@ -1,7 +1,7 @@
 package com.flightfeather.obd.socket.decoder.impl
 
 import com.flightfeather.obd.socket.bean.EngineDataStream
-import com.flightfeather.obd.socket.bean.ObdData
+import com.flightfeather.obd.socket.bean.ObdInfo
 import com.flightfeather.obd.socket.bean.SupplementDataStream
 import com.flightfeather.obd.socket.decoder.RealTimeDataDecoder
 import com.flightfeather.obd.socket.eunm.ObdDataType
@@ -12,7 +12,7 @@
  * Date: 2019/9/15
  */
 class RealTimeDataDecoderImpl : RealTimeDataDecoder {
-    override fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdData? {
+    override fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdInfo? {
         val dataList = mutableListOf<String>().apply { addAll(b) }
         if (b.isNotEmpty()) {
             //鍘婚櫎 淇℃伅绫诲瀷鏍囧織
@@ -46,7 +46,7 @@
                 }
             }
 
-            return ObdData(time, serialNum).apply {
+            return ObdInfo(time, serialNum).apply {
                 obdProtocol = dataList[0].toIntOrNull(16)
                 obdMil = dataList[1].toIntOrNull(16)
                 diagnosisSupportStatus = "${dataList[2]}${dataList[3]}".toIntOrNull(16)?.toString(2)
@@ -54,7 +54,7 @@
                 obdVin = vin.toString()
                 obdCrn = softwareCode.toString()
                 obdCvn = cvn.toString()
-                this.IUPR = IUPR.toString()
+                this.iupr = IUPR.toString()
                 obdFaultCodeNum = faultCodeNum
                 obdFaultCode = faultCode.toString()
             }
@@ -78,8 +78,8 @@
                 obdFrictionTorque = dataList[4].toIntOrNull(16)?.minus(125)?.toDouble()?.div(100)
                 obdEngineRpm = "${dataList[5]}${dataList[6]}".toIntOrNull(16)?.toDouble()?.times(0.125)
                 obdEngineFuelFlow = "${dataList[7]}${dataList[8]}".toIntOrNull(16)?.toDouble()?.times(0.05)
-                obdScrUpstreamNo = "${dataList[9]}${dataList[10]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
-                obdScrDownstreamNo = "${dataList[11]}${dataList[12]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
+                obdScrUpstreamNox = "${dataList[9]}${dataList[10]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
+                obdScrDownstreamNox = "${dataList[11]}${dataList[12]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
                 obdRemainReactant = dataList[13].toIntOrNull(16)?.toDouble()?.times(0.4)?.div(100)
                 obdAirInput = "${dataList[14]}${dataList[15]}".toIntOrNull(16)?.toDouble()?.times(0.05)
                 obdScrInputTemp = "${dataList[16]}${dataList[17]}".toIntOrNull(16)?.minus(273)?.toDouble()?.times(0.03125)
diff --git a/src/main/kotlin/com/flightfeather/obd/socket/eunm/ObdDataType.kt b/src/main/kotlin/com/flightfeather/obd/socket/eunm/ObdDataType.kt
index 9b9c944..55b30cf 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/eunm/ObdDataType.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/eunm/ObdDataType.kt
@@ -7,7 +7,7 @@
  *
  * 瀹炴椂淇℃伅[RealTimeData]鍜岃ˉ鍙戜俊鎭痆ReplacementData] 涓殑鏁版嵁绫诲瀷
  * 绫诲瀷缂栫爜                     璇存槑
- * 0x01                           OBD 淇℃伅    @see [com.flightfeather.obd.socket.bean.ObdData]
+ * 0x01                           OBD 淇℃伅    @see [com.flightfeather.obd.socket.bean.ObdInfo]
  * 0x02                          鏁版嵁娴佷俊鎭�  @see[com.flightfeather.obd.socket.bean.EngineDataStream]
  * 0x03-0x7F                棰勭暀
  * 0x80                          琛ュ厖鏁版嵁娴�   @see[com.flightfeather.obd.socket.bean.SupplementDataStream]
diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml
index 558fd76..9b7a1a8 100644
--- a/src/main/resources/generator/generatorConfig.xml
+++ b/src/main/resources/generator/generatorConfig.xml
@@ -46,8 +46,13 @@
         </javaClientGenerator>
         <!-- 瑕佺敓鎴愮殑琛� tableName鏄暟鎹簱涓殑琛ㄥ悕鎴栬鍥惧悕 domainObjectName鏄疄浣撶被鍚�-->
         <!--<table tableName="obd_data" domainObjectName="ObdData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
-        <table tableName="obd_user" domainObjectName="ObdUser" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
-        <table tableName="obd_threshold_value" domainObjectName="ThresholdValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
-        <table tableName="obd_alarm_data" domainObjectName="AlarmData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
+        <!--<table tableName="obd_user" domainObjectName="ObdUser" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <!--<table tableName="obd_threshold_value" domainObjectName="ThresholdValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <!--<table tableName="obd_alarm_data" domainObjectName="AlarmData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <!--<table tableName="obd_origin_data" domainObjectName="OriginData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <!--<table tableName="obd_car_login" domainObjectName="CarLogin" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <!--<table tableName="obd_car_logout" domainObjectName="CarLogout" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <table tableName="obd_data_stream" domainObjectName="DataStream" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
+        <!--<table tableName="obd_info" domainObjectName="ObdInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
     </context>
 </generatorConfiguration>
\ No newline at end of file
diff --git a/src/main/resources/mapper/CarLoginMapper.xml b/src/main/resources/mapper/CarLoginMapper.xml
new file mode 100644
index 0000000..738920e
--- /dev/null
+++ b/src/main/resources/mapper/CarLoginMapper.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.flightfeather.obd.domain.mapper.CarLoginMapper">
+  <resultMap id="BaseResultMap" type="com.flightfeather.obd.domain.entity.CarLogin">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="obd_device_code" jdbcType="VARCHAR" property="obdDeviceCode" />
+    <result column="login_create_time" jdbcType="TIMESTAMP" property="loginCreateTime" />
+    <result column="login_data_time" jdbcType="TIMESTAMP" property="loginDataTime" />
+    <result column="login_serial_num" jdbcType="INTEGER" property="loginSerialNum" />
+    <result column="login_sim_code" jdbcType="VARCHAR" property="loginSimCode" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    id, obd_device_code, login_create_time, login_data_time, login_serial_num, login_sim_code
+  </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/CarLogoutMapper.xml b/src/main/resources/mapper/CarLogoutMapper.xml
new file mode 100644
index 0000000..b3a7268
--- /dev/null
+++ b/src/main/resources/mapper/CarLogoutMapper.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.flightfeather.obd.domain.mapper.CarLogoutMapper">
+  <resultMap id="BaseResultMap" type="com.flightfeather.obd.domain.entity.CarLogout">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="obd_device_code" jdbcType="VARCHAR" property="obdDeviceCode" />
+    <result column="logout_create_time" jdbcType="TIMESTAMP" property="logoutCreateTime" />
+    <result column="logout_data_time" jdbcType="TIMESTAMP" property="logoutDataTime" />
+    <result column="logout_serial_num" jdbcType="INTEGER" property="logoutSerialNum" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    id, obd_device_code, logout_create_time, logout_data_time, logout_serial_num
+  </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/DataStreamMapper.xml b/src/main/resources/mapper/DataStreamMapper.xml
new file mode 100644
index 0000000..efc0746
--- /dev/null
+++ b/src/main/resources/mapper/DataStreamMapper.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.flightfeather.obd.domain.mapper.DataStreamMapper">
+  <resultMap id="BaseResultMap" type="com.flightfeather.obd.domain.entity.DataStream">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="obd_device_code" jdbcType="VARCHAR" property="obdDeviceCode" />
+    <result column="obd_create_time" jdbcType="TIMESTAMP" property="obdCreateTime" />
+    <result column="obd_data_time" jdbcType="TIMESTAMP" property="obdDataTime" />
+    <result column="obd_serial_num" jdbcType="INTEGER" property="obdSerialNum" />
+    <result column="obd_speed" jdbcType="DOUBLE" property="obdSpeed" />
+    <result column="obd_air_pressure" jdbcType="DOUBLE" property="obdAirPressure" />
+    <result column="obd_engine_torque" jdbcType="DOUBLE" property="obdEngineTorque" />
+    <result column="obd_friction_torque" jdbcType="DOUBLE" property="obdFrictionTorque" />
+    <result column="obd_engine_rpm" jdbcType="DOUBLE" property="obdEngineRpm" />
+    <result column="obd_engine_fuel_flow" jdbcType="DOUBLE" property="obdEngineFuelFlow" />
+    <result column="obd_scr_upstream_NOx" jdbcType="DOUBLE" property="obdScrUpstreamNox" />
+    <result column="obd_scr_downstream_NOx" jdbcType="DOUBLE" property="obdScrDownstreamNox" />
+    <result column="obd_remain_reactant" jdbcType="DOUBLE" property="obdRemainReactant" />
+    <result column="obd_air_input" jdbcType="DOUBLE" property="obdAirInput" />
+    <result column="obd_scr_input_temp" jdbcType="DOUBLE" property="obdScrInputTemp" />
+    <result column="obd_scr_output_temp" jdbcType="DOUBLE" property="obdScrOutputTemp" />
+    <result column="obd_DPF" jdbcType="DOUBLE" property="obdDpf" />
+    <result column="obd_engine_coolant_temp" jdbcType="DOUBLE" property="obdEngineCoolantTemp" />
+    <result column="obd_fuel_level" jdbcType="DOUBLE" property="obdFuelLevel" />
+    <result column="obd_location_status" jdbcType="VARCHAR" property="obdLocationStatus" />
+    <result column="obd_long" jdbcType="DOUBLE" property="obdLong" />
+    <result column="obd_lat" jdbcType="DOUBLE" property="obdLat" />
+    <result column="obd_total_mileage" jdbcType="DOUBLE" property="obdTotalMileage" />
+    <result column="obd_engine_torque_mode" jdbcType="INTEGER" property="obdEngineTorqueMode" />
+    <result column="obd_accelerator_pedal" jdbcType="DOUBLE" property="obdAcceleratorPedal" />
+    <result column="obd_total_oil_consumption" jdbcType="DOUBLE" property="obdTotalOilConsumption" />
+    <result column="obd_urea_box_temp" jdbcType="DOUBLE" property="obdUreaBoxTemp" />
+    <result column="obd_urea_volume" jdbcType="DOUBLE" property="obdUreaVolume" />
+    <result column="obd_total_urea_consume" jdbcType="DOUBLE" property="obdTotalUreaConsume" />
+    <result column="obd_DPF_temp" jdbcType="DOUBLE" property="obdDpfTemp" />
+    <result column="obd_status" jdbcType="BIT" property="obdStatus" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    id, obd_device_code, obd_create_time, obd_data_time, obd_serial_num, obd_speed, obd_air_pressure, 
+    obd_engine_torque, obd_friction_torque, obd_engine_rpm, obd_engine_fuel_flow, obd_scr_upstream_NOx, 
+    obd_scr_downstream_NOx, obd_remain_reactant, obd_air_input, obd_scr_input_temp, obd_scr_output_temp, 
+    obd_DPF, obd_engine_coolant_temp, obd_fuel_level, obd_location_status, obd_long, 
+    obd_lat, obd_total_mileage, obd_engine_torque_mode, obd_accelerator_pedal, obd_total_oil_consumption, 
+    obd_urea_box_temp, obd_urea_volume, obd_total_urea_consume, obd_DPF_temp, obd_status
+  </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/ObdInfoMapper.xml b/src/main/resources/mapper/ObdInfoMapper.xml
new file mode 100644
index 0000000..b6d891d
--- /dev/null
+++ b/src/main/resources/mapper/ObdInfoMapper.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.flightfeather.obd.domain.mapper.ObdInfoMapper">
+  <resultMap id="BaseResultMap" type="com.flightfeather.obd.domain.entity.ObdInfo">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="obd_device_code" jdbcType="VARCHAR" property="obdDeviceCode" />
+    <result column="obd_create_time" jdbcType="TIMESTAMP" property="obdCreateTime" />
+    <result column="obd_data_time" jdbcType="TIMESTAMP" property="obdDataTime" />
+    <result column="obd_serial_num" jdbcType="INTEGER" property="obdSerialNum" />
+    <result column="obd_protocol" jdbcType="INTEGER" property="obdProtocol" />
+    <result column="obd_mil" jdbcType="INTEGER" property="obdMil" />
+    <result column="obd_diagnosis_support_status" jdbcType="VARCHAR" property="obdDiagnosisSupportStatus" />
+    <result column="obd_diagnosis_ready_status" jdbcType="VARCHAR" property="obdDiagnosisReadyStatus" />
+    <result column="obd_vin" jdbcType="VARCHAR" property="obdVin" />
+    <result column="obd_crn" jdbcType="VARCHAR" property="obdCrn" />
+    <result column="obd_cvn" jdbcType="VARCHAR" property="obdCvn" />
+    <result column="obd_iupr" jdbcType="VARCHAR" property="obdIupr" />
+    <result column="obd_fault_code_num" jdbcType="INTEGER" property="obdFaultCodeNum" />
+    <result column="obd_fault_code" jdbcType="VARCHAR" property="obdFaultCode" />
+    <result column="obd_status" jdbcType="BIT" property="obdStatus" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    id, obd_device_code, obd_create_time, obd_data_time, obd_serial_num, obd_protocol, 
+    obd_mil, obd_diagnosis_support_status, obd_diagnosis_ready_status, obd_vin, obd_crn, 
+    obd_cvn, obd_iupr, obd_fault_code_num, obd_fault_code, obd_status
+  </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/OriginDataMapper.xml b/src/main/resources/mapper/OriginDataMapper.xml
new file mode 100644
index 0000000..8271680
--- /dev/null
+++ b/src/main/resources/mapper/OriginDataMapper.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.flightfeather.obd.domain.mapper.OriginDataMapper">
+  <resultMap id="BaseResultMap" type="com.flightfeather.obd.domain.entity.OriginData">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="obd_device_code" jdbcType="VARCHAR" property="obdDeviceCode" />
+    <result column="obd_terminal_software_version" jdbcType="INTEGER" property="obdTerminalSoftwareVersion" />
+    <result column="obd_encryption_way" jdbcType="INTEGER" property="obdEncryptionWay" />
+    <result column="obd_command_unit" jdbcType="INTEGER" property="obdCommandUnit" />
+  </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.flightfeather.obd.domain.entity.OriginData">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <result column="obd_content" jdbcType="LONGVARCHAR" property="obdContent" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    id, obd_device_code, obd_terminal_software_version, obd_encryption_way, obd_command_unit
+  </sql>
+  <sql id="Blob_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    obd_content
+  </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/obd/socket/decoder/VehicleDataDecoderTest.kt b/src/test/kotlin/com/flightfeather/obd/socket/decoder/VehicleDataDecoderTest.kt
index 8eac338..bfdb760 100644
--- a/src/test/kotlin/com/flightfeather/obd/socket/decoder/VehicleDataDecoderTest.kt
+++ b/src/test/kotlin/com/flightfeather/obd/socket/decoder/VehicleDataDecoderTest.kt
@@ -36,11 +36,14 @@
             }
             ObdCommandUnit.RealTimeData.value,
             ObdCommandUnit.ReplacementData.value -> {
+
                 packageData.dataUnit.forEach {
+                    obdData.apply {
+                        obdTime = it.time
+                    }
                     when (it) {
-                        is com.flightfeather.obd.socket.bean.ObdData -> {
+                        is com.flightfeather.obd.socket.bean.ObdInfo -> {
                             obdData.apply {
-                                obdTime = it.time
                                 obdProtocol = it.obdProtocol
                                 obdMil = it.obdMil
                                 obdIdCode = it.obdCrn
@@ -51,7 +54,6 @@
                         }
                         is EngineDataStream -> {
                             obdData.apply {
-                                obdTime = it.time
                                 obdLng = it.obdLong
                                 obdLat = it.obdLat
                                 obdSpeed = it.obdSpeed?.toInt()
@@ -60,8 +62,8 @@
                                 obdFrictionTorque = it.obdFrictionTorque
                                 obdEngineRpm = it.obdEngineRpm?.toInt()
                                 obdStartFuelFlow = it.obdEngineFuelFlow
-                                obdScrUpstreamNo = it.obdScrUpstreamNo
-                                obdScrDownstreamNo = it.obdScrDownstreamNo
+                                obdScrUpstreamNo = it.obdScrUpstreamNox
+                                obdScrDownstreamNo = it.obdScrDownstreamNox
                                 obdRemainReactant = it.obdRemainReactant
                                 obdAirInput = it.obdAirInput
                                 obdScrInputTemp = it.obdScrInputTemp
@@ -75,7 +77,6 @@
                         }
                         is SupplementDataStream -> {
                             obdData.apply {
-                                obdTime = it.time
                                 obdEngineTorqueMode = it.obdEngineTorqueMode?.toString()
                                 obdAcceleratorPedal = it.obdAcceleratorPedal
                                 obdTotalOilConsumption = it.obdTotalOilConsumption
@@ -91,26 +92,10 @@
 
             }
             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