1.fix song collect status

main
Gary 9 months ago
parent dc0083e0f9
commit 254863f7cc

@ -146,7 +146,7 @@ public class JournalController {
@VerifyParam CollectQueryReq queryReq) {
List<String> 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<String> getJournalObjectIds(CollectQueryReq queryReq) {

@ -91,23 +91,23 @@ public class SongController {
@VerifyParam CollectQueryReq queryReq) {
List<String> 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<PageResult<SongRespDTO>> getCollectSongs(String loginUserId, String queryUserId, List<String> objectIds) {
public Result<PageResult<SongRespDTO>> getCollectSongs(String loginUserId, String queryUserId, List<String> objectIds, boolean isJouranlSource) {
if (objectIds.isEmpty()) {
return Result.success(new PageResult<SongRespDTO>(0L, Collections.emptyList()));
}
List<SongInfo> songs = songInfoService.orderByField(objectIds);
Set<String> songCollectSet = getMyCollectSet(loginUserId,queryUserId,objectIds);
Set<String> songCollectSet = getMyCollectSet(loginUserId,queryUserId,objectIds,isJouranlSource);
List<SongRespDTO> results = songs.stream().map(s -> SongMapper.getSongRespDTO(s, songCollectSet))
.collect(Collectors.toList());
return Result.success(new PageResult<SongRespDTO>(Long.valueOf(results.size()), results));
}
private Set<String> getMyCollectSet(String loginUser, String checkUser, List<String> objectIds) {
if(loginUser.equals(checkUser)) {
private Set<String> getMyCollectSet(String loginUser, String checkUser, List<String> objectIds, boolean isJouranlSource) {
if(loginUser.equals(checkUser)&&!isJouranlSource) {
return new HashSet<>(objectIds);
}
List<String> myObjectIds=userCollectInfoService.findByUserIdAndCollectTypeAndObjectIdIn(loginUser,CollectTypeEnum.SONG,objectIds);

Loading…
Cancel
Save