From 4a063ec3432fd66ee3b8e70cf60434b3916cc3a0 Mon Sep 17 00:00:00 2001 From: fanxb Date: Sun, 8 Sep 2019 19:39:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Refactor:=20[=E5=90=8E=E5=8F=B0]?= =?UTF-8?q?:=E5=BC=80=E5=A7=8B=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/user/controller/UserController.java | 12 ++++++++++++ .../bookmark/business/user/service/UserService.java | 10 ++++++++++ bookMarkService/pom.xml | 2 +- .../web/src/main/resources/application.yml | 3 +++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java index 6a5d98b..c35282d 100644 --- a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java +++ b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java @@ -8,6 +8,7 @@ import com.fanxb.bookmark.common.util.UserContextHolder; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; /** * 类功能简述: @@ -63,6 +64,17 @@ public class UserController { return Result.success(userService.getUserInfo(UserContextHolder.get().getUserId())); } + + /** + * 修改用户头像 + * + * @param file 头像文件 + */ + @PostMapping("/icon") + public Result pushIcon(@RequestParam("file") MultipartFile file) { + return Result.success(userService.updateIcon(file)); + } + /** * Description: 用户登录 * diff --git a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java index be84311..24359f5 100644 --- a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java +++ b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java @@ -11,6 +11,7 @@ import com.fanxb.bookmark.common.exception.FormDataException; import com.fanxb.bookmark.common.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import java.util.HashMap; import java.util.Map; @@ -155,4 +156,13 @@ public class UserService { public User getUserInfo(int userId) { return userDao.selectByUserId(userId); } + + /** + * 修改用户头像 + * @param file file + * @return 修改后的路径 + */ + public String updateIcon(MultipartFile file){ + return "asdf"; + } } diff --git a/bookMarkService/pom.xml b/bookMarkService/pom.xml index 73ef8bc..01671fe 100644 --- a/bookMarkService/pom.xml +++ b/bookMarkService/pom.xml @@ -1 +1 @@ - 4.0.0 com.fanxb bookMarkService pom 1.0-SNAPSHOT common business web utf-8 utf-8 11 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE org.elasticsearch.client elasticsearch-rest-high-level-client 7.2.0 org.elasticsearch elasticsearch 7.2.0 org.elasticsearch.client elasticsearch-rest-client 7.2.0 org.springframework.boot spring-boot-starter-web \ No newline at end of file + 4.0.0 com.fanxb bookMarkService pom 1.0-SNAPSHOT common business web utf-8 utf-8 8 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE org.elasticsearch.client elasticsearch-rest-high-level-client 7.2.0 org.elasticsearch elasticsearch 7.2.0 org.elasticsearch.client elasticsearch-rest-client 7.2.0 org.springframework.boot spring-boot-starter-web \ No newline at end of file diff --git a/bookMarkService/web/src/main/resources/application.yml b/bookMarkService/web/src/main/resources/application.yml index e74b703..e87e17e 100644 --- a/bookMarkService/web/src/main/resources/application.yml +++ b/bookMarkService/web/src/main/resources/application.yml @@ -66,3 +66,6 @@ es: host: localhost port: 9200 scheme: http + +# 默认文件上传基路径 +fileSavePath: ./