feat():根据vin接收数据,将实时数据放入redis
parent
2914d640f2
commit
dbf5b3138a
|
@ -0,0 +1,242 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VehicleData {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIN
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
/**
|
||||||
|
* 行驶路线
|
||||||
|
*/
|
||||||
|
private String drivingRoute;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private String longitude;
|
||||||
|
/**
|
||||||
|
* 维度
|
||||||
|
*/
|
||||||
|
private String latitude;
|
||||||
|
/**
|
||||||
|
* 速度
|
||||||
|
*/
|
||||||
|
private String speed;
|
||||||
|
/**
|
||||||
|
* 里程
|
||||||
|
*/
|
||||||
|
private BigDecimal mileage;
|
||||||
|
/**
|
||||||
|
* 总电压
|
||||||
|
*/
|
||||||
|
private String voltage;
|
||||||
|
/**
|
||||||
|
* 总电流
|
||||||
|
*/
|
||||||
|
private String current;
|
||||||
|
/**
|
||||||
|
* 绝缘电阻
|
||||||
|
*/
|
||||||
|
private String resistance;
|
||||||
|
/**
|
||||||
|
* 档位
|
||||||
|
*/
|
||||||
|
private String gear = "P";
|
||||||
|
/**
|
||||||
|
* 加速踏板行程值
|
||||||
|
*/
|
||||||
|
private String accelerationPedal;
|
||||||
|
/**
|
||||||
|
* 制动踏板行程值
|
||||||
|
*/
|
||||||
|
private String brakePedal;
|
||||||
|
/**
|
||||||
|
* 燃料消耗率
|
||||||
|
*/
|
||||||
|
private String fuelConsumptionRate;
|
||||||
|
/**
|
||||||
|
* 电机控制器温度
|
||||||
|
*/
|
||||||
|
private String motorControllerTemperature;
|
||||||
|
/**
|
||||||
|
* 电机转速
|
||||||
|
*/
|
||||||
|
private String motorSpeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机转矩
|
||||||
|
*/
|
||||||
|
private String motorTorque;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机温度
|
||||||
|
*/
|
||||||
|
private String motorTemperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机电压
|
||||||
|
*/
|
||||||
|
private String motorVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电机电流
|
||||||
|
*/
|
||||||
|
private String motorCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池剩余电量SOC
|
||||||
|
*/
|
||||||
|
private BigDecimal remainingBattery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池总容量
|
||||||
|
*/
|
||||||
|
private BigDecimal batteryLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态允许的最大反馈功率
|
||||||
|
*/
|
||||||
|
private String maximumFeedbackPower;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态允许最大放电功率
|
||||||
|
*/
|
||||||
|
private String maximumDischargePower;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS自检计数器
|
||||||
|
*/
|
||||||
|
private String selfCheckCounter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池充放电电流
|
||||||
|
*/
|
||||||
|
private String totalBatteryCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池负载端总电压V3
|
||||||
|
*/
|
||||||
|
private String totalBatteryVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单次最大电压
|
||||||
|
*/
|
||||||
|
private String singleBatteryMaxVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池最低电压
|
||||||
|
*/
|
||||||
|
private String singleBatteryMinVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池最高温度
|
||||||
|
*/
|
||||||
|
private String singleBatteryMaxTemperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池最低温度
|
||||||
|
*/
|
||||||
|
private String singleBatteryMinTemperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池可用容量
|
||||||
|
*/
|
||||||
|
private String availableBatteryCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
private int vehicleStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电状态
|
||||||
|
*/
|
||||||
|
private int chargingStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
private int operatingStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SOC
|
||||||
|
*/
|
||||||
|
private int socStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可充电储能装置工作状态
|
||||||
|
*/
|
||||||
|
private int chargingEnergyStorageStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驱动电机状态
|
||||||
|
*/
|
||||||
|
private int driveMotorStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位是否有效
|
||||||
|
*/
|
||||||
|
private int positionStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EAS(汽车防盗系统)状态
|
||||||
|
*/
|
||||||
|
private int easStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PTC(电动加热器)状态
|
||||||
|
*/
|
||||||
|
private int ptcStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EPS(电动助力系统)状态
|
||||||
|
*/
|
||||||
|
private int epsStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ABS(防抱死)状态
|
||||||
|
*/
|
||||||
|
private int absStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MCU(电机/逆变器)状态
|
||||||
|
*/
|
||||||
|
private int mcuStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池加热状态
|
||||||
|
*/
|
||||||
|
private int heatingStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池当前状态
|
||||||
|
*/
|
||||||
|
private int batteryStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动力电池保温状态
|
||||||
|
*/
|
||||||
|
private int batteryInsulationStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DCDC(电力交换系统)状态
|
||||||
|
*/
|
||||||
|
private int dcdcStatus = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CHG(充电机)状态
|
||||||
|
*/
|
||||||
|
private int chgStatus = 1;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.customer.business.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RestTemplateConfig {
|
||||||
|
/**
|
||||||
|
* 没有实例化RestTemplate时,初始化RestTemplate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ConditionalOnMissingBean(RestTemplate.class)
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate(){
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
return restTemplate;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.service.VehicleDataService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆录入Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-27
|
||||||
|
*/
|
||||||
|
@Api(tags = "车辆录入")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicleData")
|
||||||
|
public class VehicleDataController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleDataService vehicleDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆录入列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/Search")
|
||||||
|
public Result search(@RequestParam("vin") String vin) {
|
||||||
|
return vehicleDataService.search(vin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/VehicleData")
|
||||||
|
public Result vehicleData(@RequestParam("vin") String vin) {
|
||||||
|
return vehicleDataService.vehicleData(vin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/VehicleDataClose")
|
||||||
|
public Result vehicleDataClose(@RequestParam("vin") String vin) {
|
||||||
|
return vehicleDataService.vehicleDataClose(vin);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.VehicleData;
|
||||||
|
|
||||||
|
public interface VehicleDataMapper extends BaseMapper<VehicleData> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.customer.business.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import com.muyu.customer.business.domain.VehicleData;
|
||||||
|
import com.muyu.customer.business.mapper.VehicleDataMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface VehicleDataService extends IService<VehicleData> {
|
||||||
|
|
||||||
|
public List<VehicleData> list(VehicleData vehicleData);
|
||||||
|
|
||||||
|
Result search(String vin);
|
||||||
|
|
||||||
|
Result vehicleData(String vin);
|
||||||
|
|
||||||
|
Result vehicleDataClose(String vin);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,220 @@
|
||||||
|
package com.muyu.customer.business.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import com.muyu.customer.business.domain.VehicleData;
|
||||||
|
import com.muyu.customer.business.mapper.VehicleDataMapper;
|
||||||
|
import com.muyu.customer.business.service.VehicleDataService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-18
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class VehicleDataServiceImpl extends ServiceImpl<VehicleDataMapper,VehicleData> implements VehicleDataService {
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String,String> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VehicleData> list(VehicleData vehicleData) {
|
||||||
|
|
||||||
|
LambdaQueryWrapper<VehicleData> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(vehicleData.getVin())){
|
||||||
|
queryWrapper.eq(VehicleData::getVin, vehicleData.getVin());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getDrivingRoute())){
|
||||||
|
queryWrapper.eq(VehicleData::getDrivingRoute, vehicleData.getDrivingRoute());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getLongitude())){
|
||||||
|
queryWrapper.eq(VehicleData::getLongitude, vehicleData.getLongitude());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getLatitude())){
|
||||||
|
queryWrapper.eq(VehicleData::getLatitude, vehicleData.getLatitude());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSpeed())){
|
||||||
|
queryWrapper.eq(VehicleData::getSpeed, vehicleData.getSpeed());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMileage())){
|
||||||
|
queryWrapper.eq(VehicleData::getMileage, vehicleData.getMileage());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getVoltage())){
|
||||||
|
queryWrapper.eq(VehicleData::getVoltage, vehicleData.getVoltage());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getCurrent())){
|
||||||
|
queryWrapper.eq(VehicleData::getCurrent, vehicleData.getCurrent());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getResistance())){
|
||||||
|
queryWrapper.eq(VehicleData::getResistance, vehicleData.getResistance());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getGear())){
|
||||||
|
queryWrapper.eq(VehicleData::getGear, vehicleData.getGear());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getAccelerationPedal())){
|
||||||
|
queryWrapper.eq(VehicleData::getAccelerationPedal, vehicleData.getAccelerationPedal());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getBrakePedal())){
|
||||||
|
queryWrapper.eq(VehicleData::getBrakePedal, vehicleData.getBrakePedal());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getFuelConsumptionRate())){
|
||||||
|
queryWrapper.eq(VehicleData::getFuelConsumptionRate, vehicleData.getFuelConsumptionRate());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMotorControllerTemperature())){
|
||||||
|
queryWrapper.eq(VehicleData::getMotorControllerTemperature, vehicleData.getMotorControllerTemperature());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMotorSpeed())){
|
||||||
|
queryWrapper.eq(VehicleData::getMotorSpeed, vehicleData.getMotorSpeed());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMotorTorque())){
|
||||||
|
queryWrapper.eq(VehicleData::getMotorTorque, vehicleData.getMotorTorque());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMotorTemperature())){
|
||||||
|
queryWrapper.eq(VehicleData::getMotorTemperature, vehicleData.getMotorTemperature());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMotorVoltage())){
|
||||||
|
queryWrapper.eq(VehicleData::getMotorVoltage, vehicleData.getMotorVoltage());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMotorCurrent())){
|
||||||
|
queryWrapper.eq(VehicleData::getMotorCurrent, vehicleData.getMotorCurrent());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getRemainingBattery())){
|
||||||
|
queryWrapper.eq(VehicleData::getRemainingBattery, vehicleData.getRemainingBattery());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getBatteryLevel())){
|
||||||
|
queryWrapper.eq(VehicleData::getBatteryLevel, vehicleData.getBatteryLevel());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMaximumFeedbackPower())){
|
||||||
|
queryWrapper.eq(VehicleData::getMaximumFeedbackPower, vehicleData.getMaximumFeedbackPower());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSelfCheckCounter())){
|
||||||
|
queryWrapper.eq(VehicleData::getSelfCheckCounter, vehicleData.getSelfCheckCounter());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getTotalBatteryCurrent())){
|
||||||
|
queryWrapper.eq(VehicleData::getTotalBatteryCurrent, vehicleData.getTotalBatteryCurrent());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getTotalBatteryVoltage())){
|
||||||
|
queryWrapper.eq(VehicleData::getTotalBatteryVoltage, vehicleData.getTotalBatteryVoltage());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSingleBatteryMaxVoltage())){
|
||||||
|
queryWrapper.eq(VehicleData::getSingleBatteryMaxVoltage, vehicleData.getSingleBatteryMaxVoltage());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSingleBatteryMinVoltage())){
|
||||||
|
queryWrapper.eq(VehicleData::getSingleBatteryMinVoltage, vehicleData.getSingleBatteryMinVoltage());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSingleBatteryMaxTemperature())){
|
||||||
|
queryWrapper.eq(VehicleData::getSingleBatteryMaxTemperature, vehicleData.getSingleBatteryMaxTemperature());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSingleBatteryMinTemperature())){
|
||||||
|
queryWrapper.eq(VehicleData::getSingleBatteryMinTemperature, vehicleData.getSingleBatteryMinTemperature());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getAvailableBatteryCapacity())){
|
||||||
|
queryWrapper.eq(VehicleData::getAvailableBatteryCapacity, vehicleData.getAvailableBatteryCapacity());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getVehicleStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getVehicleStatus, vehicleData.getVehicleStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getChgStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getChgStatus, vehicleData.getChgStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getOperatingStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getOperatingStatus, vehicleData.getOperatingStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getSocStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getSocStatus, vehicleData.getSocStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getChargingEnergyStorageStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getChargingEnergyStorageStatus, vehicleData.getChargingEnergyStorageStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getDriveMotorStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getDriveMotorStatus, vehicleData.getDriveMotorStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getPositionStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getPositionStatus, vehicleData.getPositionStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getEasStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getEasStatus, vehicleData.getEasStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getPtcStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getPtcStatus, vehicleData.getPtcStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getEpsStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getEpsStatus, vehicleData.getEpsStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getAbsStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getAbsStatus, vehicleData.getAbsStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getMcuStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getMcuStatus, vehicleData.getMcuStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getHeatingStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getHeatingStatus, vehicleData.getHeatingStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getBatteryStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getBatteryStatus, vehicleData.getBatteryStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getBatteryInsulationStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getBatteryInsulationStatus, vehicleData.getBatteryInsulationStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getDcdcStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getDcdcStatus, vehicleData.getDcdcStatus());
|
||||||
|
}
|
||||||
|
if (ObjUtils.notNull(vehicleData.getChgStatus())){
|
||||||
|
queryWrapper.eq(VehicleData::getChgStatus, vehicleData.getChgStatus());
|
||||||
|
}
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result search(String vin) {
|
||||||
|
try {
|
||||||
|
Boolean vehicleKafka = redisTemplate.opsForHash().hasKey("vehicleKafka", vin);
|
||||||
|
if (vehicleKafka){
|
||||||
|
log.info("车辆vin: {}",vin);
|
||||||
|
restTemplate.getForObject("http://192.168.97.45:9006/eventInfo/CreatKafkaConsumer?vin="+vin,Object.class);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
return Result.success("error");
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.success("error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result vehicleData(String vin) {
|
||||||
|
if (redisTemplate.hasKey(vin)){
|
||||||
|
String index = redisTemplate.opsForList().index(vin, redisTemplate.opsForList().size(vin) - 1);
|
||||||
|
VehicleData vehicleData = JSON.parseObject(index, VehicleData.class);
|
||||||
|
if ("".equals(index)){
|
||||||
|
return Result.success("error");
|
||||||
|
}
|
||||||
|
return Result.success(vehicleData);
|
||||||
|
}
|
||||||
|
return Result.success("error");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result vehicleDataClose(String vin) {
|
||||||
|
redisTemplate.delete(vin);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,11 +91,6 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> imp
|
||||||
if (ObjUtils.notNull(vehicle.getVehicleType())){
|
if (ObjUtils.notNull(vehicle.getVehicleType())){
|
||||||
queryWrapper.eq(Vehicle::getVehicleType, vehicle.getVehicleType());
|
queryWrapper.eq(Vehicle::getVehicleType, vehicle.getVehicleType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?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.muyu.customer.business.mapper.VehicleDataMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.customer.business.domain.VehicleData" id="VehicleDataResult">
|
||||||
|
<result property="vin" column="vin" />
|
||||||
|
<result property="drivingRoute" column="driving_route" />
|
||||||
|
<result property="longitude" column="longitude" />
|
||||||
|
<result property="latitude" column="latitude" />
|
||||||
|
<result property="speed" column="speed" />
|
||||||
|
<result property="mileage" column="mileage" />
|
||||||
|
<result property="voltage" column="voltage" />
|
||||||
|
<result property="current" column="current" />
|
||||||
|
<result property="resistance" column="resistance" />
|
||||||
|
<result property="gear" column="gear" />
|
||||||
|
<result property="accelerationPedal" column="acceleration_pedal" />
|
||||||
|
<result property="brakePedal" column="brake_pedal" />
|
||||||
|
<result property="fuelConsumptionRate" column="fuel_consumption_rate" />
|
||||||
|
<result property="motorControllerTemperature" column="motor_controller_temperature" />
|
||||||
|
<result property="motorSpeed" column="motor_speed" />
|
||||||
|
<result property="motorTorque" column="motor_torque" />
|
||||||
|
<result property="motorTemperature" column="motor_temperature" />
|
||||||
|
<result property="motorVoltage" column="motor_voltage" />
|
||||||
|
<result property="motorCurrent" column="motor_current" />
|
||||||
|
<result property="remainingBattery" column="remaining_battery" />
|
||||||
|
<result property="batteryLevel" column="battery_level" />
|
||||||
|
<result property="maximumFeedbackPower" column="maximum_feedback_power" />
|
||||||
|
<result property="maximumDischargePower" column="maximum_discharge_power" />
|
||||||
|
<result property="selfCheckCounter" column="self_check_counter" />
|
||||||
|
<result property="totalBatteryCurrent" column="total_battery_current" />
|
||||||
|
<result property="totalBatteryVoltage" column="total_battery_voltage" />
|
||||||
|
<result property="singleBatteryMaxVoltage" column="single_battery_max_voltage" />
|
||||||
|
<result property="singleBatteryMinVoltage" column="single_battery_min_voltage" />
|
||||||
|
<result property="singleBatteryMaxTemperature" column="single_battery_max_temperature" />
|
||||||
|
<result property="singleBatteryMinTemperature" column="single_battery_min_temperature" />
|
||||||
|
<result property="availableBatteryCapacity" column="available_battery_capacity" />
|
||||||
|
<result property="vehicleStatus" column="vehicle_status" />
|
||||||
|
<result property="chargingStatus" column="charging_status" />
|
||||||
|
<result property="operatingStatus" column="operating_status" />
|
||||||
|
<result property="socStatus" column="soc_status" />
|
||||||
|
<result property="chargingEnergyStorageStatus" column="charging_energy_storage_status" />
|
||||||
|
<result property="driveMotorStatus" column="drive_motor_status" />
|
||||||
|
<result property="positionStatus" column="position_status" />
|
||||||
|
<result property="easStatus" column="eas_status" />
|
||||||
|
<result property="ptcStatus" column="ptc_status" />
|
||||||
|
<result property="epsStatus" column="eps_status" />
|
||||||
|
<result property="absStatus" column="abs_status" />
|
||||||
|
<result property="mcuStatus" column="mcu_status" />
|
||||||
|
<result property="heatingStatus" column="heating_status" />
|
||||||
|
<result property="batteryStatus" column="battery_status" />
|
||||||
|
<result property="batteryInsulationStatus" column="battery_insulation_status" />
|
||||||
|
<result property="dcdcStatus" column="dcdc_status" />
|
||||||
|
<result property="chgStatus" column="chg_status" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectVehicleDataVo">
|
||||||
|
select vin,drivingRoute,longitude,latitude,speed,mileage,voltage,current,resistance,gear,accelerationPedal,brakePedal,fuelConsumptionRate,motorControllerTemperature,motorSpeed,motorTorque,motorTemperature,motorVoltage,motorCurrent,remainingBattery,batteryLevel,maximumFeedbackPower,maximumDischargePower,selfCheckCounter,totalBatteryCurrent,totalBatteryVoltage,singleBatteryMaxVoltage,singleBatteryMinVoltage,singleBatteryMaxTemperature,singleBatteryMinTemperature,availableBatteryCapacity,vehicleStatus,chargingStatus,operatingStatus,socStatus,chargingEnergyStorageStatus,driveMotorStatus,positionStatus,easStatus,ptcStatus,epsStatus,absStatus,mcuStatus,heatingStatus,batteryStatus,batteryInsulationStatus,dcdcStatus,chgStatus from vehicleData
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue