From 695cb6d76b838b1e4cb161bae335faa948dca12a Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 27 十月 2021 13:16:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into satoken

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java |  164 ++++++++++++++++++++++++++----------------------------
 1 files changed, 80 insertions(+), 84 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 4acc311..24c1588 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
@@ -38,8 +38,6 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotEmpty;
 import java.io.IOException;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
@@ -56,92 +54,90 @@
 @RequestMapping("/system/oss")
 public class SysOssController extends BaseController {
 
-	private final ISysOssService iSysOssService;
-	private final ISysConfigService iSysConfigService;
+    private final ISysOssService iSysOssService;
+    private final ISysConfigService iSysConfigService;
 
-	/**
-	 * 鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃
-	 */
-	@ApiOperation("鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃")
-	@SaCheckPermission("system:oss:list")
-	@GetMapping("/list")
-	public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) {
-		return iSysOssService.queryPageList(bo);
-	}
+    /**
+     * 鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃
+     */
+    @ApiOperation("鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃")
+    @SaCheckPermission("system:oss:list")
+    @GetMapping("/list")
+    public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) {
+        return iSysOssService.queryPageList(bo);
+    }
 
-	/**
-	 * 涓婁紶OSS瀵硅薄瀛樺偍
-	 */
-	@ApiOperation("涓婁紶OSS瀵硅薄瀛樺偍")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true),
-	})
-	@SaCheckPermission("system:oss:upload")
-	@Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.INSERT)
-	@RepeatSubmit
-	@PostMapping("/upload")
-	public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
-		if (ObjectUtil.isNull(file)) {
-			throw new ServiceException("涓婁紶鏂囦欢涓嶈兘涓虹┖");
-		}
-		SysOss oss = iSysOssService.upload(file);
-		Map<String, String> map = new HashMap<>(2);
-		map.put("url", oss.getUrl());
-		map.put("fileName", oss.getFileName());
-		return AjaxResult.success(map);
-	}
+    /**
+     * 涓婁紶OSS瀵硅薄瀛樺偍
+     */
+    @ApiOperation("涓婁紶OSS瀵硅薄瀛樺偍")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true),
+    })
+    @SaCheckPermission("system:oss:upload")
+    @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.INSERT)
+    @RepeatSubmit
+    @PostMapping("/upload")
+    public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
+        if (ObjectUtil.isNull(file)) {
+            throw new ServiceException("涓婁紶鏂囦欢涓嶈兘涓虹┖");
+        }
+        SysOss oss = iSysOssService.upload(file);
+        Map<String, String> map = new HashMap<>(2);
+        map.put("url", oss.getUrl());
+        map.put("fileName", oss.getFileName());
+        return AjaxResult.success(map);
+    }
 
-	@ApiOperation("涓嬭浇OSS瀵硅薄瀛樺偍")
-	@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();
-		response.addHeader("Access-Control-Allow-Origin", "*");
-		response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
-		FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(sysOss.getOriginalName(), StandardCharsets.UTF_8.toString()));
-		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));
-	}
+    @ApiOperation("涓嬭浇OSS瀵硅薄瀛樺偍")
+    @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));
+    }
 
-	/**
-	 * 鍒犻櫎OSS瀵硅薄瀛樺偍
-	 */
-	@ApiOperation("鍒犻櫎OSS瀵硅薄瀛樺偍")
-	@SaCheckPermission("system:oss:remove")
-	@Log(title = "OSS瀵硅薄瀛樺偍" , businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ossIds}")
-	public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
-								   @PathVariable Long[] ossIds) {
-		return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
-	}
+    /**
+     * 鍒犻櫎OSS瀵硅薄瀛樺偍
+     */
+    @ApiOperation("鍒犻櫎OSS瀵硅薄瀛樺偍")
+    @SaCheckPermission("system:oss:remove")
+    @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ossIds}")
+    public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
+                                   @PathVariable Long[] ossIds) {
+        return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
+    }
 
-	/**
-	 * 鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵��
-	 */
-	@ApiOperation("鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵��")
-	@SaCheckPermission("system:oss:edit")
-	@Log(title = "OSS瀵硅薄瀛樺偍" , businessType = BusinessType.UPDATE)
-	@PutMapping("/changePreviewListResource")
-	public AjaxResult<Void> changePreviewListResource(@RequestBody String body) {
-		Map<String, Boolean> map = JsonUtils.parseMap(body);
-		SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
-			.eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY));
-		config.setConfigValue(map.get("previewListResource").toString());
-		return toAjax(iSysConfigService.updateConfig(config));
-	}
+    /**
+     * 鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵��
+     */
+    @ApiOperation("鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵��")
+    @SaCheckPermission("system:oss:edit")
+    @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.UPDATE)
+    @PutMapping("/changePreviewListResource")
+    public AjaxResult<Void> changePreviewListResource(@RequestBody String body) {
+        Map<String, Boolean> map = JsonUtils.parseMap(body);
+        SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
+                .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY));
+        config.setConfigValue(map.get("previewListResource").toString());
+        return toAjax(iSysConfigService.updateConfig(config));
+    }
 
 }

--
Gitblit v1.9.3