fix(media): 修正转码媒资 id 解析与存量分集补登记
This commit is contained in:
1 parent
a35b02dd18
commit
5ef5dd8eaf
11 files changed
+427
-31
No files matched your search
+32
-1
@@ -17,6 +17,7 @@ import com.fruitshorts.content.vo.EpisodeRespVO;
|
||||
import com.fruitshorts.content.vo.EpisodeSaveReqVO;
|
||||
import com.fruitshorts.media.service.EpisodeTranscodeBindingService;
|
||||
import com.fruitshorts.media.service.EpisodeTranscodeCompletionPort;
|
||||
import com.fruitshorts.media.service.EpisodeVideoSourcePort;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -31,7 +32,7 @@ import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EpisodeService implements EpisodeTranscodeCompletionPort {
|
||||
public class EpisodeService implements EpisodeTranscodeCompletionPort, EpisodeVideoSourcePort {
|
||||
|
||||
private static final int DEFAULT_PAGE_INDEX = 1;
|
||||
private static final int DEFAULT_PAGE_SIZE = 100;
|
||||
@@ -41,6 +42,36 @@ public class EpisodeService implements EpisodeTranscodeCompletionPort {
|
||||
private final DramaService dramaService;
|
||||
private final EpisodeTranscodeBindingService transcodeBindingService;
|
||||
|
||||
@Override
|
||||
public java.util.Optional<EpisodeVideoSource> resolve(Long candidateId) {
|
||||
if (candidateId == null || candidateId <= 0) {
|
||||
return java.util.Optional.empty();
|
||||
}
|
||||
DramaEpisode episode = dramaEpisodeMapper.selectById(candidateId);
|
||||
if (episode == null) {
|
||||
episode = dramaEpisodeMapper.selectOne(Wrappers.<DramaEpisode>lambdaQuery()
|
||||
.eq(DramaEpisode::getVideoAssetId, candidateId)
|
||||
.last("limit 1"));
|
||||
}
|
||||
if (episode == null) {
|
||||
return java.util.Optional.empty();
|
||||
}
|
||||
return java.util.Optional.of(new EpisodeVideoSource(
|
||||
episode.getId(), episode.getDramaId(), episode.getVideoAssetId(),
|
||||
episode.getVideoUrl(), episode.getDurationSec()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void link(Long episodeId, Long mediaAssetId) {
|
||||
if (episodeId == null || episodeId <= 0 || mediaAssetId == null || mediaAssetId <= 0) {
|
||||
return;
|
||||
}
|
||||
dramaEpisodeMapper.update(null, Wrappers.<DramaEpisode>lambdaUpdate()
|
||||
.eq(DramaEpisode::getId, episodeId)
|
||||
.set(DramaEpisode::getVideoAssetId, mediaAssetId));
|
||||
}
|
||||
|
||||
/** 后台:按短剧分页查询分集,status 在 SQL 层过滤;排序稳定(sort、ep_no)。 */
|
||||
public PageResult<EpisodeRespVO> pageByDrama(Long dramaId, String status,
|
||||
Integer pageIndex, Integer pageSize) {
|
||||
|
||||
Reference in new issue
Block a user