|
@@ -444,42 +444,46 @@ public class ContentServiceImpl implements ContentService {
|
|
|
return null;
|
|
|
}
|
|
|
String transedVideoPath = wxVideo.getTransedVideoPath();
|
|
|
- ObjectMetadata objectMetadata = aliyunOssManager.getObjectMetadata(TRANSCODE_BUCKET, transedVideoPath);
|
|
|
- if (Objects.nonNull(objectMetadata)) {
|
|
|
- boolean isCodeArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
- boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
- if (isCodeArchive || isDeepColdArchive) {
|
|
|
- try {
|
|
|
- //throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
|
- if (objectMetadata.isRestoreCompleted()) {
|
|
|
- //解冻完成
|
|
|
- videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, transedVideoPath);
|
|
|
+ if (Objects.nonNull(transedVideoPath) && !transedVideoPath.isEmpty()) {
|
|
|
+ ObjectMetadata objectMetadata = aliyunOssManager.getObjectMetadata(TRANSCODE_BUCKET, transedVideoPath);
|
|
|
+ if (Objects.nonNull(objectMetadata)) {
|
|
|
+ videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, transedVideoPath);
|
|
|
+ boolean isCodeArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
+ boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.DeepColdArchive);
|
|
|
+ if (isCodeArchive || isDeepColdArchive) {
|
|
|
+ try {
|
|
|
+ //throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
|
+ if (objectMetadata.isRestoreCompleted()) {
|
|
|
+ //解冻完成
|
|
|
+ return videoUrl;
|
|
|
+ } else {
|
|
|
+ //解冻中
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ //未开始解冻
|
|
|
+ log.error("{} {} not restoreObject", videoId, videoUrl);
|
|
|
+ }
|
|
|
+ //解冻
|
|
|
+ aliyunOssManager.restoreObject(TRANSCODE_BUCKET, transedVideoPath, EXPIRE_DAYS);
|
|
|
+ Map<String, Object> messageMap = new HashMap<>();
|
|
|
+ messageMap.put("videoId", videoId);
|
|
|
+ Duration duration;
|
|
|
+ if (isCodeArchive) {
|
|
|
+ duration = Duration.ofHours(1);
|
|
|
} else {
|
|
|
- //解冻中
|
|
|
- return null;
|
|
|
+ duration = Duration.ofHours(12);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("{} {} not restoreObject", videoId, videoUrl);
|
|
|
- }
|
|
|
- //解冻
|
|
|
- aliyunOssManager.restoreObject(TRANSCODE_BUCKET, transedVideoPath, EXPIRE_DAYS);
|
|
|
- Map<String, Object> messageMap = new HashMap<>();
|
|
|
- messageMap.put("videoId", videoId);
|
|
|
- Duration duration;
|
|
|
- if (isCodeArchive) {
|
|
|
- duration = Duration.ofHours(1);
|
|
|
+ try {
|
|
|
+ MessageId messageId = oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageMap, duration);
|
|
|
+ log.info("syncSendDelayMessage messageId = {}", messageId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("syncSendDelayMessage error messageMap = {}", e, messageMap);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
} else {
|
|
|
- duration = Duration.ofHours(12);
|
|
|
- }
|
|
|
- try {
|
|
|
- MessageId messageId = oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageMap, duration);
|
|
|
- log.info("syncSendDelayMessage messageId = {}", messageId);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("syncSendDelayMessage error messageMap = {}", e, messageMap);
|
|
|
+ return videoUrl;
|
|
|
}
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, transedVideoPath);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -491,41 +495,44 @@ public class ContentServiceImpl implements ContentService {
|
|
|
return null;
|
|
|
}
|
|
|
String videoPath = wxVideo.getVideoPath();
|
|
|
- ObjectMetadata objectMetadata = aliyunOssManager.getObjectMetadata(TRANSCODE_BUCKET, videoPath);
|
|
|
- if (Objects.nonNull(objectMetadata)) {
|
|
|
- boolean isCodeArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
- boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
- if (isCodeArchive || isDeepColdArchive) {
|
|
|
- try {
|
|
|
- //throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
|
- if (objectMetadata.isRestoreCompleted()) {
|
|
|
- //解冻完成
|
|
|
- videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, videoPath);
|
|
|
+ if (Objects.nonNull(videoPath) && !videoPath.isEmpty()) {
|
|
|
+ ObjectMetadata objectMetadata = aliyunOssManager.getObjectMetadata(TRANSCODE_BUCKET, videoPath);
|
|
|
+ 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);
|
|
|
+ if (isCodeArchive || isDeepColdArchive) {
|
|
|
+ try {
|
|
|
+ //throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
|
+ if (objectMetadata.isRestoreCompleted()) {
|
|
|
+ //解冻完成
|
|
|
+ return videoUrl;
|
|
|
+ } else {
|
|
|
+ //解冻中
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("{} {} not restoreObject", videoId, videoUrl);
|
|
|
+ }
|
|
|
+ //解冻
|
|
|
+ aliyunOssManager.restoreObject(TRANSCODE_BUCKET, videoPath, EXPIRE_DAYS);
|
|
|
+ Map<String, Object> messageMap = new HashMap<>();
|
|
|
+ messageMap.put("videoId", videoId);
|
|
|
+ Duration duration;
|
|
|
+ if (isCodeArchive) {
|
|
|
+ duration = Duration.ofHours(1);
|
|
|
} else {
|
|
|
- //解冻中
|
|
|
- return null;
|
|
|
+ duration = Duration.ofHours(12);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("{} {} not restoreObject", videoId, videoUrl);
|
|
|
- }
|
|
|
- //解冻
|
|
|
- aliyunOssManager.restoreObject(TRANSCODE_BUCKET, videoPath, EXPIRE_DAYS);
|
|
|
- Map<String, Object> messageMap = new HashMap<>();
|
|
|
- messageMap.put("videoId", videoId);
|
|
|
- Duration duration;
|
|
|
- if (isCodeArchive) {
|
|
|
- duration = Duration.ofHours(1);
|
|
|
+ try {
|
|
|
+ oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageMap, duration);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("syncSendDelayMessage error messageMap = {}", e, messageMap);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
} else {
|
|
|
- duration = Duration.ofHours(12);
|
|
|
- }
|
|
|
- try {
|
|
|
- oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageMap, duration);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("syncSendDelayMessage error messageMap = {}", e, messageMap);
|
|
|
+ return videoUrl;
|
|
|
}
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, videoPath);
|
|
|
}
|
|
|
}
|
|
|
}
|