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

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

parent 967b62eb
...@@ -43,8 +43,6 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService { ...@@ -43,8 +43,6 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private RealtimeDataflowStatService realtimeDataflowStatService; private RealtimeDataflowStatService realtimeDataflowStatService;
@Autowired @Autowired
private IHikFaceService faceService;
@Autowired
private UploadService uploadService; private UploadService uploadService;
...@@ -56,13 +54,15 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService { ...@@ -56,13 +54,15 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
private void delFiles() { private void delFiles() {
//保留七天人脸数据 //保留七天人脸数据
log.info("定时删除人流数据");
String endTimeStr = DateUtil.offsetDay(new Date(), -7).toDateStr(); String endTimeStr = DateUtil.offsetDay(new Date(), -7).toDateStr();
RealtimeDataflowQuery realtimeDataflowQuery = new RealtimeDataflowQuery(); RealtimeDataflowQuery realtimeDataflowQuery = new RealtimeDataflowQuery();
realtimeDataflowQuery.setCreateTimeEnd(endTimeStr); realtimeDataflowQuery.setCreateTimeEnd(endTimeStr);
List<RealtimeDataflowEntity> realtimeDataflowEntities = realtimeDataflowService.find(realtimeDataflowQuery, null); 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); Long[] delIds = realtimeDataflowEntities.stream().map(i -> i.getId()).toArray(Long[]::new);
realtimeDataflowStatService.remove(delIds, null); realtimeDataflowStatService.remove(delIds, null);
for (RealtimeDataflowEntity entity : realtimeDataflowEntities) { for (RealtimeDataflowEntity entity : realtimeDataflowEntities) {
if (ObjectUtils.isEmpty(entity.getPicture())) continue; if (ObjectUtils.isEmpty(entity.getPicture())) continue;
uploadService.deleteFile(entity.getPicture()); uploadService.deleteFile(entity.getPicture());
...@@ -70,6 +70,8 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService { ...@@ -70,6 +70,8 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
} }
}
private void statPeople() { private void statPeople() {
Date startTime = DateUtil.beginOfHour(new Date()); Date startTime = DateUtil.beginOfHour(new Date());
Date endTime = DateUtil.endOfHour(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