From 56050aa6501f3d9d2f79a2c40a28815878ac56ee Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 24 十一月 2022 15:14:47 +0800 Subject: [PATCH] update 同步 ruoyi 相关提交 * fix 修复Log注解GET请求记录不到参数问题 * fix 修复某些特性的环境生成代码变乱码TXT文件问题 * update 消除Vue3控制台出现的警告信息 * fix 开启TopNav没有子菜单隐藏侧边栏 * fix 修复回显数据字典数组异常问题(I60UYQ) * update 忽略不必要的属性数据返回 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java | 27 +++++---------------------- 1 files changed, 5 insertions(+), 22 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java index 85faa16..606895a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java @@ -15,11 +15,12 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.oss.core.OssClient; +import com.ruoyi.oss.factory.OssFactory; import com.ruoyi.system.domain.SysOss; import com.ruoyi.system.domain.bo.SysOssBo; import com.ruoyi.system.domain.vo.SysOssVo; import com.ruoyi.system.service.ISysOssService; -import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; @@ -40,7 +41,6 @@ * @author Lion Li */ @Validated -@Tag(name = "瀵硅薄瀛樺偍鎺у埗鍣�", description = "瀵硅薄瀛樺偍绠$悊") @RequiredArgsConstructor @RestController @RequestMapping("/system/oss") @@ -82,7 +82,7 @@ if (ObjectUtil.isNull(file)) { throw new ServiceException("涓婁紶鏂囦欢涓嶈兘涓虹┖"); } - SysOss oss = iSysOssService.upload(file); + SysOssVo oss = iSysOssService.upload(file); Map<String, String> map = new HashMap<>(2); map.put("url", oss.getUrl()); map.put("fileName", oss.getOriginalName()); @@ -98,24 +98,7 @@ @SaCheckPermission("system:oss:download") @GetMapping("/download/{ossId}") public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { - SysOss sysOss = iSysOssService.getById(ossId); - if (ObjectUtil.isNull(sysOss)) { - throw new ServiceException("鏂囦欢鏁版嵁涓嶅瓨鍦�!"); - } - response.reset(); - FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); - response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); - long data; - try { - data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false); - } catch (HttpException e) { - if (e.getMessage().contains("403")) { - throw new ServiceException("鏃犺鍙栨潈闄�, 璇峰湪瀵瑰簲鐨凮SS寮�鍚�'鍏湁璇�'鏉冮檺!"); - } else { - throw new ServiceException(e.getMessage()); - } - } - response.setContentLength(Convert.toInt(data)); + iSysOssService.download(ossId,response); } /** @@ -128,7 +111,7 @@ @DeleteMapping("/{ossIds}") public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") @PathVariable Long[] ossIds) { - return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); + return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true)); } } -- Gitblit v1.9.3