mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-04 13:24:07 +08:00
[update]user server模块新增测试,修改部分接口规范问题
This commit is contained in:
@@ -3,9 +3,9 @@ GET {{userServerUrl}}/system/user/profile/get
|
||||
Authorization: Bearer test245
|
||||
|
||||
### 请求 /system/user/profile/revise-nickname 接口 成功
|
||||
PUT http://localhost:28080/api/system/user/profile/update-nickname?nickName=yunai222
|
||||
PUT {{userServerUrl}}/system/user/profile/update-nickname?nickName=yunai222
|
||||
Authorization: Bearer test245
|
||||
|
||||
### 请求 /system/user/profile/get-user-info 接口 成功
|
||||
GET http://localhost:28080/api/system/user/profile/get-user-info?id=245
|
||||
GET {{userServerUrl}}/system/user/profile/get-user-info?id=245
|
||||
Authorization: Bearer test245
|
@@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.userserver.modules.member.controller.user;
|
||||
|
||||
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
|
||||
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
|
||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
@@ -30,13 +30,6 @@ public class SysUserProfileController {
|
||||
@Resource
|
||||
private MbrUserService userService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得登录用户信息")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> profile() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PutMapping("/update-nickname")
|
||||
@ApiOperation("修改用户昵称")
|
||||
@PreAuthenticated
|
||||
@@ -45,21 +38,21 @@ public class SysUserProfileController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/revise-avatar")
|
||||
@PutMapping("/update-avatar")
|
||||
@ApiOperation("修改用户头像")
|
||||
@PreAuthenticated
|
||||
public CommonResult<String> reviseAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
|
||||
public CommonResult<String> updateAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
|
||||
if (file.isEmpty()) {
|
||||
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
|
||||
}
|
||||
String avatar = userService.reviseAvatar(getLoginUserId(), file.getInputStream());
|
||||
String avatar = userService.updateAvatar(getLoginUserId(), file.getInputStream());
|
||||
return success(avatar);
|
||||
}
|
||||
|
||||
@GetMapping("/get-user-info")
|
||||
@ApiOperation("获取用户头像与昵称")
|
||||
@PreAuthenticated
|
||||
public CommonResult<SysUserInfoRespVO> getUserInfo() {
|
||||
public CommonResult<MbrUserInfoRespVO> getUserInfo() {
|
||||
return success(userService.getUserInfo(getLoginUserId()));
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysUserInfoRespVO {
|
||||
public class MbrUserInfoRespVO {
|
||||
|
||||
@ApiModelProperty(value = "用户昵称", required = true, example = "芋艿")
|
||||
private String nickName;
|
@@ -9,9 +9,9 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
*/
|
||||
public interface MbrErrorCodeConstants {
|
||||
|
||||
// ==========用户相关============
|
||||
// ==========用户相关 1004001000============
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
|
||||
|
||||
// ==========文件相关 ===========
|
||||
// ==========文件相关 1004002000 ===========
|
||||
ErrorCode FILE_IS_EMPTY = new ErrorCode(1004002000, "文件为空");
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.userserver.modules.member.service.user;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
|
||||
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
|
||||
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -60,13 +60,13 @@ public interface MbrUserService {
|
||||
* @param inputStream 头像文件
|
||||
* @return 头像url
|
||||
*/
|
||||
String reviseAvatar(Long userId, InputStream inputStream);
|
||||
String updateAvatar(Long userId, InputStream inputStream);
|
||||
|
||||
/**
|
||||
* 根据用户id,获取用户头像与昵称
|
||||
* @param userId 用户id
|
||||
* @return 用户响应实体类
|
||||
*/
|
||||
SysUserInfoRespVO getUserInfo(Long userId);
|
||||
MbrUserInfoRespVO getUserInfo(Long userId);
|
||||
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
|
||||
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
|
||||
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
|
||||
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
|
||||
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
|
||||
@@ -93,7 +93,7 @@ public class MbrUserServiceImpl implements MbrUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String reviseAvatar(Long userId, InputStream avatarFile) {
|
||||
public String updateAvatar(Long userId, InputStream avatarFile) {
|
||||
this.checkUserExists(userId);
|
||||
// 创建文件
|
||||
String avatar = fileCoreService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile));
|
||||
@@ -107,9 +107,9 @@ public class MbrUserServiceImpl implements MbrUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserInfoRespVO getUserInfo(Long userId) {
|
||||
public MbrUserInfoRespVO getUserInfo(Long userId) {
|
||||
MbrUserDO user = this.checkUserExists(userId);
|
||||
SysUserInfoRespVO userResp = new SysUserInfoRespVO();
|
||||
MbrUserInfoRespVO userResp = new MbrUserInfoRespVO();
|
||||
userResp.setNickName(user.getNickname());
|
||||
userResp.setAvatar(user.getAvatar());
|
||||
return userResp;
|
||||
|
Reference in New Issue
Block a user