新增添加实时轨迹事件

master
tangwenkang 2023-12-01 11:09:53 +08:00
parent 80b042b1d7
commit 9ddeefa450
5 changed files with 41 additions and 1 deletions

View File

@ -77,6 +77,11 @@
<artifactId>dragon-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-redis</artifactId>
</dependency>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-core</artifactId>

View File

@ -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<List<Fence>> listFence() {
return carService.listFence();
}
/**
*
* @param vin
* @return
*/
@PostMapping("/realTime")
public Result realTime(String vin){
return carService.realTime(vin);
}
}

View File

@ -26,7 +26,7 @@ public class HistoricalTrackController {
*
* @return
*/
@PostMapping("/listHistoricalTrack")
@GetMapping("/listHistoricalTrack")
@DS(value = "slave")
public Result<List<HistoryRecord>> listHistoricalTrack() {
return Result.success(historicalTrackService.listHistoricalTrack());

View File

@ -54,4 +54,11 @@ public interface CarService {
* @return
*/
Result<List<Fence>> listFence();
/**
*
* @param vin
* @return
*/
Result realTime(String vin);
}

View File

@ -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<Fence> fences = fenceMapper.selectList(new MPJLambdaWrapper<Fence>().select(Fence::getFenceId,Fence::getFenceName));
return Result.success(fences);
}
/**
*
* @param vin
* @return
*/
@Override
public Result realTime(String vin) {
List<String> cacheList = redisService.getCacheList(vin);//根据vin查询出车辆的事件列表
cacheList.add("runtimeTraceEvent");//添加实时轨迹事件
redisService.setCacheList("event_"+vin,cacheList);//将事件列表存入redis
return Result.success("事件添加成功!");
}
}