| | |
| | | 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); |
| | |
| | | // 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); |
| | |
| | | // 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); |
| | |
| | | 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()); |