From 1ee76c252f2dbba62e0ec34cccf9eaac51de9083 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 23 七月 2025 16:25:23 +0800 Subject: [PATCH] 修改bug --- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CarServiceImpl.java | 29 ++++++----------------------- 1 files changed, 6 insertions(+), 23 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CarServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CarServiceImpl.java index 9e46f1f..cd68ef1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CarServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CarServiceImpl.java @@ -26,7 +26,6 @@ import com.ruoyi.system.service.ICarTypeService; import com.ruoyi.system.service.IDriverService; import com.ruoyi.system.service.IEnterpriseService; -import com.ruoyi.system.util.JavaCVStreamUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -38,8 +37,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** @@ -84,8 +81,13 @@ } List<Enterprise> list1 = enterpriseService.list(); List<Driver> driverList = driverService.list(new LambdaQueryWrapper<Driver>().eq(Driver::getStatus, 1)); + List<Car> list2 = this.list(); List<Car> carList = new ArrayList<>(); for (UPExgMsgRegisterVo vo : list) { + Optional<Car> first = list2.stream().filter(s -> s.getVehicleNumber().equals(vo.getVehicleNo())).findFirst(); + if(first.isPresent()){ + continue; + } car = new Car(); car.setVehicleNumber(vo.getVehicleNo()); car.setLicensePlateColor(VehicleColorEnum.getName(vo.getVehicleColor())); @@ -187,26 +189,7 @@ } - /** - * 检测视频播放,清除没有播放的视频流 - */ - @Override - public void taskPlayDetection(Integer deviceNumber) { - Car car = this.getById(deviceNumber); - try { - ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - executorService.scheduleWithFixedDelay(new Runnable() { - @Override - public void run() { - if(!redisTemplate.hasKey("live:" + car.getId())){ - String folderPath = hlsOutputPath + "hls\\" + car.getVehicleNumber(); - JavaCVStreamUtil.close(car.getId(), folderPath); - } - }}, 1, 1, TimeUnit.MINUTES); - }catch (Exception e){ - e.printStackTrace(); - } - } + -- Gitblit v1.7.1