release- 新增表tb_artist_register,不再做复杂查询

release-2024-08-08
huangyawei 6 months ago
parent 84b20174f0
commit 0ba6c3dc44

@ -52,4 +52,6 @@ public class ErrorConstants {
public final static String USER_ALREADY_EXISTS_ARTIST = "用户已发起过音乐人审核"; public final static String USER_ALREADY_EXISTS_ARTIST = "用户已发起过音乐人审核";
public final static String USER_STATUS_ERROR = "用户状态错误"; public final static String USER_STATUS_ERROR = "用户状态错误";
public final static String USER_NAME_ALREADY_EXISTS = "用户名已存在";
} }

@ -7,6 +7,7 @@ import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistSearchDto; import com.luoo.user.dto.artist.ArtistSearchDto;
import com.luoo.user.dto.artist.ArtistUserBindDto; import com.luoo.user.dto.artist.ArtistUserBindDto;
import com.luoo.user.pojo.ArtistInfo; import com.luoo.user.pojo.ArtistInfo;
import com.luoo.user.pojo.ArtistRegister;
import com.luoo.user.pojo.UserProcess; import com.luoo.user.pojo.UserProcess;
import com.luoo.user.service.ArtistService; import com.luoo.user.service.ArtistService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -84,15 +85,9 @@ public class ArtistController {
return Result.success(artistService.getList(artistSearchDto, page, size)); return Result.success(artistService.getList(artistSearchDto, page, size));
} }
@ApiOperation(value = "上一次申请的记录", notes = "上一次申请的记录-音乐人注册审批失败后可以自动带出上一次审批填写的数据") @ApiOperation(value = "上一次申请的记录", notes = "上一次申请的记录:申请状态 0-待审批 1-审批通过 2-审批不通过")
@GetMapping("/last/apply/record") @GetMapping("/last/apply/record")
public Result<ArtistRegisterDto> lastApplyRecord(@ApiParam(value = "Header中的token信息", required = true) String token) { public Result<ArtistRegister> lastApplyRecord(@ApiParam(value = "Header中的token信息", required = true) String token) {
return Result.success(artistService.lastApplyRecord(token));
}
@ApiOperation(value = "当前申请的状态", notes = "当前申请的状态-申请状态 0-待审批 1-审批通过 2-审批失败")
@GetMapping("/last/apply/result")
public Result<UserProcess> lastApplyResult(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token) {
return Result.success(artistService.lastApplyResult(token)); return Result.success(artistService.lastApplyResult(token));
} }

@ -0,0 +1,27 @@
package com.luoo.user.dao;
import com.luoo.user.pojo.ArtistRegister;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @Author: yawei.huang
* @Package: com.luoo.user.dao
* @Project: luoo_parent
* @Date: 2024/5/29 18:47
* @Filename: ArtistRegisterDao
* @Describe:
*/
public interface ArtistRegisterDao extends JpaRepository<ArtistRegister, String>, JpaSpecificationExecutor<ArtistRegister> {
List<ArtistRegister> findAllByCreateUser(String createUser);
List<ArtistRegister> findAllByUserName(String userName);
List<ArtistRegister> findAllByUserNameAndIdNot(String userName, String id);
ArtistRegister findArtistRegisterByCreateUserOrderByCreateTime(String createUser);
}

