diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index 835010e..a58e580 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -228,14 +228,16 @@ public class SysUserController { /** * 用户完善信息 - * @param files + * @param * @param * @param token * @return */ @PostMapping("/updateUserByUserId") - public String updateUserByUserId(@RequestParam("file") MultipartFile files, String nickName, @RequestHeader(value="Authorization") String token) throws IOException { + public String updateUserByUserId(@RequestBody Map map, @RequestHeader(value="Authorization") String token) throws IOException { Locale locale = LocaleContextHolder.getLocale(); + String avatar = (String) map.get("avatar"); + String nickName = (String) map.get("nickName"); if(nickName != null){ SysUserEntity byNickName = sysUserDao.findByNickName(nickName); if(byNickName != null){ @@ -244,7 +246,7 @@ public class SysUserController { } String tokenUserName = TokenUtil.getTokenUserName(token); SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName); - return sysUserService.updateUserByUserId(files,nickName,sysUserEntity.getId()); + return sysUserService.updateUserByUserId(avatar,nickName,sysUserEntity.getId()); } /** diff --git a/src/main/java/com/xkrs/service/SysUserService.java b/src/main/java/com/xkrs/service/SysUserService.java index be06548..550d754 100644 --- a/src/main/java/com/xkrs/service/SysUserService.java +++ b/src/main/java/com/xkrs/service/SysUserService.java @@ -87,12 +87,12 @@ public interface SysUserService { /** * 用户完善个人信息 - * @param files + * @param * @param * @param userId * @return */ - String updateUserByUserId(MultipartFile files, String nickName, Integer userId) throws IOException; + String updateUserByUserId(String avatar, String nickName, Integer userId) throws IOException; /** * 启用 diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index 19636ed..209f1eb 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -25,6 +25,7 @@ import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.security.crypto.keygen.KeyGenerators; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -234,22 +235,16 @@ public class SysUserServiceImpl implements SysUserService { /** * 用户完善个人信息 - * @param files + * @param * @param * @param userId * @return */ @Transactional(rollbackFor=Exception.class) @Override - public String updateUserByUserId(MultipartFile files, String nickName, Integer userId) throws IOException { + public String updateUserByUserId(String avatar, String nickName, Integer userId) throws IOException { Locale locale = LocaleContextHolder.getLocale(); - if(files == null){ - String uploadAvatar = ""; - sysUserDao.updateUserByUserId(userId,nickName,uploadAvatar); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功!",locale); - } - String memoryPhoto = PhotoUtil.memoryPhoto(files); - sysUserDao.updateUserByUserId(userId,nickName,memoryPhoto); + sysUserDao.updateUserByUserId(userId,nickName,avatar); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功!",locale); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ea1d3ed..b4c7ca5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -45,10 +45,10 @@ spring.jpa.properties.hibernate.order_updates =true ## Redis配置 12 spring.cache.type = redis -spring.redis.database = 12 +spring.redis.database = 8 spring.redis.host = localhost spring.redis.port = 6379 -spring.redis.password=sdust2020 +spring.redis.password=lybABC123 spring.redis.timeout = 10000 spring.redis.lettuce.pool.max-active = 100 spring.redis.lettuce.pool.max-wait = 10000