添加工地抓图
This commit is contained in:
parent
e541fba4a0
commit
3a0da0fd4d
|
@ -286,10 +286,10 @@ public class BuildingController {
|
|||
return success;
|
||||
}
|
||||
|
||||
/*@GetMapping("exportEvent")
|
||||
@GetMapping("exportEvent")
|
||||
public void exportRaiseEvent() throws Exception {
|
||||
buildingRecordsService.testHSSF();
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询近7天噪声事件
|
||||
|
|
|
@ -106,7 +106,7 @@ public class Controller {
|
|||
|
||||
@GetMapping("capture1")
|
||||
public Object capture1(){
|
||||
monitorService.WaterPointService();
|
||||
monitorService.buildingImage();
|
||||
|
||||
return "finish capture";
|
||||
}
|
||||
|
|
|
@ -34,4 +34,8 @@ public class BuildingSite {
|
|||
|
||||
private String yjsg;
|
||||
|
||||
private String channelCode;
|
||||
|
||||
private String channelName;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,4 +19,7 @@ public interface BuildingSiteMapper extends BaseMapper<BuildingSite> {
|
|||
|
||||
@Select("select * from t_building_new_site")
|
||||
List<BuildingSite> selectBuildSite();
|
||||
|
||||
@Select("select * from t_building_new_site where channel_code is not null")
|
||||
List<BuildingSite> selectByList();
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ public class MonitorService{
|
|||
@Autowired
|
||||
private WCameraMapper wCameraMapper;
|
||||
|
||||
@Autowired
|
||||
private BuildingSiteMapper buildingSiteMapper;
|
||||
|
||||
@Value("${hwx.file.work-path}")
|
||||
private String fileDir;
|
||||
|
@ -304,6 +306,34 @@ public class MonitorService{
|
|||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 30 8 * * ?")
|
||||
public void buildingImage() {
|
||||
try {
|
||||
List<BuildingSite> buildingSites = buildingSiteMapper.selectByList();
|
||||
|
||||
buildingSites.forEach(building -> {
|
||||
String channelCode = building.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 channelPicture = new ChannelPicture();
|
||||
channelPicture.setChannelCode(channelCode);
|
||||
channelPicture.setPicUrl(picUrl);
|
||||
channelPicture.setInsertTime(new Date());
|
||||
channelPictureMapper.insert(channelPicture);
|
||||
}catch (Exception e){
|
||||
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
|
||||
}
|
||||
});
|
||||
log.info("[monitor-capture]: end capture");
|
||||
}catch (Exception exception){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 所有摄像头抓图 sql持续更新
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue