添加工地抓图

This commit is contained in:
wuweida 2022-08-17 15:26:05 +08:00
parent e541fba4a0
commit 3a0da0fd4d
5 changed files with 40 additions and 3 deletions

View File

@ -286,10 +286,10 @@ public class BuildingController {
return success; return success;
} }
/*@GetMapping("exportEvent") @GetMapping("exportEvent")
public void exportRaiseEvent() throws Exception { public void exportRaiseEvent() throws Exception {
buildingRecordsService.testHSSF(); buildingRecordsService.testHSSF();
}*/ }
/** /**
* 查询近7天噪声事件 * 查询近7天噪声事件

View File

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

View File

@ -34,4 +34,8 @@ public class BuildingSite {
private String yjsg; private String yjsg;
private String channelCode;
private String channelName;
} }

View File

@ -19,4 +19,7 @@ public interface BuildingSiteMapper extends BaseMapper<BuildingSite> {
@Select("select * from t_building_new_site") @Select("select * from t_building_new_site")
List<BuildingSite> selectBuildSite(); List<BuildingSite> selectBuildSite();
@Select("select * from t_building_new_site where channel_code is not null")
List<BuildingSite> selectByList();
} }

View File

@ -76,6 +76,8 @@ public class MonitorService{
@Autowired @Autowired
private WCameraMapper wCameraMapper; private WCameraMapper wCameraMapper;
@Autowired
private BuildingSiteMapper buildingSiteMapper;
@Value("${hwx.file.work-path}") @Value("${hwx.file.work-path}")
private String fileDir; 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持续更新 * 所有摄像头抓图 sql持续更新
*/ */