From 883fa32e2c0fa82e8d89294063a4099d4e3b6458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Fri, 15 Dec 2023 13:46:36 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20oss=20=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=B0=83=E7=94=A8=20=E6=94=AF=E6=8C=81=E9=99=8D?= =?UTF-8?q?=E7=BA=A7=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/api/RemoteFileServiceMock.java | 37 +++++++++++++++++++ .../core/impl/OssUrlTranslationImpl.java | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileServiceMock.java diff --git a/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileServiceMock.java b/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileServiceMock.java new file mode 100644 index 00000000..c689f2d1 --- /dev/null +++ b/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileServiceMock.java @@ -0,0 +1,37 @@ +package org.dromara.resource.api; + +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.resource.api.domain.RemoteFile; + +/** + * 文件服务(降级处理) + * + * @author Lion Li + */ +@Slf4j +public class RemoteFileServiceMock implements RemoteFileService { + + /** + * 上传文件 + * + * @param file 文件信息 + * @return 结果 + */ + public RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) { + log.warn("服务调用异常 -> 降级处理"); + return null; + } + + /** + * 通过ossId查询对应的url + * + * @param ossIds ossId串逗号分隔 + * @return url串逗号分隔 + */ + public String selectUrlByIds(String ossIds) { + log.warn("服务调用异常 -> 降级处理"); + return StringUtils.EMPTY; + } + +} diff --git a/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/OssUrlTranslationImpl.java b/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/OssUrlTranslationImpl.java index 0277ec1b..b9fe8392 100644 --- a/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/OssUrlTranslationImpl.java +++ b/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/OssUrlTranslationImpl.java @@ -16,7 +16,7 @@ import org.apache.dubbo.config.annotation.DubboReference; @TranslationType(type = TransConstant.OSS_ID_TO_URL) public class OssUrlTranslationImpl implements TranslationInterface { - @DubboReference + @DubboReference(mock = "true") private RemoteFileService ossService; @Override