车辆实时数据
parent
e931b2e6c0
commit
8deed8739c
|
@ -0,0 +1,29 @@
|
||||||
|
package com.shiyi.internet.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : Redis常量
|
||||||
|
* @Author : YangHaoYu
|
||||||
|
* @Date: 2023-11-22 19:29
|
||||||
|
*/
|
||||||
|
public class RedisConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*实时信息
|
||||||
|
*/
|
||||||
|
public static final String CURRENT_INFO = "current_info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当日警告数
|
||||||
|
*/
|
||||||
|
public static final String CURRENT_DAY_FAULT = "current_day_fault";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*当月警告数
|
||||||
|
*/
|
||||||
|
public static final String CURRENT_MONTH_FAULT = "current_month_fault";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆有关信息标识
|
||||||
|
*/
|
||||||
|
public static final String VEHICLE_INFO_TOKEN = "vehicle_info_token";
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.shiyi.internet.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Author : YangHaoYu
|
||||||
|
* @Date: 2023-11-23 11:33
|
||||||
|
*/
|
||||||
|
public class VehicleConstant {
|
||||||
|
/**
|
||||||
|
* 车辆启动
|
||||||
|
*/
|
||||||
|
public static final Integer VEHICLE_START = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆停止
|
||||||
|
*/
|
||||||
|
public static final Integer VEHICLE_END = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态更改队列
|
||||||
|
*/
|
||||||
|
public static final String VEHICLE_STATUS_UPDATE_QUEUE = "vehicle_status_update_queue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆信息前缀
|
||||||
|
*/
|
||||||
|
public static final String VEHICLE_INFO_MAP = "vehicle_info_map";
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ public class Car extends BaseEntity {
|
||||||
|
|
||||||
@ApiModelProperty("车辆ID")
|
@ApiModelProperty("车辆ID")
|
||||||
@TableId(value = "car_id", type = IdType.AUTO)
|
@TableId(value = "car_id", type = IdType.AUTO)
|
||||||
private Integer carId;
|
private String carId;
|
||||||
|
|
||||||
@ApiModelProperty("车辆名称")
|
@ApiModelProperty("车辆名称")
|
||||||
@TableField("car_name")
|
@TableField("car_name")
|
||||||
|
@ -37,6 +37,14 @@ public class Car extends BaseEntity {
|
||||||
@TableField("car_license")
|
@TableField("car_license")
|
||||||
private String carLicense;
|
private String carLicense;
|
||||||
|
|
||||||
|
@ApiModelProperty("车辆vin")
|
||||||
|
@TableField("car_vin")
|
||||||
|
private String carVin;
|
||||||
|
|
||||||
|
@ApiModelProperty("车辆状态")
|
||||||
|
@TableField("car_status")
|
||||||
|
private String car_status;
|
||||||
|
|
||||||
@ApiModelProperty("车辆类型")
|
@ApiModelProperty("车辆类型")
|
||||||
@TableField("type_id")
|
@TableField("type_id")
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
|
|
|
@ -0,0 +1,737 @@
|
||||||
|
package com.shiyi.internet.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 车辆实时数据
|
||||||
|
* @Author : YangHaoYu
|
||||||
|
* @Date: 2023-11-22 19:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VehicleMessage {
|
||||||
|
/**
|
||||||
|
* 消息标识
|
||||||
|
*/
|
||||||
|
private String identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIN码
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private String longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private String latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车速
|
||||||
|
*/
|
||||||
|
private String speed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总里程
|
||||||
|
*/
|
||||||
|
private String totalDistance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总电压
|
||||||
|
*/
|
||||||
|
private String totalVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总电流
|
||||||
|
*/
|
||||||
|
private String jointCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绝缘电阻
|
||||||
|
*/
|
||||||
|
private String insulationResistance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 档位
|
||||||
|
*/
|
||||||
|
private String gears;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加速踏板行程值
|
||||||
|
*/
|
||||||
|
private String acceleratorPedal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制动踏板行程值
|
||||||
|
*/
|
||||||
|
private String brakePedal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 燃料消耗率
|
||||||
|
*/
|
||||||
|
private String fuelRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机控制器温度
|
||||||
|
*/
|
||||||
|
private String motorControllerTemperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机转速
|
||||||
|
*/
|
||||||
|
private String motorSpeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机转矩
|
||||||
|
*/
|
||||||
|
private String motorTorque;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机温度
|
||||||
|
*/
|
||||||
|
private String motorTemperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机电压
|
||||||
|
*/
|
||||||
|
private String motorVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机电流
|
||||||
|
*/
|
||||||
|
private String motorCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池剩余电量SOC
|
||||||
|
*/
|
||||||
|
private String dumpEnergy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态允许的最大反馈功率
|
||||||
|
*/
|
||||||
|
private String maximumFeedbackPower;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态允许最大放电功率
|
||||||
|
*/
|
||||||
|
private String maximumDischargePower;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS自检计数器
|
||||||
|
*/
|
||||||
|
private String selfCheckingCounter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池充放电电流
|
||||||
|
*/
|
||||||
|
private String chargingAndDischargingCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池负载端总电压V3
|
||||||
|
*/
|
||||||
|
private String totalVoltageAtLoadEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单次最大电压
|
||||||
|
*/
|
||||||
|
private String maximumVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池最低电压
|
||||||
|
*/
|
||||||
|
private String lowestVoltageBattery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池最高温度
|
||||||
|
*/
|
||||||
|
private String maximumTemperatureBattery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池最低温度
|
||||||
|
*/
|
||||||
|
private String lowestTemperatureBattery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池可用容量
|
||||||
|
*/
|
||||||
|
private String availableBatteryCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
private Integer vehicleState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电状态
|
||||||
|
*/
|
||||||
|
private Integer chargingState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
private Integer runningStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SOC
|
||||||
|
*/
|
||||||
|
private Integer socStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可充电储能装置工作状态
|
||||||
|
*/
|
||||||
|
private Integer energyStorageDeviceState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驱动电机状态
|
||||||
|
*/
|
||||||
|
private Integer driveMotorCondition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位是否有效
|
||||||
|
*/
|
||||||
|
private Integer positioningState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EAS 电子防窃系统状态
|
||||||
|
*/
|
||||||
|
private Integer easStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PTC 传动系统状态
|
||||||
|
*/
|
||||||
|
private Integer ptcStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EPS 蓄电池状态
|
||||||
|
*/
|
||||||
|
private Integer epsStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ABS 防滑刹车系统状态
|
||||||
|
*/
|
||||||
|
private Integer absStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MCU 微处理器状态
|
||||||
|
*/
|
||||||
|
private Integer mcuStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池加热状态
|
||||||
|
*/
|
||||||
|
private Integer batteryHeatingCondition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池当前状态
|
||||||
|
*/
|
||||||
|
private Integer currentBatteryStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池保温状态
|
||||||
|
*/
|
||||||
|
private Integer batteryInsulationStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DCDC 电力交换系统状态
|
||||||
|
*/
|
||||||
|
private Integer dcdcStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CHG 充电机状态
|
||||||
|
*/
|
||||||
|
private Integer chgStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*时间
|
||||||
|
*/
|
||||||
|
private Long time;
|
||||||
|
|
||||||
|
public Long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(Object time) {
|
||||||
|
if(time != null){
|
||||||
|
this.time = Long.valueOf(time.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentifier(Object identifier) {
|
||||||
|
if(identifier != null) {
|
||||||
|
this.identifier = (String) identifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVin() {
|
||||||
|
return vin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVin(Object vin) {
|
||||||
|
if(vin != null) {
|
||||||
|
this.vin = (String) vin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(Object longitude) {
|
||||||
|
if(longitude != null) {
|
||||||
|
this.longitude = (String) longitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(Object latitude) {
|
||||||
|
if(latitude != null) {
|
||||||
|
this.latitude = (String) latitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpeed() {
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpeed(Object speed) {
|
||||||
|
if(speed != null) {
|
||||||
|
this.speed = (String) speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotalDistance() {
|
||||||
|
return totalDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalDistance(Object totalDistance) {
|
||||||
|
if(totalDistance != null) {
|
||||||
|
this.totalDistance = (String) totalDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotalVoltage() {
|
||||||
|
return totalVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalVoltage(Object totalVoltage) {
|
||||||
|
if(totalVoltage != null) {
|
||||||
|
this.totalVoltage = (String) totalVoltage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJointCurrent() {
|
||||||
|
return jointCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJointCurrent(Object jointCurrent) {
|
||||||
|
if(jointCurrent != null) {
|
||||||
|
this.jointCurrent = (String) jointCurrent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInsulationResistance() {
|
||||||
|
return insulationResistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInsulationResistance(Object insulationResistance) {
|
||||||
|
if(insulationResistance != null) {
|
||||||
|
this.insulationResistance = (String) insulationResistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGears() {
|
||||||
|
return gears;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGears(Object gears) {
|
||||||
|
if(gears != null) {
|
||||||
|
this.gears = (String) gears;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAcceleratorPedal() {
|
||||||
|
return acceleratorPedal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcceleratorPedal(Object acceleratorPedal) {
|
||||||
|
if(acceleratorPedal != null) {
|
||||||
|
this.acceleratorPedal = (String) acceleratorPedal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBrakePedal() {
|
||||||
|
return brakePedal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrakePedal(Object brakePedal) {
|
||||||
|
if(brakePedal != null) {
|
||||||
|
this.brakePedal = (String) brakePedal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFuelRate() {
|
||||||
|
return fuelRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuelRate(Object fuelRate) {
|
||||||
|
if(fuelRate != null) {
|
||||||
|
this.fuelRate = (String) fuelRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotorControllerTemperature() {
|
||||||
|
return motorControllerTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotorControllerTemperature(Object motorControllerTemperature) {
|
||||||
|
if(motorControllerTemperature != null) {
|
||||||
|
this.motorControllerTemperature = (String) motorControllerTemperature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotorSpeed() {
|
||||||
|
return motorSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotorSpeed(Object motorSpeed) {
|
||||||
|
if(motorSpeed != null) {
|
||||||
|
this.motorSpeed = (String) motorSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotorTorque() {
|
||||||
|
return motorTorque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotorTorque(Object motorTorque) {
|
||||||
|
if(motorTorque != null) {
|
||||||
|
this.motorTorque = (String) motorTorque;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotorTemperature() {
|
||||||
|
return motorTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotorTemperature(Object motorTemperature) {
|
||||||
|
if(motorTemperature != null) {
|
||||||
|
this.motorTemperature = (String) motorTemperature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotorVoltage() {
|
||||||
|
return motorVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotorVoltage(Object motorVoltage) {
|
||||||
|
if(motorVoltage != null) {
|
||||||
|
this.motorVoltage = (String) motorVoltage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotorCurrent() {
|
||||||
|
return motorCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotorCurrent(Object motorCurrent) {
|
||||||
|
if(motorCurrent != null) {
|
||||||
|
this.motorCurrent = (String) motorCurrent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDumpEnergy() {
|
||||||
|
return dumpEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDumpEnergy(Object dumpEnergy) {
|
||||||
|
if(dumpEnergy != null) {
|
||||||
|
this.dumpEnergy = (String) dumpEnergy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaximumFeedbackPower() {
|
||||||
|
return maximumFeedbackPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximumFeedbackPower(Object maximumFeedbackPower) {
|
||||||
|
if(maximumFeedbackPower != null) {
|
||||||
|
this.maximumFeedbackPower = (String) maximumFeedbackPower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaximumDischargePower() {
|
||||||
|
return maximumDischargePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximumDischargePower(Object maximumDischargePower) {
|
||||||
|
if(maximumDischargePower != null) {
|
||||||
|
this.maximumDischargePower = (String) maximumDischargePower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelfCheckingCounter() {
|
||||||
|
return selfCheckingCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelfCheckingCounter(Object selfCheckingCounter) {
|
||||||
|
if(selfCheckingCounter != null) {
|
||||||
|
this.selfCheckingCounter = (String) selfCheckingCounter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChargingAndDischargingCurrent() {
|
||||||
|
return chargingAndDischargingCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargingAndDischargingCurrent(Object chargingAndDischargingCurrent) {
|
||||||
|
if(chargingAndDischargingCurrent != null) {
|
||||||
|
this.chargingAndDischargingCurrent = (String) chargingAndDischargingCurrent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotalVoltageAtLoadEnd() {
|
||||||
|
return totalVoltageAtLoadEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalVoltageAtLoadEnd(Object totalVoltageAtLoadEnd) {
|
||||||
|
if(totalVoltageAtLoadEnd != null) {
|
||||||
|
this.totalVoltageAtLoadEnd = (String) totalVoltageAtLoadEnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaximumVoltage() {
|
||||||
|
return maximumVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximumVoltage(Object maximumVoltage) {
|
||||||
|
if(maximumVoltage != null) {
|
||||||
|
this.maximumVoltage = (String) maximumVoltage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLowestVoltageBattery() {
|
||||||
|
return lowestVoltageBattery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLowestVoltageBattery(Object lowestVoltageBattery) {
|
||||||
|
if(lowestVoltageBattery != null) {
|
||||||
|
this.lowestVoltageBattery = (String) lowestVoltageBattery;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaximumTemperatureBattery() {
|
||||||
|
return maximumTemperatureBattery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximumTemperatureBattery(Object maximumTemperatureBattery) {
|
||||||
|
if(maximumTemperatureBattery != null) {
|
||||||
|
this.maximumTemperatureBattery = (String) maximumTemperatureBattery;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLowestTemperatureBattery() {
|
||||||
|
return lowestTemperatureBattery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLowestTemperatureBattery(Object lowestTemperatureBattery) {
|
||||||
|
if(lowestTemperatureBattery != null) {
|
||||||
|
this.lowestTemperatureBattery = (String) lowestTemperatureBattery;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvailableBatteryCapacity() {
|
||||||
|
return availableBatteryCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailableBatteryCapacity(Object availableBatteryCapacity) {
|
||||||
|
if(availableBatteryCapacity != null) {
|
||||||
|
this.availableBatteryCapacity = (String) availableBatteryCapacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getVehicleState() {
|
||||||
|
return vehicleState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVehicleState(Object vehicleState) {
|
||||||
|
if(vehicleState != null) {
|
||||||
|
this.vehicleState = Integer.valueOf(vehicleState.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getChargingState() {
|
||||||
|
return chargingState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargingState(Object chargingState) {
|
||||||
|
if(chargingState != null) {
|
||||||
|
this.chargingState = Integer.valueOf(chargingState.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRunningStatus() {
|
||||||
|
return runningStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRunningStatus(Object runningStatus) {
|
||||||
|
if(runningStatus != null){
|
||||||
|
this.runningStatus = Integer.valueOf(runningStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSocStatus() {
|
||||||
|
return socStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocStatus(Object socStatus) {
|
||||||
|
if(socStatus != null) {
|
||||||
|
this.socStatus = Integer.valueOf(socStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEnergyStorageDeviceState() {
|
||||||
|
return energyStorageDeviceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnergyStorageDeviceState(Object energyStorageDeviceState) {
|
||||||
|
if(energyStorageDeviceState != null){
|
||||||
|
this.energyStorageDeviceState = Integer.valueOf(energyStorageDeviceState.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDriveMotorCondition() {
|
||||||
|
return driveMotorCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriveMotorCondition(Object driveMotorCondition) {
|
||||||
|
if(driveMotorCondition != null) {
|
||||||
|
this.driveMotorCondition = Integer.valueOf(driveMotorCondition.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPositioningState() {
|
||||||
|
return positioningState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPositioningState(Object positioningState) {
|
||||||
|
if(positioningState != null) {
|
||||||
|
this.positioningState = Integer.valueOf(positioningState.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEasStatus() {
|
||||||
|
return easStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEasStatus(Object easStatus) {
|
||||||
|
if(easStatus != null) {
|
||||||
|
this.easStatus = Integer.valueOf(easStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPtcStatus() {
|
||||||
|
return ptcStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtcStatus(Object ptcStatus) {
|
||||||
|
if(ptcStatus != null) {
|
||||||
|
this.ptcStatus = Integer.valueOf(ptcStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEpsStatus() {
|
||||||
|
return epsStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEpsStatus(Object epsStatus) {
|
||||||
|
if(epsStatus != null) {
|
||||||
|
this.epsStatus = Integer.valueOf(epsStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAbsStatus() {
|
||||||
|
return absStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbsStatus(Object absStatus) {
|
||||||
|
if(absStatus != null) {
|
||||||
|
this.absStatus = Integer.valueOf(absStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMcuStatus() {
|
||||||
|
return mcuStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMcuStatus(Object mcuStatus) {
|
||||||
|
if(mcuStatus != null) {
|
||||||
|
this.mcuStatus = Integer.valueOf(mcuStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getBatteryHeatingCondition() {
|
||||||
|
return batteryHeatingCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatteryHeatingCondition(Object batteryHeatingCondition) {
|
||||||
|
if(batteryHeatingCondition != null) {
|
||||||
|
this.batteryHeatingCondition = Integer.valueOf(batteryHeatingCondition.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCurrentBatteryStatus() {
|
||||||
|
return currentBatteryStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentBatteryStatus(Object currentBatteryStatus) {
|
||||||
|
if(currentBatteryStatus != null){
|
||||||
|
this.currentBatteryStatus = Integer.valueOf(currentBatteryStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getBatteryInsulationStatus() {
|
||||||
|
return batteryInsulationStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatteryInsulationStatus(Object batteryInsulationStatus) {
|
||||||
|
if(batteryInsulationStatus != null){
|
||||||
|
this.batteryInsulationStatus = Integer.valueOf(batteryInsulationStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDcdcStatus() {
|
||||||
|
return dcdcStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDcdcStatus(Object dcdcStatus) {
|
||||||
|
if(dcdcStatus != null) {
|
||||||
|
this.dcdcStatus = Integer.valueOf(dcdcStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getChgStatus() {
|
||||||
|
return chgStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChgStatus(Object chgStatus) {
|
||||||
|
if(chgStatus != null) {
|
||||||
|
this.chgStatus = Integer.valueOf(chgStatus.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.shiyi.vehicle.feign;
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 接口调用
|
||||||
|
* @Author : YangHaoYu
|
||||||
|
* @Date: 2023-11-23 11:13
|
||||||
|
*/
|
||||||
|
@FeignClient(name = "fate-fence")
|
||||||
|
public interface VehicleFeign {
|
||||||
|
}
|
|
@ -39,7 +39,7 @@ public class DrivingRecordController extends BaseController {
|
||||||
* @Updator: YHY
|
* @Updator: YHY
|
||||||
* @Date 2023/11/21 14:38
|
* @Date 2023/11/21 14:38
|
||||||
*/
|
*/
|
||||||
//@RequiresPermissions("record:record:list")
|
@RequiresPermissions("record:record:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<List<DrivingRecord>> list(DrivingRecord drivingRecord){
|
public Result<List<DrivingRecord>> list(DrivingRecord drivingRecord){
|
||||||
log.info("功能名称:车辆行驶记录,请求URL:【{}】,请求方法:【{}】",request.getRequestURI(),
|
log.info("功能名称:车辆行驶记录,请求URL:【{}】,请求方法:【{}】",request.getRequestURI(),
|
||||||
|
@ -55,8 +55,8 @@ public class DrivingRecordController extends BaseController {
|
||||||
* @param response
|
* @param response
|
||||||
* @param drivingRecord
|
* @param drivingRecord
|
||||||
*/
|
*/
|
||||||
//@RequiresPermissions("record:record:export")
|
@RequiresPermissions("record:record:export")
|
||||||
//@Log(title = "导出车辆行驶记录", businessType = BusinessType.EXPORT)
|
@Log(title = "导出车辆行驶记录", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response ,DrivingRecord drivingRecord){
|
public void export(HttpServletResponse response ,DrivingRecord drivingRecord){
|
||||||
Result<List<DrivingRecord>> list = drivingRecordService.listDriving(drivingRecord); //车辆行驶车辆对象
|
Result<List<DrivingRecord>> list = drivingRecordService.listDriving(drivingRecord); //车辆行驶车辆对象
|
||||||
|
@ -87,8 +87,8 @@ public class DrivingRecordController extends BaseController {
|
||||||
* @param drivingRecord
|
* @param drivingRecord
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
//@RequiresPermissions("record:record:insertDriving")
|
@RequiresPermissions("record:record:insertDriving")
|
||||||
//@Log(title = "车辆行驶记录", businessType = BusinessType.INSERT)
|
@Log(title = "车辆行驶记录", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/insertDriving")
|
@PostMapping("/insertDriving")
|
||||||
public Result insertDriving(@RequestBody DrivingRecord drivingRecord){
|
public Result insertDriving(@RequestBody DrivingRecord drivingRecord){
|
||||||
log.info("功能名称:添加车辆行驶记录,请求URL:【{}】,请求防范:【{}】,请求参数:【{}】",request.getRequestURI(),
|
log.info("功能名称:添加车辆行驶记录,请求URL:【{}】,请求防范:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||||
|
@ -105,8 +105,8 @@ public class DrivingRecordController extends BaseController {
|
||||||
* @param drivingRecord
|
* @param drivingRecord
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
//@RequiresPermissions("record:record:updateDrivingRecord")
|
@RequiresPermissions("record:record:updateDrivingRecord")
|
||||||
//@Log(title = "修改车辆行驶记录", businessType = BusinessType.UPDATE)
|
@Log(title = "修改车辆行驶记录", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/updateDrivingRecord")
|
@PostMapping("/updateDrivingRecord")
|
||||||
public Result updateDrivingRecord(@RequestBody DrivingRecord drivingRecord){
|
public Result updateDrivingRecord(@RequestBody DrivingRecord drivingRecord){
|
||||||
log.info("功能名称:修改车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{】】",request.getRequestURI(),
|
log.info("功能名称:修改车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{】】",request.getRequestURI(),
|
||||||
|
@ -123,8 +123,8 @@ public class DrivingRecordController extends BaseController {
|
||||||
* @param recordId
|
* @param recordId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
//@RequiresPermissions("record:record:deleteDrivingRecord")
|
@RequiresPermissions("record:record:deleteDrivingRecord")
|
||||||
//@Log(title = "根据ID删除车辆行驶记录", businessType = BusinessType.DELETE)
|
@Log(title = "根据ID删除车辆行驶记录", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/deleteDrivingRecord/{recordId}")
|
@PostMapping("/deleteDrivingRecord/{recordId}")
|
||||||
public Result deleteDrivingRecord(@PathVariable Integer recordId){
|
public Result deleteDrivingRecord(@PathVariable Integer recordId){
|
||||||
log.info("功能名称:根据ID删除车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
log.info("功能名称:根据ID删除车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||||
|
|
|
@ -5,8 +5,10 @@ import com.fate.common.core.domain.Result;
|
||||||
import com.fate.common.core.utils.poi.ExcelUtil;
|
import com.fate.common.core.utils.poi.ExcelUtil;
|
||||||
import com.fate.common.core.web.controller.BaseController;
|
import com.fate.common.core.web.controller.BaseController;
|
||||||
import com.shiyi.internet.domain.Car;
|
import com.shiyi.internet.domain.Car;
|
||||||
|
import com.shiyi.internet.domain.VehicleMessage;
|
||||||
import com.shiyi.internet.domain.response.ResponseCar;
|
import com.shiyi.internet.domain.response.ResponseCar;
|
||||||
import com.shiyi.internet.service.VehicleService;
|
import com.shiyi.internet.service.VehicleService;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -79,8 +81,7 @@ public class VehicleController extends BaseController {
|
||||||
public Result addVehicl(@RequestBody Car car){
|
public Result addVehicl(@RequestBody Car car){
|
||||||
log.info("功能名称:添加车辆信息,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
log.info("功能名称:添加车辆信息,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||||
request.getMethod(),car);
|
request.getMethod(),car);
|
||||||
vehicleService.addVehicl(car);
|
Result result = vehicleService.addVehicl(car);
|
||||||
Result result = Result.success();
|
|
||||||
log.info("功能名称:添加车辆信息,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
log.info("功能名称:添加车辆信息,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||||
request.getMethod(), JSONObject.toJSONString(result));
|
request.getMethod(), JSONObject.toJSONString(result));
|
||||||
return result;
|
return result;
|
||||||
|
@ -105,6 +106,7 @@ public class VehicleController extends BaseController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:修改车辆管理
|
* @Description:修改车辆管理
|
||||||
No such property: code for class: Script1
|
No such property: code for class: Script1
|
||||||
|
@ -137,4 +139,63 @@ public class VehicleController extends BaseController {
|
||||||
ExcelUtil<ResponseCar> carExcelUtil = new ExcelUtil<>(ResponseCar.class);
|
ExcelUtil<ResponseCar> carExcelUtil = new ExcelUtil<>(ResponseCar.class);
|
||||||
carExcelUtil.exportExcel(response,list.getData(),"车辆信息");
|
carExcelUtil.exportExcel(response,list.getData(),"车辆信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:修改车辆状态
|
||||||
|
No such property: code for class: Script1
|
||||||
|
* @return: com.fate.common.core.domain.Result
|
||||||
|
* @Author: YHY
|
||||||
|
* @Updator: YHY
|
||||||
|
* @Date 2023/11/23 11:18
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateVehicleStatus/{vin}/{status}")
|
||||||
|
public Result updateVehicleStatus(@PathVariable("vin") String vin, @PathVariable("status")Integer status){
|
||||||
|
log.info("功能名称:修改车辆状态,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||||
|
request.getMethod(),vin,status);
|
||||||
|
Result result = vehicleService.updateVehicleStatus(vin,status);
|
||||||
|
log.info("功能名称:修改车辆状态,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||||
|
request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:查询所有在线车辆
|
||||||
|
No such property: code for class: Script1
|
||||||
|
* @return: com.fate.common.core.domain.Result<java.util.List<com.shiyi.internet.domain.VehicleMessage>>
|
||||||
|
* @Author: YHY
|
||||||
|
* @Updator: YHY
|
||||||
|
* @Date 2023/11/23 20:27
|
||||||
|
*/
|
||||||
|
@GetMapping("onlineVehicle")
|
||||||
|
public Result<List<VehicleMessage>> onlineVehicle(){
|
||||||
|
log.info("功能名称:查询所有在线车辆,请求URL:【{}】,请求方法:【{}】",request.getRequestURI(),
|
||||||
|
request.getMethod());
|
||||||
|
Result<List<VehicleMessage>> result = vehicleService.onlineVehicle();
|
||||||
|
log.info("功能名称:查询所有在线车辆,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||||
|
request.getMethod(),JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:统计数据
|
||||||
|
No such property: code for class: Script1
|
||||||
|
* @return: com.fate.common.core.domain.Result<java.lang.String>
|
||||||
|
* @Author: YHY
|
||||||
|
* @Updator: YHY
|
||||||
|
* @Date 2023/11/23 20:42
|
||||||
|
*/
|
||||||
|
@GetMapping("/countData")
|
||||||
|
public Result<String> countData(){
|
||||||
|
log.info("功能名称:统计数据,请求URL:【{}】,请求方法:【{}】",request.getRequestURI(),
|
||||||
|
request.getMethod());
|
||||||
|
Result<String> result = vehicleService.countData();
|
||||||
|
log.info("功能名称:统计数据,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||||
|
request.getMethod(),JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.shiyi.internet.domain.DrivingRecord;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,4 +39,8 @@ public interface DrivingRecordMapper extends BaseMapper<DrivingRecord> {
|
||||||
|
|
||||||
void deleteDrivingRecord(@Param("recordId") Integer recordId);
|
void deleteDrivingRecord(@Param("recordId") Integer recordId);
|
||||||
|
|
||||||
|
Integer selectLastId(@Param("carVin") String carVin);
|
||||||
|
|
||||||
|
void endVehicle(@Param("id") Integer id, @Param("date") Date date, @Param("endKey") String endKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.shiyi.internet.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.shiyi.internet.domain.Car;
|
import com.shiyi.internet.domain.Car;
|
||||||
|
import com.shiyi.internet.domain.DrivingRecord;
|
||||||
import com.shiyi.internet.domain.response.ResponseCar;
|
import com.shiyi.internet.domain.response.ResponseCar;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -19,9 +20,23 @@ public interface VehicleMapper extends BaseMapper<Car> {
|
||||||
|
|
||||||
int deletVehiclById(@Param("carId") Integer carId);
|
int deletVehiclById(@Param("carId") Integer carId);
|
||||||
|
|
||||||
void addVehicl(Car car);
|
int addVehicl(Car car);
|
||||||
|
|
||||||
ResponseCar findVehiclById(@Param("carId") Integer carId);
|
ResponseCar findVehiclById(@Param("carId") Integer carId);
|
||||||
|
|
||||||
int updateVehicl(Car car);
|
int updateVehicl(Car car);
|
||||||
|
|
||||||
|
void updateVehicleStatus(@Param("carVin") String carVin, @Param("status") Integer status);
|
||||||
|
|
||||||
|
Car getVehicleInfoByVin(@Param("vin") String vin);
|
||||||
|
|
||||||
|
void insertRecord(DrivingRecord record);
|
||||||
|
|
||||||
|
DrivingRecord selectLastByVin(@Param("carVin") String carVin);
|
||||||
|
|
||||||
|
List<String> getOnlineVehicleIds();
|
||||||
|
|
||||||
|
Integer getOnlineCount();
|
||||||
|
|
||||||
|
Integer getUnOnlineCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.shiyi.internet.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fate.common.core.domain.Result;
|
import com.fate.common.core.domain.Result;
|
||||||
import com.shiyi.internet.domain.Car;
|
import com.shiyi.internet.domain.Car;
|
||||||
|
import com.shiyi.internet.domain.VehicleMessage;
|
||||||
import com.shiyi.internet.domain.response.ResponseCar;
|
import com.shiyi.internet.domain.response.ResponseCar;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,9 +19,15 @@ public interface VehicleService extends IService<Car> {
|
||||||
|
|
||||||
Result deletVehiclById(Integer carId);
|
Result deletVehiclById(Integer carId);
|
||||||
|
|
||||||
void addVehicl(Car car);
|
Result addVehicl(Car car);
|
||||||
|
|
||||||
ResponseCar findVehiclById(Integer carId);
|
ResponseCar findVehiclById(Integer carId);
|
||||||
|
|
||||||
Result updateVehicl(Car car);
|
Result updateVehicl(Car car);
|
||||||
|
|
||||||
|
Result updateVehicleStatus(String vin, Integer status);
|
||||||
|
|
||||||
|
Result<List<VehicleMessage>> onlineVehicle();
|
||||||
|
|
||||||
|
Result<String> countData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,26 +2,40 @@ package com.shiyi.internet.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fate.common.core.domain.Result;
|
import com.fate.common.core.domain.Result;
|
||||||
|
import com.shiyi.internet.constants.RedisConstants;
|
||||||
|
import com.shiyi.internet.constants.VehicleConstant;
|
||||||
import com.shiyi.internet.domain.Car;
|
import com.shiyi.internet.domain.Car;
|
||||||
|
import com.shiyi.internet.domain.DrivingRecord;
|
||||||
|
import com.shiyi.internet.domain.VehicleMessage;
|
||||||
import com.shiyi.internet.domain.response.ResponseCar;
|
import com.shiyi.internet.domain.response.ResponseCar;
|
||||||
import com.shiyi.internet.mapper.FencingMapper;
|
import com.shiyi.internet.mapper.DrivingRecordMapper;
|
||||||
import com.shiyi.internet.mapper.VehicleMapper;
|
import com.shiyi.internet.mapper.VehicleMapper;
|
||||||
import com.shiyi.internet.service.VehicleService;
|
import com.shiyi.internet.service.VehicleService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description : 车辆系统业务层
|
* @Description : 车辆系统业务层
|
||||||
* @Author : YHY
|
* @Author : YHY
|
||||||
* @Date: 2023-11-19 21:24
|
* @Date: 2023-11-19 21:24
|
||||||
*/
|
*/
|
||||||
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
public class VehicleServiceimpl extends ServiceImpl<VehicleMapper,Car> implements VehicleService {
|
public class VehicleServiceimpl extends ServiceImpl<VehicleMapper,Car> implements VehicleService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleMapper vehicleMapper;
|
private VehicleMapper vehicleMapper;
|
||||||
|
@Autowired
|
||||||
|
private DrivingRecordMapper drivingRecordMapper;
|
||||||
|
|
||||||
|
private RedisTemplate<String,String> redisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<List<ResponseCar>> vehicleList() {
|
public Result<List<ResponseCar>> vehicleList() {
|
||||||
|
@ -36,9 +50,11 @@ public class VehicleServiceimpl extends ServiceImpl<VehicleMapper,Car> implement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addVehicl(Car car) {
|
public Result addVehicl(Car car) {
|
||||||
|
car.setCarId(UUID.randomUUID().toString().replaceAll("-","").toUpperCase());
|
||||||
vehicleMapper.addVehicl(car);
|
int i = vehicleMapper.addVehicl(car);
|
||||||
|
redisTemplate.opsForHash().put(VehicleConstant.VEHICLE_INFO_MAP,car.getCarVin(),vehicleMapper.getVehicleInfoByVin(car.getCarVin()));
|
||||||
|
return i>0?Result.success(200,"成功"):Result.error(500,"失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,4 +67,56 @@ public class VehicleServiceimpl extends ServiceImpl<VehicleMapper,Car> implement
|
||||||
int i = vehicleMapper.updateVehicl(car);
|
int i = vehicleMapper.updateVehicl(car);
|
||||||
return i>0?Result.success(200,"车辆信息已成功修改"):Result.error(500,"修改失败");
|
return i>0?Result.success(200,"车辆信息已成功修改"):Result.error(500,"修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result updateVehicleStatus(String carVin, Integer status) {
|
||||||
|
vehicleMapper.updateVehicleStatus(carVin,status);
|
||||||
|
if (status.equals(VehicleConstant.VEHICLE_START)){
|
||||||
|
DrivingRecord drivingRecord = vehicleMapper.selectLastByVin(carVin);
|
||||||
|
if (drivingRecord == null){
|
||||||
|
DrivingRecord record = new DrivingRecord();
|
||||||
|
record.setCarVin(carVin);
|
||||||
|
record.setStartTime(new Date()); //开始时间
|
||||||
|
record.setStartKey(String.valueOf(new Date().getTime())); //开始标识
|
||||||
|
log.info("车辆启动:【{}】,时间:【{}】",carVin,new Date().getTime());
|
||||||
|
vehicleMapper.insertRecord(record);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
if (drivingRecord != null && drivingRecord.getStartTime() != null && drivingRecord.getEndTime() != null){
|
||||||
|
DrivingRecord record = new DrivingRecord();
|
||||||
|
record.setCarVin(carVin);
|
||||||
|
record.setStartTime(new Date()); //开始时间
|
||||||
|
record.setStartKey(String.valueOf(new Date().getTime())); //开始标识
|
||||||
|
log.info("车辆启动:【{}】,时间:【{}】",carVin,new Date().getTime());
|
||||||
|
drivingRecordMapper.insertDriving(record);
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}else {
|
||||||
|
Integer id =drivingRecordMapper.selectLastId(carVin);
|
||||||
|
String endKey = String.valueOf(new Date().getTime());
|
||||||
|
log.info("车辆停止:【{}】,时间:【{}】",carVin,new Date().getTime());
|
||||||
|
drivingRecordMapper.endVehicle(id,new Date(),endKey);
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<VehicleMessage>> onlineVehicle() {
|
||||||
|
List<String> ids = vehicleMapper.getOnlineVehicleIds();
|
||||||
|
List<VehicleMessage> messages = ids.stream().map(id -> {
|
||||||
|
String vmString = redisTemplate.opsForValue().get(RedisConstants.CURRENT_INFO + ":" + id);
|
||||||
|
VehicleMessage message = new VehicleMessage();
|
||||||
|
return message;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return Result.success(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> countData() { //响应信息主体
|
||||||
|
Integer day = Integer.valueOf(redisTemplate.opsForValue().get(RedisConstants.VEHICLE_INFO_TOKEN + RedisConstants.CURRENT_DAY_FAULT));
|
||||||
|
Integer month = Integer.valueOf(redisTemplate.opsForValue().get(RedisConstants.VEHICLE_INFO_TOKEN + RedisConstants.CURRENT_MONTH_FAULT));
|
||||||
|
Integer onlineCount = vehicleMapper.getOnlineCount();
|
||||||
|
Integer unOnlineCount = vehicleMapper.getUnOnlineCount();
|
||||||
|
return Result.success(day +":"+ month +":"+ onlineCount +":"+ unOnlineCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,17 +33,23 @@
|
||||||
start_key=#{startKey},
|
start_key=#{startKey},
|
||||||
end_key=#{endKey} where record_id=#{recordId}
|
end_key=#{endKey} where record_id=#{recordId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="endVehicle">
|
||||||
|
update driving_record set
|
||||||
|
end_time=#{date},end_key=#{endKey}
|
||||||
|
where record_id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteDrivingRecord">
|
<delete id="deleteDrivingRecord">
|
||||||
delete from car_record where record_id=#{recordId}
|
delete from car_record where record_id=#{recordId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
<select id="listDriving" resultType="com.shiyi.internet.domain.DrivingRecord">
|
<select id="listDriving" resultType="com.shiyi.internet.domain.DrivingRecord">
|
||||||
select * from car_record
|
select * from car_record
|
||||||
</select>
|
</select>
|
||||||
<select id="fingCarRecordById" resultType="com.shiyi.internet.domain.DrivingRecord">
|
<select id="fingCarRecordById" resultType="com.shiyi.internet.domain.DrivingRecord">
|
||||||
select * from car_record where record_id=#{recordId}
|
select * from car_record where record_id=#{recordId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectLastId" resultType="java.lang.Integer">
|
||||||
|
select max(recordId) from driving_record where car_vin = #{carVin}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
#{batteryId},
|
#{batteryId},
|
||||||
#{carAddress})
|
#{carAddress})
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertRecord">
|
||||||
|
insert into driving_record values (#{recordId},#{carVin},#{startTime},#{endTime},#{startKey},#{endKey})
|
||||||
|
</insert>
|
||||||
<update id="updateVehicl">
|
<update id="updateVehicl">
|
||||||
update t_car set
|
update t_car set
|
||||||
car_name=#{carName},
|
car_name=#{carName},
|
||||||
|
@ -30,6 +33,9 @@
|
||||||
battery_id=#{batteryId},
|
battery_id=#{batteryId},
|
||||||
car_address=#{carAddress} where car_id=#{carId}
|
car_address=#{carAddress} where car_id=#{carId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateVehicleStatus">
|
||||||
|
update t_car set car_vin=#{},car_status=#{status}
|
||||||
|
</update>
|
||||||
<delete id="deletVehiclById">
|
<delete id="deletVehiclById">
|
||||||
delete from t_car where car_id=#{carId}
|
delete from t_car where car_id=#{carId}
|
||||||
</delete>
|
</delete>
|
||||||
|
@ -43,4 +49,19 @@
|
||||||
t_battery ba on ca.battery_id=ba.battery_id left join t_fence fe on ca.fence_id=fe.fence_id
|
t_battery ba on ca.battery_id=ba.battery_id left join t_fence fe on ca.fence_id=fe.fence_id
|
||||||
where car_id=#{carId}
|
where car_id=#{carId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getVehicleInfoByVin" resultType="com.shiyi.internet.domain.Car">
|
||||||
|
select * from t_car where vin=#{vin}
|
||||||
|
</select>
|
||||||
|
<select id="selectLastByVin" resultType="com.shiyi.internet.domain.DrivingRecord">
|
||||||
|
select * from driving_record dr left join (select max(recordId) id from friving_record where car_vin=#{carVin}) l on dr.record_id=l.record_id
|
||||||
|
</select>
|
||||||
|
<select id="getOnlineVehicleIds" resultType="java.lang.String">
|
||||||
|
select car_vin from t_car where car_status=1
|
||||||
|
</select>
|
||||||
|
<select id="getOnlineCount" resultType="java.lang.Integer">
|
||||||
|
select count(*) from t_car where car_status=1
|
||||||
|
</select>
|
||||||
|
<select id="getUnOnlineCount" resultType="java.lang.Integer">
|
||||||
|
select count(*) from t_car
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue