diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index e5113ba..abc2693 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -301,13 +301,8 @@ public class Controller { @ApiImplicitParam(name = "page",value = "页码",required = true,dataType = "Integer"), @ApiImplicitParam(name = "pageSize",value = "页码大小",required = true,dataType = "Integer") }) - public Result selectNLAll(Integer page,Integer pageSize,String labelCode){ + public Result selectNLAll(Integer page,Integer pageSize){ List selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize); - if (labelCode != null && labelCode != ""){ - List dtos = cameraChannelMapper.selectByLabel(page, pageSize); - Result success = Result.success(dtos); - return success; - } Result success = Result.success(selectNLAll); return success; } diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 1defa35..98a9b7e 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -56,9 +56,8 @@ public interface CameraChannelMapper extends BaseMapper { @Param("gpsY") Double gpsY, @Param("gpsY1") Double gpsY1); - List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - List selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - + @Select("SELECT * FROM t_camera_channel WHERE channel_code > '183_37028312581314000628' 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 9a6c466..2495d6c 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -292,6 +292,42 @@ public class MonitorService { } } + public void CameraScreenshot () { + try { + log.info("[monitor-capture]: start capture"); + + List cameraChannels = cameraChannelMapper.selectCameraChannel(); + cameraChannels.forEach(channel -> { + 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); + /*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()); + channel.setCheckStatus(0); + + } + }); + log.info("[monitor-capture]: end capture"); + }catch (Exception exception){ + exception.printStackTrace(); + } + } /** * 海水浴场人群图片算法识别 */ diff --git a/src/main/resources/mapper/CameraChannelMapper.xml b/src/main/resources/mapper/CameraChannelMapper.xml index 867b24b..b78de4b 100644 --- a/src/main/resources/mapper/CameraChannelMapper.xml +++ b/src/main/resources/mapper/CameraChannelMapper.xml @@ -32,12 +32,4 @@ limit #{page},#{pageSize} - - \ No newline at end of file