|
@@ -1,23 +1,16 @@
|
|
|
package cn.reghao.tnb.content.app.vod.service;
|
|
package cn.reghao.tnb.content.app.vod.service;
|
|
|
|
|
|
|
|
import cn.reghao.file.api.iface.OssService;
|
|
import cn.reghao.file.api.iface.OssService;
|
|
|
-import cn.reghao.jutil.jdk.result.Result;
|
|
|
|
|
-import cn.reghao.oss.sdk.model.dto.media.VideoInfo;
|
|
|
|
|
import cn.reghao.oss.sdk.model.dto.media.VideoUrlDto;
|
|
import cn.reghao.oss.sdk.model.dto.media.VideoUrlDto;
|
|
|
import cn.reghao.tnb.common.auth.UserContext;
|
|
import cn.reghao.tnb.common.auth.UserContext;
|
|
|
-import cn.reghao.tnb.content.api.constant.VideoErrorType;
|
|
|
|
|
-import cn.reghao.tnb.content.api.constant.VideoStatus;
|
|
|
|
|
import cn.reghao.tnb.content.app.vod.db.mapper.*;
|
|
import cn.reghao.tnb.content.app.vod.db.mapper.*;
|
|
|
-import cn.reghao.tnb.content.app.vod.model.dto.*;
|
|
|
|
|
import cn.reghao.tnb.content.app.vod.model.po.*;
|
|
import cn.reghao.tnb.content.app.vod.model.po.*;
|
|
|
import cn.reghao.tnb.content.app.vod.model.vo.DownloadUrl;
|
|
import cn.reghao.tnb.content.app.vod.model.vo.DownloadUrl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author reghao
|
|
* @author reghao
|
|
@@ -31,59 +24,17 @@ public class VideoService {
|
|
|
|
|
|
|
|
private final VideoPostMapper videoPostMapper;
|
|
private final VideoPostMapper videoPostMapper;
|
|
|
private final VideoFileMapper videoFileMapper;
|
|
private final VideoFileMapper videoFileMapper;
|
|
|
- private final VideoErrorMapper videoErrorMapper;
|
|
|
|
|
- private final Set<Long> adminUsers;
|
|
|
|
|
- private VideoStatisticMapper videoStatisticMapper;
|
|
|
|
|
|
|
+ private final VideoStatisticMapper videoStatisticMapper;
|
|
|
|
|
|
|
|
public VideoService(VideoPostMapper videoPostMapper, VideoFileMapper videoFileMapper,
|
|
public VideoService(VideoPostMapper videoPostMapper, VideoFileMapper videoFileMapper,
|
|
|
- VideoErrorMapper videoErrorMapper, VideoStatisticMapper videoStatisticMapper) {
|
|
|
|
|
|
|
+ VideoStatisticMapper videoStatisticMapper) {
|
|
|
this.videoPostMapper = videoPostMapper;
|
|
this.videoPostMapper = videoPostMapper;
|
|
|
this.videoFileMapper = videoFileMapper;
|
|
this.videoFileMapper = videoFileMapper;
|
|
|
- this.videoErrorMapper = videoErrorMapper;
|
|
|
|
|
this.videoStatisticMapper = videoStatisticMapper;
|
|
this.videoStatisticMapper = videoStatisticMapper;
|
|
|
- this.adminUsers = Set.of(10001L, 10002L);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void thumbVideo(String videoId) {
|
|
public void thumbVideo(String videoId) {
|
|
|
- //videoStatisticMapper.updateIncrView(videoId);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public Result errorReport(VideoErrorReport videoErrorReport) {
|
|
|
|
|
- long loginUser = UserContext.getUser();
|
|
|
|
|
- if (!adminUsers.contains(loginUser)) {
|
|
|
|
|
- return Result.fail("no permission");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- String videoId = videoErrorReport.getVideoId();
|
|
|
|
|
- int errCode = videoErrorReport.getErrorCode();
|
|
|
|
|
- VideoErrorType errorType = VideoErrorType.getDescByCode(errCode);
|
|
|
|
|
- int videoStatus;
|
|
|
|
|
- switch (errorType) {
|
|
|
|
|
- case noCover:
|
|
|
|
|
- case noAudio:
|
|
|
|
|
- case noVideo:
|
|
|
|
|
- videoStatus = VideoStatus.needRepair.getCode();
|
|
|
|
|
- break;
|
|
|
|
|
- case noResource:
|
|
|
|
|
- videoStatus = VideoStatus.revoke.getCode();
|
|
|
|
|
- break;
|
|
|
|
|
- case hasAd:
|
|
|
|
|
- videoStatus = VideoStatus.hasAd.getCode();
|
|
|
|
|
- break;
|
|
|
|
|
- case needRestore:
|
|
|
|
|
- videoStatus = VideoStatus.needRestore.getCode();
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- return Result.fail("unknown errorType");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- videoPostMapper.updateVideoStatus(videoId, videoStatus);
|
|
|
|
|
- if (videoStatus != VideoStatus.revoke.getCode() || videoStatus != VideoStatus.needRestore.getCode()) {
|
|
|
|
|
- VideoError videoError = new VideoError(videoErrorReport);
|
|
|
|
|
- videoErrorMapper.save(videoError);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return Result.success();
|
|
|
|
|
|
|
+ videoStatisticMapper.updateIncrView(videoId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public String getShareLink(String videoId) {
|
|
public String getShareLink(String videoId) {
|
|
@@ -112,9 +63,4 @@ public class VideoService {
|
|
|
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- public void editVideo(VideoEdit videoEdit) {
|
|
|
|
|
- long newUserId = videoEdit.getNewUserId();
|
|
|
|
|
- videoPostMapper.updateVideoUser(newUserId, videoEdit.getVideoIds());
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|