From 4e87f5f570a84621734035217f08882f52809c48 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 06 五月 2025 18:32:35 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CarController.java |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 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 4adde60..cc4bb7e 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);
@@ -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());
@@ -331,6 +334,6 @@
 				JavaCVStreamUtil.push_flv(input, url, id);
 			}
 		});
-//		carService.taskPlayDetection(id);
+		carService.taskPlayDetection(id);
 	}
 }

--
Gitblit v1.7.1