初始化
parent
b8db6fb0d9
commit
8f14c51ca4
|
@ -62,6 +62,12 @@
|
|||
<artifactId>february-common-swagger</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 车辆信息
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Car {
|
||||
/**
|
||||
* 车辆主键
|
||||
*/
|
||||
private int carId;
|
||||
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String carVIN;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carBh;
|
||||
|
||||
/**
|
||||
* 车型Id
|
||||
*/
|
||||
private int carTypeId;
|
||||
|
||||
/**
|
||||
* 驱动编号
|
||||
*/
|
||||
private int actuateId;
|
||||
|
||||
/**
|
||||
* 电池编号
|
||||
*/
|
||||
private int batteryId;
|
||||
|
||||
/**
|
||||
* 电池厂家编号
|
||||
*/
|
||||
private int batteryMakerId;
|
||||
|
||||
/**
|
||||
* 电机厂家编号
|
||||
*/
|
||||
private int motorManufacturerId;
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private int carStatus;
|
||||
|
||||
/**
|
||||
* 运用区域
|
||||
*/
|
||||
private String operatingArea;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.february.system.domain.constants;
|
||||
|
||||
/**
|
||||
* @description: 系统常量
|
||||
* @author
|
||||
*/
|
||||
public class Constants {
|
||||
/**
|
||||
* 成功标记
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
public static final String SUCCESS_MSG = "操作成功";
|
||||
/**
|
||||
* 失败标记
|
||||
*/
|
||||
public static final Integer ERROR = 500;
|
||||
public static final String ERROR_MSG = "操作异常";
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HistoricalDetail {
|
||||
|
||||
/**
|
||||
* 历史详情主键
|
||||
*/
|
||||
private int historicalDetailId;
|
||||
|
||||
/**
|
||||
* 历史轨迹Id
|
||||
*/
|
||||
private int historicalTrackId;
|
||||
|
||||
/**
|
||||
* 电机转速
|
||||
*/
|
||||
private String motorSpeed;
|
||||
|
||||
/**
|
||||
* 瞬时功率
|
||||
*/
|
||||
private String instantaneousSpeed;
|
||||
|
||||
/**
|
||||
* 续航里程
|
||||
*/
|
||||
private String range;
|
||||
|
||||
/**
|
||||
* 总里程
|
||||
*/
|
||||
private String totalMileage;
|
||||
|
||||
/**
|
||||
* SOC%
|
||||
*/
|
||||
private String residualElectricity;
|
||||
|
||||
/**
|
||||
* 监测温度
|
||||
*/
|
||||
private String monitoringTemperature;
|
||||
|
||||
/**
|
||||
* 电池Id
|
||||
*/
|
||||
private String batteryId;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 历史轨迹
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HistoricalTrack {
|
||||
|
||||
/**
|
||||
* 历史轨迹主键
|
||||
*/
|
||||
private int historicalTrackId;
|
||||
|
||||
/**
|
||||
* 车辆Id
|
||||
*/
|
||||
private int carId;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private String dimensionality;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date historicalStartTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date historicalEndTime;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private int speed;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 历史数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HistoryData {
|
||||
|
||||
/**
|
||||
* 历史数据主键
|
||||
*/
|
||||
private int historyDataId;
|
||||
|
||||
/**
|
||||
* 车辆轨迹
|
||||
*/
|
||||
private int carTrajectory;
|
||||
|
||||
/**
|
||||
* 车辆转速
|
||||
*/
|
||||
private int carSpeed;
|
||||
|
||||
/**
|
||||
* 电池温度
|
||||
*/
|
||||
private int batteryTemperature;
|
||||
|
||||
/**
|
||||
* 电池电压
|
||||
*/
|
||||
private int batteryVoltage;
|
||||
|
||||
/**
|
||||
* 电机转速
|
||||
*/
|
||||
private int actuateSpeed;
|
||||
|
||||
/**
|
||||
* BMS自检计数器
|
||||
*/
|
||||
private String selfCheckCounter;
|
||||
|
||||
/**
|
||||
* 电池Id
|
||||
*/
|
||||
private String batteryId;
|
||||
|
||||
/**
|
||||
* 档位
|
||||
*/
|
||||
private String gearPosition;
|
||||
|
||||
/**
|
||||
* 单次最大电压
|
||||
*/
|
||||
private String singleMaximumVoltage;
|
||||
|
||||
/**
|
||||
* 燃烧消耗率
|
||||
*/
|
||||
private String specificFuelConsumption;
|
||||
|
||||
/**
|
||||
* 绝缘电阻
|
||||
*/
|
||||
private String insulationResistance;
|
||||
|
||||
/**
|
||||
* 最大反馈功率
|
||||
*/
|
||||
private String maximumFeedbackPower;
|
||||
|
||||
/**
|
||||
* 总体电量最高温度
|
||||
*/
|
||||
private String maximumTemperature;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 实时数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RealData {
|
||||
|
||||
/**
|
||||
* 实时数据主键
|
||||
*/
|
||||
private int realDataId;
|
||||
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String carVIN;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private int carTypeId;
|
||||
|
||||
/**
|
||||
* 电子围栏
|
||||
*/
|
||||
private int fenceId;
|
||||
|
||||
/**
|
||||
* 车辆状态Id
|
||||
*/
|
||||
private int carStatusId;
|
||||
|
||||
/**
|
||||
* 电机厂商Id
|
||||
*/
|
||||
private int batteryMakerId;
|
||||
|
||||
/**
|
||||
* 电池厂商Id
|
||||
*/
|
||||
private int motorManufacturerId;
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import com.february.system.domain.constants.Constants;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @description: 响应信息主体
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int FAIL = Constants.ERROR;
|
||||
/**
|
||||
* 返回状态码
|
||||
*/
|
||||
private int code;
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
public static <T> Result<T> success() {
|
||||
return restResult(null, SUCCESS, Constants.SUCCESS_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data) {
|
||||
return restResult(data, SUCCESS, Constants.SUCCESS_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data, String msg) {
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error() {
|
||||
return restResult(null, FAIL, Constants.ERROR_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg) {
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data) {
|
||||
return restResult(data, FAIL, Constants.ERROR_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data, String msg) {
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String msg) {
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> Result<T> restResult(T data, int code, String msg) {
|
||||
Result<T> apiResult = new Result<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
}
|
|
@ -27,18 +27,12 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-vehicle-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-log</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.february</groupId>-->
|
||||
<!-- <artifactId>february-common-log</artifactId>-->
|
||||
<!-- <version>3.6.3</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- RuoYi Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
|
@ -51,6 +45,21 @@
|
|||
<artifactId>february-common-datasource</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-redis</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson</artifactId>
|
||||
<version>3.16.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.february;
|
||||
package com.vehicle.trajectory;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
public class Main {
|
||||
public class TrajectoryApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Main.class);
|
||||
SpringApplication.run(TrajectoryApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.vehicle.trajectory.controller;
|
||||
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Result;
|
||||
import com.vehicle.trajectory.service.TrajectoryService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class TrajectoryController {
|
||||
@Autowired
|
||||
private TrajectoryService trajectoryService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
|
||||
@GetMapping("/realDateList")
|
||||
public Result<List<RealData>> realDateList() {
|
||||
log.info("功能名称:【实时数据查看】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
||||
Result<List<RealData>> result = trajectoryService.realDateList();
|
||||
log.info("请求结果:【{}】", result);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 查询车辆信息
|
||||
*/
|
||||
@GetMapping("/carList")
|
||||
public Result<List<Car>> carList() {
|
||||
log.info("功能名称:【查看在线车辆】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
||||
Result<List<Car>> result = trajectoryService.carList();
|
||||
log.info("请求结果:【{}】", result);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.vehicle.trajectory.mapper;
|
||||
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TrajectoryMapper {
|
||||
List<RealData> realDateList();
|
||||
|
||||
List<Car> carList();
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.vehicle.trajectory.service;
|
||||
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TrajectoryService {
|
||||
Result<List<RealData>> realDateList();
|
||||
|
||||
Result<List<Car>> carList();
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.vehicle.trajectory.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Result;
|
||||
import com.february.common.redis.service.RedisService;
|
||||
import com.vehicle.trajectory.mapper.TrajectoryMapper;
|
||||
import com.vehicle.trajectory.service.TrajectoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Configuration
|
||||
public class TrajectoryServiceImpl implements TrajectoryService {
|
||||
@Autowired
|
||||
private TrajectoryMapper mapper;
|
||||
|
||||
@Override
|
||||
public Result<List<RealData>> realDateList() {
|
||||
List<RealData> realData = mapper.realDateList();
|
||||
return Result.success(realData);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Override
|
||||
public Result<List<Car>> carList() {
|
||||
Boolean aBoolean = redisService.hasKey("状态为上线的车辆信息");
|
||||
if (Boolean.TRUE.equals(aBoolean)){
|
||||
List<Object> list = redisService.redisTemplate.opsForList().range("状态为上线的车辆信息", 0, -1);
|
||||
ArrayList<Car> carArrayList = new ArrayList<>();
|
||||
if (list != null) {
|
||||
for (Object o : list) {
|
||||
String o1 = (String) o;
|
||||
Car notice = JSON.parseObject(o1, Car.class);
|
||||
carArrayList.add(notice);
|
||||
}
|
||||
return Result.success(carArrayList);
|
||||
}
|
||||
}
|
||||
List<Car> carList = mapper.carList(); //上线车辆的信息
|
||||
for (Car car : carList) {
|
||||
redisService.redisTemplate.opsForList().leftPush("状态为上线的车辆信息", JSONObject.toJSONString(car));
|
||||
}
|
||||
return Result.success(carList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9203
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: vehicle-trajectory
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.100.1.4:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 10.100.1.4:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,13 @@
|
|||
<?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.vehicle.trajectory.mapper.TrajectoryMapper">
|
||||
|
||||
<select id="realDateList" resultType="com.february.common.domain.RealData">
|
||||
select *
|
||||
from t_real_data
|
||||
</select>
|
||||
<select id="carList" resultType="com.february.common.domain.Car">
|
||||
select *
|
||||
from t_car where car_status = 1;
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue