This commit is contained in:
parent
f7c4d8b6c3
commit
0cb1669dc4
|
@ -106,7 +106,7 @@ public class Controller {
|
|||
|
||||
@GetMapping("capture1")
|
||||
public Object capture1(){
|
||||
monitorService.buildingImage();
|
||||
monitorService.scenicSpotAndBathing1();
|
||||
|
||||
return "finish capture";
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
|
|||
|
||||
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();
|
||||
|
||||
}
|
||||
|
|
|
@ -268,10 +268,8 @@ public class MonitorService{
|
|||
public void scenicSpotAndBathing() {
|
||||
|
||||
try {
|
||||
|
||||
log.info("[monitor-capture]: start capture");
|
||||
|
||||
List<ChannelLabelDto> labels = cameraChannelMapper.selectLabelAndChannel("1006,1004,1001");
|
||||
List<ChannelLabelDto> 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<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 {
|
||||
List<BuildingSite> 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() {
|
||||
|
|
Loading…
Reference in New Issue