From 585fb9b67dc81f9e14f2cbf59f1c3a02eb4fe98f Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 11 六月 2020 10:58:23 +0800 Subject: [PATCH] 1.添加无人机多参数的数据接收解析函数 2.添加参数存储函数 --- src/main/kotlin/com/flightfeather/uav/socket/ServerHandler.kt | 3 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/VehicleServiceImpl.kt | 14 src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdDataType.kt | 8 src/main/kotlin/com/flightfeather/uav/socket/decoder/DataUnitDecoder.kt | 16 src/main/resources/generator/generatorConfig.xml | 8 src/test/kotlin/com/flightfeather/uav/Test.kt | 140 ------- src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataPackageDecoderImpl.kt | 60 +-- src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt | 12 src/main/kotlin/com/flightfeather/uav/socket/SocketServerClient.kt | 3 src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt | 33 + src/main/kotlin/com/flightfeather/uav/socket/bean/AirData.kt | 14 src/main/kotlin/com/flightfeather/uav/socket/bean/AirPackageData.kt | 31 + src/main/kotlin/com/flightfeather/uav/domain/mapper/RealTimeDataMapper.kt | 8 src/main/kotlin/com/flightfeather/uav/socket/bean/DataUnit.kt | 11 src/test/kotlin/com/flightfeather/uav/UAVApplicationTests.kt | 17 src/main/kotlin/com/flightfeather/uav/socket/UAVByteDataDecoder.kt | 28 src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt | 32 + src/main/kotlin/com/flightfeather/uav/socket/eunm/AirCommandUnit.kt | 17 src/main/kotlin/com/flightfeather/uav/domain/entity/RealTimeData.java | 156 ++++++++ src/main/kotlin/com/flightfeather/uav/socket/bean/AirTypeData.kt | 9 src/main/kotlin/com/flightfeather/uav/socket/decoder/AirDataDecoder.kt | 15 src/main/kotlin/com/flightfeather/uav/socket/decoder/DataPackageDecoder.kt | 19 /dev/null | 102 ----- src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataUnitDecoderImpl.kt | 127 +----- src/main/kotlin/com/flightfeather/uav/socket/MessageManager.kt | 112 +---- src/main/kotlin/com/flightfeather/uav/socket/DeviceSession.kt | 21 + src/main/resources/application.yml | 12 src/main/kotlin/com/flightfeather/uav/repository/VehicleRepository.kt | 6 28 files changed, 460 insertions(+), 574 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/AlarmData.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/AlarmData.java deleted file mode 100644 index 0329f4a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/AlarmData.java +++ /dev/null @@ -1,619 +0,0 @@ -package com.flightfeather.uav.domain.entity; - -import java.util.Date; -import javax.persistence.*; - -@Table(name = "obd_alarm_data") -public class AlarmData { - @Id - private Integer id; - - @Column(name = "obd_vin") - private String obdVin; - - @Column(name = "alarm_time") - private Date alarmTime; - - @Column(name = "alarm_lng") - private Double alarmLng; - - @Column(name = "alarm_lat") - private Double alarmLat; - - @Column(name = "alarm_protocol") - private Integer alarmProtocol; - - @Column(name = "alarm_mil") - private Integer alarmMil; - - @Column(name = "alarm_id_code") - private String alarmIdCode; - - @Column(name = "alarm_verification_code") - private String alarmVerificationCode; - - @Column(name = "alarm_fault_code_num") - private Integer alarmFaultCodeNum; - - @Column(name = "alarm_fault_code") - private String alarmFaultCode; - - @Column(name = "alarm_speed") - private Integer alarmSpeed; - - @Column(name = "alarm_air_pressure") - private Double alarmAirPressure; - - @Column(name = "alarm_engine_torque") - private Double alarmEngineTorque; - - @Column(name = "alarm_friction_torque") - private Double alarmFrictionTorque; - - @Column(name = "alarm_engine_rpm") - private Integer alarmEngineRpm; - - @Column(name = "alarm_start_fuel_flow") - private Double alarmStartFuelFlow; - - @Column(name = "alarm_scr_upstream_NO") - private Double alarmScrUpstreamNo; - - @Column(name = "alarm_scr_downstream_NO") - private Double alarmScrDownstreamNo; - - @Column(name = "alarm_remain_reactant") - private Double alarmRemainReactant; - - @Column(name = "alarm_air_input") - private Double alarmAirInput; - - @Column(name = "alarm_scr_input_temp") - private Double alarmScrInputTemp; - - @Column(name = "alarm_scr_output_temp") - private Double alarmScrOutputTemp; - - @Column(name = "alarm_DPF") - private Double alarmDpf; - - @Column(name = "alarm_engine_coolant_temp") - private Double alarmEngineCoolantTemp; - - @Column(name = "alarm_fuel_level") - private Double alarmFuelLevel; - - @Column(name = "alarm_location_status") - private Integer alarmLocationStatus; - - @Column(name = "alarm_total_mileage") - private Double alarmTotalMileage; - - @Column(name = "alarm_engine_torque_mode") - private String alarmEngineTorqueMode; - - @Column(name = "alarm_accelerator_pedal") - private Double alarmAcceleratorPedal; - - @Column(name = "alarm_total_oil_consumption") - private Double alarmTotalOilConsumption; - - @Column(name = "alarm_urea_box_temp") - private Double alarmUreaBoxTemp; - - @Column(name = "alarm_urea_volume") - private Integer alarmUreaVolume; - - @Column(name = "alarm_total_urea_consume") - private Double alarmTotalUreaConsume; - - @Column(name = "alarm_DPF_temp") - private Double alarmDpfTemp; - - @Column(name = "alarm_firmware_version") - private String alarmFirmwareVersion; - - /** - * @return id - */ - public Integer getId() { - return id; - } - - /** - * @param id - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * @return obd_vin - */ - public String getObdVin() { - return obdVin; - } - - /** - * @param obdVin - */ - public void setObdVin(String obdVin) { - this.obdVin = obdVin == null ? null : obdVin.trim(); - } - - /** - * @return alarm_time - */ - public Date getAlarmTime() { - return alarmTime; - } - - /** - * @param alarmTime - */ - public void setAlarmTime(Date alarmTime) { - this.alarmTime = alarmTime; - } - - /** - * @return alarm_lng - */ - public Double getAlarmLng() { - return alarmLng; - } - - /** - * @param alarmLng - */ - public void setAlarmLng(Double alarmLng) { - this.alarmLng = alarmLng; - } - - /** - * @return alarm_lat - */ - public Double getAlarmLat() { - return alarmLat; - } - - /** - * @param alarmLat - */ - public void setAlarmLat(Double alarmLat) { - this.alarmLat = alarmLat; - } - - /** - * @return alarm_protocol - */ - public Integer getAlarmProtocol() { - return alarmProtocol; - } - - /** - * @param alarmProtocol - */ - public void setAlarmProtocol(Integer alarmProtocol) { - this.alarmProtocol = alarmProtocol; - } - - /** - * @return alarm_mil - */ - public Integer getAlarmMil() { - return alarmMil; - } - - /** - * @param alarmMil - */ - public void setAlarmMil(Integer alarmMil) { - this.alarmMil = alarmMil; - } - - /** - * @return alarm_id_code - */ - public String getAlarmIdCode() { - return alarmIdCode; - } - - /** - * @param alarmIdCode - */ - public void setAlarmIdCode(String alarmIdCode) { - this.alarmIdCode = alarmIdCode == null ? null : alarmIdCode.trim(); - } - - /** - * @return alarm_verification_code - */ - public String getAlarmVerificationCode() { - return alarmVerificationCode; - } - - /** - * @param alarmVerificationCode - */ - public void setAlarmVerificationCode(String alarmVerificationCode) { - this.alarmVerificationCode = alarmVerificationCode == null ? null : alarmVerificationCode.trim(); - } - - /** - * @return alarm_fault_code_num - */ - public Integer getAlarmFaultCodeNum() { - return alarmFaultCodeNum; - } - - /** - * @param alarmFaultCodeNum - */ - public void setAlarmFaultCodeNum(Integer alarmFaultCodeNum) { - this.alarmFaultCodeNum = alarmFaultCodeNum; - } - - /** - * @return alarm_fault_code - */ - public String getAlarmFaultCode() { - return alarmFaultCode; - } - - /** - * @param alarmFaultCode - */ - public void setAlarmFaultCode(String alarmFaultCode) { - this.alarmFaultCode = alarmFaultCode == null ? null : alarmFaultCode.trim(); - } - - /** - * @return alarm_speed - */ - public Integer getAlarmSpeed() { - return alarmSpeed; - } - - /** - * @param alarmSpeed - */ - public void setAlarmSpeed(Integer alarmSpeed) { - this.alarmSpeed = alarmSpeed; - } - - /** - * @return alarm_air_pressure - */ - public Double getAlarmAirPressure() { - return alarmAirPressure; - } - - /** - * @param alarmAirPressure - */ - public void setAlarmAirPressure(Double alarmAirPressure) { - this.alarmAirPressure = alarmAirPressure; - } - - /** - * @return alarm_engine_torque - */ - public Double getAlarmEngineTorque() { - return alarmEngineTorque; - } - - /** - * @param alarmEngineTorque - */ - public void setAlarmEngineTorque(Double alarmEngineTorque) { - this.alarmEngineTorque = alarmEngineTorque; - } - - /** - * @return alarm_friction_torque - */ - public Double getAlarmFrictionTorque() { - return alarmFrictionTorque; - } - - /** - * @param alarmFrictionTorque - */ - public void setAlarmFrictionTorque(Double alarmFrictionTorque) { - this.alarmFrictionTorque = alarmFrictionTorque; - } - - /** - * @return alarm_engine_rpm - */ - public Integer getAlarmEngineRpm() { - return alarmEngineRpm; - } - - /** - * @param alarmEngineRpm - */ - public void setAlarmEngineRpm(Integer alarmEngineRpm) { - this.alarmEngineRpm = alarmEngineRpm; - } - - /** - * @return alarm_start_fuel_flow - */ - public Double getAlarmStartFuelFlow() { - return alarmStartFuelFlow; - } - - /** - * @param alarmStartFuelFlow - */ - public void setAlarmStartFuelFlow(Double alarmStartFuelFlow) { - this.alarmStartFuelFlow = alarmStartFuelFlow; - } - - /** - * @return alarm_scr_upstream_NO - */ - public Double getAlarmScrUpstreamNo() { - return alarmScrUpstreamNo; - } - - /** - * @param alarmScrUpstreamNo - */ - public void setAlarmScrUpstreamNo(Double alarmScrUpstreamNo) { - this.alarmScrUpstreamNo = alarmScrUpstreamNo; - } - - /** - * @return alarm_scr_downstream_NO - */ - public Double getAlarmScrDownstreamNo() { - return alarmScrDownstreamNo; - } - - /** - * @param alarmScrDownstreamNo - */ - public void setAlarmScrDownstreamNo(Double alarmScrDownstreamNo) { - this.alarmScrDownstreamNo = alarmScrDownstreamNo; - } - - /** - * @return alarm_remain_reactant - */ - public Double getAlarmRemainReactant() { - return alarmRemainReactant; - } - - /** - * @param alarmRemainReactant - */ - public void setAlarmRemainReactant(Double alarmRemainReactant) { - this.alarmRemainReactant = alarmRemainReactant; - } - - /** - * @return alarm_air_input - */ - public Double getAlarmAirInput() { - return alarmAirInput; - } - - /** - * @param alarmAirInput - */ - public void setAlarmAirInput(Double alarmAirInput) { - this.alarmAirInput = alarmAirInput; - } - - /** - * @return alarm_scr_input_temp - */ - public Double getAlarmScrInputTemp() { - return alarmScrInputTemp; - } - - /** - * @param alarmScrInputTemp - */ - public void setAlarmScrInputTemp(Double alarmScrInputTemp) { - this.alarmScrInputTemp = alarmScrInputTemp; - } - - /** - * @return alarm_scr_output_temp - */ - public Double getAlarmScrOutputTemp() { - return alarmScrOutputTemp; - } - - /** - * @param alarmScrOutputTemp - */ - public void setAlarmScrOutputTemp(Double alarmScrOutputTemp) { - this.alarmScrOutputTemp = alarmScrOutputTemp; - } - - /** - * @return alarm_DPF - */ - public Double getAlarmDpf() { - return alarmDpf; - } - - /** - * @param alarmDpf - */ - public void setAlarmDpf(Double alarmDpf) { - this.alarmDpf = alarmDpf; - } - - /** - * @return alarm_engine_coolant_temp - */ - public Double getAlarmEngineCoolantTemp() { - return alarmEngineCoolantTemp; - } - - /** - * @param alarmEngineCoolantTemp - */ - public void setAlarmEngineCoolantTemp(Double alarmEngineCoolantTemp) { - this.alarmEngineCoolantTemp = alarmEngineCoolantTemp; - } - - /** - * @return alarm_fuel_level - */ - public Double getAlarmFuelLevel() { - return alarmFuelLevel; - } - - /** - * @param alarmFuelLevel - */ - public void setAlarmFuelLevel(Double alarmFuelLevel) { - this.alarmFuelLevel = alarmFuelLevel; - } - - /** - * @return alarm_location_status - */ - public Integer getAlarmLocationStatus() { - return alarmLocationStatus; - } - - /** - * @param alarmLocationStatus - */ - public void setAlarmLocationStatus(Integer alarmLocationStatus) { - this.alarmLocationStatus = alarmLocationStatus; - } - - /** - * @return alarm_total_mileage - */ - public Double getAlarmTotalMileage() { - return alarmTotalMileage; - } - - /** - * @param alarmTotalMileage - */ - public void setAlarmTotalMileage(Double alarmTotalMileage) { - this.alarmTotalMileage = alarmTotalMileage; - } - - /** - * @return alarm_engine_torque_mode - */ - public String getAlarmEngineTorqueMode() { - return alarmEngineTorqueMode; - } - - /** - * @param alarmEngineTorqueMode - */ - public void setAlarmEngineTorqueMode(String alarmEngineTorqueMode) { - this.alarmEngineTorqueMode = alarmEngineTorqueMode == null ? null : alarmEngineTorqueMode.trim(); - } - - /** - * @return alarm_accelerator_pedal - */ - public Double getAlarmAcceleratorPedal() { - return alarmAcceleratorPedal; - } - - /** - * @param alarmAcceleratorPedal - */ - public void setAlarmAcceleratorPedal(Double alarmAcceleratorPedal) { - this.alarmAcceleratorPedal = alarmAcceleratorPedal; - } - - /** - * @return alarm_total_oil_consumption - */ - public Double getAlarmTotalOilConsumption() { - return alarmTotalOilConsumption; - } - - /** - * @param alarmTotalOilConsumption - */ - public void setAlarmTotalOilConsumption(Double alarmTotalOilConsumption) { - this.alarmTotalOilConsumption = alarmTotalOilConsumption; - } - - /** - * @return alarm_urea_box_temp - */ - public Double getAlarmUreaBoxTemp() { - return alarmUreaBoxTemp; - } - - /** - * @param alarmUreaBoxTemp - */ - public void setAlarmUreaBoxTemp(Double alarmUreaBoxTemp) { - this.alarmUreaBoxTemp = alarmUreaBoxTemp; - } - - /** - * @return alarm_urea_volume - */ - public Integer getAlarmUreaVolume() { - return alarmUreaVolume; - } - - /** - * @param alarmUreaVolume - */ - public void setAlarmUreaVolume(Integer alarmUreaVolume) { - this.alarmUreaVolume = alarmUreaVolume; - } - - /** - * @return alarm_total_urea_consume - */ - public Double getAlarmTotalUreaConsume() { - return alarmTotalUreaConsume; - } - - /** - * @param alarmTotalUreaConsume - */ - public void setAlarmTotalUreaConsume(Double alarmTotalUreaConsume) { - this.alarmTotalUreaConsume = alarmTotalUreaConsume; - } - - /** - * @return alarm_DPF_temp - */ - public Double getAlarmDpfTemp() { - return alarmDpfTemp; - } - - /** - * @param alarmDpfTemp - */ - public void setAlarmDpfTemp(Double alarmDpfTemp) { - this.alarmDpfTemp = alarmDpfTemp; - } - - /** - * @return alarm_firmware_version - */ - public String getAlarmFirmwareVersion() { - return alarmFirmwareVersion; - } - - /** - * @param alarmFirmwareVersion - */ - public void setAlarmFirmwareVersion(String alarmFirmwareVersion) { - this.alarmFirmwareVersion = alarmFirmwareVersion == null ? null : alarmFirmwareVersion.trim(); - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/CarLogin.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/CarLogin.java deleted file mode 100644 index 583af4a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/CarLogin.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.flightfeather.uav.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/uav/domain/entity/CarLogout.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/CarLogout.java deleted file mode 100644 index 3c17d70..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/CarLogout.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.flightfeather.uav.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/uav/domain/entity/DataStream.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/DataStream.java deleted file mode 100644 index 7c4034a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/DataStream.java +++ /dev/null @@ -1,551 +0,0 @@ -package com.flightfeather.uav.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/uav/domain/entity/ObdData.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdData.java deleted file mode 100644 index 468aaae..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdData.java +++ /dev/null @@ -1,622 +0,0 @@ -package com.flightfeather.uav.domain.entity; - -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Date; -import javax.persistence.*; - -@Table(name = "obd_data") -@JsonInclude(JsonInclude.Include.NON_NULL) -public class ObdData { - @Id - private Integer id; - - @Column(name = "obd_vin") - private String obdVin; - - @Column(name = "obd_time") - private Date obdTime; - - @Column(name = "obd_lng") - private Double obdLng; - - @Column(name = "obd_lat") - private Double obdLat; - - @Column(name = "obd_protocol") - private Integer obdProtocol; - - @Column(name = "obd_mil") - private Integer obdMil; - - @Column(name = "obd_id_code") - private String obdIdCode; - - @Column(name = "obd_verification_code") - private String obdVerificationCode; - - @Column(name = "obd_fault_code_num") - private Integer obdFaultCodeNum; - - @Column(name = "obd_fault_code") - private String obdFaultCode; - - @Column(name = "obd_speed") - private Integer 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 Integer obdEngineRpm; - - @Column(name = "obd_start_fuel_flow") - private Double obdStartFuelFlow; - - @Column(name = "obd_scr_upstream_NO") - private Double obdScrUpstreamNo; - - @Column(name = "obd_scr_downstream_NO") - private Double obdScrDownstreamNo; - - @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 Integer obdLocationStatus; - - @Column(name = "obd_total_mileage") - private Double obdTotalMileage; - - @Column(name = "obd_engine_torque_mode") - private String 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 Integer obdUreaVolume; - - @Column(name = "obd_total_urea_consume") - private Double obdTotalUreaConsume; - - @Column(name = "obd_DPF_temp") - private Double obdDpfTemp; - - @Column(name = "obd_firmware_version") - private String obdFirmwareVersion; - - /** - * @return id - */ - public Integer getId() { - return id; - } - - /** - * @param id - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * @return obd_vin - */ - public String getObdVin() { - return obdVin; - } - - /** - * @param obdVin - */ - public void setObdVin(String obdVin) { - this.obdVin = obdVin == null ? null : obdVin.trim(); - } - - /** - * @return obd_time - */ - public Date getObdTime() { - return obdTime; - } - - /** - * @param obdTime - */ - public void setObdTime(Date obdTime) { - this.obdTime = obdTime; - } - - /** - * @return obd_lng - */ - public Double getObdLng() { - return obdLng; - } - - /** - * @param obdLng - */ - public void setObdLng(Double obdLng) { - this.obdLng = obdLng; - } - - /** - * @return obd_lat - */ - public Double getObdLat() { - return obdLat; - } - - /** - * @param obdLat - */ - public void setObdLat(Double obdLat) { - this.obdLat = obdLat; - } - - /** - * @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_id_code - */ - public String getObdIdCode() { - return obdIdCode; - } - - /** - * @param obdIdCode - */ - public void setObdIdCode(String obdIdCode) { - this.obdIdCode = obdIdCode == null ? null : obdIdCode.trim(); - } - - /** - * @return obd_verification_code - */ - public String getObdVerificationCode() { - return obdVerificationCode; - } - - /** - * @param obdVerificationCode - */ - public void setObdVerificationCode(String obdVerificationCode) { - this.obdVerificationCode = obdVerificationCode == null ? null : obdVerificationCode.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_speed - */ - public Integer getObdSpeed() { - return obdSpeed; - } - - /** - * @param obdSpeed - */ - public void setObdSpeed(Integer 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 Integer getObdEngineRpm() { - return obdEngineRpm; - } - - /** - * @param obdEngineRpm - */ - public void setObdEngineRpm(Integer obdEngineRpm) { - this.obdEngineRpm = obdEngineRpm; - } - - /** - * @return obd_start_fuel_flow - */ - public Double getObdStartFuelFlow() { - return obdStartFuelFlow; - } - - /** - * @param obdStartFuelFlow - */ - public void setObdStartFuelFlow(Double obdStartFuelFlow) { - this.obdStartFuelFlow = obdStartFuelFlow; - } - - /** - * @return obd_scr_upstream_NO - */ - public Double getObdScrUpstreamNo() { - return obdScrUpstreamNo; - } - - /** - * @param obdScrUpstreamNo - */ - public void setObdScrUpstreamNo(Double obdScrUpstreamNo) { - this.obdScrUpstreamNo = obdScrUpstreamNo; - } - - /** - * @return obd_scr_downstream_NO - */ - public Double getObdScrDownstreamNo() { - return obdScrDownstreamNo; - } - - /** - * @param obdScrDownstreamNo - */ - public void setObdScrDownstreamNo(Double obdScrDownstreamNo) { - this.obdScrDownstreamNo = obdScrDownstreamNo; - } - - /** - * @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 Integer getObdLocationStatus() { - return obdLocationStatus; - } - - /** - * @param obdLocationStatus - */ - public void setObdLocationStatus(Integer obdLocationStatus) { - this.obdLocationStatus = obdLocationStatus; - } - - /** - * @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 String getObdEngineTorqueMode() { - return obdEngineTorqueMode; - } - - /** - * @param obdEngineTorqueMode - */ - public void setObdEngineTorqueMode(String obdEngineTorqueMode) { - this.obdEngineTorqueMode = obdEngineTorqueMode == null ? null : obdEngineTorqueMode.trim(); - } - - /** - * @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 Integer getObdUreaVolume() { - return obdUreaVolume; - } - - /** - * @param obdUreaVolume - */ - public void setObdUreaVolume(Integer 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_firmware_version - */ - public String getObdFirmwareVersion() { - return obdFirmwareVersion; - } - - /** - * @param obdFirmwareVersion - */ - public void setObdFirmwareVersion(String obdFirmwareVersion) { - this.obdFirmwareVersion = obdFirmwareVersion == null ? null : obdFirmwareVersion.trim(); - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdInfo.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdInfo.java deleted file mode 100644 index b23c6d7..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdInfo.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.flightfeather.uav.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/uav/domain/entity/ObdUser.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdUser.java deleted file mode 100644 index 4575a81..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/ObdUser.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.flightfeather.uav.domain.entity; - -import javax.persistence.*; - -@Table(name = "obd_user") -public class ObdUser { - @Id - private Integer id; - - @Column(name = "obd_vin") - private String obdVin; - - @Column(name = "obd_user_id") - private Double obdUserId; - - @Column(name = "obd_user_name") - private String obdUserName; - - @Column(name = "obd_user_password") - private String obdUserPassword; - - /** - * @return id - */ - public Integer getId() { - return id; - } - - /** - * @param id - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * @return obd_vin - */ - public String getObdVin() { - return obdVin; - } - - /** - * @param obdVin - */ - public void setObdVin(String obdVin) { - this.obdVin = obdVin == null ? null : obdVin.trim(); - } - - /** - * @return obd_user_id - */ - public Double getObdUserId() { - return obdUserId; - } - - /** - * @param obdUserId - */ - public void setObdUserId(Double obdUserId) { - this.obdUserId = obdUserId; - } - - /** - * @return obd_user_name - */ - public String getObdUserName() { - return obdUserName; - } - - /** - * @param obdUserName - */ - public void setObdUserName(String obdUserName) { - this.obdUserName = obdUserName == null ? null : obdUserName.trim(); - } - - /** - * @return obd_user_password - */ - public String getObdUserPassword() { - return obdUserPassword; - } - - /** - * @param obdUserPassword - */ - public void setObdUserPassword(String obdUserPassword) { - this.obdUserPassword = obdUserPassword == null ? null : obdUserPassword.trim(); - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/OriginData.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/OriginData.java deleted file mode 100644 index 8185848..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/OriginData.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.flightfeather.uav.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/uav/domain/entity/RealTimeData.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/RealTimeData.java new file mode 100644 index 0000000..e7d33db --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/domain/entity/RealTimeData.java @@ -0,0 +1,156 @@ +package com.flightfeather.uav.domain.entity; + +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.*; + +@Table(name = "air_real_time_data") +public class RealTimeData { + @Id + private Integer id; + + @Column(name = "device_code") + private String deviceCode; + + private BigDecimal latitude; + + private BigDecimal longitude; + + private Float altitude; + + private Float height; + + @Column(name = "data_time") + private Date dataTime; + + @Column(name = "create_time") + private Date createTime; + + private String factors; + + /** + * @return id + */ + public Integer getId() { + return id; + } + + /** + * @param id + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * @return device_code + */ + public String getDeviceCode() { + return deviceCode; + } + + /** + * @param deviceCode + */ + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode == null ? null : deviceCode.trim(); + } + + /** + * @return latitude + */ + public BigDecimal getLatitude() { + return latitude; + } + + /** + * @param latitude + */ + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } + + /** + * @return longitude + */ + public BigDecimal getLongitude() { + return longitude; + } + + /** + * @param longitude + */ + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + + /** + * @return altitude + */ + public Float getAltitude() { + return altitude; + } + + /** + * @param altitude + */ + public void setAltitude(Float altitude) { + this.altitude = altitude; + } + + /** + * @return height + */ + public Float getHeight() { + return height; + } + + /** + * @param height + */ + public void setHeight(Float height) { + this.height = height; + } + + /** + * @return data_time + */ + public Date getDataTime() { + return dataTime; + } + + /** + * @param dataTime + */ + public void setDataTime(Date dataTime) { + this.dataTime = dataTime; + } + + /** + * @return create_time + */ + public Date getCreateTime() { + return createTime; + } + + /** + * @param createTime + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * @return factors + */ + public String getFactors() { + return factors; + } + + /** + * @param factors + */ + public void setFactors(String factors) { + this.factors = factors == null ? null : factors.trim(); + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/ThresholdValue.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/ThresholdValue.java deleted file mode 100644 index 7defa1c..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/ThresholdValue.java +++ /dev/null @@ -1,499 +0,0 @@ -package com.flightfeather.uav.domain.entity; - -import javax.persistence.*; - -@Table(name = "obd_threshold_value") -public class ThresholdValue { - @Id - private Integer id; - - @Column(name = "obd_vin") - private String obdVin; - - @Column(name = "th_mil") - private Integer thMil; - - @Column(name = "th_fault_code_num") - private Integer thFaultCodeNum; - - @Column(name = "th_fault_code") - private String thFaultCode; - - @Column(name = "th_speed") - private Integer thSpeed; - - @Column(name = "th_air_pressure") - private Double thAirPressure; - - @Column(name = "th_engine_torque") - private Double thEngineTorque; - - @Column(name = "th_friction_torque") - private Double thFrictionTorque; - - @Column(name = "th_engine_rpm") - private Integer thEngineRpm; - - @Column(name = "th_start_fuel_flow") - private Double thStartFuelFlow; - - @Column(name = "th_scr_upstream_NO") - private Double thScrUpstreamNo; - - @Column(name = "th_scr_downstream_NO") - private Double thScrDownstreamNo; - - @Column(name = "th_remain_reactant") - private Double thRemainReactant; - - @Column(name = "th_air_input") - private Double thAirInput; - - @Column(name = "th_scr_input_temp") - private Double thScrInputTemp; - - @Column(name = "th_scr_output_temp") - private Double thScrOutputTemp; - - @Column(name = "th_DPF") - private Double thDpf; - - @Column(name = "th_engine_coolant_temp") - private Double thEngineCoolantTemp; - - @Column(name = "th_fuel_level") - private Double thFuelLevel; - - @Column(name = "th_location_status") - private Integer thLocationStatus; - - @Column(name = "th_total_mileage") - private Double thTotalMileage; - - @Column(name = "th_engine_torque_mode") - private String thEngineTorqueMode; - - @Column(name = "th_accelerator_pedal") - private Double thAcceleratorPedal; - - @Column(name = "th_total_oil_consumption") - private Double thTotalOilConsumption; - - @Column(name = "th_urea_box_temp") - private Double thUreaBoxTemp; - - @Column(name = "th_urea_volume") - private Integer thUreaVolume; - - @Column(name = "th_total_urea_consume") - private Double thTotalUreaConsume; - - @Column(name = "th_DPF_temp") - private Double thDpfTemp; - - /** - * @return id - */ - public Integer getId() { - return id; - } - - /** - * @param id - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * @return obd_vin - */ - public String getObdVin() { - return obdVin; - } - - /** - * @param obdVin - */ - public void setObdVin(String obdVin) { - this.obdVin = obdVin == null ? null : obdVin.trim(); - } - - /** - * @return th_mil - */ - public Integer getThMil() { - return thMil; - } - - /** - * @param thMil - */ - public void setThMil(Integer thMil) { - this.thMil = thMil; - } - - /** - * @return th_fault_code_num - */ - public Integer getThFaultCodeNum() { - return thFaultCodeNum; - } - - /** - * @param thFaultCodeNum - */ - public void setThFaultCodeNum(Integer thFaultCodeNum) { - this.thFaultCodeNum = thFaultCodeNum; - } - - /** - * @return th_fault_code - */ - public String getThFaultCode() { - return thFaultCode; - } - - /** - * @param thFaultCode - */ - public void setThFaultCode(String thFaultCode) { - this.thFaultCode = thFaultCode == null ? null : thFaultCode.trim(); - } - - /** - * @return th_speed - */ - public Integer getThSpeed() { - return thSpeed; - } - - /** - * @param thSpeed - */ - public void setThSpeed(Integer thSpeed) { - this.thSpeed = thSpeed; - } - - /** - * @return th_air_pressure - */ - public Double getThAirPressure() { - return thAirPressure; - } - - /** - * @param thAirPressure - */ - public void setThAirPressure(Double thAirPressure) { - this.thAirPressure = thAirPressure; - } - - /** - * @return th_engine_torque - */ - public Double getThEngineTorque() { - return thEngineTorque; - } - - /** - * @param thEngineTorque - */ - public void setThEngineTorque(Double thEngineTorque) { - this.thEngineTorque = thEngineTorque; - } - - /** - * @return th_friction_torque - */ - public Double getThFrictionTorque() { - return thFrictionTorque; - } - - /** - * @param thFrictionTorque - */ - public void setThFrictionTorque(Double thFrictionTorque) { - this.thFrictionTorque = thFrictionTorque; - } - - /** - * @return th_engine_rpm - */ - public Integer getThEngineRpm() { - return thEngineRpm; - } - - /** - * @param thEngineRpm - */ - public void setThEngineRpm(Integer thEngineRpm) { - this.thEngineRpm = thEngineRpm; - } - - /** - * @return th_start_fuel_flow - */ - public Double getThStartFuelFlow() { - return thStartFuelFlow; - } - - /** - * @param thStartFuelFlow - */ - public void setThStartFuelFlow(Double thStartFuelFlow) { - this.thStartFuelFlow = thStartFuelFlow; - } - - /** - * @return th_scr_upstream_NO - */ - public Double getThScrUpstreamNo() { - return thScrUpstreamNo; - } - - /** - * @param thScrUpstreamNo - */ - public void setThScrUpstreamNo(Double thScrUpstreamNo) { - this.thScrUpstreamNo = thScrUpstreamNo; - } - - /** - * @return th_scr_downstream_NO - */ - public Double getThScrDownstreamNo() { - return thScrDownstreamNo; - } - - /** - * @param thScrDownstreamNo - */ - public void setThScrDownstreamNo(Double thScrDownstreamNo) { - this.thScrDownstreamNo = thScrDownstreamNo; - } - - /** - * @return th_remain_reactant - */ - public Double getThRemainReactant() { - return thRemainReactant; - } - - /** - * @param thRemainReactant - */ - public void setThRemainReactant(Double thRemainReactant) { - this.thRemainReactant = thRemainReactant; - } - - /** - * @return th_air_input - */ - public Double getThAirInput() { - return thAirInput; - } - - /** - * @param thAirInput - */ - public void setThAirInput(Double thAirInput) { - this.thAirInput = thAirInput; - } - - /** - * @return th_scr_input_temp - */ - public Double getThScrInputTemp() { - return thScrInputTemp; - } - - /** - * @param thScrInputTemp - */ - public void setThScrInputTemp(Double thScrInputTemp) { - this.thScrInputTemp = thScrInputTemp; - } - - /** - * @return th_scr_output_temp - */ - public Double getThScrOutputTemp() { - return thScrOutputTemp; - } - - /** - * @param thScrOutputTemp - */ - public void setThScrOutputTemp(Double thScrOutputTemp) { - this.thScrOutputTemp = thScrOutputTemp; - } - - /** - * @return th_DPF - */ - public Double getThDpf() { - return thDpf; - } - - /** - * @param thDpf - */ - public void setThDpf(Double thDpf) { - this.thDpf = thDpf; - } - - /** - * @return th_engine_coolant_temp - */ - public Double getThEngineCoolantTemp() { - return thEngineCoolantTemp; - } - - /** - * @param thEngineCoolantTemp - */ - public void setThEngineCoolantTemp(Double thEngineCoolantTemp) { - this.thEngineCoolantTemp = thEngineCoolantTemp; - } - - /** - * @return th_fuel_level - */ - public Double getThFuelLevel() { - return thFuelLevel; - } - - /** - * @param thFuelLevel - */ - public void setThFuelLevel(Double thFuelLevel) { - this.thFuelLevel = thFuelLevel; - } - - /** - * @return th_location_status - */ - public Integer getThLocationStatus() { - return thLocationStatus; - } - - /** - * @param thLocationStatus - */ - public void setThLocationStatus(Integer thLocationStatus) { - this.thLocationStatus = thLocationStatus; - } - - /** - * @return th_total_mileage - */ - public Double getThTotalMileage() { - return thTotalMileage; - } - - /** - * @param thTotalMileage - */ - public void setThTotalMileage(Double thTotalMileage) { - this.thTotalMileage = thTotalMileage; - } - - /** - * @return th_engine_torque_mode - */ - public String getThEngineTorqueMode() { - return thEngineTorqueMode; - } - - /** - * @param thEngineTorqueMode - */ - public void setThEngineTorqueMode(String thEngineTorqueMode) { - this.thEngineTorqueMode = thEngineTorqueMode == null ? null : thEngineTorqueMode.trim(); - } - - /** - * @return th_accelerator_pedal - */ - public Double getThAcceleratorPedal() { - return thAcceleratorPedal; - } - - /** - * @param thAcceleratorPedal - */ - public void setThAcceleratorPedal(Double thAcceleratorPedal) { - this.thAcceleratorPedal = thAcceleratorPedal; - } - - /** - * @return th_total_oil_consumption - */ - public Double getThTotalOilConsumption() { - return thTotalOilConsumption; - } - - /** - * @param thTotalOilConsumption - */ - public void setThTotalOilConsumption(Double thTotalOilConsumption) { - this.thTotalOilConsumption = thTotalOilConsumption; - } - - /** - * @return th_urea_box_temp - */ - public Double getThUreaBoxTemp() { - return thUreaBoxTemp; - } - - /** - * @param thUreaBoxTemp - */ - public void setThUreaBoxTemp(Double thUreaBoxTemp) { - this.thUreaBoxTemp = thUreaBoxTemp; - } - - /** - * @return th_urea_volume - */ - public Integer getThUreaVolume() { - return thUreaVolume; - } - - /** - * @param thUreaVolume - */ - public void setThUreaVolume(Integer thUreaVolume) { - this.thUreaVolume = thUreaVolume; - } - - /** - * @return th_total_urea_consume - */ - public Double getThTotalUreaConsume() { - return thTotalUreaConsume; - } - - /** - * @param thTotalUreaConsume - */ - public void setThTotalUreaConsume(Double thTotalUreaConsume) { - this.thTotalUreaConsume = thTotalUreaConsume; - } - - /** - * @return th_DPF_temp - */ - public Double getThDpfTemp() { - return thDpfTemp; - } - - /** - * @param thDpfTemp - */ - public void setThDpfTemp(Double thDpfTemp) { - this.thDpfTemp = thDpfTemp; - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/VehicleInfo.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/VehicleInfo.java deleted file mode 100644 index 8969e7f..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/entity/VehicleInfo.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.flightfeather.uav.domain.entity; - -import javax.persistence.*; - -@Table(name = "obd_vehicle_info") -public class VehicleInfo { - @Id - private Integer id; - - @Column(name = "obd_device_code") - private String obdDeviceCode; - - @Column(name = "obd_vin") - private String obdVin; - - @Column(name = "obd_licence_plate") - private String obdLicencePlate; - - /** - * 0: 闆嗗崱锛� 1锛氭福鍦熻溅 - */ - @Column(name = "obd_vehicle_type") - private Integer obdVehicleType; - - /** - * @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_vin - */ - public String getObdVin() { - return obdVin; - } - - /** - * @param obdVin - */ - public void setObdVin(String obdVin) { - this.obdVin = obdVin == null ? null : obdVin.trim(); - } - - /** - * @return obd_licence_plate - */ - public String getObdLicencePlate() { - return obdLicencePlate; - } - - /** - * @param obdLicencePlate - */ - public void setObdLicencePlate(String obdLicencePlate) { - this.obdLicencePlate = obdLicencePlate == null ? null : obdLicencePlate.trim(); - } - - /** - * 鑾峰彇1: 闆嗗崱锛� 2锛氭福鍦熻溅 - * - * @return obd_vehicle_type - 1: 闆嗗崱锛� 2锛氭福鍦熻溅 - */ - public Integer getObdVehicleType() { - return obdVehicleType; - } - - /** - * 璁剧疆1: 闆嗗崱锛� 2锛氭福鍦熻溅 - * - * @param obdVehicleType 1: 闆嗗崱锛� 2锛氭福鍦熻溅 - */ - public void setObdVehicleType(Integer obdVehicleType) { - this.obdVehicleType = obdVehicleType; - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/AlarmDataMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/AlarmDataMapper.kt deleted file mode 100644 index ca3242e..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/AlarmDataMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.domain.entity.AlarmData -import org.apache.ibatis.annotations.Mapper - -@Mapper -interface AlarmDataMapper : MyMapper<AlarmData> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/CarLoginMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/CarLoginMapper.kt deleted file mode 100644 index a45152b..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/CarLoginMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.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/uav/domain/mapper/CarLogoutMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/CarLogoutMapper.kt deleted file mode 100644 index f594a22..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/CarLogoutMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.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/uav/domain/mapper/DataStreamMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/DataStreamMapper.kt deleted file mode 100644 index 29c06f0..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/DataStreamMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.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/uav/domain/mapper/ObdDataMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdDataMapper.kt deleted file mode 100644 index bd6bf26..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdDataMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.domain.entity.ObdData -import org.apache.ibatis.annotations.Mapper - -@Mapper -interface ObdDataMapper : MyMapper<ObdData> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdInfoMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdInfoMapper.kt deleted file mode 100644 index 2f50397..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdInfoMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.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/uav/domain/mapper/ObdUserMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdUserMapper.kt deleted file mode 100644 index 2f6bf1a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/ObdUserMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.domain.entity.ObdUser -import org.apache.ibatis.annotations.Mapper - -@Mapper -interface ObdUserMapper : MyMapper<ObdUser> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/OriginDataMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/OriginDataMapper.kt deleted file mode 100644 index dd95e02..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/OriginDataMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.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/uav/domain/mapper/RealTimeDataMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/RealTimeDataMapper.kt new file mode 100644 index 0000000..7fd9e33 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/domain/mapper/RealTimeDataMapper.kt @@ -0,0 +1,8 @@ +package com.flightfeather.uav.domain.mapper + +import com.flightfeather.uav.domain.MyMapper +import com.flightfeather.uav.domain.entity.RealTimeData +import org.apache.ibatis.annotations.Mapper + +@Mapper +interface RealTimeDataMapper : MyMapper<RealTimeData> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/ThresholdValueMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/ThresholdValueMapper.kt deleted file mode 100644 index 7626536..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/ThresholdValueMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.domain.entity.ThresholdValue -import org.apache.ibatis.annotations.Mapper - -@Mapper -interface ThresholdValueMapper : MyMapper<ThresholdValue> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/VehicleInfoMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/VehicleInfoMapper.kt deleted file mode 100644 index df9b1c7..0000000 --- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/VehicleInfoMapper.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.flightfeather.uav.domain.mapper - -import com.flightfeather.uav.domain.MyMapper -import com.flightfeather.uav.domain.entity.VehicleInfo -import org.apache.ibatis.annotations.Mapper - -@Mapper -interface VehicleInfoMapper : MyMapper<VehicleInfo> \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/AlarmDataVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/AlarmDataVo.kt deleted file mode 100644 index 6abfb2b..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/AlarmDataVo.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import java.util.* - -/** - * @author riku - * Date: 2019/9/2 - */ -class AlarmDataVo :BaseJson() { - var id: Int? = null - var obdVin: String? = null - var alarmTime: Date? = null - var alarmLng: Double? = null - var alarmLat: Double? = null - var alarmProtocol: Int? = null - var alarmMil: Int? = null - var alarmIdCode: String? = null - var alarmVerificationCode: String? = null - var alarmFaultCodeNum: Int? = null - var alarmFaultCode: String? = null - var alarmSpeed: Int? = null - var alarmAirPressure: Double? = null - var alarmEngineTorque: Double? = null - var alarmFrictionTorque: Double? = null - var alarmEngineRpm: Int? = null - var alarmStartFuelFlow: Double? = null - var alarmScrUpstreamNo: Double? = null - var alarmScrDownstreamNo: Double? = null - var alarmRemainReactant: Double? = null - var alarmAirInput: Double? = null - var alarmScrInputTemp: Double? = null - var alarmScrOutputTemp: Double? = null - var alarmDpf: Double? = null - var alarmEngineCoolantTemp: Double? = null - var alarmFuelLevel: Double? = null - var alarmLocationStatus: Int? = null - var alarmTotalMileage: Double? = null - var alarmEngineTorqueMode: String? = null - var alarmAcceleratorPedal: Double? = null - var alarmTotalOilConsumption: Double? = null - var alarmUreaBoxTemp: Double? = null - var alarmUreaVolume: Int? = null - var alarmTotalUreaConsume: Double? = null - var alarmDpfTemp: Double? = null - var alarmFirmwareVersion: String? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/CarLoginVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/CarLoginVo.kt deleted file mode 100644 index 91917d8..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/CarLoginVo.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import java.util.* - -/** - * @author riku - * Date: 2019/9/19 - */ -class CarLoginVo : BaseJson() { - var id: Int? = null - var obdDeviceCode: String? = null - var loginCreateTime: Date? = null - var loginDataTime: Date? = null - var loginSerialNum: Int? = null - var loginSimCode: String? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/CarLogoutVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/CarLogoutVo.kt deleted file mode 100644 index 1a3cbf7..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/CarLogoutVo.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import java.util.* - -/** - * @author riku - * Date: 2019/9/19 - */ -class CarLogoutVo : BaseJson() { - var id: Int? = null - var obdDeviceCode: String? = null - var loginCreateTime: Date? = null - var loginDataTime: Date? = null - var loginSerialNum: Int? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataStreamVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataStreamVo.kt deleted file mode 100644 index cd5308f..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/DataStreamVo.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import java.util.* - -/** - * @author riku - * Date: 2019/9/19 - */ -class DataStreamVo : BaseJson() { - var id: Int?= null - var obdDeviceCode: String?= null - var obdCreateTime: Date?= null - var obdDataTime: Date?= null - var obdSerialNum: Int?= null - var obdSpeed: Double?= null - var obdAirPressure: Double?= null - var obdEngineTorque: Double?= null - var obdFrictionTorque: Double?= null - var obdEngineRpm: Double?= null - var obdEngineFuelFlow: Double?= null - var obdScrUpstreamNox: Double?= null - var obdScrDownstreamNox: Double?= null - var obdRemainReactant: Double?= null - var obdAirInput: Double?= null - var obdScrInputTemp: Double?= null - var obdScrOutputTemp: Double?= null - var obdDpf: Double?= null - var obdEngineCoolantTemp: Double?= null - var obdFuelLevel: Double?= null - var obdLocationStatus: String?= null - var obdLong: Double?= null - var obdLat: Double?= null - var obdTotalMileage: Double?= null - var obdEngineTorqueMode: Int?= null - var obdAcceleratorPedal: Double?= null - var obdTotalOilConsumption: Double?= null - var obdUreaBoxTemp: Double?= null - var obdUreaVolume: Double?= null - var obdTotalUreaConsume: Double?= null - var obdDpfTemp: Double?= null - var obdStatus: Boolean?= null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/LatLngVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/LatLngVo.kt deleted file mode 100644 index 33ab5f5..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/LatLngVo.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import java.util.* - -/** - * @author riku - * Date: 2019/9/19 - */ -class LatLngVo : BaseJson() { - var deviceCode: String? = null - var vin: String? = null - var license: String? = null - var obdDataTime: Date? = null - //杞﹁締绫诲瀷 - var carType: Int? = null - //杞﹁締鐘舵�� - var status: Int = 0 - var lat: Double? = null - var lng: Double? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdDataVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdDataVo.kt deleted file mode 100644 index 7f41288..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdDataVo.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import com.google.gson.annotations.SerializedName -import java.util.* - -class ObdDataVo : BaseJson() { - var id: Int? = null - @SerializedName("vin") - var obdVin: String? = null - var obdTime: Date? = null - var obdLng: Double? = null - var obdLat: Double? = null - @SerializedName("protocol") - var obdProtocol: Int? = null - var obdMil: Int? = null - var obdIdCode: String? = null - var obdVerificationCode: String? = null - var obdFaultCodeNum: Int? = null - var obdFaultCode: String? = null - var obdSpeed: Int? = null - var obdAirPressure: Double? = null - var obdEngineTorque: Double? = null - var obdFrictionTorque: Double? = null - var obdEngineRpm: Int? = null - var obdEngineFuelFlow: Double? = null - var obdScrUpstreamNo: Double? = null - var obdScrDownstreamNo: Double? = null - var obdRemainReactant: Double? = null - var obdAirInput: Double? = null - var obdScrInputTemp: Double? = null - var obdScrOutputTemp: Double? = null - var obdDpf: Double? = null - var obdEngineCoolantTemp: Double? = null - var obdFuelLevel: Double? = null - var obdLocationStatus: Int? = null - var obdTotalMileage: Double? = null - var obdEngineTorqueMode: String? = null - var obdAcceleratorPedal: Double? = null - var obdTotalOilConsumption: Double? = null - var obdUreaBoxTemp: Double? = null - var obdUreaVolume: Int? = null - var obdTotalUreaConsume: Double? = null - var obdDpfTemp: Double? = null - var obdFirmwareVersion: String? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdInfoVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdInfoVo.kt deleted file mode 100644 index 7ab46a6..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdInfoVo.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -import java.util.* - -/** - * @author riku - * Date: 2019/9/19 - */ -class ObdInfoVo : BaseJson() { - var id: Int?= null - var obdDeviceCode: String?= null - var obdCreateTime: Date?= null - var obdDataTime: Date?= null - var obdSerialNum: Int?= null - var obdProtocol: Int?= null - var obdMil: Int?= null - var obdDiagnosisSupportStatus: String?= null - var obdDiagnosisReadyStatus: String?= null - var obdVin: String?= null - var obdCrn: String?= null - var obdCvn: String?= null - var obdIupr: String?= null - var obdFaultCodeNum: Int?= null - var obdFaultCode: String?= null - var obdStatus: Boolean?= null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdUserVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdUserVo.kt deleted file mode 100644 index 0461c78..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ObdUserVo.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - - -/** - * @author riku - * Date: 2019/9/2 - */ -class ObdUserVo : BaseJson() { - var id: Int? = null - var obdVin: String? = null - var obdUserId: Double? = null - var obdUserName: String? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ThresholdValueVo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ThresholdValueVo.kt deleted file mode 100644 index 44d25a4..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ThresholdValueVo.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.flightfeather.uav.lightshare.bean - -/** - * @author riku - * Date: 2019/9/2 - */ -class ThresholdValueVo : BaseJson() { - var id:Int? = null - var obdVin:String? = null - var thMil:Int? = null - var thFaultCodeNum:Int? = null - var thFaultCode:String? = null - var thSpeed:Int? = null - var thAirPressure:Double? = null - var thEngineTorque:Double? = null - var thFrictionTorque:Double? = null - var thEngineRpm:Int? = null - var thStartFuelFlow:Double? = null - var thScrUpstreamNo:Double? = null - var thScrDownstreamNo:Double? = null - var thRemainReactant:Double? = null - var thAirInput:Double? = null - var thScrInputTemp:Double? = null - var thScrOutputTemp:Double? = null - var thDpf:Double? = null - var thEngineCoolantTemp:Double? = null - var thFuelLevel:Double? = null - var thLocationStatus:Int? = null - var thTotalMileage:Double? = null - var thEngineTorqueMode:String? = null - var thAcceleratorPedal:Double? = null - var thTotalOilConsumption:Double? = null - var thUreaBoxTemp:Double? = null - var thUreaVolume:Int? = null - var thTotalUreaConsume:Double? = null - var thDpfTemp:Double? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdAlarmService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdAlarmService.kt deleted file mode 100644 index 70c794a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdAlarmService.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.flightfeather.uav.lightshare.service - -import com.flightfeather.uav.lightshare.bean.AlarmDataVo - -/** - * @author riku - * Date: 2019/9/5 - */ -interface ObdAlarmService { - - /** - * 鏍规嵁vin鐮佽幏鍙栬鎶ユ暟鎹� - */ - fun getAlarmByVinCode(vinCode: String, pageNum: Int?, pageSize: Int?): MutableList<AlarmDataVo> - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdDataService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdDataService.kt deleted file mode 100644 index 3faf50f..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdDataService.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.flightfeather.uav.lightshare.service - -import com.flightfeather.uav.lightshare.bean.* - -/** - * @author riku - * Date: 2019/8/27 - */ -interface ObdDataService { - - /** - * 鏍规嵁vin鐮佽幏鍙栧搴旀暟鎹� - */ - fun getDataByVinCode(vinCode: String?, pageNum: Int?, pageSize: Int?): MutableList<ObdDataVo> - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栫櫥褰曟暟鎹� - */ - fun getLoginData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLoginVo> - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栫櫥鍑烘暟鎹� - */ - fun getLogoutData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLogoutVo> - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙杘bd鏁版嵁 - */ - fun getObdInfo(deviceCode: String, pageNum: Int?, pageSize: Int?): List<ObdInfoVo> - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栨暟鎹祦鏁版嵁 - */ - fun getDataStream(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<DataStreamVo> - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栨暟鎹祦鏁版嵁璁℃暟 - */ - fun getDataStreamCount(deviceCode: String, startTime: String?, endTime: String?): Int - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栨渶鏂扮粡绾害 - */ - fun getCoordinate(deviceCode: String): LatLngVo - - /** - * 鏍规嵁缁堢璁惧鐮佷互鍙婃椂闀縯 鑾峰彇t涔嬪墠鍒扮幇鍦ㄧ殑鎵�鏈夎建杩瑰潗鏍� - */ - fun getTrack(deviceCode: String, startTime: String, endTime: String): List<LatLngVo> - - /** - * 鑾峰彇鏈�鏂扮殑杞﹁締鍧愭爣淇℃伅 - */ - fun getLatestCoordinate(pageNum: Int?, pageSize: Int?): List<LatLngVo> - - /** - * 鏍规嵁缁堢璁惧鐮佸強鏃堕棿娈碉紝缁欏嚭姝ゆ鏃堕棿鍐呯殑鍧愭爣 - */ - //TODO -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdThresholdValueService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdThresholdValueService.kt deleted file mode 100644 index 9366a45..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdThresholdValueService.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.flightfeather.uav.lightshare.service - -import com.flightfeather.uav.lightshare.bean.ThresholdValueVo - -/** - * @author riku - * Date: 2019/9/5 - */ -interface ObdThresholdValueService { - - /** - * 淇濆瓨 - */ - fun save(userId: String, thresholdValueVo: ThresholdValueVo): Boolean - - /** - * 鏇存柊 - */ - fun update(userId: String, thresholdValueVo: ThresholdValueVo): Boolean - - /** - * 鏍规嵁vin鐮佽幏鍙栧搴旈槇鍊� - */ - fun getDataByVinCode(vinCode: String): ThresholdValueVo? - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdUserService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdUserService.kt deleted file mode 100644 index 261dd26..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/ObdUserService.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.flightfeather.uav.lightshare.service - -import com.flightfeather.uav.lightshare.bean.ObdUserVo - -/** - * @author riku - * Date: 2019/9/6 - */ -interface ObdUserService { - - fun getUserInfo(userId: String): ObdUserVo? - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdAlarmServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdAlarmServiceImpl.kt deleted file mode 100644 index 9cd9de3..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdAlarmServiceImpl.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.flightfeather.uav.lightshare.service.impl - -import com.flightfeather.uav.lightshare.bean.AlarmDataVo -import com.flightfeather.uav.lightshare.service.ObdAlarmService -import com.flightfeather.uav.repository.ObdAlarmRepository -import org.springframework.stereotype.Service - -/** - * @author riku - * Date: 2019/9/5 - */ -@Service -class ObdAlarmServiceImpl(val obdAlarmRepository: ObdAlarmRepository) : ObdAlarmService { - - override fun getAlarmByVinCode(vinCode: String, pageNum: Int?, pageSize: Int?): MutableList<AlarmDataVo> { - return obdAlarmRepository.getAlarmByVinCode(vinCode, pageNum, pageSize) - } - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdDataServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdDataServiceImpl.kt deleted file mode 100644 index 6bf01cf..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdDataServiceImpl.kt +++ /dev/null @@ -1,164 +0,0 @@ -package com.flightfeather.uav.lightshare.service.impl - -import com.flightfeather.uav.lightshare.bean.* -import com.flightfeather.uav.lightshare.eunm.CarStatus -import com.flightfeather.uav.lightshare.service.ObdDataService -import com.flightfeather.uav.repository.* -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Service -import java.time.LocalDateTime -import java.time.ZoneId - -/** - * @author riku - * Date: 2019/8/27 - */ -@Service -class ObdDataServiceImpl( - val obdDataRepository: ObdDataRepository, - val carLoginRepository: CarLoginRepository, - val carLogoutRepository: CarLogoutRepository, - val obdInfoRepository: ObdInfoRepository, - val dataStreamRepository: DataStreamRepository, - val vehicleRepository: VehicleRepository -) : ObdDataService { - - override fun getDataByVinCode(vinCode: String?, pageNum: Int?, pageSize: Int?): MutableList<ObdDataVo>{ - val resultList = mutableListOf<ObdDataVo>() - - vehicleRepository.getVehicleInfo(pageNum, pageSize).forEach { vehicleInfo -> - val dataStream = dataStreamRepository.getLatestDataStream(vehicleInfo.obdDeviceCode) - val obdInfo = obdInfoRepository.getObdInfo(vehicleInfo.obdDeviceCode, 1, 1).takeIf { it.isNotEmpty() }?.get(0) - - resultList.add(ObdDataVo().apply { - obdVin = obdInfo?.obdDeviceCode - obdTime = dataStream?.obdDataTime - obdLng = dataStream?.obdLong - obdLat = dataStream?.obdLat - obdProtocol = obdInfo?.obdProtocol - obdMil = obdInfo?.obdMil -// obdIdCode -// obdVerificationCode - obdFaultCodeNum = obdInfo?.obdFaultCodeNum - obdFaultCode = obdInfo?.obdFaultCode - obdSpeed = dataStream?.obdSpeed?.toInt() - obdAirPressure = dataStream?.obdAirPressure - obdEngineTorque = dataStream?.obdEngineTorque - obdFrictionTorque = dataStream?.obdFrictionTorque - obdEngineRpm = dataStream?.obdEngineRpm?.toInt() - obdEngineFuelFlow = dataStream?.obdEngineFuelFlow - obdScrUpstreamNo = dataStream?.obdScrUpstreamNox - obdScrDownstreamNo = dataStream?.obdScrDownstreamNox - obdRemainReactant = dataStream?.obdRemainReactant - obdAirInput = dataStream?.obdAirInput - obdScrInputTemp = dataStream?.obdScrInputTemp - obdScrOutputTemp = dataStream?.obdScrOutputTemp - obdDpf = dataStream?.obdDpf - obdEngineCoolantTemp = dataStream?.obdEngineCoolantTemp - obdFuelLevel = dataStream?.obdFuelLevel -// obdLocationStatus = dataStream?.obdLocationStatus - obdTotalMileage = dataStream?.obdTotalMileage - obdEngineTorqueMode = dataStream?.obdEngineTorqueMode?.toString() - obdAcceleratorPedal = dataStream?.obdAcceleratorPedal - obdTotalOilConsumption = dataStream?.obdTotalOilConsumption - obdUreaBoxTemp = dataStream?.obdUreaBoxTemp - obdUreaVolume = dataStream?.obdUreaVolume?.toInt() - obdTotalUreaConsume = dataStream?.obdTotalUreaConsume - obdDpfTemp = dataStream?.obdDpfTemp -// obdFirmwareVersion = dataStream?. - }) - } - - return resultList - } - - override fun getLoginData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLoginVo> - = carLoginRepository.getLoginData(deviceCode, pageNum, pageSize, startTime, endTime) - - override fun getLogoutData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLogoutVo> - = carLogoutRepository.getLogoutData(deviceCode, pageNum, pageSize, startTime, endTime) - - override fun getObdInfo(deviceCode: String, pageNum: Int?, pageSize: Int?): List<ObdInfoVo>{ - val resultList = mutableListOf<ObdInfoVo>() - obdInfoRepository.getObdInfo(deviceCode, pageNum, pageSize).forEach { - val vo = ObdInfoVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - return resultList - } - - override fun getDataStream(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<DataStreamVo> - = dataStreamRepository.getDataStream(deviceCode, pageNum, pageSize, startTime, endTime) - - override fun getDataStreamCount(deviceCode: String, startTime: String?, endTime: String?): Int - = dataStreamRepository.getDataStreamCount(deviceCode, startTime, endTime) - - override fun getCoordinate(deviceCode: String): LatLngVo{ - val latLngVo = LatLngVo() - dataStreamRepository.getLatestDataStream(deviceCode)?.let { - latLngVo.apply { - this.deviceCode = it.obdDeviceCode - obdDataTime = it.obdDataTime - lat = it.obdLat - lng = it.obdLong - } - } - - return latLngVo - } - - override fun getTrack(deviceCode: String, startTime: String, endTime: String): List<LatLngVo> { - val resultList = mutableListOf<LatLngVo>() - //2019.10.30 鐩墠鍓嶇瀹夊崜璁惧畾鏈�闀胯幏鍙栫殑鏃堕暱涓�6灏忔椂鍓嶈嚦鐜板湪鐨勬暟鎹紝鎸夌収obd 姣�10绉掍腑浜х敓涓�鏉℃暟鎹紝鏈�澶�4 * 360 = 1440 鏉� - dataStreamRepository.getDataStream(deviceCode, 1, 1500, startTime, endTime).run { - sortedBy { - it.obdDataTime - } - }.forEach { - val latLngVo = LatLngVo().apply { - this.deviceCode = it.obdDeviceCode - obdDataTime = it.obdDataTime - lat = it.obdLat - lng = it.obdLong - } - resultList.add(latLngVo) - } - return resultList - } - - override fun getLatestCoordinate(pageNum: Int?, pageSize: Int?): List<LatLngVo> { - val resultList = mutableListOf<LatLngVo>() - - val now = LocalDateTime.now() - - vehicleRepository.getVehicleInfo(pageNum, pageSize).forEach { vehicleInfo -> - val dataStream = dataStreamRepository.getLatestDataStream(vehicleInfo.obdDeviceCode) - val obdInfo = obdInfoRepository.getObdInfo(vehicleInfo.obdDeviceCode, 1, 1).takeIf { it.isNotEmpty() }?.get(0) - - //鑾峰彇鏁版嵁閲囨牱鏃堕棿锛屽鏋滀负绌猴紝鍒欏彇褰撳墠鏃堕棿鐨勫墠24灏忔椂 - val dataTime = dataStream?.obdDataTime?.toInstant()?.atZone(ZoneId.systemDefault())?.toLocalDateTime() - ?: LocalDateTime.now().minusDays(1) - - resultList.add(LatLngVo().apply { - deviceCode = vehicleInfo.obdDeviceCode - vin = obdInfo?.obdVin - license = vehicleInfo.obdLicencePlate - obdDataTime = dataStream?.obdDataTime - carType = vehicleInfo.obdVehicleType - //閲囨牱鏃堕棿鍜屽綋鍓嶆椂闂寸浉宸秴杩�10鍒嗛挓璁や负璁惧澶勪簬绂荤嚎鐘舵�� - //todo 2019.10.25 鍏朵綑涓ょ杞﹁締鐘舵�侊紝鍚庣画闇�澶勭悊 - status = if (now.minusMinutes(10).isAfter(dataTime)) { - CarStatus.OffLine.value - } else { - CarStatus.OnLine.value - } - lat = dataStream?.obdLat - lng = dataStream?.obdLong - }) - } - - return resultList - - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdThresholdValueServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdThresholdValueServiceImpl.kt deleted file mode 100644 index 29ab32b..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdThresholdValueServiceImpl.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.flightfeather.uav.lightshare.service.impl - -import com.flightfeather.uav.lightshare.bean.ThresholdValueVo -import com.flightfeather.uav.lightshare.service.ObdThresholdValueService -import com.flightfeather.uav.repository.ObdThresholdValueRepository -import org.springframework.stereotype.Service - -/** - * @author riku - * Date: 2019/9/5 - */ -@Service -class ObdThresholdValueServiceImpl(val obdThresholdValueRepository: ObdThresholdValueRepository) : ObdThresholdValueService { - - override fun save(userId: String, thresholdValueVo: ThresholdValueVo): Boolean { - return obdThresholdValueRepository.save(userId, thresholdValueVo) - } - - override fun update(userId: String, thresholdValueVo: ThresholdValueVo): Boolean { - return obdThresholdValueRepository.update(userId, thresholdValueVo) - } - - override fun getDataByVinCode(vinCode: String): ThresholdValueVo? { - return obdThresholdValueRepository.getByVinCode(vinCode) - } - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdUserServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdUserServiceImpl.kt deleted file mode 100644 index 6c40d05..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ObdUserServiceImpl.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.flightfeather.uav.lightshare.service.impl - -import com.flightfeather.uav.lightshare.bean.ObdUserVo -import com.flightfeather.uav.lightshare.service.ObdUserService -import com.flightfeather.uav.repository.ObdUserRepository -import org.springframework.stereotype.Service - -/** - * @author riku - * Date: 2019/9/6 - */ -@Service -class ObdUserServiceImpl(val userRepository: ObdUserRepository) :ObdUserService{ - - override fun getUserInfo(userId: String): ObdUserVo? { - return userRepository.getUserInfo(userId) - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/VehicleServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/VehicleServiceImpl.kt index 00c1d22..d012ac5 100644 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/VehicleServiceImpl.kt +++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/VehicleServiceImpl.kt @@ -1,5 +1,6 @@ package com.flightfeather.uav.lightshare.service.impl +import com.flightfeather.uav.domain.entity.RealTimeData import com.flightfeather.uav.lightshare.bean.VehicleInfoVo import com.flightfeather.uav.lightshare.service.VehicleService import com.flightfeather.uav.repository.VehicleRepository @@ -11,18 +12,9 @@ * Date: 2019/10/25 */ @Service -class VehicleServiceImpl(val vehicleRepository: VehicleRepository) : VehicleService { +class VehicleServiceImpl() : VehicleService { override fun getVehicleInfo(pageNum: Int?, pageSize: Int?): List<VehicleInfoVo> { - val dbResult = vehicleRepository.getVehicleInfo(pageNum, pageSize) - val resultList = mutableListOf<VehicleInfoVo>() - - dbResult.forEach { - val vo = VehicleInfoVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - - return resultList + return emptyList() } } \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdAlarmController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdAlarmController.kt deleted file mode 100644 index 418cf5b..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdAlarmController.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.flightfeather.uav.lightshare.web - -import com.flightfeather.uav.lightshare.service.ObdAlarmService -import org.springframework.web.bind.annotation.* - -/** - * @author riku - * Date: 2019/9/5 - */ -@RestController -@RequestMapping("uav/alarm") -class ObdAlarmController(val obdAlarmService: ObdAlarmService) { - - @GetMapping("/{vinCode}") - fun getAlarmByVinCode( - @PathVariable("vinCode") vinCode: String, - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int? - ) = obdAlarmService.getAlarmByVinCode(vinCode, pageNum, pageSize) - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdDataController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdDataController.kt deleted file mode 100644 index 7b28cad..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdDataController.kt +++ /dev/null @@ -1,79 +0,0 @@ -package com.flightfeather.uav.lightshare.web - -import com.flightfeather.uav.lightshare.service.ObdDataService -import org.springframework.web.bind.annotation.* - -/** - * @author riku - * Date: 2019/8/27 - */ -@RestController -@RequestMapping("uav/data") -class ObdDataController(val obdDataService: ObdDataService) { - - @GetMapping("/data") - fun getById( - @RequestParam("vinCode", required = false) vinCode: String?, - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int? - ) = obdDataService.getDataByVinCode(vinCode, pageNum, pageSize) - - @GetMapping("/login/{deviceCode}") - fun getLoginData( - @PathVariable("deviceCode") deviceCode: String, - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int?, - @RequestParam("startTime", required = false) startTime: String?, - @RequestParam("endTime", required = false) endTime: String? - ) = obdDataService.getLoginData(deviceCode, pageNum, pageSize, startTime, endTime) - - @GetMapping("/logout/{deviceCode}") - fun getLogoutData( - @PathVariable("deviceCode") deviceCode: String, - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int?, - @RequestParam("startTime", required = false) startTime: String?, - @RequestParam("endTime", required = false) endTime: String? - ) = obdDataService.getLogoutData(deviceCode, pageNum, pageSize, startTime, endTime) - - @GetMapping("/obdInfo/") - fun getObdInfo( - @RequestParam("deviceCode") deviceCode: String, - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int? - ) = obdDataService.getObdInfo(deviceCode, pageNum, pageSize) - - @GetMapping("/dataStream/{deviceCode}") - fun getDataStream( - @PathVariable("deviceCode") deviceCode: String, - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int?, - @RequestParam("startTime", required = false) startTime: String?, - @RequestParam("endTime", required = false) endTime: String? - ) = obdDataService.getDataStream(deviceCode, pageNum, pageSize, startTime, endTime) - - @GetMapping("/dataStream/count") - fun getDataStreamCount( - @RequestParam("deviceCode") deviceCode: String = "", - @RequestParam("startTime", required = false) startTime: String?, - @RequestParam("endTime", required = false) endTime: String? - ) = obdDataService.getDataStreamCount(deviceCode, startTime, endTime) - - @GetMapping("/coordinate/{deviceCode}") - fun getCoordinate( - @PathVariable("deviceCode") deviceCode: String - ) = obdDataService.getCoordinate(deviceCode) - - @GetMapping("/coordinate/track") - fun getTrack( - @RequestParam("deviceCode") deviceCode: String, - @RequestParam("startTime") startTime: String, - @RequestParam("endTime") endTime: String - ) = obdDataService.getTrack(deviceCode, startTime, endTime) - - @GetMapping("/coordinate/latest") - fun getCoordinate( - @RequestParam("page", required = false) pageNum: Int?, - @RequestParam("per_page", required = false) pageSize: Int? - ) = obdDataService.getLatestCoordinate(pageNum, pageSize) -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdThresholdController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdThresholdController.kt deleted file mode 100644 index 7788d06..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdThresholdController.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.flightfeather.uav.lightshare.web - -import com.flightfeather.uav.lightshare.bean.ThresholdValueVo -import com.flightfeather.uav.lightshare.service.ObdThresholdValueService -import org.springframework.web.bind.annotation.* - -/** - * @author riku - * Date: 2019/9/5 - */ -@RestController -@RequestMapping("uav/threshold") -class ObdThresholdController(val obdThresholdValueService: ObdThresholdValueService) { - - @GetMapping("/{vinCode}") - fun getDataByVinCode( - @PathVariable("vinCode") vinCode: String - ) = obdThresholdValueService.getDataByVinCode(vinCode) - - @PostMapping("/update") - fun update( - @RequestParam("userId") userId: String, - @RequestBody thresholdValueVo: ThresholdValueVo - ) = obdThresholdValueService.update(userId, thresholdValueVo) - - @PutMapping("/save") - fun save( - @RequestParam("userId") userId: String, - @RequestBody thresholdValueVo: ThresholdValueVo - ) = obdThresholdValueService.save(userId, thresholdValueVo) - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdUserController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdUserController.kt deleted file mode 100644 index 1fa99ae..0000000 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/ObdUserController.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.flightfeather.uav.lightshare.web - -import com.flightfeather.uav.lightshare.service.ObdUserService -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController - -/** - * @author riku - * Date: 2019/9/6 - */ -@RestController -@RequestMapping("uav/user") -class ObdUserController(val obdUserService: ObdUserService) { - - @GetMapping("/info/{userId}") - fun getUserInfo( - @PathVariable("userId") userId: String - ) = obdUserService.getUserInfo(userId) - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt new file mode 100644 index 0000000..7e2f4af --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/repository/AirDataRepository.kt @@ -0,0 +1,12 @@ +package com.flightfeather.uav.repository + +import com.flightfeather.uav.socket.bean.AirPackageData + +/** + * @author riku + * Date: 2020/6/11 + */ +interface AirDataRepository { + + fun saveAirData(packageData: AirPackageData): Int +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/CarLoginRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/CarLoginRepository.kt deleted file mode 100644 index fef16d8..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/CarLoginRepository.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.lightshare.bean.CarLoginVo -import com.flightfeather.uav.socket.bean.ObdPackageData - -/** - * @author riku - * Date: 2019/9/17 - */ -interface CarLoginRepository { - - /** - * 淇濆瓨杞﹁締鐧诲叆淇℃伅 - */ - fun saveCarLogin(packageData: ObdPackageData): Boolean - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栫櫥褰曟暟鎹� - */ - fun getLoginData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLoginVo> -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/CarLogoutRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/CarLogoutRepository.kt deleted file mode 100644 index 5304c2b..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/CarLogoutRepository.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.lightshare.bean.CarLogoutVo -import com.flightfeather.uav.socket.bean.ObdPackageData - -/** - * @author riku - * Date: 2019/9/17 - */ -interface CarLogoutRepository { - - /** - * 淇濆瓨 杞﹁締鐧诲嚭鍏ヤ俊鎭� - */ - fun saveCarLogout(packageData: ObdPackageData): Boolean - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栫櫥鍑烘暟鎹� - */ - fun getLogoutData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLogoutVo> -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/DataStreamRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/DataStreamRepository.kt deleted file mode 100644 index ad1f279..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/DataStreamRepository.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.domain.entity.DataStream -import com.flightfeather.uav.lightshare.bean.DataStreamVo -import com.flightfeather.uav.socket.bean.ObdPackageData - -/** - * @author riku - * Date: 2019/9/17 - */ -interface DataStreamRepository { - - /** - * 淇濆瓨 瀹炴椂淇℃伅鎴栬ˉ浼犱俊鎭� 涓殑 鏁版嵁娴佷俊鎭� 鍜� 琛ュ厖鏁版嵁娴� - */ - fun saveDataStream(packageData: ObdPackageData): Boolean - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栨暟鎹祦鏁版嵁 - */ - fun getDataStream(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<DataStreamVo> - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙栨暟鎹祦鏁版嵁璁℃暟 - */ - fun getDataStreamCount(deviceCode: String, startTime: String?, endTime: String?): Int - - /** - * 鑾峰彇涓�杈嗚溅鏈�鏂扮殑涓�鏉$姸鎬佷俊鎭� - */ - fun getLatestDataStream(deviceCode: String): DataStream? -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/ObdAlarmRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/ObdAlarmRepository.kt deleted file mode 100644 index 0dff00d..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/ObdAlarmRepository.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.lightshare.bean.AlarmDataVo - -/** - * obd璀︽姤鐩稿叧鏁版嵁搴撴搷浣滄帴鍙� - * @author riku - * Date: 2019/9/5 - */ -interface ObdAlarmRepository { - - /** - * 瀛樺偍璀︽姤鏁版嵁 - */ - fun saveObdAlarm(alarmDataVo: AlarmDataVo): Boolean - - /** - * 閫氳繃姹借溅vin鐮佽幏鍙栬鎶ユ暟鎹� - */ - fun getAlarmByVinCode(vinCode: String, pageNum: Int?, pageSize: Int?): MutableList<AlarmDataVo> - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/ObdDataRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/ObdDataRepository.kt deleted file mode 100644 index 8b6fb27..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/ObdDataRepository.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.lightshare.bean.ObdDataVo -import com.flightfeather.uav.socket.bean.ObdPackageData - -/** - * obd鏁版嵁鐩稿叧鏁版嵁搴撴搷浣滄帴鍙� - * @author riku - * Date: 2019/8/27 - */ -interface ObdDataRepository { - - /** - * 瀛樺偍obd鏁版嵁 - */ - fun saveObdData(data: ObdDataVo): Boolean - - /** - * 閫氳繃姹借溅vin鐮佽幏鍙栨渶鏂版暟鎹� - */ - fun getDataByVinCode(vinCode: String?, pageNum: Int?, pageSize: Int?): MutableList<ObdDataVo> - - fun saveObdData(packageData: ObdPackageData):Boolean - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/ObdInfoRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/ObdInfoRepository.kt deleted file mode 100644 index 5a71b2a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/ObdInfoRepository.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.socket.bean.ObdInfo -import com.flightfeather.uav.socket.bean.ObdPackageData -import com.flightfeather.uav.socket.bean.RealTimeData -import com.flightfeather.uav.socket.bean.ReplacementData - -/** - * @author riku - * Date: 2019/9/17 - */ -interface ObdInfoRepository { - - /** - * 淇濆瓨 瀹炴椂淇℃伅 @see [RealTimeData] 鎴栬ˉ浼犱俊鎭� @see [ReplacementData] 涓殑 uav 鏁版嵁 @see [ObdInfo] - */ - fun saveObdInfo(packageData: ObdPackageData): Boolean - - /** - * 鏍规嵁缁堢璁惧鐮佽幏鍙杘bd鏁版嵁 - */ - fun getObdInfo(deviceCode: String, pageNum: Int?, pageSize: Int?): List<com.flightfeather.uav.domain.entity.ObdInfo> - - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/ObdThresholdValueRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/ObdThresholdValueRepository.kt deleted file mode 100644 index 11e1cd5..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/ObdThresholdValueRepository.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.lightshare.bean.ThresholdValueVo - -/** - * obd璀︽姤闃堝�肩浉鍏虫暟鎹簱鎿嶄綔鎺ュ彛 - * @author riku - * Date: 2019/9/5 - */ -interface ObdThresholdValueRepository { - - /** - * 瀛樺偍闃堝�� - */ - fun save(userId: String, thresholdValueVo: ThresholdValueVo): Boolean - - /** - * 鏇存柊闃堝�� - */ - fun update(userId: String, thresholdValueVo: ThresholdValueVo): Boolean - - /** - * 閫氳繃姹借溅vin鐮佽幏鍙栭槇鍊兼暟鎹� - */ - fun getByVinCode(vinCode: String): ThresholdValueVo? - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/ObdUserRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/ObdUserRepository.kt deleted file mode 100644 index a6a3376..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/ObdUserRepository.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.lightshare.bean.ObdUserVo - -/** - * @author riku - * Date: 2019/9/6 - */ -interface ObdUserRepository { - - fun getUserInfo(userId: String): ObdUserVo? - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/OriginDataRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/OriginDataRepository.kt deleted file mode 100644 index 6a5b69a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/OriginDataRepository.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.flightfeather.uav.repository - -import com.flightfeather.uav.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/uav/repository/VehicleRepository.kt b/src/main/kotlin/com/flightfeather/uav/repository/VehicleRepository.kt index eed3531..910ebab 100644 --- a/src/main/kotlin/com/flightfeather/uav/repository/VehicleRepository.kt +++ b/src/main/kotlin/com/flightfeather/uav/repository/VehicleRepository.kt @@ -1,15 +1,9 @@ package com.flightfeather.uav.repository -import com.flightfeather.uav.domain.entity.VehicleInfo - /** * @author riku * Date: 2019/10/25 */ interface VehicleRepository { - /** - * 鑾峰彇杞﹁締淇℃伅 - */ - fun getVehicleInfo(pageNum: Int?, pageSize: Int?): List<VehicleInfo> } \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt new file mode 100644 index 0000000..055349d --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt @@ -0,0 +1,32 @@ +package com.flightfeather.uav.repository.impl + +import com.flightfeather.uav.domain.entity.RealTimeData +import com.flightfeather.uav.domain.mapper.RealTimeDataMapper +import com.flightfeather.uav.repository.AirDataRepository +import com.flightfeather.uav.socket.bean.AirPackageData +import com.google.gson.Gson +import org.springframework.stereotype.Repository + +/** + * @author riku + * Date: 2020/6/11 + */ +@Repository +class AirDataRepositoryImpl(private val realTimeDataMapper: RealTimeDataMapper): AirDataRepository { + + override fun saveAirData(packageData: AirPackageData): Int { + + val data = RealTimeData().apply { + deviceCode = packageData.deviceCode + latitude + longitude + altitude + height + factors = Gson().toJson(packageData.dataUnit) + dataTime = packageData.dataTime + } + realTimeDataMapper.insert(data) + + return 0 + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/CarLoginDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/CarLoginDaoImpl.kt deleted file mode 100644 index 179e19c..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/CarLoginDaoImpl.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.CarLogin -import com.flightfeather.uav.domain.mapper.CarLoginMapper -import com.flightfeather.uav.lightshare.bean.CarLoginVo -import com.flightfeather.uav.repository.CarLoginRepository -import com.flightfeather.uav.socket.bean.CarRegisterData -import com.flightfeather.uav.socket.bean.ObdPackageData -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import com.github.pagehelper.PageHelper -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * @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 - } - } - - override fun getLoginData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLoginVo> { - val example = Example(CarLogin::class.java).apply { - createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { - startTime?.let { andGreaterThanOrEqualTo("loginDataTime", it) } - endTime?.let { andLessThanOrEqualTo("loginDataTime", it) } - orderBy("loginDataTime").desc() - } - } - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<CarLogin>(offset, pageSize ?: 10) - val result = carLoginMapper.selectByExample(example) - - val resultList = mutableListOf<CarLoginVo>() - result.forEach { - val vo = CarLoginVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - - return resultList - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/CarLogoutDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/CarLogoutDaoImpl.kt deleted file mode 100644 index 8025dd7..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/CarLogoutDaoImpl.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.CarLogout -import com.flightfeather.uav.domain.mapper.CarLogoutMapper -import com.flightfeather.uav.lightshare.bean.CarLogoutVo -import com.flightfeather.uav.repository.CarLogoutRepository -import com.flightfeather.uav.socket.bean.CarLogOutData -import com.flightfeather.uav.socket.bean.ObdPackageData -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import com.github.pagehelper.PageHelper -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * @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 - } - } - - override fun getLogoutData(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<CarLogoutVo> { - val example = Example(CarLogout::class.java).apply { - createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { - startTime?.let { andGreaterThanOrEqualTo("loginDataTime", it) } - endTime?.let { andLessThanOrEqualTo("loginDataTime", it) } - orderBy("loginDataTime").desc() - } - } - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<CarLogout>(offset, pageSize ?: 10) - val result = carLogoutMapper.selectByExample(example) - - val resultList = mutableListOf<CarLogoutVo>() - result.forEach { - val vo = CarLogoutVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - - return resultList - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/DataStreamDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/DataStreamDaoImpl.kt deleted file mode 100644 index 510c97b..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/DataStreamDaoImpl.kt +++ /dev/null @@ -1,157 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.DataStream -import com.flightfeather.uav.domain.mapper.DataStreamMapper -import com.flightfeather.uav.domain.mapper.VehicleInfoMapper -import com.flightfeather.uav.lightshare.bean.DataStreamVo -import com.flightfeather.uav.repository.DataStreamRepository -import com.flightfeather.uav.socket.bean.EngineDataStream -import com.flightfeather.uav.socket.bean.ObdPackageData -import com.flightfeather.uav.socket.bean.SupplementDataStream -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import com.github.pagehelper.PageHelper -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example -import java.text.SimpleDateFormat -import java.util.* - -/** - * @author riku - * Date: 2019/9/17 - */ -@Repository -class DataStreamDaoImpl(val dataStreamMapper: DataStreamMapper, val vehicleInfoMapper: VehicleInfoMapper): 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 - } - } - - override fun getDataStream(deviceCode: String, pageNum: Int?, pageSize: Int?, startTime: String?, endTime: String?): List<DataStreamVo> { - val sf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") - val example = Example(DataStream::class.java).apply { - createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { - startTime?.let { - try { - val st = sf.parse(startTime) - andGreaterThanOrEqualTo("obdDataTime", st) - } catch (e: Throwable) { - e.printStackTrace() - } - } - endTime?.let { - try { - val et = sf.parse(endTime) - andLessThanOrEqualTo("obdDataTime", et) - } catch (e: Throwable) { - e.printStackTrace() - } - } - orderBy("obdDataTime").desc() - } - } - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<DataStream>(offset, pageSize ?: 10) - val result = dataStreamMapper.selectByExample(example) - - val resultList = mutableListOf<DataStreamVo>() - result.forEach { - val vo = DataStreamVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - - return resultList - } - - override fun getDataStreamCount(deviceCode: String, startTime: String?, endTime: String?): Int { - val sf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA) - val example = Example(DataStream::class.java).apply { - createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { - startTime?.let { - try { - val st = sf.parse(startTime) - andGreaterThanOrEqualTo("obdDataTime", st) - } catch (e: Throwable) { - e.printStackTrace() - } - } - endTime?.let { - try { - val et = sf.parse(endTime) - andLessThanOrEqualTo("obdDataTime", et) - } catch (e: Throwable) { - e.printStackTrace() - } - } - orderBy("obdDataTime").desc() - } - } - - return dataStreamMapper.selectCountByExample(example) - } - - override fun getLatestDataStream(deviceCode: String): DataStream? { - val example = Example(DataStream::class.java).apply { - createCriteria().andEqualTo("obdDeviceCode", deviceCode) - orderBy("obdDataTime").desc() - } - //鑾峰彇鏈�鏂扮殑涓�涓� - PageHelper.offsetPage<DataStream>(0, 1) - return dataStreamMapper.selectByExample(example).takeIf { it.isNotEmpty() }?.get(0) - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdAlarmDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdAlarmDaoImpl.kt deleted file mode 100644 index 6d301f0..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdAlarmDaoImpl.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.AlarmData -import com.flightfeather.uav.domain.mapper.AlarmDataMapper -import com.flightfeather.uav.lightshare.bean.AlarmDataVo -import com.flightfeather.uav.repository.ObdAlarmRepository -import com.github.pagehelper.PageHelper -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * @author riku - * Date: 2019/9/5 - */ -@Repository -class ObdAlarmDaoImpl(val alarmDataMapper: AlarmDataMapper) : ObdAlarmRepository { - - override fun saveObdAlarm(alarmDataVo: AlarmDataVo): Boolean { - val alarmData = AlarmData() - BeanUtils.copyProperties(alarmDataVo, alarmData) - return alarmDataMapper.insert(alarmData) == 1 - } - - override fun getAlarmByVinCode(vinCode: String, pageNum: Int?, pageSize: Int?): MutableList<AlarmDataVo> { - val example = Example(AlarmData::class.java).apply { - createCriteria().andEqualTo("obdVin", vinCode) - orderBy("alarmTime").desc() - } - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<AlarmData>(offset, pageSize ?: 10) - val result = alarmDataMapper.selectByExample(example) - - val resultList = mutableListOf<AlarmDataVo>() - result.forEach { - val vo = AlarmDataVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - - return resultList - } - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdDataDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdDataDaoImpl.kt deleted file mode 100644 index c2a84c5..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdDataDaoImpl.kt +++ /dev/null @@ -1,147 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.ObdData -import com.flightfeather.uav.domain.mapper.ObdDataMapper -import com.flightfeather.uav.lightshare.bean.ObdDataVo -import com.flightfeather.uav.repository.ObdDataRepository -import com.flightfeather.uav.socket.bean.* -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import com.github.pagehelper.PageHelper -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * obd鏁版嵁鐩稿叧鏁版嵁搴撴搷浣滃疄鐜� - * @author riku - * Date: 2019/8/27 - */ -@Repository -class ObdDataDaoImpl(val obdDataMapper: ObdDataMapper) : ObdDataRepository { - - override fun saveObdData(data: ObdDataVo): Boolean { - val obdData = ObdData() - BeanUtils.copyProperties(data, obdData) - return obdDataMapper.insert(obdData) == 1 - } - - override fun getDataByVinCode(vinCode: String?, pageNum: Int?, pageSize: Int?): MutableList<ObdDataVo> { - val example = Example(ObdData::class.java).apply { - createCriteria().andEqualTo("obdVin", vinCode) - orderBy("obdTime").desc() - } - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<ObdData>(offset, pageSize ?: 10) - val result = obdDataMapper.selectByExample(example) - - val resultList = mutableListOf<ObdDataVo>() - result.forEach { - val vo = ObdDataVo() - BeanUtils.copyProperties(it, vo) - resultList.add(vo) - } - - return resultList - } - - override fun saveObdData(packageData: ObdPackageData): Boolean { - val obdData = ObdData().apply { - 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 -> { - packageData.dataUnit.forEach { - when (it) { - is com.flightfeather.uav.socket.bean.ObdInfo -> { - obdData.apply { - obdTime = it.time - obdProtocol = it.obdProtocol - obdMil = it.obdMil - obdIdCode = it.obdCrn - obdVerificationCode = it.obdCvn - obdFaultCodeNum = it.obdFaultCodeNum - obdFaultCode = it.obdFaultCode - } - } - is EngineDataStream -> { - obdData.apply { - obdTime = it.time - obdLng = it.obdLong - obdLat = it.obdLat - obdSpeed = it.obdSpeed?.toInt() - obdAirPressure = it.obdAirPressure - obdEngineTorque = it.obdEngineTorque - obdFrictionTorque = it.obdFrictionTorque - obdEngineRpm = it.obdEngineRpm?.toInt() - obdStartFuelFlow = it.obdEngineFuelFlow - obdScrUpstreamNo = it.obdScrUpstreamNox - obdScrDownstreamNo = 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 - obdTotalMileage = it.obdTotalMileage - } - } - is SupplementDataStream -> { - obdData.apply { - obdTime = it.time - obdEngineTorqueMode = it.obdEngineTorqueMode?.toString() - obdAcceleratorPedal = it.obdAcceleratorPedal - obdTotalOilConsumption = it.obdTotalOilConsumption - obdUreaBoxTemp = it.obdUreaBoxTemp - obdUreaVolume = it.obdUreaVolume?.toInt() - obdTotalUreaConsume = it.obdTotalUreaConsume - obdDpfTemp = it.obdDpfTemp -// obdFirmwareVersion = - } - } - } - } - - } - 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 - } - } - } - } - } - } - - return obdDataMapper.insert(obdData) == 1 - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdInfoDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdInfoDaoImpl.kt deleted file mode 100644 index 967a02a..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdInfoDaoImpl.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.ObdInfo -import com.flightfeather.uav.domain.mapper.ObdInfoMapper -import com.flightfeather.uav.repository.ObdInfoRepository -import com.flightfeather.uav.socket.bean.ObdPackageData -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import com.github.pagehelper.PageHelper -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * @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.uav.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 - } - } - - override fun getObdInfo(deviceCode: String, pageNum: Int?, pageSize: Int?): List<ObdInfo> { - val example = Example(ObdInfo::class.java).apply { - createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { - orderBy("obdDataTime").desc() - } - } - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<ObdInfo>(offset, pageSize ?: 10) - return obdInfoMapper.selectByExample(example) - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdThresholdValueDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdThresholdValueDaoImpl.kt deleted file mode 100644 index 6461bed..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdThresholdValueDaoImpl.kt +++ /dev/null @@ -1,56 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.ThresholdValue -import com.flightfeather.uav.domain.mapper.ThresholdValueMapper -import com.flightfeather.uav.lightshare.bean.ThresholdValueVo -import com.flightfeather.uav.repository.ObdThresholdValueRepository -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * @author riku - * Date: 2019/9/5 - */ -@Repository -class ObdThresholdValueDaoImpl(val obdThresholdValueMapper: ThresholdValueMapper) : ObdThresholdValueRepository { - - override fun save(userId: String, thresholdValueVo: ThresholdValueVo): Boolean { - val thresholdValue = ThresholdValue() - BeanUtils.copyProperties(thresholdValueVo, thresholdValue) - val example = Example(ThresholdValue::class.java).apply { - createCriteria().andEqualTo("obdVin", thresholdValueVo.obdVin) - } - val tempResult = obdThresholdValueMapper.selectByExample(example) - return if (tempResult.isNotEmpty()) - false - else - obdThresholdValueMapper.insert(thresholdValue) == 1 - } - - override fun update(userId: String, thresholdValueVo: ThresholdValueVo): Boolean { - val thresholdValue = ThresholdValue() - BeanUtils.copyProperties(thresholdValueVo, thresholdValue) - val example = Example(ThresholdValue::class.java).apply { - createCriteria().andEqualTo("obdVin", thresholdValue.obdVin) - } - return obdThresholdValueMapper.updateByExample(thresholdValue, example) == 1 - } - - override fun getByVinCode(vinCode: String): ThresholdValueVo? { - val example = Example(ThresholdValue::class.java).apply { - createCriteria().andEqualTo("obdVin", vinCode) - } - - val result = obdThresholdValueMapper.selectByExample(example) - - if (result.isNotEmpty()) { - val vo = ThresholdValueVo() - BeanUtils.copyProperties(result[0], vo) - return vo - } - - return null - } - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdUserDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdUserDaoImpl.kt deleted file mode 100644 index 73a00d4..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/ObdUserDaoImpl.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.ObdUser -import com.flightfeather.uav.domain.mapper.ObdUserMapper -import com.flightfeather.uav.lightshare.bean.ObdUserVo -import com.flightfeather.uav.repository.ObdUserRepository -import org.springframework.beans.BeanUtils -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * @author riku - * Date: 2019/9/6 - */ -@Repository -class ObdUserDaoImpl(val obdUserMapper: ObdUserMapper): ObdUserRepository { - - override fun getUserInfo(userId: String): ObdUserVo? { - val example = Example(ObdUser::class.java).apply { - createCriteria().andEqualTo("obdUserId", userId) - } - - val result = obdUserMapper.selectByExample(example) - - if (result.isNotEmpty()) { - val vo = ObdUserVo() - BeanUtils.copyProperties(result[0], vo) - return vo - } - - return null - } - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/repository/impl/OriginDataDaoImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/OriginDataDaoImpl.kt deleted file mode 100644 index 427e09e..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/OriginDataDaoImpl.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.OriginData -import com.flightfeather.uav.domain.mapper.OriginDataMapper -import com.flightfeather.uav.repository.OriginDataRepository -import com.flightfeather.uav.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/uav/repository/impl/VehicleRepositoryImpl.kt b/src/main/kotlin/com/flightfeather/uav/repository/impl/VehicleRepositoryImpl.kt deleted file mode 100644 index 7d92023..0000000 --- a/src/main/kotlin/com/flightfeather/uav/repository/impl/VehicleRepositoryImpl.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.flightfeather.uav.repository.impl - -import com.flightfeather.uav.domain.entity.DataStream -import com.flightfeather.uav.domain.entity.VehicleInfo -import com.flightfeather.uav.domain.mapper.VehicleInfoMapper -import com.flightfeather.uav.repository.VehicleRepository -import com.github.pagehelper.PageHelper -import org.springframework.stereotype.Repository - -/** - * @author riku - * Date: 2019/10/25 - */ -@Repository -class VehicleRepositoryImpl(val vehicleInfoMapper: VehicleInfoMapper):VehicleRepository { - override fun getVehicleInfo(pageNum: Int?, pageSize: Int?): List<VehicleInfo> { - - //鍒嗛〉 - val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 - PageHelper.offsetPage<DataStream>(offset, pageSize ?: 10) - - return vehicleInfoMapper.selectAll() - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/DeviceSession.kt b/src/main/kotlin/com/flightfeather/uav/socket/DeviceSession.kt index 1bc9472..ff079ed 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/DeviceSession.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/DeviceSession.kt @@ -1,10 +1,11 @@ package com.flightfeather.uav.socket +import com.flightfeather.uav.socket.bean.AirTypeData import io.netty.channel.ChannelHandlerContext import java.util.concurrent.ConcurrentHashMap /** - * 鐢ㄤ簬淇濆瓨杩炴帴鐨勮澶囧強瀵瑰簲鐨剆ession閫氶亾 + * 鐢ㄤ簬淇濆瓨杩炴帴鐨勮澶囧強瀵瑰簲鐨剆ession閫氶亾浠ュ強瀵瑰簲鐨勪笓灞炰俊鎭� * Date: 2019.8.27 * @author riku */ @@ -12,6 +13,8 @@ companion object{ private val deviceMap = ConcurrentHashMap<String, ChannelHandlerContext?>() + private val typeMap = ConcurrentHashMap<String, List<AirTypeData>>() + private const val DEFAULT_DEVICE = "default_device" fun saveDevice(deviceCode: String?, channel: ChannelHandlerContext?) { deviceCode?.let { @@ -25,5 +28,21 @@ else null } + + fun saveAirType(deviceCode: String?, types: List<AirTypeData>) { + if (deviceCode == null) { + typeMap[DEFAULT_DEVICE] = types + } else { + typeMap[deviceCode] = types + } + } + + fun getAirType(deviceCode: String?): List<AirTypeData>? { + return if (typeMap.containsKey(deviceCode)) { + typeMap[deviceCode] + } else { + null + } + } } } \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/MessageManager.kt b/src/main/kotlin/com/flightfeather/uav/socket/MessageManager.kt index 51ad90d..3301672 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/MessageManager.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/MessageManager.kt @@ -2,13 +2,10 @@ import com.flightfeather.uav.common.utils.FileUtil import com.flightfeather.uav.repository.* -import com.flightfeather.uav.socket.bean.EngineDataStream -import com.flightfeather.uav.socket.bean.ObdInfo -import com.flightfeather.uav.socket.bean.ObdPackageData -import com.flightfeather.uav.socket.bean.SupplementDataStream -import com.flightfeather.uav.socket.decoder.VehicleDataDecoder +import com.flightfeather.uav.socket.bean.* +import com.flightfeather.uav.socket.decoder.AirDataDecoder import com.flightfeather.uav.socket.decoder.impl.DataPackageDecoderImpl -import com.flightfeather.uav.socket.eunm.ObdCommandUnit +import com.flightfeather.uav.socket.eunm.AirCommandUnit import io.netty.buffer.Unpooled import io.netty.channel.ChannelHandlerContext import org.springframework.beans.factory.annotation.Autowired @@ -31,50 +28,40 @@ } @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 + lateinit var airDataRepository: AirDataRepository - val vehicleDataDecoder = VehicleDataDecoder() + val vehicleDataDecoder = AirDataDecoder() val dataPackageDecoder = DataPackageDecoderImpl() @PostConstruct 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 + airDataRepository = this.airDataRepository } fun dealStringMsg(msg: String, ctx: ChannelHandlerContext?) { //瑙e寘 val packageData = vehicleDataDecoder.decode(msg) - saveToTxt(msg) - val isCommand = command(packageData, ctx) - - if (isCommand) { - println("------杩滅▼鎺у埗鎸囦护 [${SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())}]") - } else { - if (bccCheck(msg)) { - //淇濆瓨 - DeviceSession.saveDevice(packageData.deviceCode, ctx) - saveToDataBase(packageData, msg) - } else { - println("------鏁版嵁BCC鏍¢獙澶辫触锛岃垗寮� [${SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())}]") + if (bccCheck(msg)) { + if (packageData.commandUnit == AirCommandUnit.Confirm.value) { + val t = mutableListOf<AirTypeData>() + packageData.dataUnit.forEach { + if (it is AirTypeData) { + t.add(it) + } + } + DeviceSession.saveAirType(packageData.deviceCode, t) + } else if (packageData.commandUnit == AirCommandUnit.AirData.value) { + val types = DeviceSession.getAirType(packageData.deviceCode) } + //淇濆瓨 + DeviceSession.saveDevice(packageData.deviceCode, ctx) +// saveToTxt(msg) + saveToDataBase(packageData) + } else { + println("------鏁版嵁BCC鏍¢獙澶辫触锛岃垗寮� [${SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())}]") } } @@ -89,27 +76,9 @@ /** * 淇濆瓨鑷虫暟鎹簱 */ - fun saveToDataBase(packageData: ObdPackageData, msg: String) { -// instance.obdDataRepository.saveObdData(packageData) - instance.originDataRepository.saveOriginData(packageData, msg) + fun saveToDataBase(packageData: AirPackageData) { when (packageData.commandUnit) { - ObdCommandUnit.CarRegister.value -> instance.carLoginRepository.saveCarLogin(packageData) - ObdCommandUnit.RealTimeData.value, - ObdCommandUnit.ReplacementData.value -> { - var done = false - for (i in 0 until packageData.dataUnit.size) { - when (packageData.dataUnit[i]) { - is ObdInfo -> instance.obdInfoRepository.saveObdInfo(packageData) - is EngineDataStream, - is SupplementDataStream -> { - instance.dataStreamRepository.saveDataStream(packageData) - done = true - } - } - if (done) break - } - } - ObdCommandUnit.CarLogOut.value-> instance.carLogoutRepository.saveCarLogout(packageData) + AirCommandUnit.AirData.value -> instance.airDataRepository.saveAirData(packageData) } } @@ -139,37 +108,6 @@ return oldBcc == newBcc } - /** - * 杩滅▼鎸囦护 - */ - fun command(packageData: ObdPackageData, ctx: ChannelHandlerContext?): Boolean { - if (packageData.commandUnit == ObdCommandUnit.Update.value) { - val channel = DeviceSession.getDevice(packageData.deviceCode) - if (channel != null) { - val s = getDataPackage(packageData.deviceCode) - if (s == null) { - ctx?.writeAndFlush("[${packageData.deviceCode}] 璁惧缂栧彿涓虹┖") - } else { - val bytes = encodeToBytes(s) - channel.writeAndFlush(Unpooled.copiedBuffer(bytes)) - ctx?.writeAndFlush("[${packageData.deviceCode}] 鎸囦护鍙戦�佹垚鍔�") - } - } else { - ctx?.writeAndFlush("[${packageData.deviceCode}] 璁惧鏈繛鎺ユ垨涓嶅瓨鍦�") - } - return true - } else if (packageData.commandUnit != ObdCommandUnit.CarRegister.value - && packageData.commandUnit != ObdCommandUnit.RealTimeData.value - && packageData.commandUnit != ObdCommandUnit.ReplacementData.value - && packageData.commandUnit != ObdCommandUnit.CarLogOut.value - && packageData.commandUnit != ObdCommandUnit.TimeCalibration.value) { - ctx?.writeAndFlush("[${packageData.deviceCode}] 鍛戒护涓嶅瓨鍦�") - - return true - } else { - return false - } - } fun encodeToBytes(msg:String): ByteArray { val list = msg.split(" ") diff --git a/src/main/kotlin/com/flightfeather/uav/socket/ServerHandler.kt b/src/main/kotlin/com/flightfeather/uav/socket/ServerHandler.kt index 8c08a82..9a9b790 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/ServerHandler.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/ServerHandler.kt @@ -31,8 +31,7 @@ if (msg is ByteArray) { println("------鏀跺埌鐨勫師濮嬫暟鎹細[ip:${ctx?.channel()?.remoteAddress()}] ${SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())}") msg.forEach { - var a = 0 - a = if (it < 0) { + val a: Int = if (it < 0) { it + 256 } else { it.toInt() diff --git a/src/main/kotlin/com/flightfeather/uav/socket/SocketServerClient.kt b/src/main/kotlin/com/flightfeather/uav/socket/SocketServerClient.kt index 3baeaa1..80eddb7 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/SocketServerClient.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/SocketServerClient.kt @@ -6,6 +6,7 @@ import io.netty.channel.nio.NioEventLoopGroup import io.netty.channel.socket.nio.NioServerSocketChannel import io.netty.channel.socket.nio.NioSocketChannel +import io.netty.handler.codec.string.StringDecoder import io.netty.handler.codec.string.StringEncoder import java.nio.charset.Charset @@ -41,7 +42,7 @@ override fun initChannel(p0: NioSocketChannel?) { p0?.pipeline() // ?.addLast("decoder", StringDecoder()) - ?.addLast(ObdByteDataDecoder()) + ?.addLast(UAVByteDataDecoder()) ?.addLast("encoder", StringEncoder(Charset.forName("UTF-8"))) ?.addLast(ServerHandler()) } diff --git a/src/main/kotlin/com/flightfeather/uav/socket/ObdByteDataDecoder.kt b/src/main/kotlin/com/flightfeather/uav/socket/UAVByteDataDecoder.kt similarity index 78% rename from src/main/kotlin/com/flightfeather/uav/socket/ObdByteDataDecoder.kt rename to src/main/kotlin/com/flightfeather/uav/socket/UAVByteDataDecoder.kt index 8810240..bb88cb1 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/ObdByteDataDecoder.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/UAVByteDataDecoder.kt @@ -7,14 +7,18 @@ /** * @author riku - * Date: 2019/9/16 + * Date: 2020/06/02 * 鏁版嵁绮樺寘鍒嗗寘瑙g爜鍣� */ -class ObdByteDataDecoder : ByteToMessageDecoder() { +class UAVByteDataDecoder : ByteToMessageDecoder() { companion object { - const val BASE_LENGTH = 2 + 1 + 17 + 1 + 1 + 2 + 0 + 1 - const val HEAD = 0x23.toByte() + private const val HEAD_BYTES = 2//鏁版嵁澶存墍鍗犻暱搴� + private const val LENGTH_BYTES = 1//鏁版嵁浣嶆暟鎵�鍗犻暱搴� + private const val BCC_BYTES = 2//鏍¢獙鐮侀暱搴� + const val BASE_LENGTH = HEAD_BYTES + LENGTH_BYTES + BCC_BYTES + const val HEAD1 = 0x01.toByte() + const val HEAD2 = 0x05.toByte() } override fun decode(p0: ChannelHandlerContext?, p1: ByteBuf?, p2: MutableList<Any>?) { @@ -40,7 +44,7 @@ // 璇诲埌浜嗗崗璁殑寮�濮嬫爣蹇楋紝缁撴潫while寰幆 val b = ByteArray(2) it.readBytes(b) - if (b[0] == HEAD && b[1] == HEAD) { + if (b[0] == HEAD1 && b[1] == HEAD2) { dataList.add(b[0]) dataList.add(b[1]) break @@ -57,7 +61,7 @@ } } - ByteArray(1 + 17 + 1 + 1).apply { + ByteArray(1).apply { it.readBytes(this) }.forEach {b -> dataList.add(b) @@ -65,15 +69,15 @@ //鏁版嵁鍗曞厓鐨勯暱搴� val length = getDataUnitLength(it, dataList) - // 鍒ゆ柇璇锋眰鏁版嵁鍗曞厓鏁版嵁鍙�1涓瓧鑺傜殑鏍¢獙鐮佹槸鍚﹀埌榻� - if (it.readableBytes() < length + 1) { + // 鍒ゆ柇璇锋眰鏁版嵁鍗曞厓鏁版嵁鍙奫LENGTH_BYTES]涓瓧鑺傜殑鏍¢獙鐮佹槸鍚﹀埌榻� + if (it.readableBytes() < length + BCC_BYTES) { // 杩樺師璇绘寚閽� it.readerIndex(beginReader) return } //璇诲彇鏁版嵁鍗曞厓鍜屾牎楠岀爜鏁版嵁 - ByteArray(length + 1).apply { + ByteArray(length + BCC_BYTES).apply { it.readBytes(this) }.forEach {b -> dataList.add(b) @@ -91,11 +95,10 @@ private fun getDataUnitLength(p1: ByteBuf, dataList: MutableList<Byte>): Int { val sb = StringBuilder() - ByteArray(2).apply { + ByteArray(1).apply { p1.readBytes(this) }.forEach { b -> - var a = 0 - a = if (b < 0) { + val a: Int = if (b < 0) { b + 256 } else { b.toInt() @@ -108,5 +111,4 @@ return sb.toString().toInt(16) } - } \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/AirData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/AirData.kt new file mode 100644 index 0000000..879adc9 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/socket/bean/AirData.kt @@ -0,0 +1,14 @@ +package com.flightfeather.uav.socket.bean + +import java.util.* + +/** + * @author riku + * Date: 2020/6/10 + */ +class AirData:DataUnit(){ + var factorId: String? = null + var factorName: String? = null + var sensorId: String? = null + var factorData: Double? = null +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/AirPackageData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/AirPackageData.kt new file mode 100644 index 0000000..a5e3ffa --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/socket/bean/AirPackageData.kt @@ -0,0 +1,31 @@ +package com.flightfeather.uav.socket.bean + +import com.flightfeather.uav.socket.eunm.AirCommandUnit +import java.util.* + +/** + * @author riku + * Date: 2019/9/12 + * 鏁版嵁鍖呯粨鏋� + * + * 璧峰瀛楄妭 瀹氫箟 鏁版嵁绫诲瀷 鎻忚堪鍙婅姹� + * + */ +data class AirPackageData constructor( + //璧峰绗� + var head: String? = null, + //鍛戒护鍗曞厓 + var commandUnit: Int? = null, + //璁惧缂栧彿 + var deviceCode: String? = null, + //閲囨牱鏃堕棿 + var dataTime: Date? = null, + //鏁版嵁鍔犲瘑鏂瑰紡 +// var encryptionWay: Int? = null, + //鏁版嵁鍗曞厓闀垮害 + var dataLength: Int? = null, + //鏁版嵁鍗曞厓 + var dataUnit: List<DataUnit>, + //鏍¢獙鐮� + var checkCode: Int? = null +) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/AirTypeData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/AirTypeData.kt new file mode 100644 index 0000000..08bd203 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/socket/bean/AirTypeData.kt @@ -0,0 +1,9 @@ +package com.flightfeather.uav.socket.bean + +import com.flightfeather.uav.socket.eunm.FactorType + +/** + * @author riku + * Date: 2020/6/10 + */ +class AirTypeData(var factorType: FactorType): DataUnit() \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/CarLogOutData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/CarLogOutData.kt deleted file mode 100644 index 6ff5c06..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/CarLogOutData.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import java.util.* - -/** - * @author riku - * Date: 2019/9/12 - * 杞﹁締鐧诲嚭淇℃伅 - * 鏁版嵁绫诲瀷 @see [ObdCommandUnit.CarLogOut] - * - * 鏁版嵁琛ㄧず鍐呭 闀垮害锛堝瓧鑺傦級 鏁版嵁绫诲瀷 鎻忚堪鍙婅姹� - * 鐧诲嚭鏃堕棿 6 BYTE[6] 鏃堕棿鍧囧簲閲囩敤 GMT+8 鏃堕棿锛屾椂闂村畾涔夌鍚� GB/T32960.3-2016 绗� 6.4 鏉$殑瑕佹眰 - * 鐧诲嚭娴佹按鍙� 2 WORD 鐧诲嚭娴佹按鍙蜂笌褰撴鐧诲叆娴佹按鍙蜂竴鑷淬�侤see [CarRegisterData] - */ -class CarLogOutData( - time: Date?, - serialNum: Int? -): DataUnit(time, serialNum) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/CarRegisterData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/CarRegisterData.kt deleted file mode 100644 index 2f6d2c1..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/CarRegisterData.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import java.util.* - -/** - * @author riku - * Date: 2019/9/12 - * - * 杞﹁締鐧诲叆鏁版嵁鏍煎紡 - * 鏁版嵁绫诲瀷 @see [ObdCommandUnit.CarRegister] - * - * 璧峰瀛楄妭 鍐呭 鎻忚堪 - * 0 鏁版嵁閲囬泦鏃堕棿 鏃堕棿鍧囧簲閲囩敤 GMT+8 鏃堕棿锛屾椂闂村畾涔夌鍚� GB/T32960.3-2016 绗� 6.4 鏉$殑瑕佹眰 - * 6 鐧诲叆娴佹按鍙� 杞﹁浇缁堢姣忕櫥鍏ヤ竴娆★紝鐧诲叆娴佹按鍙疯嚜鍔ㄥ姞 1锛屼粠 1寮�濮嬪惊鐜疮鍔狅紝鏈�澶у�间负 65531锛屽惊鐜懆鏈熶负澶┿�� - * 10 SIM 鍗″彿 SIM 鍗� ICCID 鍙凤紙ICCID 搴斾负缁堢浠� SIM 鍗¤幏鍙栫殑鍊硷紝涓嶅簲浜轰负濉啓鎴栦慨鏀癸級銆� - */ -class CarRegisterData( - time: Date?, - serialNum: Int?, - var SIMCode: String? = null -): DataUnit(time, serialNum) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/DataUnit.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/DataUnit.kt index bbfcd4e..11edd95 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/DataUnit.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/bean/DataUnit.kt @@ -1,6 +1,6 @@ package com.flightfeather.uav.socket.bean -import com.flightfeather.uav.socket.eunm.ObdCommandUnit +import com.flightfeather.uav.socket.eunm.AirCommandUnit import java.util.* /** @@ -8,9 +8,8 @@ * Date: 2019/9/12 * * 鏁版嵁鍗曞厓 - * 鏍规嵁鍛戒护鍗曞厓 @see [ObdCommandUnit] 鐨勫垎绫伙紝涓嶅悓绫诲瀷鐨勭粨鏋勪笉鍚岋紝瑙佸悇瀛愮被 + * 鏍规嵁鍛戒护鍗曞厓 @see [AirCommandUnit] 鐨勫垎绫伙紝涓嶅悓绫诲瀷鐨勭粨鏋勪笉鍚岋紝瑙佸悇瀛愮被 */ -open class DataUnit( - var time: Date?, - var serialNum: Int? -) \ No newline at end of file +open class DataUnit { + var time: Date? = null +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/EngineDataStream.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/EngineDataStream.kt deleted file mode 100644 index 32027b3..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/EngineDataStream.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import com.flightfeather.uav.socket.eunm.ObdDataType -import java.util.* - -/** - * @author riku - * Date: 2019/9/15 - * 瀹炴椂淇℃伅[RealTimeData] 涓殑鍙戝姩鏈烘暟鎹祦 - * 鏁版嵁绫诲瀷 @see [ObdDataType.EngineDataFlow] - */ -class EngineDataStream( - time: Date?, - serialNum: Int? -) : RealTimeData(time, serialNum) { - var obdSpeed: Double? = null - var obdAirPressure: Double? = null - var obdEngineTorque: Double? = null - var obdFrictionTorque: Double? = null - var obdEngineRpm: Double? = null - var obdEngineFuelFlow: Double? = null - var obdScrUpstreamNox: Double? = null - var obdScrDownstreamNox: Double? = null - var obdRemainReactant: Double? = null - var obdAirInput: Double? = null - var obdScrInputTemp: Double? = null - var obdScrOutputTemp: Double? = null - var obdDpf: Double? = null - var obdEngineCoolantTemp: Double? = null - var obdFuelLevel: Double? = null - var obdLocationStatus: Int? = null - var obdLong: Double? = null - var obdLat: Double? = null - var obdTotalMileage: Double? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/ObdInfo.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/ObdInfo.kt deleted file mode 100644 index f0eedb5..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/ObdInfo.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import com.flightfeather.uav.socket.eunm.ObdDataType -import java.util.* - -/** - * @author riku - * Date: 2019/9/15 - * 瀹炴椂淇℃伅[RealTimeData] 涓殑obd鏁版嵁 - * 鏁版嵁绫诲瀷 @see [ObdDataType.ObdData] - */ -class ObdInfo( - time: Date?, - serialNum: Int? -) : RealTimeData(time, serialNum) { - var obdProtocol: Int? = null - var obdMil: Int? = null - var diagnosisSupportStatus: String? = null//璇婃柇鏀寔鐘舵�� - var diagnosisReadyStatus: String? = null//璇婃柇灏辩华鐘舵�� - var obdVin: String? = null - var obdCrn: String? = null//杞欢鏍囧畾璇嗗埆鍙� - var obdCvn: String? = null//鏍囧畾楠岃瘉鐮� - 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/uav/socket/bean/ObdPackageData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/ObdPackageData.kt deleted file mode 100644 index 7b53378..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/ObdPackageData.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import com.flightfeather.uav.socket.eunm.ObdCommandUnit - -/** - * @author riku - * Date: 2019/9/12 - * 鏁版嵁鍖呯粨鏋� - * - * 璧峰瀛楄妭 瀹氫箟 鏁版嵁绫诲瀷 鎻忚堪鍙婅姹� - * 0 璧峰绗� STRING 鍥哄畾涓� ASCII 瀛楃鈥�##鈥欙紝鐢ㄢ��0x23锛�0x23鈥濊〃绀� - * 2 鍛戒护鍗曞厓 BYTE 鍛戒护鍗曞厓瀹氫箟 @see [ObdCommandUnit] - * 3 杞﹁締璇嗗埆鍙� STRING 杞﹁締璇嗗埆鐮佹槸璇嗗埆鐨勫敮涓�鏍囪瘑锛岀敱 17 浣嶅瓧鐮佺粍鎴愶紝瀛楃爜搴旂鍚� GB16735 涓� 4.5 鐨勮瀹� - * 20 缁堢杞欢鐗堟湰鍙� BYTE 缁堢杞欢鐗堟湰鍙锋湁鏁堝�艰寖鍥� 0~255 - * 21 鏁版嵁鍔犲瘑鏂瑰紡 BYTE 0x01锛氭暟鎹笉鍔犲瘑锛� - * 0x02锛氭暟鎹粡杩� RSA 绠楁硶鍔犲瘑锛� - * 0x03锛氭暟鎹粡杩囧浗瀵� SM2 绠楁硶鍔犲瘑锛� - * 鈥�0xFE鈥濇爣璇嗗紓甯革紝鈥�0xFF鈥濊〃绀烘棤鏁堬紝鍏朵粬棰勭暀 - * 22 鏁版嵁鍗曞厓闀垮害 WORD 鏁版嵁鍗曞厓闀垮害鏄暟鎹崟鍏冪殑鎬诲瓧鑺傛暟锛屾湁鏁堣寖鍥达細0~65531 - * 24 鏁版嵁鍗曞厓 瑙佹暟鎹崟鍏冩牸寮忓拰瀹氫箟 @see [DataUnit] - * 鍊掓暟绗� 1 鏍¢獙鐮� BYTE 閲囩敤 BCC锛堝紓鎴栨牎楠岋級娉曪紝鏍¢獙鑼冨洿鑱槑鏄熷崟鍏冪殑绗竴涓瓧鑺傚紑濮嬶紝鍚屽悗涓�涓瓧鑺傚紓鎴栵紝鐩村埌鏍¢獙鐮佸墠涓�瀛楄妭涓烘锛屾牎楠岀爜鍗犵敤涓�涓瓧鑺� - */ -data class ObdPackageData constructor( - //璧峰绗� - var head: String? = null, - //鍛戒护鍗曞厓 - var commandUnit: Int? = null, - //杞﹁締璇嗗埆鍙�(鎸噊bd鏁版嵁閲囬泦璁惧鐨勭紪鍙�) - var deviceCode: String? = null, - //缁堢杞欢鐗堟湰鍙� - var softwareVersion: Int? = null, - //鏁版嵁鍔犲瘑鏂瑰紡 - var encryptionWay: Int? = null, - //鏁版嵁鍗曞厓闀垮害 - var dataLength: Int? = null, - //鏁版嵁鍗曞厓 - var dataUnit: List<DataUnit>, - //鏍¢獙鐮� - var checkCode: Int? = null -) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/RealTimeData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/RealTimeData.kt deleted file mode 100644 index 9e60359..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/RealTimeData.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import java.util.* -import com.flightfeather.uav.socket.eunm.ObdDataType -import com.flightfeather.uav.socket.eunm.ObdCommandUnit - -/** - * @author riku - * Date: 2019/9/12 - * - * 瀹炴椂淇℃伅 - * 鏁版嵁绫诲瀷 @see[ObdCommandUnit.RealTimeData] - * - * 鏁版嵁琛ㄧず鍐呭 闀垮害锛堝瓧鑺傦級 鏁版嵁绫诲瀷 鎻忚堪鍙婅姹� - * 鏁版嵁閲囬泦鏃堕棿 6 BYTE[6] 鏃堕棿鍧囧簲閲囩敤 GMT+8 鏃堕棿锛屾椂闂村畾涔夌鍚� GB/T32960.3-2016 绗� 6.4 鏉$殑瑕佹眰 - * 淇℃伅娴佹按鍙� 2 WORD 浠ュぉ涓哄崟浣嶏紝姣忓寘瀹炴椂淇℃伅娴佹按鍙峰敮涓�锛屼粠 1 寮�濮嬬疮鍔� - * 淇℃伅绫诲瀷鏍囧織锛坣锛� 1 BYTE 淇℃伅绫诲瀷鏍囧織 @see [ObdDataType] - * 淇℃伅浣擄紙n锛� 鏍规嵁淇℃伅绫诲瀷涓嶅悓锛岄暱搴﹀拰鏁版嵁绫诲瀷涓嶅悓 - * 鈥︹�� 鈥︹�� - * 淇℃伅绫诲瀷鏍囧織锛坢锛� 1 BYTE[6] 淇℃伅绫诲瀷鏍囧織 - * 淇℃伅浣擄紙m锛� 鏍规嵁淇℃伅绫诲瀷涓嶅悓锛岄暱搴﹀拰鏁版嵁绫诲瀷涓嶅悓 - */ -open class RealTimeData( - time: Date?, - serialNum: Int? -) : ReplacementData(time, serialNum) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/ReplacementData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/ReplacementData.kt deleted file mode 100644 index 98d07d0..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/ReplacementData.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import java.util.* -import com.flightfeather.uav.socket.eunm.ObdCommandUnit - -/** - * @author riku - * Date: 2019/9/12 - * 琛ュ彂淇℃伅涓庡疄鏃朵俊鎭唴瀹逛竴鑷� @see [RealTimeData] - * 鏁版嵁绫诲瀷 @see [ObdCommandUnit.ReplacementData] - */ -open class ReplacementData ( - time: Date?, - serialNum: Int? -): DataUnit(time, serialNum) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/SupplementDataStream.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/SupplementDataStream.kt deleted file mode 100644 index 55d5103..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/SupplementDataStream.kt +++ /dev/null @@ -1,59 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import java.util.* -import com.flightfeather.uav.socket.eunm.ObdDataType - -/** - * @author riku - * Date: 2019/9/15 - * 琛ュ厖鏁版嵁娴� - * 鏁版嵁绫诲瀷 @see [ObdDataType.SupplementDataFlow] - * - * 璧峰瀛楄妭 鏁版嵁椤� 鏁版嵁绫诲瀷 鍗曚綅 鎻忚堪鍙婅姹� - * 0 鍙戝姩鏈烘壄鐭╂ā寮� BYTE 0锛氳秴閫熷け鏁� - * 1锛氳浆閫熸帶鍒� - * 2锛氭壄鐭╂帶鍒� - * 3锛氳浆閫�/鎵煩鎺у埗 - * 1 娌归棬韪忔澘 BYTE % 鏁版嵁闀垮害锛�1bytes - * 绮惧害锛�0.4%/bit - * 鍋忕Щ閲忥細0 - * 鏁版嵁鑼冨洿锛�0~100% - * 鈥�0xFF鈥濊〃绀烘棤鏁� - * 2 绱娌硅�楋紙鎬绘补鑰楋級 DWORD L 鏁版嵁闀垮害锛�4bytes - * 绮惧害锛�0.5L per bit - * 鍋忕Щ閲忥細0 - * 鏁版嵁鑼冨洿锛�0~2,105,540,607.5L - * 鈥�0xFF,0xFF,0xFF,0xFF鈥濊〃绀烘棤鏁� - * 6 灏跨礌绠辨俯搴� BYTE 鈩� 鏁版嵁闀垮害锛�1bytes - * 绮惧害锛�1 鈩�/bit - * 鍋忕Щ閲忥細-40 - * 鏁版嵁鑼冨洿锛�-40~210鈩� - * 鈥�0xFF鈥濊〃绀烘棤鏁� - * 7 瀹為檯灏跨礌鍠峰皠閲� DWORD ml/h 鏁版嵁闀垮害锛�4bytes - * 绮惧害锛�0.01 ml/h per bit - * 鍋忕Щ閲忥細0 - * 鏁版嵁鑼冨洿锛�0 - * 鈥�0xFF,0xFF,0xFF,0xFF鈥濊〃绀烘棤鏁� - * 11 绱灏跨礌娑堣�楋紙鎬诲翱绱犳秷鑰楋級DWORD g 鏁版嵁闀垮害锛�4bytes - * 绮惧害锛�1 g per bit - * 鍋忕Щ閲忥細0 - * 鏁版嵁鑼冨洿锛�0 - * 鈥�0xFF,0xFF,0xFF,0xFF鈥濊〃绀烘棤鏁� - * 15 DPF 鎺掓皵娓╁害 WORD 鈩� 鏁版嵁闀垮害锛�2bytes - * 绮惧害锛�0.03125 鈩� per bit - * 鍋忕Щ閲忥細-273 - * 鏁版嵁鑼冨洿锛�-273~1734.96875鈩� - * 鈥�0xFF,0xFF鈥濊〃绀烘棤鏁� - */ -class SupplementDataStream( - time: Date?, - serialNum: Int? -) : RealTimeData(time, serialNum) { - var obdEngineTorqueMode: Int? = null - var obdAcceleratorPedal: Double? = null - var obdTotalOilConsumption: Double? = null - var obdUreaBoxTemp: Double? = null - var obdUreaVolume: Double? = null - var obdTotalUreaConsume: Double? = null - var obdDpfTemp: Double? = null -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/bean/TimeCalibrationData.kt b/src/main/kotlin/com/flightfeather/uav/socket/bean/TimeCalibrationData.kt deleted file mode 100644 index 8268606..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/bean/TimeCalibrationData.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.flightfeather.uav.socket.bean - -import java.util.* -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -/** - * @author riku - * Date: 2019/9/12 - * - * 杞﹁浇缁堢鏍℃椂鐨勬暟鎹崟鍏冧负绌恒�� - * 鏁版嵁绫诲瀷 @see [ObdCommandUnit.TimeCalibration] - * - */ -class TimeCalibrationData( - time: Date? = null, - serialNum: Int? = null -) : DataUnit(time, serialNum) \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/VehicleDataDecoder.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/AirDataDecoder.kt similarity index 63% rename from src/main/kotlin/com/flightfeather/uav/socket/decoder/VehicleDataDecoder.kt rename to src/main/kotlin/com/flightfeather/uav/socket/decoder/AirDataDecoder.kt index 17eda1c..f06f127 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/VehicleDataDecoder.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/decoder/AirDataDecoder.kt @@ -1,26 +1,25 @@ package com.flightfeather.uav.socket.decoder -import com.flightfeather.uav.socket.bean.ObdPackageData +import com.flightfeather.uav.socket.bean.AirPackageData import com.flightfeather.uav.socket.decoder.impl.DataPackageDecoderImpl /** - * 杞﹁締 uav 鏁版嵁瑙g爜鍣� + * 绌烘皵璐ㄩ噺澶氬弬鏁版暟鎹В鐮佸櫒 * @author riku * Date: 2019/9/12 */ -class VehicleDataDecoder { +class AirDataDecoder { private val dataPackageDecoder: DataPackageDecoder = DataPackageDecoderImpl() - fun decode(msg: String): ObdPackageData { + fun decode(msg: String): AirPackageData { val list = dataPackageDecoder.toStringList(msg) dataPackageDecoder.run { - return ObdPackageData( + return AirPackageData( getHead(list), getCommandUnit(list), - getVinCode(list), - getSoftwareVersion(list), - getEncryptionWay(list), + getDeviceCode(list), + getDataTime(list), getDataLength(list), getDataUnit(list), getCheckCode(list) diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataPackageDecoder.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataPackageDecoder.kt index 1849efa..8740c9c 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataPackageDecoder.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataPackageDecoder.kt @@ -1,7 +1,8 @@ package com.flightfeather.uav.socket.decoder import com.flightfeather.uav.socket.bean.DataUnit -import com.flightfeather.uav.socket.eunm.ObdCommandUnit +import com.flightfeather.uav.socket.eunm.AirCommandUnit +import java.util.* /** * uav 绗竴灞傛暟鎹寘瑙g爜鍣� @@ -11,13 +12,9 @@ * 鏁版嵁绗竴灞傜粨鏋勫畾涔夊涓嬶細 * 璧峰瀛楄妭 瀹氫箟 * 0 璧峰绗� - * 2 鍛戒护鍗曞厓 绫诲瀷@see [ObdCommandUnit] - * 3 杞﹁締璇嗗埆鍙� - * 4 缁堢杞欢鐗堟湰鍙� - * 21 鏁版嵁鍔犲瘑鏂瑰紡 - * 22 鏁版嵁鍗曞厓闀垮害 - * 24 鏁版嵁鍗曞厓 瑙g爜鍣ˊsee [DataUnitDecoder] - * 鍊掓暟绗�1 鏍¢獙鐮� + * 1 鍛戒护鍗曞厓 绫诲瀷@see [AirCommandUnit] + * 2 鏁版嵁鍗曞厓闀垮害 + * 鍊掓暟绗�2 鏍¢獙鐮� */ interface DataPackageDecoder { @@ -25,11 +22,9 @@ fun getCommandUnit(b: List<String>): Int? - fun getVinCode(b: List<String>): String? + fun getDeviceCode(b: List<String>): String? - fun getSoftwareVersion(b: List<String>): Int? - - fun getEncryptionWay(b: List<String>): Int? + fun getDataTime(b: List<String>): Date fun getDataLength(b: List<String>): Int diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataUnitDecoder.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataUnitDecoder.kt index a2fb584..ce26095 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataUnitDecoder.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/decoder/DataUnitDecoder.kt @@ -1,7 +1,7 @@ package com.flightfeather.uav.socket.decoder import com.flightfeather.uav.socket.bean.* -import com.flightfeather.uav.socket.eunm.ObdCommandUnit +import com.flightfeather.uav.socket.eunm.AirCommandUnit import java.util.* /** @@ -10,7 +10,7 @@ * Date: 2019/9/12 * * 鏁版嵁鍗曞厓鎸夌収鍛戒护鍗曞厓鐨勭被鍨嬪叡鏈変互涓嬪嚑绉嶇被鍨嬶細 - * 鍛戒护鍗曞厓 @see [ObdCommandUnit] + * 鍛戒护鍗曞厓 @see [AirCommandUnit] * 缂栫爜(byte) 瀹氫箟 * 0x01 杞﹁締鐧诲叆 * 0x02 瀹炴椂淇℃伅涓婃姤 @@ -21,16 +21,8 @@ */ interface DataUnitDecoder { - fun getCarRegisterData(b: List<String>): List<CarRegisterData> + fun getAirConfirmData(b: List<String>): List<AirTypeData> - fun getRealTimeData(b: List<String>): List<RealTimeData> - - fun getReplacementData(b: List<String>): List<ReplacementData> - - fun getCarLogOutData(b: List<String>): List<CarLogOutData> - - fun getTimeCalibrationData(b: List<String>): List<TimeCalibrationData> - - fun decodeDataTime(b: List<String>): Date? + fun getAirData(b: List<String>): List<AirData> } \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/RealTimeDataDecoder.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/RealTimeDataDecoder.kt deleted file mode 100644 index dca173c..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/RealTimeDataDecoder.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.flightfeather.uav.socket.decoder - -import com.flightfeather.uav.socket.bean.* -import com.flightfeather.uav.socket.eunm.ObdDataType -import java.util.* - -/** - * @author riku - * Date: 2019/9/15 - * 鏁版嵁鍗曞厓[DataUnit]涓紝绫诲瀷涓哄疄鏃朵俊鎭痆RealTimeData]鐨勮В鐮佸櫒 - * 鍏跺垎绫� @see [ObdDataType] - */ -interface RealTimeDataDecoder { - - fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdInfo? - - fun getEngineDataStream(time: Date?, serialNum: Int, b: List<String>): EngineDataStream? - - fun getSupplementDataStream(time: Date?, serialNum: Int, b: List<String>): SupplementDataStream? - - /** - * 鏍规嵁浼犲叆鐨勫垪琛紝榛樿绗竴浣嶄负 [ObdDataType]锛岃繑鍥炲搴旂殑鏁版嵁鍒楄〃 - */ - fun getDataListByDataType(list: List<String>): MutableList<String> - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataPackageDecoderImpl.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataPackageDecoderImpl.kt index cb41fb8..66ade0c 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataPackageDecoderImpl.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataPackageDecoderImpl.kt @@ -3,7 +3,8 @@ import com.flightfeather.uav.socket.bean.DataUnit import com.flightfeather.uav.socket.decoder.DataPackageDecoder import com.flightfeather.uav.socket.decoder.DataUnitDecoder -import com.flightfeather.uav.socket.eunm.ObdCommandUnit +import com.flightfeather.uav.socket.eunm.AirCommandUnit +import java.util.* /** * @author riku @@ -13,79 +14,62 @@ private val dataUnitDecoder: DataUnitDecoder = DataUnitDecoderImpl() - // 鎺ユ敹鍒扮殑瀛楃涓叉槸byte杞爜鍓嶇殑锛屽叾灏辫〃绀哄瓧绗︾殑ASCII鐮侊紱 override fun getHead(b: List<String>): String? { - return if (b.size >= 2) { - "${b[0]}${b[1]}" + return if (b.isNotEmpty()) { + b[0] } else { null } } - override fun getCommandUnit(b: List<String>): Int? = if (b.size >= 3) { - b[2].toIntOrNull(16) + override fun getCommandUnit(b: List<String>): Int? = if (b.size >= 2) { + b[1].toIntOrNull(16) } else { null } - override fun getVinCode(b: List<String>): String? { - if (b.size < 20) return null - - //fixme 搴旇鏄渶瑕佸皢b褰撲綔ASCII鐮侊紝鍐嶈幏鍙栬浆鎹㈠悗鐨勫瓧绗︿覆 - val s = StringBuilder() - - for (i in 3..19) { - s.append(b[i].toIntOrNull(16)?.toChar()) - } - - return s.toString() + override fun getDeviceCode(b: List<String>): String? { + return null } - override fun getSoftwareVersion(b: List<String>): Int? = if (b.size >= 21) { - b[20].toIntOrNull(16) - } else { - null - } - - override fun getEncryptionWay(b: List<String>): Int? = if (b.size >= 21) { - b[21].toIntOrNull(16) - } else { - null + override fun getDataTime(b: List<String>): Date { + //fixme 2020/06/11 鐩墠鏁版嵁娴佷腑涓嶅寘鍚噰鏍锋椂闂达紝鎵�浠ラ噰鐢ㄦ湇鍔″櫒鎺ユ敹鏃堕棿浣滀负閲囨牱鏃堕棿 + return Date() } override fun getDataLength(b: List<String>): Int { - if (b.size < 24) return 0 + if (b.size < 5) return 0 - val hexNum = "${b[22]}${b[23]}" + val hexNum = b[2] return hexNum.toIntOrNull(16) ?: 0 } override fun getDataUnit(b: List<String>): List<DataUnit> { - if (getDataLength(b) == 0 || b.size < 26) { + if (getDataLength(b) == 0 || b.size < 5) { return emptyList() } val unit = mutableListOf<String>() - for (i in 24..b.size - 2) { + for (i in 3..b.size - 3) { unit.add(b[i]) } + dataUnitDecoder.run { return when (getCommandUnit(b)) { - ObdCommandUnit.CarRegister.value -> getCarRegisterData(unit) - ObdCommandUnit.RealTimeData.value -> getRealTimeData(unit) - ObdCommandUnit.ReplacementData.value -> getReplacementData(unit) - ObdCommandUnit.CarLogOut.value -> getCarLogOutData(unit) - ObdCommandUnit.TimeCalibration.value -> getTimeCalibrationData(unit) + AirCommandUnit.Confirm.value -> getAirConfirmData(unit) + AirCommandUnit.AirData.value -> getAirData(unit) else -> emptyList() } } } override fun getCheckCode(b: List<String>): Int? { - return if (b.isNotEmpty()) { - b[b.size - 1].toIntOrNull(16) + return if (b.size >= 5) { + val hexNum = "${b[b.size - 2]}${b[b.size - 1]}" + + hexNum.toIntOrNull(16) } else { null } diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataUnitDecoderImpl.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataUnitDecoderImpl.kt index ef8f26d..4f70a2a 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataUnitDecoderImpl.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/DataUnitDecoderImpl.kt @@ -1,12 +1,10 @@ package com.flightfeather.uav.socket.decoder.impl -import com.flightfeather.uav.socket.bean.* +import com.flightfeather.uav.socket.bean.AirData +import com.flightfeather.uav.socket.bean.AirTypeData import com.flightfeather.uav.socket.decoder.DataUnitDecoder -import com.flightfeather.uav.socket.decoder.RealTimeDataDecoder -import com.flightfeather.uav.socket.eunm.ObdDataType +import com.flightfeather.uav.socket.eunm.FactorType import org.slf4j.LoggerFactory -import java.lang.StringBuilder -import java.util.* /** * @author riku @@ -15,113 +13,34 @@ class DataUnitDecoderImpl : DataUnitDecoder { private val logger = LoggerFactory.getLogger(javaClass.name) - private var realTimeDataDecoder: RealTimeDataDecoder = RealTimeDataDecoderImpl() - override fun getCarRegisterData(b: List<String>): List<CarRegisterData> { - val time = decodeDataTime(b) - val serialNum = "${b[6]}${b[7]}".toInt(16) - - val simCode = StringBuilder() - for (i in 10 until b.size) { - simCode.append(b[i].toInt(16).toChar()) - } - - return mutableListOf(CarRegisterData(time, serialNum, simCode.toString())) - } - - override fun getRealTimeData(b: List<String>): List<RealTimeData> { - val time = decodeDataTime(b) - - //鍥芥爣娉�: 璧峰瀛楄妭涓�7 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙� -// val serialNum = "${b[7]}${b[8]}".toInt(16) - - //涓婃捣娉�: 璧峰瀛楄妭涓�6 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙� - val serialNum = "${b[6]}${b[7]}".toInt(16) - - val dataList = mutableListOf<String>().apply { addAll(b) } - //鍒犲幓鍓�6浣嶆椂闂� - for (i in 0..5) { - if (dataList.isNotEmpty()) dataList.removeAt(0) - } - - //fixme 2019.9.15 鐩墠涓ょ瑙勫垯鏈夊啿绐侊紝骞朵笖鍙粠鏁版嵁鍐呭鏃犳硶鍖哄垎銆傛殏鏃朵娇鐢� 鍥芥爣娉� - /* - * 鍒犲幓娴佹按鍙凤紝寰楀埌淇℃伅鏍囧織涓庝俊鎭綋鐨勭粍鍚� - * (鍥芥爣娉曪細鍘婚櫎鍓�6浣嶆椂闂村悗锛岃捣濮嬪瓧鑺備负1 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙�) - */ -// if (dataList.size >= 2) dataList.removeAt(1) -// if (dataList.size >= 2) dataList.removeAt(1) - - /* - * 鍒犲幓娴佹按鍙凤紝寰楀埌淇℃伅鏍囧織涓庝俊鎭綋鐨勭粍鍚� - * (涓婃捣娉曪細鍘婚櫎鍓�6浣嶆椂闂村悗锛岃捣濮嬪瓧鑺備负0 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙�) - */ - if (dataList.isNotEmpty()) dataList.removeAt(0) - if (dataList.isNotEmpty()) dataList.removeAt(0) - - val resultList = mutableListOf<RealTimeData>() - - /* - * 鏈�缁堝緱鍒扮殑鏁版嵁缁撴瀯涓� [ 淇℃伅绫诲瀷鏍囧織, 淇℃伅浣�, ...... , 淇℃伅绫诲瀷鏍囧織, 淇℃伅浣� ] - */ - while (dataList.isNotEmpty()) { - //寰楀埌鏈�鍓嶉潰鐨勪竴缁勪俊鎭被鍨�+淇℃伅浣撳垪琛� - val data = realTimeDataDecoder.getDataListByDataType(dataList) - if (data.isNotEmpty()) { - val r = when (data[0].toInt(16)) { - ObdDataType.ObdData.value -> realTimeDataDecoder.getObdData(time, serialNum, data) - ObdDataType.EngineDataFlow.value -> realTimeDataDecoder.getEngineDataStream(time, serialNum, data) - ObdDataType.SupplementDataFlow.value -> realTimeDataDecoder.getSupplementDataStream(time, serialNum, data) - else -> null - } - - if (r != null) { - resultList.add(r) - } - - for (i in 0 until data.size) { - if (dataList.isNotEmpty()) dataList.removeAt(0) - } - }else if (dataList.isNotEmpty()) { - //鎸夌収瑙勫垯娌℃湁鍙栧埌淇℃伅浣擄紝骞朵笖鍘熸暟鎹笉涓虹┖锛岃〃绀哄師鏁版嵁鏍煎紡閿欒锛岄��鍑哄惊鐜� - logger.error("-------鏁版嵁淇℃伅娴佹垨琛ュ厖鏁版嵁娴佹牸寮忛敊璇�") - break + override fun getAirConfirmData(b: List<String>): List<AirTypeData> { + val resultList = mutableListOf<AirTypeData>() + b.forEach { + FactorType.getByIndex(it.toInt(16))?.let { f-> + resultList.add(AirTypeData(f)) } } - return resultList } - override fun getReplacementData(b: List<String>): List<ReplacementData> = getRealTimeData(b) - - override fun getCarLogOutData(b: List<String>): List<CarLogOutData> { - val time = decodeDataTime(b) - - val serialNum = "${b[6]}${b[7]}".toInt(16) - - return mutableListOf(CarLogOutData(time, serialNum)) - } - - override fun getTimeCalibrationData(b: List<String>): List<TimeCalibrationData> = emptyList() - - override fun decodeDataTime(b: List<String>): Date? { - if (b.size < 6) { - return null + override fun getAirData(b: List<String>): List<AirData> { + val resultList = mutableListOf<AirData>() + var i = 0 + while (i < b.size - 3) { + val a = "${b[i]}${b[i + 1]}".toInt(16) + var b1 = b[i + 2].toInt(16).toDouble() + while (b1 >= 1) { + b1 /= 10 + } + val data = a + b1 + resultList.add(AirData().apply { + factorData = data + }) + i += 3 } - val year = b[0].toInt(16) + 2000 - if (year < 2000 || year > 2099) return null - val month = b[1].toInt(16) - val day = b[2].toInt(16) - val hour = b[3].toInt(16) - val min = b[4].toInt(16) - 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 + return resultList } } \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/RealTimeDataDecoderImpl.kt b/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/RealTimeDataDecoderImpl.kt deleted file mode 100644 index 690239f..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/decoder/impl/RealTimeDataDecoderImpl.kt +++ /dev/null @@ -1,185 +0,0 @@ -package com.flightfeather.uav.socket.decoder.impl - -import com.flightfeather.uav.common.INVALID_DATA_4_BYTE -import com.flightfeather.uav.socket.bean.EngineDataStream -import com.flightfeather.uav.socket.bean.ObdInfo -import com.flightfeather.uav.socket.bean.SupplementDataStream -import com.flightfeather.uav.socket.decoder.RealTimeDataDecoder -import com.flightfeather.uav.socket.eunm.ObdDataType -import java.util.* - -/** - * @author riku - * Date: 2019/9/15 - */ -class RealTimeDataDecoderImpl : RealTimeDataDecoder { - override fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdInfo? { - val dataList = mutableListOf<String>().apply { addAll(b) } - if (b.isNotEmpty()) { - //鍘婚櫎 淇℃伅绫诲瀷鏍囧織 - dataList.removeAt(0) - } - if (dataList.size >= 96) { - val vin = StringBuilder() - for (i in 6..22) { - vin.append(dataList[i].toIntOrNull(16)?.toChar()) - } - val softwareCode = StringBuilder() - for (i in 23..40) { - softwareCode.append(dataList[i].toIntOrNull(16)?.toChar()) - } - val cvn = StringBuilder() - for (i in 41..58) { - cvn.append(dataList[i].toIntOrNull(16)?.toChar()) - } - val IUPR = StringBuilder() - for (i in 59..94) { - //todo 2019.9.15 鍥犳殏涓嶆竻妤氭牸寮忎笌鍚箟锛岀洿鎺ヤ繚瀛� - IUPR.append(dataList[i]) - } - var faultCodeNum = dataList[95].toIntOrNull() ?: 0 - val faultCode = StringBuilder() - if (faultCodeNum < 0 || faultCodeNum > 253) { - faultCodeNum = 254//浠h〃鏃犳晥 - } else { - for (i in 96..(95 + 4 * faultCodeNum)) { - faultCode.append(dataList[i]) - } - } - - return ObdInfo(time, serialNum).apply { - obdProtocol = dataList[0].toIntOrNull(16) - obdMil = dataList[1].toIntOrNull(16) - diagnosisSupportStatus = "${dataList[2]}${dataList[3]}".toIntOrNull(16)?.toString(2) - diagnosisReadyStatus = "${dataList[4]}${dataList[5]}".toIntOrNull(16)?.toString(2) - obdVin = vin.toString() - obdCrn = softwareCode.toString() - obdCvn = cvn.toString() - this.iupr = IUPR.toString() - obdFaultCodeNum = faultCodeNum - obdFaultCode = faultCode.toString() - } - } else { - return null - } - } - - override fun getEngineDataStream(time: Date?, serialNum: Int, b: List<String>): EngineDataStream? { - val dataList = mutableListOf<String>().apply { addAll(b) } - if (b.isNotEmpty()) { - //鍘婚櫎 淇℃伅绫诲瀷鏍囧織 - dataList.removeAt(0) - } - - return if (dataList.size >= 37) { - EngineDataStream(time, serialNum).apply { - obdSpeed = "${dataList[0]}${dataList[1]}".toIntOrNull(16)?.toDouble()?.div(256) - obdAirPressure = dataList[2].toIntOrNull(16)?.toDouble()?.times(0.5) - obdEngineTorque = dataList[3].toIntOrNull(16)?.minus(125)?.toDouble()?.div(100) - 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) - obdScrUpstreamNox = "${dataList[9]}${dataList[10]}".toIntOrNull(16)?.times(0.05)?.minus(200) - obdScrDownstreamNox = "${dataList[11]}${dataList[12]}".toIntOrNull(16)?.times(0.05)?.minus(200) - 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)?.times(0.03125)?.minus(273) - obdScrOutputTemp = "${dataList[18]}${dataList[19]}".toIntOrNull(16)?.times(0.03125)?.minus(273) - obdDpf = "${dataList[20]}${dataList[21]}".toIntOrNull(16)?.toDouble()?.times(0.1) - obdEngineCoolantTemp = dataList[22].toIntOrNull(16)?.minus(40)?.toDouble() - obdFuelLevel = dataList[23].toIntOrNull(16)?.toDouble()?.times(0.4) - obdLocationStatus = dataList[24].toIntOrNull(16) - with("${dataList[25]}${dataList[26]}${dataList[27]}${dataList[28]}") { - obdLong = if (toUpperCase() == INVALID_DATA_4_BYTE) { -1.0 } else { toBigIntegerOrNull(16)?.toDouble()?.times(0.000001) } - } - with("${dataList[29]}${dataList[30]}${dataList[31]}${dataList[32]}") { - obdLat = if (toUpperCase() == INVALID_DATA_4_BYTE) { -1.0 } else { toBigIntegerOrNull(16)?.toDouble()?.times(0.000001) } - } - with("${dataList[33]}${dataList[34]}${dataList[35]}${dataList[36]}") { - obdTotalMileage = if (toUpperCase() == INVALID_DATA_4_BYTE) { -1.0 } else { toBigIntegerOrNull(16)?.toDouble()?.times(0.1) } - } - } - } else { - null - } - } - - override fun getSupplementDataStream(time: Date?, serialNum: Int, b: List<String>): SupplementDataStream? { - val dataList = mutableListOf<String>().apply { addAll(b) } - if (b.isNotEmpty()) { - //鍘婚櫎 淇℃伅绫诲瀷鏍囧織 - dataList.removeAt(0) - } - - return if (dataList.size >= 17) { - SupplementDataStream(time, serialNum).apply { - obdEngineTorqueMode = dataList[0].toIntOrNull(16) - obdAcceleratorPedal = dataList[1].toIntOrNull(16)?.toDouble()?.times(0.4)?.div(100) - with("${dataList[2]}${dataList[3]}${dataList[4]}${dataList[5]}") { - obdTotalOilConsumption = if (toUpperCase() == INVALID_DATA_4_BYTE) -1.0 else toBigIntegerOrNull(16)?.toDouble()?.times(0.5) - } - obdUreaBoxTemp = dataList[6].toIntOrNull(16)?.toDouble()?.minus(40) - with("${dataList[7]}${dataList[8]}${dataList[9]}${dataList[10]}") { - obdUreaVolume = if (toUpperCase() == INVALID_DATA_4_BYTE) -1.0 else toBigIntegerOrNull(16)?.toDouble()?.times(0.01) - } - with("${dataList[11]}${dataList[12]}${dataList[13]}${dataList[14]}") { - obdTotalUreaConsume = if (toUpperCase() == INVALID_DATA_4_BYTE) -1.0 else toBigIntegerOrNull(16)?.toDouble() - } - obdDpfTemp = "${dataList[15]}${dataList[16]}".toIntOrNull(16)?.times(0.03125)?.minus(273) - } - } else { - null - } - } - - override fun getDataListByDataType(list: List<String>): MutableList<String> { - if (list.isEmpty()) return mutableListOf() - - //fixme 2019.9.16 涓嶇绗竴浣嶇殑淇℃伅绫诲瀷鏍囧織鏄惁姝g‘锛岃嚦灏戣繑鍥炰竴涓�硷紝姝ゆ柟娉曞湪淇℃伅浣撶粨鏋勬病鏈変弗鏍兼寜鐓ф爣鍑嗭紝 - //fixme 鍗冲湪鍚庝竴涓俊鎭被鍨嬫爣蹇楀拰鍓嶄竴涓俊鎭綋涔嬮棿鏈夋棤鏁堝瓧绗︽椂锛岃兘澶熷皢鍏跺拷鐣ワ紝浣嗕笉纭畾杩欑澶勭悊鏂瑰紡鏄惁姝g‘鍜屽繀瑕� - val resultList = mutableListOf<String>().apply { - add(list[0]) - } - - when (list[0].toIntOrNull(16)) { - ObdDataType.ObdData.value -> { - - if (list.size >= 97) { - //浠庤捣濮嬪瓧鑺� 1 寮�濮嬶紝鍥哄畾鏈�96涓瓧鑺傜殑鏁版嵁 - for (i in 1..96) { - resultList.add(list[i]) - } - - val faultCodeNum = list[96].toIntOrNull() ?: 0//鏁呴殰鐮佹�绘暟 - //鏍规嵁鏁呴殰鐮佹�绘暟锛屾瘡涓晠闅滅爜4涓瓧鑺傦紝寰楀埌鏁呴殰鐮佹�诲瓧鑺傛暟 - if (faultCodeNum in 0..253) { - for (i in 97..(96 + faultCodeNum * 4)) { - resultList.add(list[i]) - } - } - } - } - ObdDataType.EngineDataFlow.value -> { - - if (list.size >= 38) { - //浠庤捣濮嬪瓧鑺� 1 寮�濮嬶紝鍥哄畾鏈�37涓瓧鑺傜殑鏁版嵁 - for (i in 1..37) { - resultList.add(list[i]) - } - } - } - ObdDataType.SupplementDataFlow.value -> { - - if (list.size>= 18) { - //浠庤捣濮嬪瓧鑺� 1 寮�濮嬶紝鍥哄畾鏈�17涓瓧鑺傜殑鏁版嵁 - for (i in 1..17) { - resultList.add(list[i]) - } - } - } - } - - return resultList - } - -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/eunm/AirCommandUnit.kt b/src/main/kotlin/com/flightfeather/uav/socket/eunm/AirCommandUnit.kt new file mode 100644 index 0000000..f27dd36 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/socket/eunm/AirCommandUnit.kt @@ -0,0 +1,17 @@ +package com.flightfeather.uav.socket.eunm + +/** + * @author riku + * Date: 2019/9/12 + * + * uav 鍛戒护鍗曞厓 + * + * 缂栫爜 瀹氫箟 + * 0x04 鐩戞祴鍙傛暟纭鎸囦护浣� + * 0x05 鐩戞祴鍙傛暟鍙嶉鎸囦护浣� + * + */ +enum class AirCommandUnit constructor(val value: Int) { + Confirm(4), + AirData(5) +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt b/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt new file mode 100644 index 0000000..e14c100 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt @@ -0,0 +1,33 @@ +package com.flightfeather.uav.socket.eunm + +/** + * @author riku + * Date: 2020/6/10 + */ +enum class FactorType(val value: Int, val des: String){ + NO2(1, "NO2"), + CO(2,"CO"), + H2S(3,"H2S"), + SO2(4,"SO2"), + O3(5,"O3"), + PM25(6,"PM25"), + PM10(7, "PM10"), + TEMPERATURE(8,"TEMPERATURE"), + HUMIDITY(9, "HUMIDITY"); + + companion object { + + fun getByIndex(index: Int): FactorType? = when (index) { + NO2.value -> NO2 + CO.value -> CO + H2S.value -> H2S + SO2.value -> SO2 + O3.value -> O3 + PM25.value -> PM25 + PM10.value -> PM10 + TEMPERATURE.value -> TEMPERATURE + HUMIDITY.value -> HUMIDITY + else -> null + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdCommandUnit.kt b/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdCommandUnit.kt deleted file mode 100644 index 1c7dbfe..0000000 --- a/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdCommandUnit.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.flightfeather.uav.socket.eunm - -import com.flightfeather.uav.socket.bean.* - -/** - * @author riku - * Date: 2019/9/12 - * - * uav 鍛戒护鍗曞厓 - * - * 缂栫爜 瀹氫箟 鏂瑰悜 - * 0x01 杞﹁締鐧诲叆 涓婅 @see [CarRegisterData] - * 0x02 瀹炴椂淇℃伅涓婃姤 涓婅 @see [com.flightfeather.uav.socket.bean.RealTimeData] - * 0x03 琛ュ彂淇℃伅涓婃姤 涓婅 @see [com.flightfeather.uav.socket.bean.ReplacementData] - * 0x04 杞﹁締鐧诲嚭 涓婅 @see [CarLogOutData] - * 0x05 缁堢鏍℃椂 涓婅 @see [TimeCalibrationData] - * 0x06~0x7F 涓婅鏁版嵁绯荤粺棰勭暀 涓婅 - * 0x7F 鍥轰欢杩滅▼鏇存柊 - */ -enum class ObdCommandUnit constructor(val value: Int) { - CarRegister(1), - RealTimeData(2), - ReplacementData(3), - CarLogOut(4), - TimeCalibration(5), - Update(127) -} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdDataType.kt b/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdDataType.kt index 725acdd..6313196 100644 --- a/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdDataType.kt +++ b/src/main/kotlin/com/flightfeather/uav/socket/eunm/ObdDataType.kt @@ -1,17 +1,9 @@ package com.flightfeather.uav.socket.eunm -import com.flightfeather.uav.socket.bean.* /** * @author riku * Date: 2019/9/15 * - * 瀹炴椂淇℃伅[RealTimeData]鍜岃ˉ鍙戜俊鎭痆ReplacementData] 涓殑鏁版嵁绫诲瀷 - * 绫诲瀷缂栫爜 璇存槑 - * 0x01 OBD 淇℃伅 @see [com.flightfeather.uav.socket.bean.ObdInfo] - * 0x02 鏁版嵁娴佷俊鎭� @see[com.flightfeather.uav.socket.bean.EngineDataStream] - * 0x03-0x7F 棰勭暀 - * 0x80 琛ュ厖鏁版嵁娴� @see[com.flightfeather.uav.socket.bean.SupplementDataStream] - * 0x81~0xFE 鐢ㄦ埛鑷畾涔� */ enum class ObdDataType constructor(val value: Int){ ObdData(1), diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3f19fd0..2cbc2a0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,9 +1,15 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://47.100.191.150:3306/uav?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false - username: uav - password: obd2019 +# url: jdbc:mysql://47.100.191.150:3306/uav?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false +# username: uav +# password: obd2019 + + url: jdbc:mysql://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false + username: root + password: 123456 + + mybatis: type-aliases-package: com.flightfeather.uav.domain.entity diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml index 2a30db3..47b4c78 100644 --- a/src/main/resources/generator/generatorConfig.xml +++ b/src/main/resources/generator/generatorConfig.xml @@ -24,9 +24,9 @@ <property name="suppressAllComments" value="true"/> </commentGenerator> <!--鏁版嵁搴撻摼鎺RL锛岀敤鎴峰悕銆佸瘑鐮� --> - <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://47.100.191.150:3306/obd" - userId="obd" - password="obd2019"> + <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://114.215.109.124:3306/dronemonitor" + userId="root" + password="123456"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> @@ -54,6 +54,6 @@ <!--<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"/>--> - <table tableName="obd_vehicle_info" domainObjectName="VehicleInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> + <table tableName="air_real_time_data" domainObjectName="RealTimeData" 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/AlarmDataMapper.xml b/src/main/resources/mapper/AlarmDataMapper.xml deleted file mode 100644 index 8fbfbfc..0000000 --- a/src/main/resources/mapper/AlarmDataMapper.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?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.uav.domain.mapper.AlarmDataMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.AlarmData"> - <!-- - WARNING - @mbg.generated - --> - <id column="id" jdbcType="INTEGER" property="id" /> - <result column="obd_vin" jdbcType="VARCHAR" property="obdVin" /> - <result column="alarm_time" jdbcType="TIMESTAMP" property="alarmTime" /> - <result column="alarm_lng" jdbcType="DOUBLE" property="alarmLng" /> - <result column="alarm_lat" jdbcType="DOUBLE" property="alarmLat" /> - <result column="alarm_protocol" jdbcType="INTEGER" property="alarmProtocol" /> - <result column="alarm_mil" jdbcType="INTEGER" property="alarmMil" /> - <result column="alarm_id_code" jdbcType="VARCHAR" property="alarmIdCode" /> - <result column="alarm_verification_code" jdbcType="VARCHAR" property="alarmVerificationCode" /> - <result column="alarm_fault_code_num" jdbcType="INTEGER" property="alarmFaultCodeNum" /> - <result column="alarm_fault_code" jdbcType="VARCHAR" property="alarmFaultCode" /> - <result column="alarm_speed" jdbcType="INTEGER" property="alarmSpeed" /> - <result column="alarm_air_pressure" jdbcType="DOUBLE" property="alarmAirPressure" /> - <result column="alarm_engine_torque" jdbcType="DOUBLE" property="alarmEngineTorque" /> - <result column="alarm_friction_torque" jdbcType="DOUBLE" property="alarmFrictionTorque" /> - <result column="alarm_engine_rpm" jdbcType="INTEGER" property="alarmEngineRpm" /> - <result column="alarm_start_fuel_flow" jdbcType="DOUBLE" property="alarmStartFuelFlow" /> - <result column="alarm_scr_upstream_NO" jdbcType="DOUBLE" property="alarmScrUpstreamNo" /> - <result column="alarm_scr_downstream_NO" jdbcType="DOUBLE" property="alarmScrDownstreamNo" /> - <result column="alarm_remain_reactant" jdbcType="DOUBLE" property="alarmRemainReactant" /> - <result column="alarm_air_input" jdbcType="DOUBLE" property="alarmAirInput" /> - <result column="alarm_scr_input_temp" jdbcType="DOUBLE" property="alarmScrInputTemp" /> - <result column="alarm_scr_output_temp" jdbcType="DOUBLE" property="alarmScrOutputTemp" /> - <result column="alarm_DPF" jdbcType="DOUBLE" property="alarmDpf" /> - <result column="alarm_engine_coolant_temp" jdbcType="DOUBLE" property="alarmEngineCoolantTemp" /> - <result column="alarm_fuel_level" jdbcType="DOUBLE" property="alarmFuelLevel" /> - <result column="alarm_location_status" jdbcType="INTEGER" property="alarmLocationStatus" /> - <result column="alarm_total_mileage" jdbcType="DOUBLE" property="alarmTotalMileage" /> - <result column="alarm_engine_torque_mode" jdbcType="VARCHAR" property="alarmEngineTorqueMode" /> - <result column="alarm_accelerator_pedal" jdbcType="DOUBLE" property="alarmAcceleratorPedal" /> - <result column="alarm_total_oil_consumption" jdbcType="DOUBLE" property="alarmTotalOilConsumption" /> - <result column="alarm_urea_box_temp" jdbcType="DOUBLE" property="alarmUreaBoxTemp" /> - <result column="alarm_urea_volume" jdbcType="INTEGER" property="alarmUreaVolume" /> - <result column="alarm_total_urea_consume" jdbcType="DOUBLE" property="alarmTotalUreaConsume" /> - <result column="alarm_DPF_temp" jdbcType="DOUBLE" property="alarmDpfTemp" /> - <result column="alarm_firmware_version" jdbcType="VARCHAR" property="alarmFirmwareVersion" /> - </resultMap> - <sql id="Base_Column_List"> - <!-- - WARNING - @mbg.generated - --> - id, obd_vin, alarm_time, alarm_lng, alarm_lat, alarm_protocol, alarm_mil, alarm_id_code, - alarm_verification_code, alarm_fault_code_num, alarm_fault_code, alarm_speed, alarm_air_pressure, - alarm_engine_torque, alarm_friction_torque, alarm_engine_rpm, alarm_start_fuel_flow, - alarm_scr_upstream_NO, alarm_scr_downstream_NO, alarm_remain_reactant, alarm_air_input, - alarm_scr_input_temp, alarm_scr_output_temp, alarm_DPF, alarm_engine_coolant_temp, - alarm_fuel_level, alarm_location_status, alarm_total_mileage, alarm_engine_torque_mode, - alarm_accelerator_pedal, alarm_total_oil_consumption, alarm_urea_box_temp, alarm_urea_volume, - alarm_total_urea_consume, alarm_DPF_temp, alarm_firmware_version - </sql> -</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/CarLoginMapper.xml b/src/main/resources/mapper/CarLoginMapper.xml deleted file mode 100644 index b576ec6..0000000 --- a/src/main/resources/mapper/CarLoginMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?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.uav.domain.mapper.CarLoginMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.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 deleted file mode 100644 index 47e0f92..0000000 --- a/src/main/resources/mapper/CarLogoutMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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.uav.domain.mapper.CarLogoutMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.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 deleted file mode 100644 index 8392fa8..0000000 --- a/src/main/resources/mapper/DataStreamMapper.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?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.uav.domain.mapper.DataStreamMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.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/ObdDataMapper.xml b/src/main/resources/mapper/ObdDataMapper.xml deleted file mode 100644 index ca7f7d7..0000000 --- a/src/main/resources/mapper/ObdDataMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?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.uav.domain.mapper.ObdDataMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.ObdData"> - <!-- - WARNING - @mbg.generated - --> - <id column="id" jdbcType="INTEGER" property="id" /> - <result column="obd_vin" jdbcType="VARCHAR" property="obdVin" /> - <result column="obd_time" jdbcType="TIMESTAMP" property="obdTime" /> - <result column="obd_lng" jdbcType="DOUBLE" property="obdLng" /> - <result column="obd_lat" jdbcType="DOUBLE" property="obdLat" /> - <result column="obd_protocol" jdbcType="INTEGER" property="obdProtocol" /> - <result column="obd_mil" jdbcType="INTEGER" property="obdMil" /> - <result column="obd_id_code" jdbcType="VARCHAR" property="obdIdCode" /> - <result column="obd_verification_code" jdbcType="VARCHAR" property="obdVerificationCode" /> - <result column="obd_fault_code_num" jdbcType="INTEGER" property="obdFaultCodeNum" /> - <result column="obd_fault_code" jdbcType="VARCHAR" property="obdFaultCode" /> - <result column="obd_speed" jdbcType="INTEGER" 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="INTEGER" property="obdEngineRpm" /> - <result column="obd_start_fuel_flow" jdbcType="DOUBLE" property="obdStartFuelFlow" /> - <result column="obd_scr_upstream_NO" jdbcType="DOUBLE" property="obdScrUpstreamNo" /> - <result column="obd_scr_downstream_NO" jdbcType="DOUBLE" property="obdScrDownstreamNo" /> - <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="INTEGER" property="obdLocationStatus" /> - <result column="obd_total_mileage" jdbcType="DOUBLE" property="obdTotalMileage" /> - <result column="obd_engine_torque_mode" jdbcType="VARCHAR" 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="INTEGER" property="obdUreaVolume" /> - <result column="obd_total_urea_consume" jdbcType="DOUBLE" property="obdTotalUreaConsume" /> - <result column="obd_DPF_temp" jdbcType="DOUBLE" property="obdDpfTemp" /> - <result column="obd_firmware_version" jdbcType="VARCHAR" property="obdFirmwareVersion" /> - </resultMap> - <sql id="Base_Column_List"> - <!-- - WARNING - @mbg.generated - --> - id, obd_vin, obd_time, obd_lng, obd_lat, obd_protocol, obd_mil, obd_id_code, obd_verification_code, - obd_fault_code_num, obd_fault_code, obd_speed, obd_air_pressure, obd_engine_torque, - obd_friction_torque, obd_engine_rpm, obd_start_fuel_flow, obd_scr_upstream_NO, obd_scr_downstream_NO, - 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_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_firmware_version - </sql> -</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ObdInfoMapper.xml b/src/main/resources/mapper/ObdInfoMapper.xml deleted file mode 100644 index 91f4888..0000000 --- a/src/main/resources/mapper/ObdInfoMapper.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?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.uav.domain.mapper.ObdInfoMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.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/ObdUserMapper.xml b/src/main/resources/mapper/ObdUserMapper.xml deleted file mode 100644 index ef97fb5..0000000 --- a/src/main/resources/mapper/ObdUserMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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.uav.domain.mapper.ObdUserMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.ObdUser"> - <!-- - WARNING - @mbg.generated - --> - <id column="id" jdbcType="INTEGER" property="id" /> - <result column="obd_vin" jdbcType="VARCHAR" property="obdVin" /> - <result column="obd_user_id" jdbcType="DOUBLE" property="obdUserId" /> - <result column="obd_user_name" jdbcType="VARCHAR" property="obdUserName" /> - <result column="obd_user_password" jdbcType="VARCHAR" property="obdUserPassword" /> - </resultMap> - <sql id="Base_Column_List"> - <!-- - WARNING - @mbg.generated - --> - id, obd_vin, obd_user_id, obd_user_name, obd_user_password - </sql> -</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/OriginDataMapper.xml b/src/main/resources/mapper/OriginDataMapper.xml deleted file mode 100644 index 5831863..0000000 --- a/src/main/resources/mapper/OriginDataMapper.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?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.uav.domain.mapper.OriginDataMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.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.uav.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/main/resources/mapper/ThresholdValueMapper.xml b/src/main/resources/mapper/ThresholdValueMapper.xml deleted file mode 100644 index 011a80f..0000000 --- a/src/main/resources/mapper/ThresholdValueMapper.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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.uav.domain.mapper.ThresholdValueMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.ThresholdValue"> - <!-- - WARNING - @mbg.generated - --> - <id column="id" jdbcType="INTEGER" property="id" /> - <result column="obd_vin" jdbcType="VARCHAR" property="obdVin" /> - <result column="th_mil" jdbcType="INTEGER" property="thMil" /> - <result column="th_fault_code_num" jdbcType="INTEGER" property="thFaultCodeNum" /> - <result column="th_fault_code" jdbcType="VARCHAR" property="thFaultCode" /> - <result column="th_speed" jdbcType="INTEGER" property="thSpeed" /> - <result column="th_air_pressure" jdbcType="DOUBLE" property="thAirPressure" /> - <result column="th_engine_torque" jdbcType="DOUBLE" property="thEngineTorque" /> - <result column="th_friction_torque" jdbcType="DOUBLE" property="thFrictionTorque" /> - <result column="th_engine_rpm" jdbcType="INTEGER" property="thEngineRpm" /> - <result column="th_start_fuel_flow" jdbcType="DOUBLE" property="thStartFuelFlow" /> - <result column="th_scr_upstream_NO" jdbcType="DOUBLE" property="thScrUpstreamNo" /> - <result column="th_scr_downstream_NO" jdbcType="DOUBLE" property="thScrDownstreamNo" /> - <result column="th_remain_reactant" jdbcType="DOUBLE" property="thRemainReactant" /> - <result column="th_air_input" jdbcType="DOUBLE" property="thAirInput" /> - <result column="th_scr_input_temp" jdbcType="DOUBLE" property="thScrInputTemp" /> - <result column="th_scr_output_temp" jdbcType="DOUBLE" property="thScrOutputTemp" /> - <result column="th_DPF" jdbcType="DOUBLE" property="thDpf" /> - <result column="th_engine_coolant_temp" jdbcType="DOUBLE" property="thEngineCoolantTemp" /> - <result column="th_fuel_level" jdbcType="DOUBLE" property="thFuelLevel" /> - <result column="th_location_status" jdbcType="INTEGER" property="thLocationStatus" /> - <result column="th_total_mileage" jdbcType="DOUBLE" property="thTotalMileage" /> - <result column="th_engine_torque_mode" jdbcType="VARCHAR" property="thEngineTorqueMode" /> - <result column="th_accelerator_pedal" jdbcType="DOUBLE" property="thAcceleratorPedal" /> - <result column="th_total_oil_consumption" jdbcType="DOUBLE" property="thTotalOilConsumption" /> - <result column="th_urea_box_temp" jdbcType="DOUBLE" property="thUreaBoxTemp" /> - <result column="th_urea_volume" jdbcType="INTEGER" property="thUreaVolume" /> - <result column="th_total_urea_consume" jdbcType="DOUBLE" property="thTotalUreaConsume" /> - <result column="th_DPF_temp" jdbcType="DOUBLE" property="thDpfTemp" /> - </resultMap> - <sql id="Base_Column_List"> - <!-- - WARNING - @mbg.generated - --> - id, obd_vin, th_mil, th_fault_code_num, th_fault_code, th_speed, th_air_pressure, - th_engine_torque, th_friction_torque, th_engine_rpm, th_start_fuel_flow, th_scr_upstream_NO, - th_scr_downstream_NO, th_remain_reactant, th_air_input, th_scr_input_temp, th_scr_output_temp, - th_DPF, th_engine_coolant_temp, th_fuel_level, th_location_status, th_total_mileage, - th_engine_torque_mode, th_accelerator_pedal, th_total_oil_consumption, th_urea_box_temp, - th_urea_volume, th_total_urea_consume, th_DPF_temp - </sql> -</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/VehicleInfoMapper.xml b/src/main/resources/mapper/VehicleInfoMapper.xml deleted file mode 100644 index 2fa81c2..0000000 --- a/src/main/resources/mapper/VehicleInfoMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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.uav.domain.mapper.VehicleInfoMapper"> - <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.VehicleInfo"> - <!-- - WARNING - @mbg.generated - --> - <id column="id" jdbcType="INTEGER" property="id" /> - <result column="obd_device_code" jdbcType="VARCHAR" property="obdDeviceCode" /> - <result column="obd_vin" jdbcType="VARCHAR" property="obdVin" /> - <result column="obd_licence_plate" jdbcType="VARCHAR" property="obdLicencePlate" /> - <result column="obd_vehicle_type" jdbcType="INTEGER" property="obdVehicleType" /> - </resultMap> - <sql id="Base_Column_List"> - <!-- - WARNING - @mbg.generated - --> - id, obd_device_code, obd_vin, obd_licence_plate, obd_vehicle_type - </sql> -</mapper> \ No newline at end of file diff --git a/src/test/kotlin/com/flightfeather/uav/Test.kt b/src/test/kotlin/com/flightfeather/uav/Test.kt index d359695..6152cdb 100644 --- a/src/test/kotlin/com/flightfeather/uav/Test.kt +++ b/src/test/kotlin/com/flightfeather/uav/Test.kt @@ -1,150 +1,10 @@ package com.flightfeather.uav -import org.junit.Test -import java.text.SimpleDateFormat -import java.util.* - /** * @author riku * Date: 2019/9/12 */ class Test { - @Test - fun foo1() { - val b = ByteArray(20) {8} - val a = 1 - println(a.toString(2)) - } - @Test - fun foo2() { - val b = ByteArray(2) - b[0] = 0x01 - b[1] = 0x80.toByte() - - println("${b[0].toString(16)}${b[1].toInt()}") - println("${b[0]}${b[1]}".toInt(16)) - } - - @Test - fun foo3() { - val hexNum = "ff" - val length = hexNum.toInt(16) - println(length) - } - - @Test - fun foo4() { - val h = "0101" - val byte = 0xff - val b = h.toInt(16) - println(b) - } - - @Test - fun foo5() { - val s = "23 23 30 30 30 30 30 35 33 31 36 30 38 30 31 30 35 33 36" - val sb = StringBuilder() - val ascii = s.split(" ") - ascii.forEach { - sb.append(it.toIntOrNull(16)?.toChar()) - } - println(sb.toString()) - } - - @Test - fun foo6() { - val cal = Calendar.getInstance().apply { - set(2019, 9, 15, 23, 16, 59) - } - - println(SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.time)) - } - - @Test - fun foo7() { - val a = "0AAF".toIntOrNull(16)?.toString(2) - println(a) - } - - @Test - fun foo8() { - val byte = ByteArray(2) - byte[0] = 0x23 - byte[1] = 0x23 - - byte[0].toString(16) - } - - @Test - fun foo9() { - val b = 128.toByte() - var a = 0 - if (b < 0) { - a = b + 256 - } else { - a = b.toInt() - } - println(b.toString(16)) - } - - @Test - fun foo10() { - val s = "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 33 3b 2 0 8a 1b 0 36 2e 0 23 60 11 b4 0 c8 0 b4 0 0 66 0 0 0 0 0 0 73 0 0 0 b9 4 75 0 2e d8 ed 0 0 0 0 80 0 bc 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" - val ascii = s.split(" ") - var bcc = 0x00 - ascii.forEach { - bcc = bcc.xor(it.toInt(16)) - } - println(bcc.toString(16)) - } - - @Test - fun foo11() { - val b = mutableListOf<String>().apply { - add("13") - add("09") - add("10") - add("10") - add("2b") - add("2f") - } - if (b.size < 6) { - println("null") - } - - val year = b[0].toInt(16) + 2000 - if (year < 2000 || year > 2099) println("null") - val month = b[1].toInt(16) - val day = b[2].toInt(16) - val hour = b[3].toInt(16) - val min = b[4].toInt(16) - val sec = b[5].toInt(16) - val cal = Calendar.getInstance().apply { - set(year, month - 1, day, hour, min, sec) - } - - println(SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.time)) - } - - @Test - fun f0012() { - val sb = java.lang.StringBuilder() - val byte = ByteArray(2) - byte[0] = 0x00 - byte[1] = 0xBD.toByte() - byte.forEach { b -> - var a = 0 - a = if (b < 0) { - b + 256 - } else { - b.toInt() - } - - sb.append(a.toString(16)) - } - - println(sb.toString().toInt(16)) - } } \ No newline at end of file diff --git a/src/test/kotlin/com/flightfeather/uav/UAVApplicationTests.kt b/src/test/kotlin/com/flightfeather/uav/UAVApplicationTests.kt index 0f0e75f..d1be554 100644 --- a/src/test/kotlin/com/flightfeather/uav/UAVApplicationTests.kt +++ b/src/test/kotlin/com/flightfeather/uav/UAVApplicationTests.kt @@ -1,12 +1,8 @@ package com.flightfeather.uav -import com.flightfeather.uav.domain.mapper.ObdDataMapper -import com.flightfeather.uav.lightshare.bean.ObdDataVo -import com.google.gson.Gson import org.junit.Test import org.junit.runner.RunWith import org.slf4j.LoggerFactory -import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.junit4.SpringRunner @@ -14,8 +10,6 @@ @SpringBootTest class UAVApplicationTests { - @Autowired - lateinit var obdDataMapper: ObdDataMapper @Test fun contextLoads() { @@ -23,16 +17,7 @@ @Test fun foo1(): Unit { -// val map = GsonJsonParser().parseMap("{\"vin\":\"vin001\",\"protocol\":2}") - val map = Gson().fromJson("{\"vin\":\"vin001\",\"protocol\":2,\"cmdCode\":2001}", ObdDataVo::class.java) - val res = obdDataMapper.selectAll() - res.forEach { - println(it.obdVin) - println(it.obdTime) - } - println(map.obdVin) - println(map.obdProtocol) - println(map.cmdCode) + } @Test diff --git a/src/test/kotlin/com/flightfeather/uav/socket/decoder/VehicleDataDecoderTest.kt b/src/test/kotlin/com/flightfeather/uav/socket/decoder/VehicleDataDecoderTest.kt deleted file mode 100644 index dcbdc7a..0000000 --- a/src/test/kotlin/com/flightfeather/uav/socket/decoder/VehicleDataDecoderTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -package com.flightfeather.uav.socket.decoder - -import com.flightfeather.uav.domain.entity.ObdData -import com.flightfeather.uav.socket.bean.* -import com.flightfeather.uav.socket.eunm.ObdCommandUnit -import org.junit.Test - -/** - * @author riku - * Date: 2019/9/17 - */ -class VehicleDataDecoderTest { - - private val vehicleDataDecoder = VehicleDataDecoder() - - @Test - fun decode() { - val msg = "23 23 02 31 37 36 39 31 35 33 31 39 30 39 31 32 30 30 31 36 01 01 00 40 13 09 17 09 05 29 00 cd 02 17 00 da fd ff 12 c0 ff ff 00 c8 04 ec ff 15 a9 ff ff ff ff ff ff 73 00 00 07 43 ec 88 01 d6 de cc ff ff ff ff 80 ff 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f6" - val msg2 = "23 23 02 31 37 36 39 31 35 33 31 39 30 39 31 32 30 30 30 36 01 01 00 42 13 09 11 08 3b 36 02 00 3b 00 00 d4 00 00 12 c0 09 5e 00 c8 00 c8 00 15 a9 00 00 00 00 00 00 73 00 00 00 b9 1b c7 00 2e e1 25 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dc" - val packageData = vehicleDataDecoder.decode(msg) - - val obdData = ObdData().apply { - 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 -> { - - packageData.dataUnit.forEach { - obdData.apply { - obdTime = it.time - } - when (it) { - is com.flightfeather.uav.socket.bean.ObdInfo -> { - obdData.apply { - obdProtocol = it.obdProtocol - obdMil = it.obdMil - obdIdCode = it.obdCrn - obdVerificationCode = it.obdCvn - obdFaultCodeNum = it.obdFaultCodeNum - obdFaultCode = it.obdFaultCode - } - } - is EngineDataStream -> { - obdData.apply { - obdLng = it.obdLong - obdLat = it.obdLat - obdSpeed = it.obdSpeed?.toInt() - obdAirPressure = it.obdAirPressure - obdEngineTorque = it.obdEngineTorque - obdFrictionTorque = it.obdFrictionTorque - obdEngineRpm = it.obdEngineRpm?.toInt() - obdStartFuelFlow = it.obdEngineFuelFlow - obdScrUpstreamNo = it.obdScrUpstreamNox - obdScrDownstreamNo = 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 - obdTotalMileage = it.obdTotalMileage - } - } - is SupplementDataStream -> { - obdData.apply { - obdEngineTorqueMode = it.obdEngineTorqueMode?.toString() - obdAcceleratorPedal = it.obdAcceleratorPedal - obdTotalOilConsumption = it.obdTotalOilConsumption - obdUreaBoxTemp = it.obdUreaBoxTemp - obdUreaVolume = it.obdUreaVolume?.toInt() - obdTotalUreaConsume = it.obdTotalUreaConsume - obdDpfTemp = it.obdDpfTemp -// obdFirmwareVersion = - } - } - } - } - - } - ObdCommandUnit.CarLogOut.value -> { - - } - ObdCommandUnit.TimeCalibration.value -> { - - } - } - } -} \ No newline at end of file -- Gitblit v1.9.3