test:(调用基础接口,前端实时数据展示)
parent
f1ddab1137
commit
2e563fac06
|
@ -2,8 +2,10 @@ package com.muyu.domain;
|
|||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
@ -18,6 +20,7 @@ import java.util.Date;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class Enterprise extends BaseEntity {
|
||||
/**
|
||||
*q企业入驻id
|
||||
|
@ -224,4 +227,5 @@ public class Enterprise extends BaseEntity {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,221 @@
|
|||
package com.muyu.domain.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/6/18 14:05
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
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 brakingPedal;
|
||||
/**
|
||||
* 燃料消耗率
|
||||
* */
|
||||
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 chargeStatus=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;
|
||||
|
||||
}
|
|
@ -19,6 +19,9 @@
|
|||
<dependencies>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.docker-java</groupId>
|
||||
<artifactId>docker-java</artifactId>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.networking.controller;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.data.VehicleData;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/6/18 15:51
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/vehicleData")
|
||||
public class VehicleDataController {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
|
||||
|
||||
@GetMapping("vehicleData/{vin}")
|
||||
public Result<VehicleData> list(@PathVariable String vin) {
|
||||
String index = redisTemplate.opsForList().index(vin, -1);
|
||||
log.info("数据{}",index);
|
||||
// JSONArray parseArray = JSONArray.parseArray(index);
|
||||
// JSONObject jsonObject = parseArray.getJSONArray(1).getJSONObject(0);
|
||||
VehicleData vehicleData = JSONObject.parseObject(index, VehicleData.class);
|
||||
log.info("输出数据{}",index);
|
||||
|
||||
//
|
||||
// ListOperations<String, Object> stringStringListOperations = redisTemplate.opsForList();
|
||||
// Object o = stringStringListOperations.rightPop(vin);
|
||||
//// String replace = rightPop.replace("\\", "");
|
||||
// VehicleData vehicleData = JSON.parseObject(o, VehicleData.class);
|
||||
//
|
||||
// if (vehicleData != null){
|
||||
// System.out.println("最新的数据:"+vehicleData);
|
||||
// }
|
||||
return Result.success(vehicleData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.muyu.domain.Enterprise;
|
||||
import com.muyu.domain.Information;
|
||||
import com.muyu.networking.mapper.EntInfoMapper;
|
||||
import com.muyu.networking.mapper.InformationMapper;
|
||||
import com.muyu.networking.service.IInformationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -25,6 +27,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
|
|||
@Autowired
|
||||
private InformationMapper informationMapper;
|
||||
|
||||
@Autowired
|
||||
private EntInfoMapper entInfoMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -48,8 +53,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
|
|||
@Override
|
||||
public List<Information> selectInformationList(Information information)
|
||||
{
|
||||
|
||||
|
||||
// LambdaQueryWrapper<Information> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.eq(Information::getEnterpriseId,information.getEnterpriseId());
|
||||
// List<Information> information1 = informationMapper.selectInformationList(information);
|
||||
return informationMapper.selectInformationList(information);
|
||||
}
|
||||
|
||||
|
@ -63,6 +69,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
|
|||
public int insertInformation(Information information)
|
||||
{
|
||||
information.setCreateTime(DateUtils.getNowDate());
|
||||
//把企业id值给车辆的id
|
||||
return informationMapper.insertInformation(information);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.core.web.controller.BaseController;
|
|||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.domain.Enterprise;
|
||||
import com.muyu.domain.Information;
|
||||
import com.muyu.vehicle.service.IInformationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -72,6 +73,7 @@ public class InformationController extends BaseController
|
|||
@PostMapping
|
||||
public Result add(@RequestBody Information information)
|
||||
{
|
||||
|
||||
return toAjax(informationService.insertInformation(information));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue