|
|
|
@ -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);
|
|
|
|
|