diff --git a/muyu-vehicle/muyu-vehicle-service/src/main/java/com/muyu/vehicle/controller/VehiclelnfoController.java b/muyu-vehicle/muyu-vehicle-service/src/main/java/com/muyu/vehicle/controller/VehiclelnfoController.java new file mode 100644 index 0000000..d134143 --- /dev/null +++ b/muyu-vehicle/muyu-vehicle-service/src/main/java/com/muyu/vehicle/controller/VehiclelnfoController.java @@ -0,0 +1,41 @@ +package com.muyu.vehicle.controller; + +import com.alibaba.fastjson.JSON; +import com.muyu.common.core.domain.Result; +import com.muyu.common.core.web.controller.BaseController; +import com.muyu.vehicle.domain.VehicleInfo; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +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; + +/** + * 车辆录入 VehiclelnfoController + * + * @author xiaohuang + * Date 2024/6/18 18:35 + */ + +@Log4j2 +@RestController +@RequestMapping("/vehicleInfo") +public class VehiclelnfoController extends BaseController { + + + @Autowired + private RedisTemplate redisTemplate; + + @GetMapping("/list/{vin}") + public Result vehicleInfoAllList(@PathVariable String vin){ + if (vin.isEmpty()){ + return Result.error("该车辆未上线"); + } + String lastElement = redisTemplate.opsForList().index(vin, 0); + VehicleInfo vehicleInfo = JSON.parseObject(lastElement, VehicleInfo.class); + return Result.success(vehicleInfo); + } +} + diff --git a/muyu-vehicle/muyu-vehicle-service/src/main/java/com/muyu/vehicle/domain/VehicleInfo.java b/muyu-vehicle/muyu-vehicle-service/src/main/java/com/muyu/vehicle/domain/VehicleInfo.java new file mode 100644 index 0000000..6f8b39e --- /dev/null +++ b/muyu-vehicle/muyu-vehicle-service/src/main/java/com/muyu/vehicle/domain/VehicleInfo.java @@ -0,0 +1,208 @@ +package com.muyu.vehicle.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * 车辆数据信息 + * @author Mobai + * @className Vehicle + * @description 描述 + * @date 2024/6/6 8:18 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class VehicleInfo { + + /** + * 车辆vin + */ + private String vin; + /** + * 时间戳 + */ + private Long startTime; + /** + * 经度 + */ + private BigDecimal longitude; + /** + * 纬度 + */ + private BigDecimal latitude; + /** + * 速度 + */ + private BigDecimal speed; + /** + * 总里程 + */ + private BigDecimal mileage; + /** + * 总电压 + */ + private BigDecimal voltage; + /** + * 总电流 + */ + private BigDecimal current; + /** + * 绝缘电阻 + */ + private BigDecimal resistance; + /** + * 档位 + */ + private String gear; + /** + * 加速踏板行程值 + */ + private BigDecimal accelerationPedal; + /** + * 制动踏板行程值 + */ + private BigDecimal brakePedal; + /** + * 燃料消耗率 + */ + private BigDecimal fuelConsumptionRate; + /** + * 电机控制器温度 + */ + private BigDecimal motorControllerTemperature; + /** + * 电机转速 + */ + private BigDecimal motorSpeed; + /** + * 电机转矩 + */ + private BigDecimal motoTorque; + /** + * 电机温度 + */ + private BigDecimal motorTemperature; + /** + * 电机电压 + */ + private BigDecimal motorVoltage; + /** + * 电机电流 + */ + private BigDecimal motorCurrent; + /** + * 动力电池剩余电量SOC + */ + private BigDecimal remainingBattery; + /** + * 当前状态允许的最大反馈功率 + */ + private BigDecimal maximumFeedbackPower; + /** + * 当前状态允许的最大放电功率 + */ + private BigDecimal maximumDischargePower; + /** + * BMS自检计数器 + */ + private BigDecimal selfCheckCounter; + /** + * 动力电池充放电电流 + */ + private BigDecimal totalBatteryCurrent; + /** + * 动力电池负载端总电压V3 + */ + private BigDecimal totalBatteryVoltage; + /** + * 单次最大电压 + */ + private BigDecimal singleBatteryMaxVoltage; + /** + * 单次最低电压 + */ + private BigDecimal singleBatteryMinVoltage; + /** + * 单体电池最高温度 + */ + private BigDecimal singleBatteryMaxTemperature; + /** + * 单体电池最低温度 + */ + private BigDecimal singleBatteryMinTemperature; + /** + * 动力电池可用容量 + */ + private BigDecimal availableBatteryCapacity; + /** + * 车辆状态 + */ + private Integer vehicleStatus; + /** + * 充电状态 + */ + private Integer chargingStatus; + /** + * 运行状态 + */ + private Integer operatingStatus; + /** + * SOC + */ + private Integer chargingEnergyStorageStatus; + /** + * 可充电储能装置工作状态 + */ + private Integer driveMotorStatus; + /** + * 定位是否有效 + */ + private Integer positionStatus; + /** + * EAS + */ + private Integer easStatus; + /** + * PTC + */ + private Integer ptcStatus; + /** + * EPS + */ + private Integer epsStatus; + /** + * ABS + */ + private Integer absStatus; + /** + * MCU + */ + private Integer mcuStatus; + /** + * 动力电池加热状态 + */ + private Integer heatingStatus; + /** + * 动力电池当前状态 + */ + private Integer batteryStatus; + /** + * 动力电池保温状态 + */ + private Integer batteryInsulationStatus; + /** + * DCDC + */ + private Integer dcdcStatus; + /** + * CHG + */ + private Integer chgStatus; + +}