车辆类型
parent
729f3e1fd7
commit
c0f6a98fa2
|
@ -0,0 +1,58 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Vehicle {
|
||||
|
||||
/**
|
||||
* 车辆主键
|
||||
*/
|
||||
private Integer vehicleId;
|
||||
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String vehicleVIN;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private Integer vehicleTypeId;
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private Integer vehicleStatus;
|
||||
|
||||
/**
|
||||
* 电子围栏
|
||||
*/
|
||||
private Integer fenceId;
|
||||
|
||||
/**
|
||||
* 电机厂商
|
||||
*/
|
||||
private String motorManufacturer;
|
||||
|
||||
/**
|
||||
* 电池厂商
|
||||
*/
|
||||
private String batteryManufacturer;
|
||||
|
||||
/**
|
||||
* 电机编码
|
||||
*/
|
||||
private String motorCoding;
|
||||
|
||||
/**
|
||||
* 电池编码
|
||||
*/
|
||||
private String batteryCoding;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.february.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VehicleType {
|
||||
|
||||
/**
|
||||
* 车辆类型主键
|
||||
*/
|
||||
private Integer vehicleTypeId;
|
||||
|
||||
/**
|
||||
* 车辆类型名称
|
||||
*/
|
||||
private String vehicleTypeName;
|
||||
}
|
|
@ -48,6 +48,17 @@
|
|||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- aop 依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- 用于日志切面中,以 json 格式打印出入参 -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
|
|
@ -2,8 +2,9 @@ package com.vehicle.trajectory.controller;
|
|||
|
||||
|
||||
import com.february.common.core.domain.Result;
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Vehicle;
|
||||
import com.february.common.domain.VehicleType;
|
||||
import com.vehicle.trajectory.service.TrajectoryService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -39,11 +40,22 @@ public class TrajectoryController {
|
|||
/**
|
||||
* 车辆信息
|
||||
*/
|
||||
@GetMapping("/carList")
|
||||
public Result<List<Car>> carList() {
|
||||
@GetMapping("/vehicleList")
|
||||
public Result<List<Vehicle>> carList() {
|
||||
log.info("功能名称:【查看在线车辆】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
||||
Result<List<Car>> result = trajectoryService.carList();
|
||||
Result<List<Vehicle>> result = trajectoryService.vehicleList();
|
||||
log.info("请求结果:【{}】", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
@GetMapping("/vehicleTypeList")
|
||||
public Result<List<VehicleType>> vehicleTypeList(){
|
||||
log.info("功能名称:【车辆类型】,请求路径:【{}】,请求方式:【{}】",request.getRequestURI(),request.getMethod());
|
||||
Result<List<VehicleType>> result = trajectoryService.vehicleTypeList();
|
||||
log.info("请求结果:【{}】",result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.vehicle.trajectory.mapper;
|
||||
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Vehicle;
|
||||
import com.february.common.domain.VehicleType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -10,5 +11,7 @@ import java.util.List;
|
|||
public interface TrajectoryMapper {
|
||||
List<RealData> realDateList();
|
||||
|
||||
List<Car> carList();
|
||||
List<Vehicle> vehicleList();
|
||||
|
||||
List<VehicleType> vehicleTypeList();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package com.vehicle.trajectory.service;
|
||||
|
||||
import com.february.common.core.domain.Result;
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Vehicle;
|
||||
import com.february.common.domain.VehicleType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TrajectoryService<T, C> {
|
||||
Result<List<RealData>> realDateList();
|
||||
|
||||
Result<List<Car>> carList();
|
||||
Result<List<Vehicle>> vehicleList();
|
||||
|
||||
Result<List<VehicleType>> vehicleTypeList();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,9 @@ package com.vehicle.trajectory.service.impl;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.february.common.core.domain.Result;
|
||||
import com.february.common.domain.Car;
|
||||
import com.february.common.domain.RealData;
|
||||
import com.february.common.domain.Vehicle;
|
||||
import com.february.common.domain.VehicleType;
|
||||
import com.february.common.redis.service.RedisService;
|
||||
import com.vehicle.trajectory.mapper.TrajectoryMapper;
|
||||
import com.vehicle.trajectory.service.TrajectoryService;
|
||||
|
@ -29,24 +30,32 @@ public class TrajectoryServiceImpl implements TrajectoryService {
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Override
|
||||
public Result<List<Car>> carList() {
|
||||
public Result<List<Vehicle>> vehicleList() {
|
||||
Boolean aBoolean = redisService.hasKey("状态为上线的车辆信息");//查询redis中是否有此键
|
||||
if (Boolean.TRUE.equals(aBoolean)){
|
||||
List<Object> list = redisService.redisTemplate.opsForList().range("状态为上线的车辆信息", 0, -1);
|
||||
ArrayList<Car> carArrayList = new ArrayList<>();
|
||||
ArrayList<Vehicle> carArrayList = new ArrayList<>();
|
||||
if (list != null) {
|
||||
for (Object o : list) {
|
||||
String o1 = (String) o;
|
||||
Car notice = JSON.parseObject(o1, Car.class);
|
||||
carArrayList.add(notice);
|
||||
Vehicle vehicle = JSON.parseObject(o1, Vehicle.class);
|
||||
carArrayList.add(vehicle);
|
||||
}
|
||||
return Result.success(carArrayList);
|
||||
}
|
||||
}
|
||||
List<Car> carList = mapper.carList(); //上线车辆的信息
|
||||
for (Car car : carList) {
|
||||
redisService.redisTemplate.opsForList().leftPush("状态为上线的车辆信息", JSONObject.toJSONString(car));
|
||||
List<Vehicle> vehicleList = mapper.vehicleList(); //上线车辆的信息
|
||||
for (Vehicle vehicle : vehicleList) {
|
||||
redisService.redisTemplate.opsForList().leftPush("状态为上线的车辆信息", JSONObject.toJSONString(vehicle));
|
||||
}
|
||||
return Result.success(carList);
|
||||
return Result.success(vehicleList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<VehicleType>> vehicleTypeList() {
|
||||
List<VehicleType> vehicleTypes = mapper.vehicleTypeList();
|
||||
return Result.success(vehicleTypes);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,12 @@
|
|||
select *
|
||||
from t_real_data
|
||||
</select>
|
||||
<select id="carList" resultType="com.february.common.domain.Car">
|
||||
<select id="vehicleList" resultType="com.february.common.domain.Vehicle">
|
||||
select *
|
||||
from t_car;
|
||||
from vehicle where vehicle_status = 1;
|
||||
</select>
|
||||
<select id="vehicleTypeList" resultType="com.february.common.domain.VehicleType">
|
||||
select *
|
||||
from vehicle_type;
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue