diff --git a/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java b/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java index 055f3fd..662f347 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java @@ -1,6 +1,7 @@ package com.luoo.user.controller; import api.Result; +import com.luoo.user.dto.UserProcessApproveDto; import com.luoo.user.dto.artist.ArtistRegisterDto; import com.luoo.user.dto.artist.ArtistUserBindDto; import com.luoo.user.service.ArtistService; @@ -38,7 +39,12 @@ public class ArtistController { return Result.success(); } - + @ApiOperation(value = "音乐人审核",notes = "音乐人审核") + @PostMapping("/approve") + public Result approve(@ApiParam(value = "音乐人审核对象", required = true) @Valid @RequestBody UserProcessApproveDto userProcessApproveDto) { + artistService.approve(userProcessApproveDto); + return Result.success(); + } @ApiOperation(value = "音乐人-成员绑定", notes = "音乐人-成员绑定") @PostMapping("/bind") diff --git a/luoo_user/src/main/java/com/luoo/user/dao/UserProcessDao.java b/luoo_user/src/main/java/com/luoo/user/dao/UserProcessDao.java index cbe2d15..0118904 100644 --- a/luoo_user/src/main/java/com/luoo/user/dao/UserProcessDao.java +++ b/luoo_user/src/main/java/com/luoo/user/dao/UserProcessDao.java @@ -18,4 +18,5 @@ public interface UserProcessDao extends JpaRepository, JpaSp public List findUserProcessByUserIdAndTypeAndStatus(String userId, Integer type, Integer status); + public UserProcess findUserProcessById(String id); } diff --git a/luoo_user/src/main/java/com/luoo/user/dto/UserProcessApproveDto.java b/luoo_user/src/main/java/com/luoo/user/dto/UserProcessApproveDto.java new file mode 100644 index 0000000..0461072 --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/dto/UserProcessApproveDto.java @@ -0,0 +1,30 @@ +package com.luoo.user.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author: yawei.huang + * @Package: com.luoo.user.dto + * @Project: luoo_parent + * @Date: 2024/4/28 8:53 + * @Filename: UserProcessDto + * @Describe: 审核对象 + */ +@Data +public class UserProcessApproveDto implements Serializable { + + @ApiModelProperty(name = "id") + @NotBlank(message = "id必填") + private String id; + + @ApiModelProperty(name = "审核结果") + @NotBlank(message = "审核结果必填") + private Integer status; + + @ApiModelProperty(name = "拒绝理由") + private String content; +} diff --git a/luoo_user/src/main/java/com/luoo/user/dto/artist/ArtistRegisterDto.java b/luoo_user/src/main/java/com/luoo/user/dto/artist/ArtistRegisterDto.java index 4065a4c..d67c791 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/artist/ArtistRegisterDto.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/artist/ArtistRegisterDto.java @@ -44,17 +44,17 @@ public class ArtistRegisterDto implements Serializable { @ApiModelProperty(name = "所属公司/厂牌") private String bandUserId; - @ApiModelProperty(name = "负责人名称") - @NotBlank(message = "负责人名称必填") - private String responsibleName; - - @ApiModelProperty(name = "性别") - @NotNull(message = "负责人性别必填") - private Integer sex; - - @ApiModelProperty(name = "负责人手机") - @NotBlank(message = "负责人手机必填") - private String mobile; +// @ApiModelProperty(name = "负责人名称") +// @NotBlank(message = "负责人名称必填") +// private String responsibleName; +// +// @ApiModelProperty(name = "性别") +// @NotNull(message = "负责人性别必填") +// private Integer sex; +// +// @ApiModelProperty(name = "负责人手机") +// @NotBlank(message = "负责人手机必填") +// private String mobile; @ApiModelProperty(name = "登录用户名") @NotBlank(message = "用户名必填") diff --git a/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java b/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java index c503274..d541edd 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java @@ -1,6 +1,7 @@ package com.luoo.user.service; import com.luoo.user.dao.*; +import com.luoo.user.dto.UserProcessApproveDto; import com.luoo.user.dto.artist.ArtistRegisterDto; import com.luoo.user.dto.artist.ArtistUserBindDto; import com.luoo.user.pojo.*; @@ -9,6 +10,8 @@ import enums.UserProcessStatusEnum; import enums.UserProcessTypeEnum; import enums.UserStatusEnum; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; @@ -92,14 +95,14 @@ public class ArtistService { artistInfoDao.save(artistInfo); // 新增音乐人负责人信息 - ArtistResponsible artistResponsible = ArtistResponsible.builder() - .id(String.valueOf(idWorker.nextId())) - .userId(userInfo.getId()) - .sex(artistRegisterDto.getSex()) - .name(artistRegisterDto.getNickName()) - .mobile(artistRegisterDto.getMobile()) - .build(); - artistResponsibleDao.save(artistResponsible); +// ArtistResponsible artistResponsible = ArtistResponsible.builder() +// .id(String.valueOf(idWorker.nextId())) +// .userId(userInfo.getId()) +// .sex(artistRegisterDto.getSex()) +// .name(artistRegisterDto.getNickName()) +// .mobile(artistRegisterDto.getMobile()) +// .build(); +// artistResponsibleDao.save(artistResponsible); // 审核记录 List successList = userProcessDao.findUserProcessByUserIdAndTypeAndStatus(userInfo.getId(), UserProcessTypeEnum.ARTIST.getCode(), UserProcessStatusEnum.SUCCESS.getCode()); @@ -121,6 +124,32 @@ public class ArtistService { userProcessDao.save(userProcess); } + /** + * 音乐人审核 + * + * @param userProcessApproveDto 审核实体类 + */ + @Transactional(rollbackFor = Exception.class) + public void approve(UserProcessApproveDto userProcessApproveDto) { + if(ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus()) + && StringUtils.isBlank(userProcessApproveDto.getContent())) { + throw new RuntimeException("请填写拒绝理由!"); + } + + UserProcess userProcessById = userProcessDao.findUserProcessById(userProcessApproveDto.getId()); + userProcessById.setContent(userProcessApproveDto.getContent()); + userProcessById.setModifyTime(new Date()); + userProcessById.setStatus(userProcessApproveDto.getStatus()); + + userProcessDao.save(userProcessById); + + UserInfo userInfo = userInfoDao.findById(userProcessById.getUserId()).get(); + userInfo.setStatus(ObjectUtils.equals(UserProcessStatusEnum.FAIL.getCode(), userProcessApproveDto.getStatus())? + UserStatusEnum.DISABLE.getStatus() : UserStatusEnum.ENABLE.getStatus()); + userInfo.setModifyTime(new Date()); + userInfoDao.save(userInfo); + } + /** * 音乐人-成员绑定 *