| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | } |
| | | 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())); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检测视频播放,清除没有播放的视频流 |
| | | */ |
| | | @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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | String body = execute.body(); |
| | | JSONObject jsonObject = JSON.parseObject(body); |
| | | Integer resultState = jsonObject.getInteger("ResultState"); |
| | | if(1 == resultState){ |
| | | if(null != resultState && 1 == resultState){ |
| | | JSONArray resultData = jsonObject.getJSONArray("ResultData"); |
| | | for (int i = 0; i < resultData.size(); i++) { |
| | | JSONObject jsonObject1 = resultData.getJSONObject(i); |