diff --git a/src/main/java/com/hisense/monitormanage/entity/PassengerTest.java b/src/main/java/com/hisense/monitormanage/entity/PassengerTest.java index e1f9878..8fde918 100644 --- a/src/main/java/com/hisense/monitormanage/entity/PassengerTest.java +++ b/src/main/java/com/hisense/monitormanage/entity/PassengerTest.java @@ -11,5 +11,6 @@ public class PassengerTest { private Integer id; private double longitude; private double latitude; - private String label; + private String type; + private String areaName; } diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index da9b24c..81ef856 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -307,7 +307,7 @@ public class MonitorService { /** * 所有摄像头抓图 sql持续更新 */ - @Scheduled(cron = "0 30 8 * * ?") + @Scheduled(cron = "0 0 6 * * ?") public void CameraScreenshot () { try { log.info("[monitor-capture]: start capture"); @@ -315,31 +315,23 @@ public class MonitorService { List cameraChannels = cameraChannelMapper.selectCameraChannel(); cameraChannels.forEach(channel -> { - int i = 5; - while ( i > 0){ - String channelCode = channel.getChannelCode(); - try { - BufferedImage bufferedImage = capturecreenshot(channelCode); - String fileName = channelCode + ".jpg"; - ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName)); - String picUrl = picHost + "/images/" + fileName; - ChannelPicture picture = new ChannelPicture(); - picture.setChannelCode(channelCode); - picture.setPicUrl(picUrl); - picture.setInsertTime(new Date()); - channelPictureMapper.insert(picture); - i=0; - }catch (Exception e){ - log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); - i--; - if (i == 0){ - TestCode testCode = new TestCode(); - testCode.setChannelCode(channelCode); - testCodeMapper.insert(testCode); - } - } + String channelCode = channel.getChannelCode(); + try { + BufferedImage bufferedImage = capturecreenshot(channelCode); + String fileName = channelCode + ".jpg"; + ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName)); + String picUrl = picHost + "/images/" + fileName; + ChannelPicture picture = new ChannelPicture(); + picture.setChannelCode(channelCode); + picture.setPicUrl(picUrl); + picture.setInsertTime(new Date()); + channelPictureMapper.insert(picture); + }catch (Exception e){ + log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); + TestCode testCode = new TestCode(); + testCode.setChannelCode(channelCode); + testCodeMapper.insert(testCode); } - }); log.info("[monitor-capture]: end capture"); }catch (Exception exception){ @@ -517,11 +509,11 @@ public class MonitorService { log.debug("开始抓流:" + file); FFmpegFrameGrabber grabber = FFmpegFrameGrabber.createDefault(file); - try { grabber.setOption("stimoout", "10*1000*1000"); grabber.setOption("timeout", "10*1000*1000"); + grabber.start(); log.debug("grabber启动成功"); @@ -537,14 +529,12 @@ public class MonitorService { return bufferedImage; } } - }catch (Exception e){ throw e; }finally { grabber.stop(); grabber.release(); } - } /** @@ -643,7 +633,7 @@ public class MonitorService { //获取当前时间和前一天的UTC时间 Map condition = new HashMap<>(); ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC); - ZonedDateTime startUTC = endUTC.minusDays(30); + ZonedDateTime startUTC = endUTC.minusDays(90); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'"); condition.put("checkStatus",0); condition.put("startTime",dateTimeFormatter.format(startUTC));