人流格栅实体类更新
This commit is contained in:
parent
6d519a2e6e
commit
0945c74ad3
|
@ -11,5 +11,6 @@ public class PassengerTest {
|
|||
private Integer id;
|
||||
private double longitude;
|
||||
private double latitude;
|
||||
private String label;
|
||||
private String type;
|
||||
private String areaName;
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ public class MonitorService {
|
|||
/**
|
||||
* 所有摄像头抓图 sql持续更新
|
||||
*/
|
||||
@Scheduled(cron = "0 30 8 * * ?")
|
||||
@Scheduled(cron = "0 0 6 * * ?")
|
||||
public void CameraScreenshot () {
|
||||
try {
|
||||
log.info("[monitor-capture]: start capture");
|
||||
|
@ -315,31 +315,23 @@ public class MonitorService {
|
|||
List<CameraChannel> cameraChannels = cameraChannelMapper.selectCameraChannel();
|
||||
|
||||
cameraChannels.forEach(channel -> {
|
||||
int i = 5;
|
||||
while ( i > 0){
|
||||
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);
|
||||
i=0;
|
||||
}catch (Exception e){
|
||||
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
|
||||
i--;
|
||||
if (i == 0){
|
||||
TestCode testCode = new TestCode();
|
||||
testCode.setChannelCode(channelCode);
|
||||
testCodeMapper.insert(testCode);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}catch (Exception e){
|
||||
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
|
||||
TestCode testCode = new TestCode();
|
||||
testCode.setChannelCode(channelCode);
|
||||
testCodeMapper.insert(testCode);
|
||||
}
|
||||
|
||||
});
|
||||
log.info("[monitor-capture]: end capture");
|
||||
}catch (Exception exception){
|
||||
|
@ -517,11 +509,11 @@ public class MonitorService {
|
|||
log.debug("开始抓流:" + file);
|
||||
|
||||
FFmpegFrameGrabber grabber = FFmpegFrameGrabber.createDefault(file);
|
||||
|
||||
try {
|
||||
|
||||
grabber.setOption("stimoout", "10*1000*1000");
|
||||
grabber.setOption("timeout", "10*1000*1000");
|
||||
|
||||
grabber.start();
|
||||
|
||||
log.debug("grabber启动成功");
|
||||
|
@ -537,14 +529,12 @@ public class MonitorService {
|
|||
return bufferedImage;
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
throw e;
|
||||
}finally {
|
||||
grabber.stop();
|
||||
grabber.release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -643,7 +633,7 @@ public class MonitorService {
|
|||
//获取当前时间和前一天的UTC时间
|
||||
Map<String,Object> condition = new HashMap<>();
|
||||
ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC);
|
||||
ZonedDateTime startUTC = endUTC.minusDays(30);
|
||||
ZonedDateTime startUTC = endUTC.minusDays(90);
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'");
|
||||
condition.put("checkStatus",0);
|
||||
condition.put("startTime",dateTimeFormatter.format(startUTC));
|
||||
|
|
Loading…
Reference in New Issue