release- app端新增简略版注册音乐人表单

release-2024-08-08
pikaqiudeshujia 7 months ago
parent 2b2093d76a
commit 885742c2d8

@ -3,6 +3,7 @@ package com.luoo.user.controller;
import api.PageResult;
import api.Result;
import com.luoo.user.dto.UserProcessApproveDto;
import com.luoo.user.dto.artist.ArtistRegisterAppDto;
import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistSearchDto;
import com.luoo.user.dto.artist.ArtistUserBindDto;
@ -12,6 +13,7 @@ import com.luoo.user.service.ArtistService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -40,6 +42,21 @@ public class ArtistController {
return Result.success();
}
@ApiOperation(value = "APP音乐人注册", notes = "APP音乐人注册简单模板")
@PostMapping("/app/register")
public Result<Void> appRegister(@RequestHeader(value = "Authorization", required = true) String authorization,
@Validated @RequestBody ArtistRegisterAppDto artistRegisterAppDto) {
ArtistRegisterDto artistRegisterDto = new ArtistRegisterDto();
BeanUtils.copyProperties(artistRegisterAppDto, artistRegisterDto);
artistService.artistRegister(authorization, artistRegisterDto);
return Result.success();
}
@ApiOperation(value = "未审核的音乐人列表", notes = "未审核的音乐人列表")
@GetMapping("/list/un-approve/{page}/{size}")
public Result<PageResult<ArtistInfo>> getUnApproveList(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,

@ -0,0 +1,38 @@
package com.luoo.user.dto.artist;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* APP
*
* @Author: yawei.huang
* @Package: com.luoo.user.dto.artist
* @Project: luoo_parent
* @Date: 2024/6/19 13:50
* @Filename: ArtistRegisterAppDto
* @Describe:
*/
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Data
public class ArtistRegisterAppDto implements Serializable {
@ApiModelProperty("歌手名")
@NotBlank(message = "歌手名必填")
private String nickName;
@ApiModelProperty("所在地区")
@NotBlank(message = "所在地区必填")
private String address;
@ApiModelProperty("流派风格")
@NotBlank(message = "流派风格必填")
private String style;
}

@ -101,11 +101,15 @@ public class ArtistService {
throw new BizException(ErrorConstants.USER_ALREADY_EXISTS_ARTIST);
}
if(StringUtils.isBlank(artistRegisterDto.getUserName())) {
// app端新增时不需要填写用户名。可能为空
List<ArtistRegister> allByUserName = artistRegisterDao.findAllByUserName(artistRegisterDto.getUserName());
if (!allByUserName.isEmpty()) {
// 用户名已存在
throw new BizException(ErrorConstants.USER_NAME_ALREADY_EXISTS);
}
}
ArtistRegister artistRegister = new ArtistRegister();
BeanUtils.copyProperties(artistRegisterDto, artistRegister);
// 未审核状态
@ -113,7 +117,7 @@ public class ArtistService {
// 创建人
artistRegister.setCreateUser(currentUser.getUserId());
// 密码加密
artistRegister.setPassword(encoder.encode(artistRegisterDto.getPassword()));
artistRegister.setPassword(StringUtils.isBlank(artistRegisterDto.getPassword()) ? null : encoder.encode(artistRegisterDto.getPassword()));
String serialNo = redisLockUtil.generateSerialNumber();
artistRegister.setSerialNo(serialNo);
@ -123,6 +127,7 @@ public class ArtistService {
} else {
// 拒绝后重新发起音乐人账号审批
// 判断当前是否是拒绝状态
// 重新发起id为空app不可能发起不考虑用户名密码为空的情况
ArtistRegister artistRegister = artistRegisterDao.findById(id).get();
if (ObjectUtils.notEqual(UserProcessStatusEnum.FAIL.getCode(), artistRegister.getStatus())) {
throw new BizException(ErrorConstants.STATE_ERROR);

Loading…
Cancel
Save