| | |
| | | import com.ycl.platform.mapper.DeviceInfoMapper; |
| | | import com.ycl.platform.mapper.WorkOrderCheckImgMapper; |
| | | import com.ycl.platform.service.WorkOrderService; |
| | | import com.ycl.utils.DateUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.bytedeco.javacv.FFmpegFrameGrabber; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.ArrayBlockingQueue; |
| | |
| | | private final DeviceInfoMapper deviceInfoMapper; |
| | | private final WorkOrderCheckImgMapper workOrderCheckImgMapper; |
| | | |
| | | private static final ExecutorService executorService = new ThreadPoolExecutor(8, |
| | | 24, |
| | | private static final ExecutorService executorService = new ThreadPoolExecutor(16, |
| | | 32, |
| | | 5000, |
| | | TimeUnit.SECONDS, |
| | | new ArrayBlockingQueue<>(10), |
| | | new ArrayBlockingQueue<>(1000), |
| | | new ThreadPoolExecutor.CallerRunsPolicy() |
| | | ); |
| | | |
| | | public void run() { |
| | | // 查出故障的设备 |
| | | List<DeviceInfoVO> deviceList = workOrderService.hasErrorWorkOrderList(); |
| | | // 查出最近一周的故障的设备 |
| | | Date now = new Date(); |
| | | Calendar ca = Calendar.getInstance(); |
| | | ca.setTime(now); |
| | | ca.add(Calendar.DATE, -6); |
| | | List<DeviceInfoVO> deviceList = workOrderService.hasErrorWorkOrderList(DateUtils.getDayStart(ca.getTime()), DateUtils.getDayEnd(now)); |
| | | if (CollectionUtils.isEmpty(deviceList)) { |
| | | return; |
| | | } |
| | |
| | | return; |
| | | } |
| | | for (DeviceInfoVO deviceInfo : deviceList) { |
| | | // executorService.submit(() -> { |
| | | executorService.submit(() -> { |
| | | // 国标设备的编码就是取视频流的设备编码,国标设备就一个。国标设备的每一个通道代表一个摄像头,也就是设备id是取流的通道id |
| | | String frameImg = workOrderService.getFrameImgByDevice(gbDevices.get(0).getDeviceId(), deviceInfo.getDeviceId(), deviceInfo.getWorkOrderNo()); |
| | | if (StringUtils.hasText(frameImg)) { |
| | |
| | | img.setCreateTime(new Date()); |
| | | workOrderCheckImgMapper.insert(img); |
| | | } |
| | | // }); |
| | | }); |
| | | } |
| | | executorService.shutdown(); |
| | | } |
| | | |
| | | } |