You've already forked FrameTour-BE
bug修改,根性视频meta信息
This commit is contained in:
34
src/main/java/com/ycwl/basic/repository/VideoRepository.java
Normal file
34
src/main/java/com/ycwl/basic/repository/VideoRepository.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.ycwl.basic.repository;
|
||||
|
||||
import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
import com.ycwl.basic.model.task.req.VideoInfoReq;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Component
|
||||
public class VideoRepository {
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
|
||||
public void updateMeta(Long videoId, VideoInfoReq req) {
|
||||
VideoRespVO video = videoMapper.getById(videoId);
|
||||
if (video.getDuration() != null) {
|
||||
if (video.getDuration().subtract(req.getDuration()).abs().compareTo(BigDecimal.ONE) <= 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
VideoEntity update = new VideoEntity();
|
||||
update.setId(videoId);
|
||||
update.setHeight(req.getHeight());
|
||||
update.setWidth(req.getWidth());
|
||||
update.setDuration(req.getDuration());
|
||||
videoMapper.updateMeta(update);
|
||||
}
|
||||
}
|
@ -14,8 +14,6 @@ public class VideoTaskRepository {
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
@Autowired
|
||||
private TaskMapper taskMapper;
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
|
||||
public static final String TASK_CACHE_KEY = "task:byId:%s";
|
||||
|
||||
|
Reference in New Issue
Block a user