From 65a12fccec8ad0306817eb057adb102c54f2046f Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 28 五月 2025 15:57:17 +0800
Subject: [PATCH] 添加出租车的视频设备号

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CarController.java |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CarController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CarController.java
index 7eac5d4..8d69f84 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CarController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CarController.java
@@ -124,7 +124,7 @@
 	public R<RealVideoResp> getRealVideo(@PathVariable("id") Integer id) {
 		Car car = carService.getById(id);
 		if (null == car) {
-			return R.fail("失败");
+			return R.fail("车辆信息获取失败");
 		}
 		//手动加一次状态数据,避免定时任务结束任务线程
 		redisTemplate.opsForValue().set("live:" + id, true, 1, TimeUnit.MINUTES);
@@ -138,8 +138,8 @@
 //			live_hls(data.getUrl(), car);
 //			resp.setServerIp(hlsIp);
 //			resp.setServerPort(hlsPort);
-			
-			live_flv(data.getUrl(), car.getId());
+			resp.setUrl(data.getUrl());
+//			live_flv(data.getUrl(), car.getId());
 			resp.setServerIp(flvIp);
 			resp.setServerPort(flvHttpPort);
 			return R.ok(resp);
@@ -195,8 +195,8 @@
 //			live_hls(data.getUrl(), car);
 //			resp.setServerIp(hlsIp);
 //			resp.setServerPort(hlsPort);
-			
-			live_flv(data.getUrl(), car.getId());
+			resp.setUrl(data.getUrl());
+//			live_flv(data.getUrl(), car.getId());
 			resp.setServerIp(flvIp);
 			resp.setServerPort(flvHttpPort);
 			return R.ok(resp);
@@ -240,7 +240,7 @@
 	@GetMapping("/getCarTypeList")
 	@ApiOperation(value = "获取车辆类型列表数据", tags = {"车辆类型"})
 	public R<List<CarType>> getCarTypeList(String name) {
-		List<CarType> list = carTypeService.list(new LambdaQueryWrapper<CarType>().like(StringUtils.isNotEmpty(name), CarType::getName, name));
+		List<CarType> list = carTypeService.list(new LambdaQueryWrapper<CarType>().like(StringUtils.isNotEmpty(name), CarType::getName, name).orderByAsc(CarType::getSort));
 		return R.ok(list);
 	}
 	
@@ -248,7 +248,7 @@
 	@GetMapping("/getCarCount")
 	@ApiOperation(value = "获取各种车辆类型车辆总数", tags = {"首页"})
 	public R<List<CarType>> getCarCount() {
-		List<CarType> list = carTypeService.list();
+		List<CarType> list = carTypeService.list(new LambdaQueryWrapper<CarType>().orderByAsc(CarType::getSort));
 		return R.ok(list);
 	}
 	
@@ -280,8 +280,11 @@
 	public R<List<Car>> getMapCarList() {
 		List<Car> list = carService.list(new LambdaQueryWrapper<Car>().eq(Car::getStatus, 1));
 		for (Car car : list) {
-			Long s = (null == car.getDownlineTime() ? LocalDateTime.now() : car.getDownlineTime()).toEpochSecond(ZoneOffset.ofHours(8)) - car.getOnlineTime().toEpochSecond(ZoneOffset.ofHours(8));
-			car.setDrivingTime(s / 60);
+			car.setDrivingTime(0L);
+			if(null != car.getOnlineTime()){
+				Long s = (null == car.getDownlineTime() ? LocalDateTime.now() : car.getDownlineTime()).toEpochSecond(ZoneOffset.ofHours(8)) - car.getOnlineTime().toEpochSecond(ZoneOffset.ofHours(8));
+				car.setDrivingTime(s / 60);
+			}
 			GnssDataVo gnssDataVo = (GnssDataVo) redisTemplate.opsForValue().get("location:" + car.getVehicleNumber());
 			if (null != gnssDataVo) {
 				car.setLongitude(new BigDecimal(gnssDataVo.getLon()).divide(new BigDecimal(1000000)).toString());
@@ -333,4 +336,8 @@
 		});
 		carService.taskPlayDetection(id);
 	}
+	
+	
+	
+	
 }

--
Gitblit v1.7.1