From 9ddeefa4508a24f6c192286f64d0b7a81dd85085 Mon Sep 17 00:00:00 2001
From: tangwenkang <2720983602@qq.com>
Date: Fri, 1 Dec 2023 11:09:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E5=AE=9E?=
=?UTF-8?q?=E6=97=B6=E8=BD=A8=E8=BF=B9=E4=BA=8B=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
vehicle-history-server/pom.xml | 5 +++++
.../server/controller/CarController.java | 11 +++++++++++
.../controller/HistoricalTrackController.java | 2 +-
.../history/server/service/CarService.java | 7 +++++++
.../server/service/impl/CarServiceImpl.java | 17 +++++++++++++++++
5 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/vehicle-history-server/pom.xml b/vehicle-history-server/pom.xml
index 3a43f87..b34d31c 100644
--- a/vehicle-history-server/pom.xml
+++ b/vehicle-history-server/pom.xml
@@ -77,6 +77,11 @@
dragon-common-log
+
+ com.dragon
+ dragon-common-redis
+
+
com.dragon
dragon-common-core
diff --git a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/CarController.java b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/CarController.java
index 2a8b286..832204c 100644
--- a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/CarController.java
+++ b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/CarController.java
@@ -5,6 +5,7 @@ import com.dragon.common.core.domain.PageResult;
import com.dragon.vehicle.history.common.domain.Car;
import com.dragon.vehicle.history.common.domain.CarType;
import com.dragon.vehicle.history.common.domain.Fence;
+import com.dragon.vehicle.history.common.domain.VehicleData;
import com.dragon.vehicle.history.common.domain.req.ReqCar;
import com.dragon.vehicle.history.common.domain.res.ResCar;
import com.dragon.vehicle.history.server.service.CarService;
@@ -80,4 +81,14 @@ public class CarController {
public Result> listFence() {
return carService.listFence();
}
+
+ /**
+ * 添加实时轨迹事件
+ * @param vin
+ * @return
+ */
+ @PostMapping("/realTime")
+ public Result realTime(String vin){
+ return carService.realTime(vin);
+ }
}
diff --git a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/HistoricalTrackController.java b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/HistoricalTrackController.java
index 0ab8563..dca5890 100644
--- a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/HistoricalTrackController.java
+++ b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/controller/HistoricalTrackController.java
@@ -26,7 +26,7 @@ public class HistoricalTrackController {
* 历史轨迹列表
* @return
*/
- @PostMapping("/listHistoricalTrack")
+ @GetMapping("/listHistoricalTrack")
@DS(value = "slave")
public Result> listHistoricalTrack() {
return Result.success(historicalTrackService.listHistoricalTrack());
diff --git a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/CarService.java b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/CarService.java
index 395528d..46cc4ea 100644
--- a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/CarService.java
+++ b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/CarService.java
@@ -54,4 +54,11 @@ public interface CarService {
* @return
*/
Result> listFence();
+
+ /**
+ * 添加实时轨迹事件
+ * @param vin
+ * @return
+ */
+ Result realTime(String vin);
}
diff --git a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/impl/CarServiceImpl.java b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/impl/CarServiceImpl.java
index 95889e4..285a054 100644
--- a/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/impl/CarServiceImpl.java
+++ b/vehicle-history-server/src/main/java/com/dragon/vehicle/history/server/service/impl/CarServiceImpl.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.common.core.domain.PageResult;
import com.dragon.common.core.domain.Result;
+import com.dragon.common.redis.service.RedisService;
import com.dragon.vehicle.history.common.domain.Car;
import com.dragon.vehicle.history.common.domain.CarType;
import com.dragon.vehicle.history.common.domain.Fence;
@@ -35,6 +36,8 @@ public class CarServiceImpl implements CarService {
private CarTypeMapper carTypeMapper;
@Autowired
private FenceMapper fenceMapper;
+ @Autowired
+ private RedisService redisService;
/**
* 车辆信息列表
@@ -126,4 +129,18 @@ public class CarServiceImpl implements CarService {
List fences = fenceMapper.selectList(new MPJLambdaWrapper().select(Fence::getFenceId,Fence::getFenceName));
return Result.success(fences);
}
+
+ /**
+ * 添加实时轨迹事件
+ * @param vin
+ * @return
+ */
+ @Override
+ public Result realTime(String vin) {
+ List cacheList = redisService.getCacheList(vin);//根据vin查询出车辆的事件列表
+ cacheList.add("runtimeTraceEvent");//添加实时轨迹事件
+ redisService.setCacheList("event_"+vin,cacheList);//将事件列表存入redis
+
+ return Result.success("事件添加成功!");
+ }
}