|
|
@ -10,6 +10,10 @@ import com.luoo.user.pojo.ArtistUser;
|
|
|
|
import com.luoo.user.pojo.UserInfo;
|
|
|
|
import com.luoo.user.pojo.UserInfo;
|
|
|
|
import com.luoo.user.pojo.UserProcess;
|
|
|
|
import com.luoo.user.pojo.UserProcess;
|
|
|
|
import constants.Constants;
|
|
|
|
import constants.Constants;
|
|
|
|
|
|
|
|
import constants.ErrorConstants;
|
|
|
|
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
|
|
|
|
import dto.UserMessageDto;
|
|
|
|
|
|
|
|
import enums.MessageTypeEnum;
|
|
|
|
import enums.UserProcessStatusEnum;
|
|
|
|
import enums.UserProcessStatusEnum;
|
|
|
|
import enums.UserProcessTypeEnum;
|
|
|
|
import enums.UserProcessTypeEnum;
|
|
|
|
import enums.UserStatusEnum;
|
|
|
|
import enums.UserStatusEnum;
|
|
|
@ -25,6 +29,7 @@ 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 java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -59,15 +64,20 @@ public class ArtistService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private UserProcessDao userProcessDao;
|
|
|
|
private UserProcessDao userProcessDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private UserMessageService userMessageService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private JwtUtil jwtUtil;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 音乐人注册
|
|
|
|
* 音乐人注册
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void artistRegister(ArtistRegisterDto artistRegisterDto) {
|
|
|
|
public void artistRegister(String token, ArtistRegisterDto artistRegisterDto) {
|
|
|
|
|
|
|
|
|
|
|
|
UserInfo userInfoByUserName = userInfoDao.findUserInfoByUserName(artistRegisterDto.getUserName());
|
|
|
|
UserInfo userInfoByUserName = userInfoDao.findUserInfoByUserName(artistRegisterDto.getUserName());
|
|
|
|
if(userInfoByUserName != null) {
|
|
|
|
if (userInfoByUserName != null) {
|
|
|
|
throw new BizException("该用户名已存在,请重新输入!");
|
|
|
|
throw new BizException("该用户名已存在,请重新输入!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -109,11 +119,11 @@ public class ArtistService {
|
|
|
|
|
|
|
|
|
|
|
|
// 审核记录
|
|
|
|
// 审核记录
|
|
|
|
List<UserProcess> successList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.SUCCESS.getCode());
|
|
|
|
List<UserProcess> successList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.SUCCESS.getCode());
|
|
|
|
if(!successList.isEmpty()) {
|
|
|
|
if (!successList.isEmpty()) {
|
|
|
|
throw new BizException("该账号已审核通过,请勿重复申请");
|
|
|
|
throw new BizException("该账号已审核通过,请勿重复申请");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<UserProcess> upApprovedList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.UNAPPROVED.getCode());
|
|
|
|
List<UserProcess> upApprovedList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.UNAPPROVED.getCode());
|
|
|
|
if(!upApprovedList.isEmpty()) {
|
|
|
|
if (!upApprovedList.isEmpty()) {
|
|
|
|
throw new BizException("该账号正在审核中,请勿重复申请");
|
|
|
|
throw new BizException("该账号正在审核中,请勿重复申请");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -124,13 +134,21 @@ public class ArtistService {
|
|
|
|
.status(UserProcessStatusEnum.UNAPPROVED.getCode())
|
|
|
|
.status(UserProcessStatusEnum.UNAPPROVED.getCode())
|
|
|
|
.createTime(new Date())
|
|
|
|
.createTime(new Date())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(token);
|
|
|
|
|
|
|
|
if (user != null) {
|
|
|
|
|
|
|
|
userProcess.setCreateUser(user.getUserId());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 用户校验失败,请重新登录
|
|
|
|
|
|
|
|
throw new BizException(ErrorConstants.USER_VERIFICATION_FAILURE);
|
|
|
|
|
|
|
|
}
|
|
|
|
userProcessDao.save(userProcess);
|
|
|
|
userProcessDao.save(userProcess);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取未审批的音乐人注册申请
|
|
|
|
* 获取未审批的音乐人注册申请
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return 未审批的分页列表
|
|
|
|
* @return 未审批的分页列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public PageResult<ArtistInfo> getUnApproveList(Integer page, Integer size) {
|
|
|
|
public PageResult<ArtistInfo> getUnApproveList(Integer page, Integer size) {
|
|
|
|
Pageable pageable = PageRequest.of(page - 1, size);
|
|
|
|
Pageable pageable = PageRequest.of(page - 1, size);
|
|
|
@ -146,8 +164,13 @@ public class ArtistService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void approve(UserProcessApproveDto userProcessApproveDto) {
|
|
|
|
public void approve(UserProcessApproveDto userProcessApproveDto) {
|
|
|
|
if(ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus())
|
|
|
|
|
|
|
|
&& StringUtils.isBlank(userProcessApproveDto.getContent())) {
|
|
|
|
String title = ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus()) ?
|
|
|
|
|
|
|
|
"音乐人审核通过" : "音乐人审核失败";
|
|
|
|
|
|
|
|
String content = userProcessApproveDto.getContent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus())
|
|
|
|
|
|
|
|
&& StringUtils.isBlank(userProcessApproveDto.getContent())) {
|
|
|
|
throw new BizException("请填写拒绝理由!");
|
|
|
|
throw new BizException("请填写拒绝理由!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -159,11 +182,20 @@ public class ArtistService {
|
|
|
|
userProcessDao.save(userProcessById);
|
|
|
|
userProcessDao.save(userProcessById);
|
|
|
|
|
|
|
|
|
|
|
|
UserInfo userInfo = userInfoDao.findById(userProcessById.getUserId()).get();
|
|
|
|
UserInfo userInfo = userInfoDao.findById(userProcessById.getUserId()).get();
|
|
|
|
userInfo.setStatus(ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus())?
|
|
|
|
userInfo.setStatus(ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus()) ?
|
|
|
|
UserStatusEnum.DISABLE.getStatus() : UserStatusEnum.ENABLE.getStatus());
|
|
|
|
UserStatusEnum.DISABLE.getStatus() : UserStatusEnum.ENABLE.getStatus());
|
|
|
|
userInfo.setModifyTime(new Date());
|
|
|
|
userInfo.setModifyTime(new Date());
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
// todo 审核完后发送站内消息,成功失败都需要
|
|
|
|
|
|
|
|
|
|
|
|
UserMessageDto userMessageDto = new UserMessageDto();
|
|
|
|
|
|
|
|
userMessageDto.setType(MessageTypeEnum.PRIVATE_MESSAGE.getType());
|
|
|
|
|
|
|
|
userMessageDto.setSendUserId(userInfo.getId());
|
|
|
|
|
|
|
|
userMessageDto.setTitle(title);
|
|
|
|
|
|
|
|
userMessageDto.setContent(content);
|
|
|
|
|
|
|
|
userMessageDto.setUserId(userProcessById.getCreateUser());
|
|
|
|
|
|
|
|
userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX + userInfo.getAvatar());
|
|
|
|
|
|
|
|
userMessageDto.setSendUserNickName(userInfo.getNickName());
|
|
|
|
|
|
|
|
userMessageService.sendUserMessage(userMessageDto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -174,7 +206,7 @@ public class ArtistService {
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void bindArtistAndMember(ArtistUserBindDto artistUserBindDto) {
|
|
|
|
public void bindArtistAndMember(ArtistUserBindDto artistUserBindDto) {
|
|
|
|
ArtistUser artistUser = artistUserDao.findArtistUserByArtistIdAndUserId(artistUserBindDto.getArtistId(), artistUserBindDto.getUserId());
|
|
|
|
ArtistUser artistUser = artistUserDao.findArtistUserByArtistIdAndUserId(artistUserBindDto.getArtistId(), artistUserBindDto.getUserId());
|
|
|
|
if(artistUser == null) {
|
|
|
|
if (artistUser == null) {
|
|
|
|
ArtistUser build = ArtistUser.builder()
|
|
|
|
ArtistUser build = ArtistUser.builder()
|
|
|
|
.id(String.valueOf(idWorker.nextId()))
|
|
|
|
.id(String.valueOf(idWorker.nextId()))
|
|
|
|
.artistId(artistUserBindDto.getArtistId())
|
|
|
|
.artistId(artistUserBindDto.getArtistId())
|
|
|
@ -189,11 +221,12 @@ public class ArtistService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 音乐人-成员解绑
|
|
|
|
* 音乐人-成员解绑
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param artistUserBindDto 绑定实体类
|
|
|
|
* @param artistUserBindDto 绑定实体类
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void unBindArtistAndMember(ArtistUserBindDto artistUserBindDto) {
|
|
|
|
public void unBindArtistAndMember(ArtistUserBindDto artistUserBindDto) {
|
|
|
|
ArtistUser artistUser = artistUserDao.findArtistUserByArtistIdAndUserId(artistUserBindDto.getArtistId(), artistUserBindDto.getUserId());
|
|
|
|
ArtistUser artistUser = artistUserDao.findArtistUserByArtistIdAndUserId(artistUserBindDto.getArtistId(), artistUserBindDto.getUserId());
|
|
|
|
if(artistUser != null) {
|
|
|
|
if (artistUser != null) {
|
|
|
|
artistUserDao.delete(artistUser);
|
|
|
|
artistUserDao.delete(artistUser);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw new BizException("没有绑定关系!");
|
|
|
|
throw new BizException("没有绑定关系!");
|
|
|
|