You've already forked FrameTour-BE
清理删除逻辑优化
This commit is contained in:
@ -79,4 +79,6 @@ public interface SourceMapper {
|
|||||||
List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);
|
List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);
|
||||||
|
|
||||||
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
|
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
|
||||||
|
|
||||||
|
int deleteUselessSource();
|
||||||
}
|
}
|
||||||
|
@ -54,4 +54,6 @@ public interface VideoMapper {
|
|||||||
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
||||||
|
|
||||||
int deleteNotBuyFaceRelations(Long userId, Long faceId);
|
int deleteNotBuyFaceRelations(Long userId, Long faceId);
|
||||||
|
|
||||||
|
int deleteUselessVideo();
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,8 @@ public class FaceCleaner {
|
|||||||
int expireDay = scenicConfig.getVideoStoreDay();
|
int expireDay = scenicConfig.getVideoStoreDay();
|
||||||
Date endDate = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -expireDay);
|
Date endDate = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -expireDay);
|
||||||
int deleteCount = videoMapper.deleteNotBuyRelations(scenic.getId(), endDate);
|
int deleteCount = videoMapper.deleteNotBuyRelations(scenic.getId(), endDate);
|
||||||
log.info("当前景区{},删除VLOG{}个", scenic.getName(), deleteCount);
|
int deleteVideoCount = videoMapper.deleteUselessVideo();
|
||||||
|
log.info("当前景区{},删除VLOG关系{}个,删除VLOG记录{}个", scenic.getName(), deleteCount, deleteVideoCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +204,8 @@ public class FaceCleaner {
|
|||||||
Date endDate2 = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -imageSourceExpireDay);
|
Date endDate2 = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -imageSourceExpireDay);
|
||||||
int deleteImageSourceCount = sourceMapper.deleteNotRelateSource(2, endDate2);
|
int deleteImageSourceCount = sourceMapper.deleteNotRelateSource(2, endDate2);
|
||||||
log.info("当前景区{},删除原始图片素材{}个", scenic.getName(), deleteImageSourceCount);
|
log.info("当前景区{},删除原始图片素材{}个", scenic.getName(), deleteImageSourceCount);
|
||||||
|
int deleteSourceCount = sourceMapper.deleteUselessSource();
|
||||||
|
log.info("当前景区{},删除无用素材{}个", scenic.getName(), deleteSourceCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,9 @@
|
|||||||
delete from member_source
|
delete from member_source
|
||||||
where member_id = #{userId} and face_id = #{faceId} and is_buy = 0
|
where member_id = #{userId} and face_id = #{faceId} and is_buy = 0
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="deleteUselessSource">
|
||||||
|
delete from source where id not in (select source_id from member_source where source_id is not null)
|
||||||
|
</delete>
|
||||||
|
|
||||||
<select id="list" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
<select id="list" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||||
select so.id, so.scenic_id, de.name as deviceName, device_id, url, so.create_time, so.update_time,sc.`name` as scenicName, so.video_url, so.`type`, so.face_sample_id
|
select so.id, so.scenic_id, de.name as deviceName, device_id, url, so.create_time, so.update_time,sc.`name` as scenicName, so.video_url, so.`type`, so.face_sample_id
|
||||||
|
@ -61,6 +61,12 @@
|
|||||||
delete from member_video
|
delete from member_video
|
||||||
where member_id = #{userId} and face_id = #{faceId} and is_buy = 0
|
where member_id = #{userId} and face_id = #{faceId} and is_buy = 0
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="deleteUselessVideo">
|
||||||
|
delete from video
|
||||||
|
where id not in (
|
||||||
|
select video_id from member_video where video_id is not null
|
||||||
|
)
|
||||||
|
</delete>
|
||||||
<select id="list" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
<select id="list" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
||||||
select v.id, v.scenic_id, template_id, task_id, worker_id, video_url, v.create_time, v.update_time,
|
select v.id, v.scenic_id, template_id, task_id, worker_id, video_url, v.create_time, v.update_time,
|
||||||
s.name scenicName, s.latitude, s.longitude, t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl
|
s.name scenicName, s.latitude, s.longitude, t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl
|
||||||
|
Reference in New Issue
Block a user