From ed19328a7a8b071e794bea96dbb4dd900ca33079 Mon Sep 17 00:00:00 2001 From: tangwenkang <2720983602@qq.com> Date: Sun, 3 Dec 2023 11:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E8=BD=A8=E8=BF=B91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../history/server/controller/CarController.java | 10 ++++++++++ .../vehicle/history/server/service/CarService.java | 7 +++++++ .../server/service/impl/CarServiceImpl.java | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) 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 b98aa9a..5bcdeda 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 @@ -91,4 +91,14 @@ public class CarController { public Result realTime(@RequestParam String vin){ return carService.realTime(vin); } + + /** + * 实时轨迹 + * @param vin + * @return + */ + @PostMapping("/listRealTime") + public Result listRealTime(@RequestParam String vin){ + return carService.listRealTime(vin); + } } 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 4d72ab4..6d8491e 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 @@ -62,4 +62,11 @@ public interface CarService { * @return */ Result realTime(String vin); + + /** + * 实时轨迹 + * @param vin + * @return + */ + Result listRealTime(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 6ea7425..cf31c2b 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 @@ -1,5 +1,6 @@ package com.dragon.vehicle.history.server.service.impl; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dragon.common.core.domain.PageResult; @@ -33,7 +34,6 @@ import java.util.List; */ @Service @Log4j2 - public class CarServiceImpl implements CarService { @Autowired private CarMapper carMapper; @@ -149,5 +149,15 @@ public class CarServiceImpl implements CarService { return Result.success("添加事件成功!"); } - + /** + * 实时数据 + * @param vin + * @return + */ + @Override + public Result listRealTime(String vin) { + Object cacheObject = redisService.getCacheObject("runtimeTraceEvent:"+vin); + VehicleData vehicleData = JSONObject.parseObject(cacheObject.toString(), VehicleData.class); + return Result.success(vehicleData); + } }