puzhibing
2025-05-06 4e87f5f570a84621734035217f08882f52809c48
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());