人流格栅实体类更新

This commit is contained in:
wuweida 2022-07-18 17:27:49 +08:00
parent 6d519a2e6e
commit 0945c74ad3
2 changed files with 21 additions and 30 deletions

View File

@ -11,5 +11,6 @@ public class PassengerTest {
private Integer id; private Integer id;
private double longitude; private double longitude;
private double latitude; private double latitude;
private String label; private String type;
private String areaName;
} }

View File

@ -307,7 +307,7 @@ public class MonitorService {
/** /**
* 所有摄像头抓图 sql持续更新 * 所有摄像头抓图 sql持续更新
*/ */
@Scheduled(cron = "0 30 8 * * ?") @Scheduled(cron = "0 0 6 * * ?")
public void CameraScreenshot () { public void CameraScreenshot () {
try { try {
log.info("[monitor-capture]: start capture"); log.info("[monitor-capture]: start capture");
@ -315,31 +315,23 @@ public class MonitorService {
List<CameraChannel> cameraChannels = cameraChannelMapper.selectCameraChannel(); List<CameraChannel> cameraChannels = cameraChannelMapper.selectCameraChannel();
cameraChannels.forEach(channel -> { cameraChannels.forEach(channel -> {
int i = 5; String channelCode = channel.getChannelCode();
while ( i > 0){ try {
String channelCode = channel.getChannelCode(); BufferedImage bufferedImage = capturecreenshot(channelCode);
try { String fileName = channelCode + ".jpg";
BufferedImage bufferedImage = capturecreenshot(channelCode); ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName));
String fileName = channelCode + ".jpg"; String picUrl = picHost + "/images/" + fileName;
ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName)); ChannelPicture picture = new ChannelPicture();
String picUrl = picHost + "/images/" + fileName; picture.setChannelCode(channelCode);
ChannelPicture picture = new ChannelPicture(); picture.setPicUrl(picUrl);
picture.setChannelCode(channelCode); picture.setInsertTime(new Date());
picture.setPicUrl(picUrl); channelPictureMapper.insert(picture);
picture.setInsertTime(new Date()); }catch (Exception e){
channelPictureMapper.insert(picture); log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
i=0; TestCode testCode = new TestCode();
}catch (Exception e){ testCode.setChannelCode(channelCode);
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); testCodeMapper.insert(testCode);
i--;
if (i == 0){
TestCode testCode = new TestCode();
testCode.setChannelCode(channelCode);
testCodeMapper.insert(testCode);
}
}
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ }catch (Exception exception){
@ -517,11 +509,11 @@ public class MonitorService {
log.debug("开始抓流:" + file); log.debug("开始抓流:" + file);
FFmpegFrameGrabber grabber = FFmpegFrameGrabber.createDefault(file); FFmpegFrameGrabber grabber = FFmpegFrameGrabber.createDefault(file);
try { try {
grabber.setOption("stimoout", "10*1000*1000"); grabber.setOption("stimoout", "10*1000*1000");
grabber.setOption("timeout", "10*1000*1000"); grabber.setOption("timeout", "10*1000*1000");
grabber.start(); grabber.start();
log.debug("grabber启动成功"); log.debug("grabber启动成功");
@ -537,14 +529,12 @@ public class MonitorService {
return bufferedImage; return bufferedImage;
} }
} }
}catch (Exception e){ }catch (Exception e){
throw e; throw e;
}finally { }finally {
grabber.stop(); grabber.stop();
grabber.release(); grabber.release();
} }
} }
/** /**
@ -643,7 +633,7 @@ public class MonitorService {
//获取当前时间和前一天的UTC时间 //获取当前时间和前一天的UTC时间
Map<String,Object> condition = new HashMap<>(); Map<String,Object> condition = new HashMap<>();
ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC); ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC);
ZonedDateTime startUTC = endUTC.minusDays(30); ZonedDateTime startUTC = endUTC.minusDays(90);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'");
condition.put("checkStatus",0); condition.put("checkStatus",0);
condition.put("startTime",dateTimeFormatter.format(startUTC)); condition.put("startTime",dateTimeFormatter.format(startUTC));