mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 优化OSS异常判断
This commit is contained in:
		@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.convert.Convert;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import cn.hutool.http.HttpUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
@@ -78,7 +79,7 @@ public class SysOssController extends BaseController {
 | 
			
		||||
	@RepeatSubmit
 | 
			
		||||
	@PostMapping("/upload")
 | 
			
		||||
	public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
 | 
			
		||||
		if (file.isEmpty()) {
 | 
			
		||||
		if (ObjectUtil.isNull(file)) {
 | 
			
		||||
			throw new ServiceException("上传文件不能为空");
 | 
			
		||||
		}
 | 
			
		||||
		SysOss oss = iSysOssService.upload(file);
 | 
			
		||||
@@ -93,7 +94,7 @@ public class SysOssController extends BaseController {
 | 
			
		||||
	@GetMapping("/download/{ossId}")
 | 
			
		||||
	public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
 | 
			
		||||
		SysOss sysOss = iSysOssService.getById(ossId);
 | 
			
		||||
		if (sysOss == null) {
 | 
			
		||||
		if (ObjectUtil.isNull(sysOss)) {
 | 
			
		||||
			throw new ServiceException("文件数据不存在!");
 | 
			
		||||
		}
 | 
			
		||||
		response.reset();
 | 
			
		||||
 
 | 
			
		||||
@@ -42,9 +42,11 @@ export function downLoadExcel(url, params) {
 | 
			
		||||
      if (value !== null && typeof(value) !== "undefined") {
 | 
			
		||||
        if (typeof value === 'object') {
 | 
			
		||||
          for (const key of Object.keys(value)) {
 | 
			
		||||
            let params = propName + '[' + key + ']';
 | 
			
		||||
            var subPart = encodeURIComponent(params) + "=";
 | 
			
		||||
            urlparams += subPart + encodeURIComponent(value[key]) + "&";
 | 
			
		||||
            if (value[key] !== null && typeof (value[key]) !== 'undefined') {
 | 
			
		||||
              let params = propName + '[' + key + ']';
 | 
			
		||||
              let subPart = encodeURIComponent(params) + "="
 | 
			
		||||
              urlparams += subPart + encodeURIComponent(value[key]) + "&";
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          urlparams += part + encodeURIComponent(value) + "&";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user