增加用户修改自己头像和昵称
This commit is contained in:
@@ -7,7 +7,7 @@ import cn.iocoder.mall.user.service.api.MobileCodeService;
|
||||
import cn.iocoder.mall.user.service.api.OAuth2Service;
|
||||
import cn.iocoder.mall.user.service.api.UserService;
|
||||
import cn.iocoder.mall.user.service.api.bo.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.user.application.vo.MobileRegisterVO;
|
||||
import cn.iocoder.mall.user.application.vo.users.MobileRegisterVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("user/passport")
|
||||
@RequestMapping("users/passport")
|
||||
@Api("Passport 模块")
|
||||
public class PassportController {
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package cn.iocoder.mall.user.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.application.convert.UserConvert;
|
||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.user.application.vo.UsersUserVO;
|
||||
import cn.iocoder.mall.user.application.vo.users.UsersUserVO;
|
||||
import cn.iocoder.mall.user.service.api.UserService;
|
||||
import cn.iocoder.mall.user.service.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.service.api.dto.UserUpdateDTO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -15,15 +17,14 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Api("用户模块")
|
||||
public class UserController {
|
||||
|
||||
@Reference
|
||||
@Reference(validation = "true")
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/info")
|
||||
@ApiOperation(value = "用户信息")
|
||||
public CommonResult<UsersUserVO> info() {
|
||||
// TODO 芋艿,正在实现中
|
||||
UsersUserVO user = new UsersUserVO().setId(UserSecurityContextHolder.getContext().getUserId());
|
||||
return CommonResult.success(user);
|
||||
CommonResult<UserBO> userResult = userService.getUser(UserSecurityContextHolder.getContext().getUserId());
|
||||
return UserConvert.INSTANCE.convert2(userResult);
|
||||
}
|
||||
|
||||
@PostMapping("/update_avatar")
|
||||
|
||||
@@ -2,7 +2,7 @@ package cn.iocoder.mall.user.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.service.api.bo.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.user.application.vo.MobileRegisterVO;
|
||||
import cn.iocoder.mall.user.application.vo.users.MobileRegisterVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -2,6 +2,8 @@ package cn.iocoder.mall.user.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.application.vo.admins.AdminsUserPageVO;
|
||||
import cn.iocoder.mall.user.application.vo.users.UsersUserVO;
|
||||
import cn.iocoder.mall.user.service.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.service.api.bo.UserPageBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
@@ -15,4 +17,7 @@ public interface UserConvert {
|
||||
@Mappings({})
|
||||
CommonResult<AdminsUserPageVO> convert(CommonResult<UserPageBO> result);
|
||||
|
||||
}
|
||||
@Mappings({})
|
||||
CommonResult<UsersUserVO> convert2(CommonResult<UserBO> result);
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package cn.iocoder.mall.user.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("用户信息 VO")
|
||||
public class UsersUserVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "123")
|
||||
private Integer id;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UsersUserVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.user.application.vo;
|
||||
package cn.iocoder.mall.user.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.user.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("用户信息 VO")
|
||||
public class UsersUserVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "123")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
private String mobile;
|
||||
@ApiModelProperty(value = "昵称", required = true, example = "小王")
|
||||
private String nickname;
|
||||
@ApiModelProperty(value = "头像", required = true, example = "http://www.iocoder.cn/xxx.jpg")
|
||||
private String avatar;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UsersUserVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public UsersUserVO setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public UsersUserVO setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public UsersUserVO setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user