release-申请音乐人时新增校验

release-2024-08-08
pikaqiudeshujia 7 months ago
parent 682ef08d46
commit 09c2841fa3

@ -0,0 +1,26 @@
package enums;
import lombok.Getter;
/**
* @Author: yawei.huang
* @Package: enums
* @Project: luoo_parent
* @Date: 2024/4/28 8:36
* @Filename: UserProcessStatusEnum
* @Describe:
*/
@Getter
public enum UserProcessStatusEnum {
UNAPPROVED(0, "未审核"),
SUCCESS(1, "审核成功"),
FAIL(2, "审核失败");
private final Integer code;
private final String desc;
UserProcessStatusEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
}

@ -0,0 +1,27 @@
package enums;
import lombok.Getter;
/**
* @Author: yawei.huang
* @Package: enums
* @Project: luoo_parent
* @Date: 2024/4/28 8:34
* @Filename: UserProcessTypeEnum
* @Describe:
*/
@Getter
public enum UserProcessTypeEnum {
ARTIST(1, "音乐人"),
SUCCESS(2, "厂牌");
private final Integer code;
private final String desc;
UserProcessTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
}

@ -4,6 +4,8 @@ import com.luoo.user.pojo.UserProcess;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/** /**
* @Author: yawei.huang * @Author: yawei.huang
* @Package: com.luoo.user.dao * @Package: com.luoo.user.dao
@ -13,4 +15,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @Describe: * @Describe:
*/ */
public interface UserProcessDao extends JpaRepository<UserProcess,String>, JpaSpecificationExecutor<UserProcess> { public interface UserProcessDao extends JpaRepository<UserProcess,String>, JpaSpecificationExecutor<UserProcess> {
public List<UserProcessDao> findUserProcessByUserIdAndTypeAndStatus(String userId, Integer type, Integer status);
} }

@ -33,10 +33,10 @@ public class UserProcess implements Serializable {
private String userId; private String userId;
@ApiModelProperty("申请类型 1-音乐人 2-厂牌") @ApiModelProperty("申请类型 1-音乐人 2-厂牌")
private String type; private Integer type;
@ApiModelProperty("申请状态 0-待审批 1-审批通过 2-审批成功") @ApiModelProperty("申请状态 0-待审批 1-审批通过 2-审批成功")
private String status; private Integer status;
@ApiModelProperty("拒绝理由") @ApiModelProperty("拒绝理由")
private String content; private String content;

@ -3,11 +3,10 @@ package com.luoo.user.service;
import com.luoo.user.dao.*; import com.luoo.user.dao.*;
import com.luoo.user.dto.artist.ArtistRegisterDto; import com.luoo.user.dto.artist.ArtistRegisterDto;
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.ArtistResponsible;
import com.luoo.user.pojo.ArtistUser;
import com.luoo.user.pojo.UserInfo;
import constants.Constants; import constants.Constants;
import enums.UserProcessStatusEnum;
import enums.UserProcessTypeEnum;
import enums.UserStatusEnum; import enums.UserStatusEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import util.IdWorker; import util.IdWorker;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author: yawei.huang * @Author: yawei.huang
@ -51,6 +51,9 @@ public class ArtistService {
@Autowired @Autowired
private ArtistUserDao artistUserDao; private ArtistUserDao artistUserDao;
@Autowired
private UserProcessDao userProcessDao;
/** /**
* *
* *
@ -98,6 +101,23 @@ public class ArtistService {
.build(); .build();
artistResponsibleDao.save(artistResponsible); artistResponsibleDao.save(artistResponsible);
// 审核记录
List<UserProcessDao> successList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.SUCCESS.getCode());
if(!successList.isEmpty()) {
throw new RuntimeException("该账号已审核通过,请勿重复申请");
}
List<UserProcessDao> upApprovedList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.UNAPPROVED.getCode());
if(!upApprovedList.isEmpty()) {
throw new RuntimeException("该账号正在审核中,请勿重复申请");
}
UserProcess userProcess = UserProcess.builder()
.id(String.valueOf(idWorker.nextId()))
.userId(userInfo.getId())
.type(UserProcessTypeEnum.ARTIST.getCode())
.status(UserProcessStatusEnum.UNAPPROVED.getCode())
.build();
userProcessDao.save(userProcess);
} }
/** /**

Loading…
Cancel
Save