|
|
@@ -6,7 +6,6 @@ import cn.reghao.oss.store.service.ObjectNameService;
|
|
|
import cn.reghao.oss.store.service.SignService;
|
|
|
import cn.reghao.tnb.file.api.dto.media.*;
|
|
|
import cn.reghao.oss.store.task.MediaFileProcessor;
|
|
|
-import cn.reghao.oss.store.util.UserContext;
|
|
|
import cn.reghao.tnb.file.api.iface.MediaService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
@@ -33,40 +32,10 @@ public class MediaServiceImpl implements MediaService {
|
|
|
this.mediaFileProcessor = mediaFileProcessor;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public VideoInfo getVideoInfo(int channelId, String objectId) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- public ImageInfo getImageInfo(int channelId, String objectId) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public List<ConvertedImageInfo> getWebpInfo(int channelId, List<String> objectIds) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- public AudioInfo getAudioInfo(int channelId, String objectId) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public String getSignedUrl(int loginUser, String objectId, int expireSecond) {
|
|
|
- FileMeta fileMeta = objectRepository.getByObjectId(objectId);
|
|
|
- String objectName = fileMeta.getObjectName();
|
|
|
- String url = objectNameService.getObjectUrl(objectName);
|
|
|
- String signedUrl = signService.getSignedUrl(loginUser, url, expireSecond);
|
|
|
- return signedUrl;
|
|
|
- }
|
|
|
-
|
|
|
- public String getSignedUrl(int channelId, String uploadId) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public VideoInfo getVideoInfo(String videoFileId) {
|
|
|
try {
|
|
|
- VideoInfo videoInfo = mediaFileProcessor.getVideoInfo(videoFileId);
|
|
|
+ VideoInfo videoInfo = mediaFileProcessor.getVideoInfo(objectId);
|
|
|
return videoInfo;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -75,34 +44,27 @@ public class MediaServiceImpl implements MediaService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- @Deprecated
|
|
|
- public ImageInfo getImageInfo(String imageFileId) {
|
|
|
+ @Override
|
|
|
+ public ImageInfo getImageInfo(int channelId, String objectId) {
|
|
|
try {
|
|
|
- ImageInfo imageInfo = mediaFileProcessor.getImageInfo(imageFileId);
|
|
|
+ ImageInfo imageInfo = mediaFileProcessor.getImageInfo(objectId);
|
|
|
return imageInfo;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- @Deprecated
|
|
|
- public List<ImageInfo> getImagesInfo(List<String> imageFileIds) {
|
|
|
- return mediaFileProcessor.getImagesInfo(imageFileIds);
|
|
|
- }
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public List<ConvertedImageInfo> getWebpInfo1(int loginUser, List<String> imageFileIds) {
|
|
|
- UserContext userContext = new UserContext(loginUser);
|
|
|
- return mediaFileProcessor.getWebpInfos(imageFileIds);
|
|
|
+ @Override
|
|
|
+ public List<ConvertedImageInfo> getWebpInfo(int channelId, List<String> objectIds) {
|
|
|
+ return mediaFileProcessor.getWebpInfos(objectIds);
|
|
|
}
|
|
|
|
|
|
- @Deprecated
|
|
|
- public AudioInfo getAudioInfo(String audioFileId) {
|
|
|
+ @Override
|
|
|
+ public AudioInfo getAudioInfo(int channelId, String objectId) {
|
|
|
try {
|
|
|
- AudioInfo audioInfo = mediaFileProcessor.getAudioInfo(audioFileId);
|
|
|
+ AudioInfo audioInfo = mediaFileProcessor.getAudioInfo(objectId);
|
|
|
return audioInfo;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -110,4 +72,20 @@ public class MediaServiceImpl implements MediaService {
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getSignedUrl(int channelId, String objectId) {
|
|
|
+ long userId = getUserIdByChannelId(channelId);
|
|
|
+
|
|
|
+ int expireSecond = 3600;
|
|
|
+ FileMeta fileMeta = objectRepository.getByObjectId(objectId);
|
|
|
+ String objectName = fileMeta.getObjectName();
|
|
|
+ String url = objectNameService.getObjectUrl(objectName);
|
|
|
+ String signedUrl = signService.getSignedUrl(userId, url, expireSecond);
|
|
|
+ return signedUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getUserIdByChannelId(int channelId) {
|
|
|
+ return 1L;
|
|
|
+ }
|
|
|
}
|