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 c9ef17a..bb8d63e 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 @@ -8,7 +8,6 @@ import com.luoo.user.dto.artist.ArtistSearchDto; import com.luoo.user.dto.artist.ArtistUserBindDto; import com.luoo.user.pojo.ArtistInfo; import com.luoo.user.pojo.ArtistRegister; -import com.luoo.user.pojo.UserProcess; import com.luoo.user.service.ArtistService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -54,7 +53,7 @@ public class ArtistController { public Result approve( @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "音乐人审核对象", required = true) @Validated @RequestBody UserProcessApproveDto userProcessApproveDto) { - artistService.approve(userProcessApproveDto); + artistService.approve(authorization, userProcessApproveDto); return Result.success(); } 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 3cfe175..aea121b 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 @@ -148,10 +148,11 @@ public class ArtistService { /** * 音乐人审核 * + * @param token 当前登录信息 * @param userProcessApproveDto 审核实体类 */ @Transactional(rollbackFor = Exception.class) - public void approve(UserProcessApproveDto userProcessApproveDto) { + public void approve(String token, UserProcessApproveDto userProcessApproveDto) { String title = ObjectUtils.equals(UserProcessStatusEnum.SUCCESS.getCode(), userProcessApproveDto.getStatus()) ? "音乐人审核通过" : "音乐人审核失败"; @@ -196,16 +197,19 @@ public class ArtistService { .build(); artistInfoDao.save(artistInfo); } - UserInfo sendUser = userInfoDao.findById(artistRegister.getCreateUser()).get(); + // 发送审核成功、失败的站内信 + // 发送人是当前登录用户 + // 接收人是音乐人注册人 + UserLoginDto currentUser = jwtUtil.getUserLoginDto(token); UserMessageDto userMessageDto = new UserMessageDto(); userMessageDto.setType(MessageTypeEnum.PRIVATE_MESSAGE.getType()); - userMessageDto.setSendUserId(sendUser.getId()); + userMessageDto.setSendUserId(currentUser.getUserId()); userMessageDto.setTitle(title); userMessageDto.setContent(content); userMessageDto.setUserId(artistRegister.getCreateUser()); - userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX + sendUser.getAvatar()); - userMessageDto.setSendUserNickName(sendUser.getNickName()); + userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX + currentUser.getAvatar()); + userMessageDto.setSendUserNickName(currentUser.getNickName()); userMessageService.sendUserMessage(userMessageDto); }