Commit e1aa0d62 authored by 赵啸非's avatar 赵啸非

添加定时删除七天前的人流数据

parent 967b62eb
......@@ -43,8 +43,6 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
@Autowired
private RealtimeDataflowStatService realtimeDataflowStatService;
@Autowired
private IHikFaceService faceService;
@Autowired
private UploadService uploadService;
......@@ -56,13 +54,15 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
private void delFiles() {
//保留七天人脸数据
log.info("定时删除人流数据");
String endTimeStr = DateUtil.offsetDay(new Date(), -7).toDateStr();
RealtimeDataflowQuery realtimeDataflowQuery = new RealtimeDataflowQuery();
realtimeDataflowQuery.setCreateTimeEnd(endTimeStr);
List<RealtimeDataflowEntity> realtimeDataflowEntities = realtimeDataflowService.find(realtimeDataflowQuery, null);
if (ObjectUtils.isEmpty(realtimeDataflowEntities)) {
log.info("需要删除的实时监控数据量:{}", realtimeDataflowEntities.size());
Long[] delIds = realtimeDataflowEntities.stream().map(i -> i.getId()).toArray(Long[]::new);
realtimeDataflowStatService.remove(delIds, null);
for (RealtimeDataflowEntity entity : realtimeDataflowEntities) {
if (ObjectUtils.isEmpty(entity.getPicture())) continue;
uploadService.deleteFile(entity.getPicture());
......@@ -70,6 +70,8 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
}
}
private void statPeople() {
Date startTime = DateUtil.beginOfHour(new Date());
Date endTime = DateUtil.endOfHour(new Date());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment