修改了配置文件的redis配置信息,修改了用户完善信息的功能模块。

This commit is contained in:
XinYi Song 2021-12-23 17:24:14 +08:00
parent 00c896d274
commit d07c2dc84d
4 changed files with 13 additions and 16 deletions

View File

@ -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());
}
/**

View File

@ -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;
/**
* 启用

View File

@ -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);
}

View File

@ -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