This commit is contained in:
wuweida 2022-08-29 14:20:18 +08:00
parent f7c4d8b6c3
commit 0cb1669dc4
3 changed files with 50 additions and 8 deletions

View File

@ -106,7 +106,7 @@ public class Controller {
@GetMapping("capture1") @GetMapping("capture1")
public Object capture1(){ public Object capture1(){
monitorService.buildingImage(); monitorService.scenicSpotAndBathing1();
return "finish capture"; return "finish capture";
} }

View File

@ -56,7 +56,7 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<CameraChannelNLDto> 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<CameraChannel> selectCameraChannel(); List<CameraChannel> selectCameraChannel();
} }

View File

@ -268,10 +268,8 @@ public class MonitorService{
public void scenicSpotAndBathing() { public void scenicSpotAndBathing() {
try { try {
log.info("[monitor-capture]: start capture"); log.info("[monitor-capture]: start capture");
List<ChannelLabelDto> labels = cameraChannelMapper.selectLabelAndChannel("1006,1004");
List<ChannelLabelDto> labels = cameraChannelMapper.selectLabelAndChannel("1006,1004,1001");
labels.forEach(label -> { labels.forEach(label -> {
String channelCode = label.getChannelCode(); String channelCode = label.getChannelCode();
try { 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<ChannelLabelDto> 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<ChannelPicture> 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 { try {
List<BuildingSite> buildingSites = buildingSiteMapper.selectByList(); List<BuildingSite> buildingSites = buildingSiteMapper.selectByList();
@ -331,11 +372,12 @@ public class MonitorService{
}catch (Exception exception){ }catch (Exception exception){
exception.printStackTrace(); exception.printStackTrace();
} }
} }*/
/** /**
* 所有摄像头抓图 sql持续更新 * 所有摄像头抓图 sql持续更新
* TODO 还没有更新完
*/ */
@Scheduled(cron = "0 0 6 * * ?") @Scheduled(cron = "0 0 6 * * ?")
public void CameraScreenshot() { public void CameraScreenshot() {