You've already forked FrameTour-BE
1、清理功能修复;2、device在线状态放redis;3、viid传入时重查redis缓存,避免关闭的设备传入素材
This commit is contained in:
@ -77,6 +77,27 @@ public class FaceCleaner {
|
||||
});
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 3 * * ?")
|
||||
public void deleteNotBuyVideos(){
|
||||
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
||||
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
||||
scenicList.parallelStream().forEach(scenic -> {
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenic.getId());
|
||||
if (scenicConfig == null) {
|
||||
log.info("当前景区{},无配置信息", scenic.getName());
|
||||
return;
|
||||
}
|
||||
if (scenicConfig.getVideoStoreDay() == null) {
|
||||
log.info("当前景区{},VLOG过期天数未设置", scenic.getName());
|
||||
return;
|
||||
}
|
||||
int expireDay = scenicConfig.getVideoStoreDay();
|
||||
Date endDate = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -expireDay);
|
||||
int deleteCount = videoMapper.deleteNotBuyRelations(scenic.getId(), endDate);
|
||||
log.info("当前景区{},删除VLOG{}个", scenic.getName(), deleteCount);
|
||||
});
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 30 3 * * ?")
|
||||
public void deleteExpiredSource(){
|
||||
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
||||
@ -141,17 +162,17 @@ public class FaceCleaner {
|
||||
List<StorageFileObject> fileObjectList = adapter.listDir("video-source");
|
||||
fileObjectList.parallelStream().forEach(fileObject -> {
|
||||
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getVideoUrl())).noneMatch(videoRespVO -> videoRespVO.getVideoUrl().contains(fileObject.getFullPath()))){
|
||||
log.info("删除视频文件:{}", fileObject);
|
||||
log.info("删除源视频素材文件:{}", fileObject);
|
||||
adapter.deleteFile(fileObject.getFullPath());
|
||||
} else {
|
||||
log.info("视频文件存在关系:{},未删除", fileObject);
|
||||
log.info("源视频素材文件存在关系:{},未删除", fileObject);
|
||||
}
|
||||
});
|
||||
log.info("开始清理源图片素材文件");
|
||||
IStorageAdapter imageAdapter = StorageFactory.use("faces");
|
||||
List<StorageFileObject> imageFileObjectList = imageAdapter.listDir("user-photo");
|
||||
imageFileObjectList.parallelStream().forEach(fileObject -> {
|
||||
if (list.parallelStream().noneMatch(videoRespVO -> videoRespVO.getUrl().contains(fileObject.getFullPath()))){
|
||||
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getUrl())).noneMatch(videoRespVO -> videoRespVO.getUrl().contains(fileObject.getFullPath()))){
|
||||
log.info("删除图片文件:{}", fileObject);
|
||||
imageAdapter.deleteFile(fileObject.getFullPath());
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user