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