diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index bdbb486..ac3a2ed 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -106,7 +106,7 @@ public class Controller { @GetMapping("capture1") public Object capture1(){ - monitorService.buildingImage(); + monitorService.scenicSpotAndBathing1(); return "finish capture"; } diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 0759196..b74dc4f 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -56,7 +56,7 @@ public interface CameraChannelMapper extends BaseMapper { List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - @Select("SELECT * FROM t_camera_channel WHERE channel_code < '042_37021595001320007890' AND channel_code > '042_37021536001320005082' ORDER BY channel_code DESC") + @Select("SELECT * FROM t_camera_channel WHERE channel_code < '009_37021544001321925022' AND channel_code > '009_37021502001321352341' ORDER BY channel_code DESC") List selectCameraChannel(); } diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index 512aac4..6c17fcf 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -268,10 +268,8 @@ public class MonitorService{ public void scenicSpotAndBathing() { try { - log.info("[monitor-capture]: start capture"); - - List labels = cameraChannelMapper.selectLabelAndChannel("1006,1004,1001"); + List labels = cameraChannelMapper.selectLabelAndChannel("1006,1004"); labels.forEach(label -> { String channelCode = label.getChannelCode(); try { @@ -306,8 +304,51 @@ public class MonitorService{ } } - @Scheduled(cron = "0 30 8 * * ?") - public void buildingImage() { + /** + * 窗口单位广场街区抓图 + */ + @Scheduled(cron = "0 0 8/1 * * ?") + public void scenicSpotAndBathing1() { + + try { + log.info("[monitor-capture]: start capture"); + List labels = cameraChannelMapper.selectLabelAndChannel("1001,1005,1007"); + labels.forEach(label -> { + String channelCode = label.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);*/ + if (channelCode == null){ + channelPictureMapper.insert(picture); + }else { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("channel_code", channelCode); + picture.setInsertTime(new Date()); + channelPictureMapper.update(picture, queryWrapper); + } + }catch (Exception e){ + + log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); + } + }); + + log.info("[monitor-capture]: end capture"); + }catch (Exception exception){ + exception.printStackTrace(); + } + } + + //@Scheduled(cron = "0 30 8 * * ?") + /*public void buildingImage() { try { List buildingSites = buildingSiteMapper.selectByList(); @@ -331,11 +372,12 @@ public class MonitorService{ }catch (Exception exception){ exception.printStackTrace(); } - } + }*/ /** * 所有摄像头抓图 sql持续更新 + * TODO 还没有更新完 */ @Scheduled(cron = "0 0 6 * * ?") public void CameraScreenshot() {