update 更新系统用户信息

This commit is contained in:
2023-09-14 14:03:52 +08:00
parent b0423041d1
commit fcbfff7d52

View File

@@ -1,16 +1,6 @@
package com.jsowell.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.config.JsowellConfig;
import com.jsowell.common.constant.UserConstants;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
@@ -19,10 +9,12 @@ import com.jsowell.common.core.domain.model.LoginUser;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.file.FileUploadUtils;
import com.jsowell.common.util.file.MimeTypeUtils;
import com.jsowell.common.util.file.AliyunOssUploadUtils;
import com.jsowell.framework.web.service.TokenService;
import com.jsowell.system.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* 个人信息 业务处理
@@ -116,7 +108,8 @@ public class SysProfileController extends BaseController {
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception {
if (!file.isEmpty()) {
LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(JsowellConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
// String avatar = FileUploadUtils.upload(JsowellConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
String avatar = AliyunOssUploadUtils.uploadFile(file);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);