@ -24,8 +24,8 @@ import java.io.Serializable;
@Data @Data
public class ArtistRegisterDto implements Serializable { public class ArtistRegisterDto implements Serializable {
@ApiModelProperty("用户表id,如果是再次发起审批必填") @ApiModelProperty("id,如果是再次发起审批必填")
private String userId; private String id;
@ApiModelProperty("歌手名") @ApiModelProperty("歌手名")
@NotBlank(message = "歌手名必填") @NotBlank(message = "歌手名必填")

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/** /**
* @Author: yawei.huang * @Author: yawei.huang
@ -18,4 +20,19 @@ public class ArtistSearchDto implements Serializable {
@ApiModelProperty(value = "申请状态 0-待审批 1-审批通过 2-审批失败") @ApiModelProperty(value = "申请状态 0-待审批 1-审批通过 2-审批失败")
private Integer status; private Integer status;
@ApiModelProperty(value = "搜索内容")
private String searchStr;
@ApiModelProperty(value = "音乐人类型")
private Integer type;
@ApiModelProperty(value = "流派风格-tag表id")
private String style;
@ApiModelProperty(value = "申请开始时间")
private LocalDateTime startTime;
@ApiModelProperty(value = "申请结束时间")
private LocalDateTime endTime;
} }

@ -0,0 +1,109 @@
package com.luoo.user.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @Author: yawei.huang
* @Package: com.luoo.user.pojo
* @Project: luoo_parent
* @Date: 2024/5/29 18:38
* @Filename: ArtistRegister
* @Describe:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@Builder
@Entity
@Table(name="tb_artist_register")
public class ArtistRegister implements Serializable {
@Id
@ApiModelProperty("id")
private String id;
@ApiModelProperty("歌手名")
@NotBlank(message = "歌手名必填")
private String nickName;
@ApiModelProperty("艺人头像")
@NotBlank(message = "艺人头像必填")
private String avatar;
@ApiModelProperty("主页背景")
private String backgroundImage;
@ApiModelProperty("播放器音乐人管理后台实时截图")
@NotBlank(message = "后台截图必填")
private String screenshot;
@ApiModelProperty("所在地区")
@NotBlank(message = "所在地区必填")
private String address;
@ApiModelProperty("流派风格")
@NotBlank(message = "流派风格必填")
private String style;
@ApiModelProperty("艺人类型")
@NotNull(message = "艺人类型必填")
private Integer type;
@ApiModelProperty("艺人简介")
@NotBlank(message = "艺人简介必填")
private String description;
@ApiModelProperty("所属公司/厂牌")
private String bandUserId;
@ApiModelProperty("登录用户名")
@NotBlank(message = "用户名必填")
private String userName;
@ApiModelProperty("密码")
@NotBlank(message = "密码必填")
private String password;
@ApiModelProperty("用户表id")
private String userId;
@ApiModelProperty("音乐人表id")
private String artistId;
@ApiModelProperty("申请状态 0-待审批 1-审批通过 2-审批不通过")
private Integer status;
@ApiModelProperty("拒绝理由")
private String content;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间")
@CreatedDate
private Date createTime;
@ApiModelProperty("修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@LastModifiedDate
private Date modifyTime;
@ApiModelProperty("创建人")
private String createUser;
@ApiModelProperty("修改人")
private String updateUser;
}

@ -1,18 +1,12 @@
package com.luoo.user.service; package com.luoo.user.service;
import api.PageResult; import api.PageResult;
import com.luoo.user.dao.ArtistInfoDao; import com.luoo.user.dao.*;
import com.luoo.user.dao.ArtistUserDao;
import com.luoo.user.dao.UserInfoDao;
import com.luoo.user.dao.UserProcessDao;
import com.luoo.user.dto.UserProcessApproveDto; import com.luoo.user.dto.UserProcessApproveDto;
import com.luoo.user.dto.artist.ArtistRegisterDto; import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistSearchDto; import com.luoo.user.dto.artist.ArtistSearchDto;
import com.luoo.user.dto.artist.ArtistUserBindDto; import com.luoo.user.dto.artist.ArtistUserBindDto;
import com.luoo.user.pojo.ArtistInfo; import com.luoo.user.pojo.*;
import com.luoo.user.pojo.ArtistUser;
import com.luoo.user.pojo.UserInfo;
import com.luoo.user.pojo.UserProcess;
import constants.Constants; import constants.Constants;
import constants.ErrorConstants; import constants.ErrorConstants;
import dto.UserLoginDto; import dto.UserLoginDto;
@ -25,16 +19,24 @@ import exception.BizException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import util.IdWorker; import util.IdWorker;
import util.JwtUtil; import util.JwtUtil;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -65,136 +67,69 @@ public class ArtistService {
@Autowired @Autowired
private ArtistUserDao artistUserDao; private ArtistUserDao artistUserDao;
@Autowired
private UserProcessDao userProcessDao;
@Autowired @Autowired
private UserMessageService userMessageService; private UserMessageService userMessageService;
@Autowired @Autowired
private JwtUtil jwtUtil; private JwtUtil jwtUtil;
@Autowired
private ArtistRegisterDao artistRegisterDao;
/** /**
* *
*
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void artistRegister(String token, ArtistRegisterDto artistRegisterDto) { public void artistRegister(String token, ArtistRegisterDto artistRegisterDto) {
UserLoginDto currentUser = jwtUtil.getUserLoginDto(token); UserLoginDto currentUser = jwtUtil.getUserLoginDto(token);
UserInfo userInfo; String id = artistRegisterDto.getId();
if (currentUser == null) { if (StringUtils.isNotBlank(id)) {
// 用户校验失败,请重新登录
throw new BizException(ErrorConstants.USER_VERIFICATION_FAILURE);
}
if(StringUtils.isNotBlank(artistRegisterDto.getUserId())) {
// 重新发起音乐人账号审批
UserInfo info = userInfoDao.findById(artistRegisterDto.getUserId()).get();
if(ObjectUtils.notEqual(artistRegisterDto.getUserName(), info.getUserName())) {
throw new BizException("用户名不允许修改");
}
Integer count = userInfoDao.countByUserNameAndUserNameNotNullAndIdNot(artistRegisterDto.getUserName(), artistRegisterDto.getUserId());
if (count > 0) {
throw new BizException("该用户名已存在,请重新输入!");
}
userInfo = UserInfo.builder()
.id(info.getId())
.nickName(artistRegisterDto.getNickName())
.avatar(artistRegisterDto.getAvatar())
.joinTime(new Date())
.status(UserStatusEnum.UNAPPROVED.getStatus())
.thumbnail(Constants.DEFAULT_USER_THUMBNAIL)
.signature(Constants.DEFAULT_USER_SIGNATURE)
.userName(artistRegisterDto.getUserName())
.type(artistRegisterDto.getType())
.password(encoder.encode(artistRegisterDto.getPassword()))
.build();
userInfoDao.save(userInfo);
ArtistInfo artistInfoByUserId = artistInfoDao.findArtistInfoByUserId(artistRegisterDto.getUserId());
// 新增音乐人基本信息
ArtistInfo artistInfo = ArtistInfo.builder()
.id(artistInfoByUserId != null ? artistInfoByUserId.getId() : String.valueOf(idWorker.nextId()))
.userId(userInfo.getId())
.backgroundImage(artistRegisterDto.getBackgroundImage())
.address(artistRegisterDto.getAddress())
.style(artistRegisterDto.getStyle())
.bandUserId(artistRegisterDto.getBandUserId())
.build();
artistInfoDao.save(artistInfo);
} else {
// 新增音乐人账号 // 新增音乐人账号
// 目前一个用户只能新增一个音乐人账号 // 一个用户只能新增一个音乐人账号
UserProcess currentUserProcess = userProcessDao.findUserProcessByCreateUserAndTypeOrderByCreateTime(currentUser.getUserId(), UserProcessTypeEnum.ARTIST.getCode()); List<ArtistRegister> list = artistRegisterDao.findAllByCreateUser(currentUser.getUserId());
if(currentUserProcess != null) { if (!list.isEmpty()) {
// 用户已存在音乐人账号 // 用户已存在音乐人账号
throw new BizException(ErrorConstants.USER_ALREADY_EXISTS_ARTIST); throw new BizException(ErrorConstants.USER_ALREADY_EXISTS_ARTIST);
} }
Integer count = userInfoDao.countByUserNameAndUserNameNotNull(artistRegisterDto.getUserName());
if (count > 0) {
throw new BizException("该用户名已存在,请重新输入!");
}
// 新增用户基本信息
userInfo = UserInfo.builder()
.id(String.valueOf(idWorker.nextId()))
.nickName(artistRegisterDto.getNickName())
.avatar(artistRegisterDto.getAvatar())
.joinTime(new Date())
.status(UserStatusEnum.UNAPPROVED.getStatus())
.thumbnail(Constants.DEFAULT_USER_THUMBNAIL)
.signature(Constants.DEFAULT_USER_SIGNATURE)
.userName(artistRegisterDto.getUserName())
.type(artistRegisterDto.getType())
.password(encoder.encode(artistRegisterDto.getPassword()))
.build();
userInfoDao.save(userInfo);
// 新增音乐人基本信息
ArtistInfo artistInfo = ArtistInfo.builder()
.id(String.valueOf(idWorker.nextId()))
.userId(userInfo.getId())
.backgroundImage(artistRegisterDto.getBackgroundImage())
.address(artistRegisterDto.getAddress())
.style(artistRegisterDto.getStyle())
.bandUserId(artistRegisterDto.getBandUserId())
.build();
artistInfoDao.save(artistInfo);
}
// 新增音乐人负责人信息 List<ArtistRegister> allByUserName = artistRegisterDao.findAllByUserName(artistRegisterDto.getUserName());
// ArtistResponsible artistResponsible = ArtistResponsible.builder() if (!allByUserName.isEmpty()) {
// .id(String.valueOf(idWorker.nextId())) // 用户名已存在
// .userId(userInfo.getId()) throw new BizException(ErrorConstants.USER_NAME_ALREADY_EXISTS);
// .sex(artistRegisterDto.getSex())
// .name(artistRegisterDto.getNickName())
// .mobile(artistRegisterDto.getMobile())
// .build();
// artistResponsibleDao.save(artistResponsible);
// 审核记录
List<UserProcess> successList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.SUCCESS.getCode());
if (!successList.isEmpty()) {
throw new BizException("该账号已审核通过,请勿重复申请");
} }
List<UserProcess> upApprovedList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.UNAPPROVED.getCode()); ArtistRegister artistRegister = new ArtistRegister();
if (!upApprovedList.isEmpty()) { BeanUtils.copyProperties(artistRegisterDto, artistRegister);
throw new BizException("该账号正在审核中,请勿重复申请"); // 未审核状态
artistRegister.setStatus(UserProcessStatusEnum.UNAPPROVED.getCode());
// 创建人
artistRegister.setCreateUser(currentUser.getUserId());
// 密码加密
artistRegister.setPassword(encoder.encode(artistRegisterDto.getPassword()));
artistRegisterDao.save(artistRegister);
} else {
// 拒绝后重新发起音乐人账号审批
// 判断当前是否是拒绝状态
ArtistRegister artistRegister = artistRegisterDao.findById(id).get();
if (ObjectUtils.notEqual(UserProcessStatusEnum.FAIL.getCode(), artistRegister.getStatus())) {
throw new BizException(ErrorConstants.STATE_ERROR);
} }
UserProcess userProcess = UserProcess.builder() List<ArtistRegister> allByUserName = artistRegisterDao.findAllByUserNameAndIdNot(artistRegisterDto.getUserName(), id);
.id(String.valueOf(idWorker.nextId())) if (!allByUserName.isEmpty()) {
.userId(userInfo.getId()) // 用户名已存在
.type(UserProcessTypeEnum.ARTIST.getCode()) throw new BizException(ErrorConstants.USER_NAME_ALREADY_EXISTS);
.status(UserProcessStatusEnum.UNAPPROVED.getCode()) }
.createTime(new Date())
.createUser(currentUser.getUserId())
.build();
userProcessDao.save(userProcess); BeanUtils.copyProperties(artistRegisterDto, artistRegister);
// 未审核状态
artistRegister.setStatus(UserProcessStatusEnum.UNAPPROVED.getCode());
// 创建人
artistRegister.setCreateUser(currentUser.getUserId());
// 密码加密
artistRegister.setPassword(encoder.encode(artistRegisterDto.getPassword()));
artistRegisterDao.save(artistRegister);
}
} }
@ -227,27 +162,50 @@ public class ArtistService {
throw new BizException("请填写拒绝理由!"); throw new BizException("请填写拒绝理由!");
} }
UserProcess userProcessById = userProcessDao.findUserProcessById(userProcessApproveDto.getId()); ArtistRegister artistRegister = artistRegisterDao.findById(userProcessApproveDto.getId()).get();
userProcessById.setContent(userProcessApproveDto.getContent()); artistRegister.setStatus(userProcessApproveDto.getStatus());
userProcessById.setModifyTime(new Date()); artistRegister.setContent(userProcessApproveDto.getContent());
userProcessById.setStatus(userProcessApproveDto.getStatus()); artistRegister.setModifyTime(new Date());
artistRegisterDao.save(artistRegister);
userProcessDao.save(userProcessById);
UserInfo userInfo = userInfoDao.findById(userProcessById.getUserId()).get(); if (ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus())) {
userInfo.setStatus(ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus()) ? // 审核通过
UserStatusEnum.DISABLE.getStatus() : UserStatusEnum.ENABLE.getStatus()); // 新增用户基本信息,直接是启用状态
userInfo.setModifyTime(new Date()); UserInfo userInfo = UserInfo.builder()
.id(String.valueOf(idWorker.nextId()))
.nickName(artistRegister.getNickName())
.avatar(artistRegister.getAvatar())
.joinTime(new Date())
.status(UserStatusEnum.ENABLE.getStatus())
.thumbnail(Constants.DEFAULT_USER_THUMBNAIL)
.signature(Constants.DEFAULT_USER_SIGNATURE)
.userName(artistRegister.getUserName())
.type(artistRegister.getType())
.password(artistRegister.getPassword())
.build();
userInfoDao.save(userInfo); userInfoDao.save(userInfo);
// 新增音乐人基本信息
ArtistInfo artistInfo = ArtistInfo.builder()
.id(String.valueOf(idWorker.nextId()))
.userId(userInfo.getId())
.backgroundImage(artistRegister.getBackgroundImage())
.address(artistRegister.getAddress())
.style(artistRegister.getStyle())
.bandUserId(artistRegister.getBandUserId())
.build();
artistInfoDao.save(artistInfo);
}
UserInfo sendUser = userInfoDao.findById(artistRegister.getCreateUser()).get();
UserMessageDto userMessageDto = new UserMessageDto(); UserMessageDto userMessageDto = new UserMessageDto();
userMessageDto.setType(MessageTypeEnum.PRIVATE_MESSAGE.getType()); userMessageDto.setType(MessageTypeEnum.PRIVATE_MESSAGE.getType());
userMessageDto.setSendUserId(userInfo.getId()); userMessageDto.setSendUserId(sendUser.getId());
userMessageDto.setTitle(title); userMessageDto.setTitle(title);
userMessageDto.setContent(content); userMessageDto.setContent(content);
userMessageDto.setUserId(userProcessById.getCreateUser()); userMessageDto.setUserId(artistRegister.getCreateUser());
userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX + userInfo.getAvatar()); userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX + sendUser.getAvatar());
userMessageDto.setSendUserNickName(userInfo.getNickName()); userMessageDto.setSendUserNickName(sendUser.getNickName());
userMessageService.sendUserMessage(userMessageDto); userMessageService.sendUserMessage(userMessageDto);
} }
@ -288,60 +246,72 @@ public class ArtistService {
/** /**
* *
*
*/ */
public PageResult<ArtistInfo> getList(ArtistSearchDto artistSearchDto, Integer page, Integer size) { public PageResult<ArtistRegister> getList(ArtistSearchDto artistSearchDto, Integer page, Integer size) {
Pageable pageable = PageRequest.of(page - 1, size); Sort sort = new Sort(Sort.Direction.DESC, "createTime");
Page<ArtistInfo> artistInfoPage; PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
if(artistSearchDto.getStatus() == null) {
artistInfoPage = artistInfoDao.findAllNoStatus(pageable); Specification<ArtistRegister> artistRegisterDtoSpecification = buildSearchSpecification(artistSearchDto);
} else { Page<ArtistRegister> artistRegisterPage = artistRegisterDao.findAll(artistRegisterDtoSpecification, pageRequest);
artistInfoPage = artistInfoDao.findAllByStatus(artistSearchDto.getStatus(), pageable);
} long totalElements = artistRegisterPage.getTotalElements();
long totalElements = artistInfoPage.getTotalElements(); return new PageResult<>(totalElements, artistRegisterPage.getContent());
return new PageResult<>(totalElements, artistInfoPage.getContent());
} }
/** /**
* *
* *
* @param param
* @return
*/ */
public UserProcess lastApplyResult(String token) { private Specification<ArtistRegister> buildSearchSpecification(ArtistSearchDto param) {
UserLoginDto user = jwtUtil.getUserLoginDto(token); return (Root<ArtistRegister> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
if (user == null) { List<Predicate> predicateList = new ArrayList<Predicate>();
throw new BizException(ErrorConstants.USER_VERIFICATION_FAILURE);
if (param.getType() != null) {
predicateList.add(builder.and(builder.equal(root.get("type"), param.getType())));
}
if (param.getStatus() != null) {
predicateList.add(builder.and(builder.equal(root.get("status"), param.getStatus())));
}
if (StringUtils.isNotBlank(param.getSearchStr())) {
// 专辑名称
String likeExpression = "%" + param.getSearchStr() + "%";
predicateList.add(builder.and(builder.like(root.get("nickName"), likeExpression)));
}
if (StringUtils.isNotBlank(param.getStyle())) {
// 专辑名称
String likeExpression = "%" + param.getStyle() + "%";
predicateList.add(builder.and(builder.like(root.get("style"), likeExpression)));
}
if (param.getStartTime() != null) {
predicateList.add(builder.greaterThanOrEqualTo(root.get("createTime"), param.getStartTime()));
}
if (param.getEndTime() != null) {
predicateList.add(builder.lessThanOrEqualTo(root.get("createTime"), param.getEndTime()));
} }
return userProcessDao.findUserProcessByCreateUserAndTypeOrderByCreateTime(user.getUserId(), UserProcessTypeEnum.ARTIST.getCode()); return builder.and(predicateList.toArray(new Predicate[predicateList.size()]));
};
} }
/** /**
* *
*
*/ */
public ArtistRegisterDto lastApplyRecord(String token) { public ArtistRegister lastApplyResult(String token) {
UserLoginDto user = jwtUtil.getUserLoginDto(token); UserLoginDto user = jwtUtil.getUserLoginDto(token);
if (user == null) { if (user == null) {
throw new BizException(ErrorConstants.USER_VERIFICATION_FAILURE); throw new BizException(ErrorConstants.USER_VERIFICATION_FAILURE);
} }
UserProcess userprocess = userProcessDao.findUserProcessByCreateUserAndTypeOrderByCreateTime(user.getUserId(), UserProcessTypeEnum.ARTIST.getCode());
String userId = userprocess.getUserId();
UserInfo userInfo = userInfoDao.findById(userId).get();
ArtistInfo artistInfoByUserId = artistInfoDao.findArtistInfoByUserId(userId);
return ArtistRegisterDto.builder() return artistRegisterDao.findArtistRegisterByCreateUserOrderByCreateTime(user.getUserId());
.userId(userInfo.getId())
.nickName(userInfo.getNickName())
.avatar(userInfo.getAvatar())
.userName(userInfo.getUserName())
.type(userInfo.getType())
.password("")
.backgroundImage(artistInfoByUserId.getBackgroundImage())
.address(artistInfoByUserId.getAddress())
.style(artistInfoByUserId.getStyle())
.bandUserId(artistInfoByUserId.getBandUserId())
.screenshot(artistInfoByUserId.getScreenshot())
.build();
} }

@ -0,0 +1,21 @@
create table tb_artist_register
(
id varchar(20) not null
primary key,
nick_name varchar(255) null comment '歌手名',
avatar varchar(255) null comment '艺人头像',
background_image varchar(255) null comment '主页背景',
screenshot varchar(255) null comment '播放器音乐人管理后台实时截图',
address varchar(255) null comment '所在地区',
style varchar(500) null comment '流派风格',
type int null comment '艺人类型 2- 音乐人个人 3-音乐人乐队',
description longtext null comment '艺人简介',
band_user_id varchar(20) null comment 'tb_user_info表中厂牌类型用户的id',
user_name varchar(255) null comment '用户名',
password varchar(255) null comment '密码',
user_id varchar(20) null comment '用户id审核后创建账号的id',
artist_id varchar(20) null comment '音乐人id审核后新建的id',
status int null comment '申请状态 0-待审批 1-审批通过 2-审批不通过'
)
comment '音乐人注册信息';
Loading…
Cancel
Save