| | |
| | | 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 io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | @RequestMapping("/car") |
| | | public class CarController { |
| | | |
| | | private String outputUrl = "F:\\nginx 1.7.11.3 Gryphon\\html\\"; |
| | | @Resource |
| | | private ICarService carService; |
| | | |
| | | @Resource |
| | | private IDriverService driverService; |
| | | |
| | | @Resource |
| | | private IEnterpriseService enterpriseService; |
| | | |
| | | @Resource |
| | | private RealVideoMsgClient realVideoMsgClient; |
| | | |
| | | @Resource |
| | | private PlaybackMsgClient playbackMsgClient; |
| | | |
| | | @Resource |
| | | private UPExgMsgRealLocationClient upExgMsgRealLocationClient; |
| | | |
| | | @Resource |
| | | private ICarTypeService carTypeService; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | @GetMapping("/getCarList") |
| | | @ApiOperation(value = "获取车辆列表", tags = {"车辆管理"}) |
| | |
| | | if (200 == msgStartupAckVoR.getCode()) { |
| | | UPRealvideoMsgStartupAckVo data = msgStartupAckVoR.getData(); |
| | | RealVideoResp resp = new RealVideoResp(); |
| | | resp.setServerIp(data.getServerIP()); |
| | | resp.setServerPort(data.getServerPort()); |
| | | String url = "rtmp://192.168.110.85:1935/flv-live/" + car.getVehicleNumber(); |
| | | //执行拉流和推流 |
| | | ExecutorService executorService = new ThreadPoolExecutor(1, 1, |
| | | 0L, TimeUnit.MILLISECONDS, |
| | | new LinkedBlockingQueue<Runnable>()); |
| | | executorService.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | JavaCVStreamUtil.push_flv(data.getUrl(), url, id); |
| | | } |
| | | }); |
| | | resp.setUrl(url); |
| | | return R.ok(resp); |
| | | } |
| | | |
| | | return R.fail(msgStartupAckVoR.getMsg()); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/closeRealVideo/{id}") |
| | | @ApiOperation(value = "关闭实时音视频", tags = {"车辆管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "车辆id", name = "id", required = true) |
| | | }) |
| | | public R closeRealVideo(@PathVariable("id") Integer id){ |
| | | JavaCVStreamUtil.close(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getPlaybackVideo") |
| | |
| | | if (200 == startupAckVoR.getCode()) { |
| | | UPPlaybackMsgStartupAckVo data = startupAckVoR.getData(); |
| | | RealVideoResp resp = new RealVideoResp(); |
| | | resp.setServerIp(data.getServerIP()); |
| | | resp.setServerPort(data.getServerPort()); |
| | | String url = "rtmp://192.168.110.85:1935/flv-live/" + car.getVehicleNumber(); |
| | | //执行拉流和推流 |
| | | ExecutorService executorService = new ThreadPoolExecutor(1, 1, |
| | | 0L, TimeUnit.MILLISECONDS, |
| | | new LinkedBlockingQueue<Runnable>()); |
| | | executorService.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | JavaCVStreamUtil.push_flv(data.getUrl(), url, req.getId()); |
| | | } |
| | | }); |
| | | resp.setUrl(url); |
| | | return R.ok(resp); |
| | | } |
| | | return R.fail(startupAckVoR.getMsg()); |
| | |
| | | if (null != gnssDataVo) { |
| | | car.setLongitude(new BigDecimal(gnssDataVo.getLon()).divide(new BigDecimal(1000000)).toString()); |
| | | car.setLatitude(new BigDecimal(gnssDataVo.getLat()).divide(new BigDecimal(1000000)).toString()); |
| | | car.setSpeed(gnssDataVo.getVec1()); |
| | | } |
| | | } |
| | | return R.ok(list); |