1.add more info for badge

main
Gary 9 months ago
parent 8748029aeb
commit 94c61c6ecd

@ -0,0 +1,45 @@
package enums;
public enum UserBadgeEnum {
//贡献者 三位数字以1开头
FOUNDER(100, "创始人"),
PRODUCT_MANAGER(101, "产品经理"),
EXPERIENCE_DESIGNER(102, "体验设计师"),
BACKEND(103, "服务端"),
QUALITY_ASSURANCE(104, "测试工程师"),
PROJECT_MANAGER(105, "项目管理"),
ANDROID_FRONTEND(106, "Android前端"),
IOS_FRONTEND(107, "IOS前端"),
PRODUCT_OPERATION(108, "产品运营");
private Integer code;
private String desc;
UserBadgeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static UserBadgeEnum getByCode(Integer code) {
for (UserBadgeEnum item : UserBadgeEnum.values()) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

@ -36,6 +36,7 @@ import constants.Constants;
import controller.BaseController; import controller.BaseController;
import com.luoo.user.dto.UserInfoUpdateDto; import com.luoo.user.dto.UserInfoUpdateDto;
import com.luoo.user.dto.response.UserBadge;
import com.luoo.user.dto.response.UserRespDTO; import com.luoo.user.dto.response.UserRespDTO;
import com.luoo.user.util.IpUtil; import com.luoo.user.util.IpUtil;
@ -48,6 +49,7 @@ import dto.UserLoginDto;
import enums.CollectTypeEnum; import enums.CollectTypeEnum;
import enums.DateTimePatternEnum; import enums.DateTimePatternEnum;
import enums.RequestFrequencyTypeEnum; import enums.RequestFrequencyTypeEnum;
import enums.UserBadgeEnum;
import enums.UserRelationEnum; import enums.UserRelationEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -275,7 +277,7 @@ public class MyController extends BaseController {
UserRespDTO userRespDTO = new UserRespDTO(); UserRespDTO userRespDTO = new UserRespDTO();
BeanUtils.copyProperties(user, userRespDTO); BeanUtils.copyProperties(user, userRespDTO);
if(!StringTools.isEmpty(user.getBadges())) { if(!StringTools.isEmpty(user.getBadges())) {
userRespDTO.setBadgeList(Arrays.stream(user.getBadges().split(",")).map(Integer::valueOf).collect(Collectors.toList())); userRespDTO.setBadgeList(Arrays.stream(user.getBadges().split(",")).map(this::getUserBadge).collect(Collectors.toList()));
} }
if (null != userRespDTO.getAvatar()) { if (null != userRespDTO.getAvatar()) {
userRespDTO.setAvatar(Constants.RESOURCE_PREFIX + userRespDTO.getAvatar()); userRespDTO.setAvatar(Constants.RESOURCE_PREFIX + userRespDTO.getAvatar());
@ -311,7 +313,13 @@ public class MyController extends BaseController {
return userRespDTO; return userRespDTO;
} }
private UserBadge getUserBadge(String code) {
UserBadge userBadge=new UserBadge();
userBadge.setCode(Integer.valueOf(code));
userBadge.setDesc(UserBadgeEnum.getByCode(userBadge.getCode()).getDesc());
return userBadge;
}
// 查询我的获赞 // 查询我的获赞
@ApiOperation(value = "9.查询我的获赞的分页列表", notes = "游客无法获取") @ApiOperation(value = "9.查询我的获赞的分页列表", notes = "游客无法获取")
@GetMapping("/myThumbupList/{page}/{size}") @GetMapping("/myThumbupList/{page}/{size}")

@ -0,0 +1,11 @@
package com.luoo.user.dto.response;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class UserBadge {
private Integer code;
private String desc;
}

@ -17,8 +17,8 @@ public class UserRespDTO {
private String avatar; private String avatar;
@ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”") @ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”")
private String signature; private String signature;
@ApiModelProperty(value = "用户标识,1为贡献者 2为音乐人") @ApiModelProperty(value = "用户标识,贡献者 三位数字以1开头")
private List<Integer> badgeList; private List<UserBadge> badgeList;
@ApiModelProperty(value = "关注数") @ApiModelProperty(value = "关注数")
private int followCount; private int followCount;
@ApiModelProperty(value = "粉丝数") @ApiModelProperty(value = "粉丝数")

Loading…
Cancel
Save