Pu Zhibing
2025-05-06 1ad5e3d97eb99662b08c0f5acff34875deca04c1
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);
@@ -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());