From d6ad3a50633ad81c97781062067a181e34a5c7a4 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: Mon, 8 Jun 2026 09:28:58 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=BB=BA=E8=AE=AE=E7=BB=A7=E7=BB=AD=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/api/RemoteFileService.java | 8 ---- .../resource/api/RemoteFileServiceMock.java | 12 ------ .../resource/dubbo/RemoteFileServiceImpl.java | 37 ------------------- 3 files changed, 57 deletions(-) diff --git a/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileService.java b/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileService.java index 2204de622..e2caa8c45 100644 --- a/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileService.java +++ b/ruoyi-api/ruoyi-api-resource/src/main/java/org/dromara/resource/api/RemoteFileService.java @@ -12,14 +12,6 @@ import java.util.List; */ public interface RemoteFileService { - /** - * 上传文件 - * - * @param file 文件信息 - * @return 结果 - */ - RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) throws ServiceException; - /** * 通过ossId查询对应的url * 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 index 5ce7c5a0b..95852e01c 100644 --- 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 @@ -14,18 +14,6 @@ import java.util.List; @Slf4j public class RemoteFileServiceMock implements RemoteFileService { - /** - * 上传文件 - * - * @param file 文件信息 - * @return 结果 - */ - @Override - public RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) { - log.warn("服务调用异常 -> 降级处理"); - return null; - } - /** * 通过ossId查询对应的url * diff --git a/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java b/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java index 3265b39f0..5c57ab46e 100644 --- a/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java +++ b/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java @@ -35,43 +35,6 @@ public class RemoteFileServiceImpl implements RemoteFileService { private final ISysOssService sysOssService; - /** - * 文件上传请求 - */ - @Transactional(rollbackFor = Exception.class) - @Override - public RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) throws ServiceException { - try { - String suffix = StringUtils.substring(originalFilename, originalFilename.lastIndexOf("."), originalFilename.length()); - OssClient instance = OssFactory.instance(); - String pathKey = instance.buildPathKey(originalFilename); - PutObjectResult result = instance.upload(pathKey, file); - // 保存文件信息 - SysOssBo oss = new SysOssBo(); - oss.setUrl(result.url()); - oss.setFileSuffix(suffix); - oss.setFileName(result.key()); - oss.setOriginalName(originalFilename); - oss.setService(instance.clientId()); - SysOssExt ext1 = new SysOssExt(); - ext1.setFileSize((long) file.length); - String extStr = JsonUtils.toJsonString(ext1); - oss.setExt1(extStr); - sysOssService.insertByBo(oss); - RemoteFile sysFile = new RemoteFile(); - sysFile.setOssId(oss.getOssId()); - sysFile.setName(result.key()); - sysFile.setUrl(result.url()); - sysFile.setOriginalName(originalFilename); - sysFile.setFileSuffix(suffix); - sysFile.setExt1(extStr); - return sysFile; - } catch (Exception e) { - log.error("上传文件失败", e); - throw new ServiceException("上传文件失败"); - } - } - /** * 通过ossId查询对应的url *