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