From 6557baac627dce769c2b05ab482e4daf262a88ac Mon Sep 17 00:00:00 2001
From: houruijun <411269194@kidgrow.com>
Date: Wed, 17 Jun 2020 17:34:01 +0800
Subject: [PATCH] 1.增加工具类 MultipartFileUtils ,支持将MultipartFile类型转换为file类型 2.增加缩略图相关全局配置变量:宽高和生成缩略图的暂存目录(缩略图上传成功后会删除) 3.修改文件上传中心的上传代码,将生成目录和aliyun上传方法抽离独立 4.增加医院logo上传支持接口(可返回缩略图地址) 5.修改登录后回去用户信息不完整bug

---
 kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java b/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java
index fce1698..0fdd274 100644
--- a/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java
+++ b/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java
@@ -4,6 +4,7 @@
 import com.kidgrow.common.model.Result;
 import com.kidgrow.filecenter.model.FileInfo;
 import com.kidgrow.filecenter.service.IFileService;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -31,11 +32,36 @@
      * @return
      * @throws Exception
      */
-    @PostMapping("/files-anon")
+    @PostMapping(value="/files-anon",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     public FileInfo upload(@RequestParam("file") MultipartFile file) throws Exception {
         return fileService.upload(file);
     }
 
+
+    /**
+     * 文件上传
+     * 根据fileType选择上传方式
+     *
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value="/files-upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) throws Exception {
+        return fileService.upload(file,imgType);
+    }
+    /**
+     * 文件上传 返回带缩略图地址的对象,缩略图在path字段
+     *
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value="/files-thupload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public FileInfo thUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) throws Exception {
+        return fileService.uploadForThumbnails(file,imgType);
+    }
+
     /**
      * 文件删除
      *

--
Gitblit v1.8.0