|
@@ -406,10 +406,11 @@ public class ContentServiceImpl implements ContentService {
|
|
|
* 没有转码文件使用原文件,原文件被冻结/冷归档/深度冷归档,则需要解冻
|
|
|
* 没有原文件则失败
|
|
|
*
|
|
|
- * @param videoId
|
|
|
- * @return
|
|
|
+ * @param videoId 视频ID
|
|
|
+ * @return 视频URL,如果视频不存在或正在解冻则返回null
|
|
|
*/
|
|
|
- private String getVideoUrl(Long videoId) {
|
|
|
+ @Override
|
|
|
+ public String getVideoUrl(Long videoId) {
|
|
|
//获取多码率
|
|
|
String videoUrl = null;
|
|
|
boolean isM3u8 = false;
|
|
@@ -431,7 +432,7 @@ public class ContentServiceImpl implements ContentService {
|
|
|
if (Objects.isNull(videoUrl) && !isM3u8) {
|
|
|
WxVideo wxVideo = wxVideoMapper.selectByPrimaryKey(videoId);
|
|
|
if (Objects.isNull(wxVideo)) {
|
|
|
- XxlJobLogger.log("table = {} videoId = {} wxVideo is null", topReturnTable, videoId);
|
|
|
+ log.error("videoId = {} wxVideo is null", videoId);
|
|
|
return null;
|
|
|
}
|
|
|
String transedVideoPath = wxVideo.getTransedVideoPath();
|
|
@@ -459,22 +460,15 @@ public class ContentServiceImpl implements ContentService {
|
|
|
}
|
|
|
//解冻
|
|
|
aliyunOssManager.restoreObject(TRANSCODE_BUCKET, transedVideoPath, EXPIRE_DAYS);
|
|
|
-// Map<String, Object> messageMap = new HashMap<>();
|
|
|
-// messageMap.put("videoId", videoId);
|
|
|
+ // 发送延迟消息
|
|
|
VideoUnderstandingMessageDTO messageDTO = new VideoUnderstandingMessageDTO();
|
|
|
messageDTO.setVideoId(videoId);
|
|
|
- Duration duration;
|
|
|
- if (isCodeArchive) {
|
|
|
- duration = Duration.ofHours(1);
|
|
|
- } else {
|
|
|
- duration = Duration.ofHours(12);
|
|
|
- }
|
|
|
-
|
|
|
+ Duration duration = isCodeArchive ? Duration.ofHours(1) : Duration.ofHours(12);
|
|
|
try {
|
|
|
MessageId messageId = oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageDTO, duration);
|
|
|
log.info("syncSendDelayMessage messageId = {}", messageId);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("syncSendDelayMessage error messageDTO = {}", e, messageDTO);
|
|
|
+ log.error("syncSendDelayMessage error messageDTO = {}", messageDTO, e);
|
|
|
}
|
|
|
return null;
|
|
|
} else {
|
|
@@ -488,7 +482,7 @@ public class ContentServiceImpl implements ContentService {
|
|
|
if (Objects.isNull(videoUrl)) {
|
|
|
WxVideo wxVideo = wxVideoMapper.selectByPrimaryKey(videoId);
|
|
|
if (Objects.isNull(wxVideo)) {
|
|
|
- XxlJobLogger.log("table = {} videoId = {} wxVideo is null", topReturnTable, videoId);
|
|
|
+ log.error("videoId = {} wxVideo is null", videoId);
|
|
|
return null;
|
|
|
}
|
|
|
String videoPath = wxVideo.getVideoPath();
|
|
@@ -497,7 +491,7 @@ public class ContentServiceImpl implements ContentService {
|
|
|
if (Objects.nonNull(objectMetadata)) {
|
|
|
videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, videoPath);
|
|
|
boolean isCodeArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
- boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
+ boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.DeepColdArchive);
|
|
|
if (isCodeArchive || isDeepColdArchive) {
|
|
|
try {
|
|
|
//throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
@@ -513,20 +507,15 @@ public class ContentServiceImpl implements ContentService {
|
|
|
}
|
|
|
//解冻
|
|
|
aliyunOssManager.restoreObject(TRANSCODE_BUCKET, videoPath, EXPIRE_DAYS);
|
|
|
-// Map<String, Object> messageMap = new HashMap<>();
|
|
|
-// messageMap.put("videoId", videoId);
|
|
|
+ // 发送延迟消息
|
|
|
VideoUnderstandingMessageDTO messageDTO = new VideoUnderstandingMessageDTO();
|
|
|
messageDTO.setVideoId(videoId);
|
|
|
- Duration duration;
|
|
|
- if (isCodeArchive) {
|
|
|
- duration = Duration.ofHours(1);
|
|
|
- } else {
|
|
|
- duration = Duration.ofHours(12);
|
|
|
- }
|
|
|
+ Duration duration = isCodeArchive ? Duration.ofHours(1) : Duration.ofHours(12);
|
|
|
try {
|
|
|
- oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageDTO, duration);
|
|
|
+ MessageId messageId = oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageDTO, duration);
|
|
|
+ log.info("syncSendDelayMessage messageId = {}", messageId);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("syncSendDelayMessage error messageDTO = {}", e, messageDTO);
|
|
|
+ log.error("syncSendDelayMessage error messageDTO = {}", messageDTO, e);
|
|
|
}
|
|
|
return null;
|
|
|
} else {
|