|
|
|
@ -1,15 +1,8 @@ |
|
|
|
package com.bnyer.file.controller; |
|
|
|
|
|
|
|
import com.bnyer.common.core.domain.R; |
|
|
|
import com.bnyer.common.core.utils.file.FileUtils; |
|
|
|
import com.bnyer.common.core.web.domain.AjaxResult; |
|
|
|
import com.bnyer.file.service.ISysFileService; |
|
|
|
import com.bnyer.file.service.MinioService; |
|
|
|
import com.bnyer.file.utils.FileUploadUtils; |
|
|
|
import com.bnyer.system.api.domain.SysFile; |
|
|
|
import org.apache.tomcat.jni.FileInfo; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
@ -18,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -28,10 +20,9 @@ import java.util.List; |
|
|
|
* @author ruoyi |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@Slf4j |
|
|
|
public class SysFileController |
|
|
|
{ |
|
|
|
private static final Logger log = LoggerFactory.getLogger(SysFileController.class); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MinioService minioService; |
|
|
|
|
|
|
|
@ -65,6 +56,7 @@ public class SysFileController |
|
|
|
try{ |
|
|
|
url = minioService.uploadFile(file); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("文件上传失败,原因为:【{}】",e.getMessage()); |
|
|
|
return R.fail("文件上传失败!"); |
|
|
|
} |
|
|
|
return R.ok(url); |
|
|
|
@ -84,6 +76,7 @@ public class SysFileController |
|
|
|
try{ |
|
|
|
url = minioService.uploadBanner(file); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("文件上传失败,原因为:【{}】",e.getMessage()); |
|
|
|
return R.fail("banner上传失败!"); |
|
|
|
} |
|
|
|
return R.ok(url); |
|
|
|
|