|
|
@ -1,19 +1,24 @@
|
|
|
|
package com.luoo.user.service;
|
|
|
|
package com.luoo.user.service;
|
|
|
|
|
|
|
|
|
|
|
|
import api.PageResult;
|
|
|
|
import api.PageResult;
|
|
|
|
import com.luoo.user.dao.*;
|
|
|
|
import com.luoo.user.dao.ArtistInfoDao;
|
|
|
|
|
|
|
|
import com.luoo.user.dao.ArtistRegisterDao;
|
|
|
|
|
|
|
|
import com.luoo.user.dao.ArtistUserDao;
|
|
|
|
|
|
|
|
import com.luoo.user.dao.UserInfoDao;
|
|
|
|
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.*;
|
|
|
|
import com.luoo.user.pojo.ArtistInfo;
|
|
|
|
|
|
|
|
import com.luoo.user.pojo.ArtistRegister;
|
|
|
|
|
|
|
|
import com.luoo.user.pojo.ArtistUser;
|
|
|
|
|
|
|
|
import com.luoo.user.pojo.UserInfo;
|
|
|
|
import constants.Constants;
|
|
|
|
import constants.Constants;
|
|
|
|
import constants.ErrorConstants;
|
|
|
|
import constants.ErrorConstants;
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
import dto.UserMessageDto;
|
|
|
|
import dto.UserMessageDto;
|
|
|
|
import enums.MessageTypeEnum;
|
|
|
|
import enums.MessageTypeEnum;
|
|
|
|
import enums.UserProcessStatusEnum;
|
|
|
|
import enums.UserProcessStatusEnum;
|
|
|
|
import enums.UserProcessTypeEnum;
|
|
|
|
|
|
|
|
import enums.UserStatusEnum;
|
|
|
|
import enums.UserStatusEnum;
|
|
|
|
import exception.BizException;
|
|
|
|
import exception.BizException;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@ -31,6 +36,7 @@ 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 util.RedisLockUtil;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
@ -76,6 +82,8 @@ public class ArtistService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ArtistRegisterDao artistRegisterDao;
|
|
|
|
private ArtistRegisterDao artistRegisterDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RedisLockUtil redisLockUtil;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 音乐人注册
|
|
|
|
* 音乐人注册
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -84,7 +92,7 @@ public class ArtistService {
|
|
|
|
|
|
|
|
|
|
|
|
UserLoginDto currentUser = jwtUtil.getUserLoginDto(token);
|
|
|
|
UserLoginDto currentUser = jwtUtil.getUserLoginDto(token);
|
|
|
|
String id = artistRegisterDto.getId();
|
|
|
|
String id = artistRegisterDto.getId();
|
|
|
|
if (StringUtils.isNotBlank(id)) {
|
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
|
// 新增音乐人账号
|
|
|
|
// 新增音乐人账号
|
|
|
|
// 一个用户只能新增一个音乐人账号
|
|
|
|
// 一个用户只能新增一个音乐人账号
|
|
|
|
List<ArtistRegister> list = artistRegisterDao.findAllByCreateUser(currentUser.getUserId());
|
|
|
|
List<ArtistRegister> list = artistRegisterDao.findAllByCreateUser(currentUser.getUserId());
|
|
|
@ -106,6 +114,11 @@ public class ArtistService {
|
|
|
|
artistRegister.setCreateUser(currentUser.getUserId());
|
|
|
|
artistRegister.setCreateUser(currentUser.getUserId());
|
|
|
|
// 密码加密
|
|
|
|
// 密码加密
|
|
|
|
artistRegister.setPassword(encoder.encode(artistRegisterDto.getPassword()));
|
|
|
|
artistRegister.setPassword(encoder.encode(artistRegisterDto.getPassword()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String serialNo = redisLockUtil.generateSerialNumber();
|
|
|
|
|
|
|
|
artistRegister.setSerialNo(serialNo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
artistRegister.setId(String.valueOf(idWorker.nextId()));
|
|
|
|
artistRegisterDao.save(artistRegister);
|
|
|
|
artistRegisterDao.save(artistRegister);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 拒绝后重新发起音乐人账号审批
|
|
|
|
// 拒绝后重新发起音乐人账号审批
|
|
|
@ -154,6 +167,8 @@ public class ArtistService {
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void approve(String token, UserProcessApproveDto userProcessApproveDto) {
|
|
|
|
public void approve(String token, UserProcessApproveDto userProcessApproveDto) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserLoginDto currentUser = jwtUtil.getUserLoginDto(token);
|
|
|
|
|
|
|
|
|
|
|
|
String title = ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus()) ?
|
|
|
|
String title = ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus()) ?
|
|
|
|
"音乐人审核通过" : "音乐人审核失败";
|
|
|
|
"音乐人审核通过" : "音乐人审核失败";
|
|
|
|
String content = userProcessApproveDto.getContent();
|
|
|
|
String content = userProcessApproveDto.getContent();
|
|
|
@ -164,10 +179,9 @@ public class ArtistService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ArtistRegister artistRegister = artistRegisterDao.findById(userProcessApproveDto.getId()).get();
|
|
|
|
ArtistRegister artistRegister = artistRegisterDao.findById(userProcessApproveDto.getId()).get();
|
|
|
|
|
|
|
|
artistRegister.setUserId(currentUser.getUserId());
|
|
|
|
artistRegister.setStatus(userProcessApproveDto.getStatus());
|
|
|
|
artistRegister.setStatus(userProcessApproveDto.getStatus());
|
|
|
|
artistRegister.setContent(userProcessApproveDto.getContent());
|
|
|
|
artistRegister.setContent(userProcessApproveDto.getContent());
|
|
|
|
artistRegister.setModifyTime(new Date());
|
|
|
|
|
|
|
|
artistRegisterDao.save(artistRegister);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus())) {
|
|
|
|
if (ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus())) {
|
|
|
|
// 审核通过
|
|
|
|
// 审核通过
|
|
|
@ -190,18 +204,27 @@ public class ArtistService {
|
|
|
|
ArtistInfo artistInfo = ArtistInfo.builder()
|
|
|
|
ArtistInfo artistInfo = ArtistInfo.builder()
|
|
|
|
.id(String.valueOf(idWorker.nextId()))
|
|
|
|
.id(String.valueOf(idWorker.nextId()))
|
|
|
|
.userId(userInfo.getId())
|
|
|
|
.userId(userInfo.getId())
|
|
|
|
|
|
|
|
.description(artistRegister.getDescription())
|
|
|
|
|
|
|
|
.screenshot(artistRegister.getScreenshot())
|
|
|
|
.backgroundImage(artistRegister.getBackgroundImage())
|
|
|
|
.backgroundImage(artistRegister.getBackgroundImage())
|
|
|
|
.address(artistRegister.getAddress())
|
|
|
|
.address(artistRegister.getAddress())
|
|
|
|
.style(artistRegister.getStyle())
|
|
|
|
.style(artistRegister.getStyle())
|
|
|
|
.bandUserId(artistRegister.getBandUserId())
|
|
|
|
.bandUserId(artistRegister.getBandUserId())
|
|
|
|
|
|
|
|
.serialNo(artistRegister.getSerialNo())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
artistInfoDao.save(artistInfo);
|
|
|
|
artistInfoDao.save(artistInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
artistRegister.setArtistId(artistInfo.getId());
|
|
|
|
|
|
|
|
artistRegister.setUserId(userInfo.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
artistRegister.setUpdateUser(currentUser.getUserId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
artistRegisterDao.save(artistRegister);
|
|
|
|
|
|
|
|
|
|
|
|
// 发送审核成功、失败的站内信
|
|
|
|
// 发送审核成功、失败的站内信
|
|
|
|
// 发送人是当前登录用户
|
|
|
|
// 发送人是当前登录用户
|
|
|
|
// 接收人是音乐人注册人
|
|
|
|
// 接收人是音乐人注册人
|
|
|
|
UserLoginDto currentUser = jwtUtil.getUserLoginDto(token);
|
|
|
|
|
|
|
|
UserMessageDto userMessageDto = new UserMessageDto();
|
|
|
|
UserMessageDto userMessageDto = new UserMessageDto();
|
|
|
|
userMessageDto.setType(MessageTypeEnum.PRIVATE_MESSAGE.getType());
|
|
|
|
userMessageDto.setType(MessageTypeEnum.PRIVATE_MESSAGE.getType());
|
|
|
|
userMessageDto.setSendUserId(currentUser.getUserId());
|
|
|
|
userMessageDto.setSendUserId(currentUser.getUserId());
|
|
|
|