bug修改,根性视频meta信息

This commit is contained in:
2025-01-09 19:34:20 +08:00
parent c27665e513
commit 5c0bf09c95
12 changed files with 101 additions and 7 deletions

View 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);
}
}

View File

@ -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";