|
|
@ -45,8 +45,8 @@ public class SongController {
|
|
|
|
private JournalSongService journalSongService;
|
|
|
|
private JournalSongService journalSongService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private JournalService journalService;
|
|
|
|
private JournalService journalService;
|
|
|
|
@Autowired
|
|
|
|
//@Autowired
|
|
|
|
private SongInfoService songInfoService;
|
|
|
|
//private SongInfoService songInfoService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private JwtUtil jwtUtil;
|
|
|
|
private JwtUtil jwtUtil;
|
|
|
|
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ public class SongController {
|
|
|
|
return Result.unauthorized(null);
|
|
|
|
return Result.unauthorized(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<JournalSong> songs = journalSongService.findByVolid(journalNo);
|
|
|
|
List<JournalSong> songs = journalSongService.findByVolid(journalNo);
|
|
|
|
List<String> ids=songs.stream().map(JournalSong::getSongId).collect(Collectors.toList());
|
|
|
|
List<String> ids=songs.stream().map(JournalSong::getJournalNoSongId).collect(Collectors.toList());
|
|
|
|
Set<String> songCollectSet = null == user ? Collections.emptySet()
|
|
|
|
Set<String> songCollectSet = null == user ? Collections.emptySet()
|
|
|
|
: userCollectInfoService.getCollectSet(user.getUserId(),ids, CollectTypeEnum.SONG);
|
|
|
|
: userCollectInfoService.getCollectSet(user.getUserId(),ids, CollectTypeEnum.SONG);
|
|
|
|
List<SongRespDTO> results = songs.stream().map(s -> SongMapper.getSongRespDTO(s, songCollectSet))
|
|
|
|
List<SongRespDTO> results = songs.stream().map(s -> SongMapper.getSongRespDTO(s, songCollectSet))
|
|
|
@ -99,7 +99,7 @@ public class SongController {
|
|
|
|
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<JournalSong> songs = journalSongService.orderByField(objectIds);
|
|
|
|
Set<String> songCollectSet = getMyCollectSet(loginUserId,queryUserId,objectIds,isJouranlSource);
|
|
|
|
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());
|
|
|
@ -131,10 +131,10 @@ public class SongController {
|
|
|
|
public Result<List<SongRespDTO>> random(
|
|
|
|
public Result<List<SongRespDTO>> random(
|
|
|
|
@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
@PathVariable @VerifyParam(required = true, regex = VerifyRegexEnum.RANDOM_SONG_LIMIT) Integer limit) {
|
|
|
|
@PathVariable @VerifyParam(required = true, regex = VerifyRegexEnum.RANDOM_SONG_LIMIT) Integer limit) {
|
|
|
|
List<SongInfo> songs = songInfoService.random(limit);
|
|
|
|
List<JournalSong> songs = journalSongService.random(limit);
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
|
|
|
|
|
|
|
|
List<String> ids=songs.stream().map(SongInfo::getId).collect(Collectors.toList());
|
|
|
|
List<String> ids=songs.stream().map(JournalSong::getJournalNoSongId).collect(Collectors.toList());
|
|
|
|
Set<String> songCollectSet = null == user ? Collections.emptySet()
|
|
|
|
Set<String> songCollectSet = null == user ? Collections.emptySet()
|
|
|
|
: userCollectInfoService.getCollectSet(user.getUserId(),ids, CollectTypeEnum.SONG);
|
|
|
|
: userCollectInfoService.getCollectSet(user.getUserId(),ids, CollectTypeEnum.SONG);
|
|
|
|
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ public class SongController {
|
|
|
|
@GlobalInterceptor
|
|
|
|
@GlobalInterceptor
|
|
|
|
public Result<SongRespDTO> findById(@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
public Result<SongRespDTO> findById(@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
@PathVariable @VerifyParam(required = true) String id) {
|
|
|
|
@PathVariable @VerifyParam(required = true) String id) {
|
|
|
|
SongInfo song = songInfoService.findById(id);
|
|
|
|
JournalSong song = journalSongService.findByJournalNoSongId(id);
|
|
|
|
if(null==song) {
|
|
|
|
if(null==song) {
|
|
|
|
return Result.failed(StatusCode.MUSIC_COMMON_FAILED,"找不到歌曲, id: "+id);
|
|
|
|
return Result.failed(StatusCode.MUSIC_COMMON_FAILED,"找不到歌曲, id: "+id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|