From 254863f7cc367e980a8227bd44935d796048aa18 Mon Sep 17 00:00:00 2001 From: Gary Date: Sun, 3 Mar 2024 00:35:54 +0800 Subject: [PATCH] 1.fix song collect status --- .../com/luoo/music/controller/JournalController.java | 2 +- .../java/com/luoo/music/controller/SongController.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java b/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java index 3262489..5b770a1 100644 --- a/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java +++ b/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java @@ -146,7 +146,7 @@ public class JournalController { @VerifyParam CollectQueryReq queryReq) { List objectIds= getJournalObjectIds(queryReq); UserLoginDto user = jwtUtil.getUserLoginDto(authorization); - return songController.getCollectSongs(user.getUserId(), queryReq.getUserId(),objectIds); + return songController.getCollectSongs(user.getUserId(), queryReq.getUserId(),objectIds, true); } private List getJournalObjectIds(CollectQueryReq queryReq) { diff --git a/luoo_music/src/main/java/com/luoo/music/controller/SongController.java b/luoo_music/src/main/java/com/luoo/music/controller/SongController.java index 33bdc19..e208887 100644 --- a/luoo_music/src/main/java/com/luoo/music/controller/SongController.java +++ b/luoo_music/src/main/java/com/luoo/music/controller/SongController.java @@ -91,23 +91,23 @@ public class SongController { @VerifyParam CollectQueryReq queryReq) { List objectIds= getSongIds(queryReq); UserLoginDto user = jwtUtil.getUserLoginDto(authorization); - return getCollectSongs(user.getUserId(),queryReq.getUserId(),objectIds); + return getCollectSongs(user.getUserId(),queryReq.getUserId(),objectIds,false); } - public Result> getCollectSongs(String loginUserId, String queryUserId, List objectIds) { + public Result> getCollectSongs(String loginUserId, String queryUserId, List objectIds, boolean isJouranlSource) { if (objectIds.isEmpty()) { return Result.success(new PageResult(0L, Collections.emptyList())); } List songs = songInfoService.orderByField(objectIds); - Set songCollectSet = getMyCollectSet(loginUserId,queryUserId,objectIds); + Set songCollectSet = getMyCollectSet(loginUserId,queryUserId,objectIds,isJouranlSource); List results = songs.stream().map(s -> SongMapper.getSongRespDTO(s, songCollectSet)) .collect(Collectors.toList()); return Result.success(new PageResult(Long.valueOf(results.size()), results)); } - private Set getMyCollectSet(String loginUser, String checkUser, List objectIds) { - if(loginUser.equals(checkUser)) { + private Set getMyCollectSet(String loginUser, String checkUser, List objectIds, boolean isJouranlSource) { + if(loginUser.equals(checkUser)&&!isJouranlSource) { return new HashSet<>(objectIds); } List myObjectIds=userCollectInfoService.findByUserIdAndCollectTypeAndObjectIdIn(loginUser,CollectTypeEnum.SONG,objectIds);