diff --git a/luoo_music/src/main/java/com/luoo/music/service/CMSJournalService.java b/luoo_music/src/main/java/com/luoo/music/service/CMSJournalService.java index dc97d22..b1ba294 100644 --- a/luoo_music/src/main/java/com/luoo/music/service/CMSJournalService.java +++ b/luoo_music/src/main/java/com/luoo/music/service/CMSJournalService.java @@ -441,8 +441,16 @@ public class CMSJournalService { Map songId2JournalSongIdMap=journalSongs.stream().collect(Collectors.toMap(JournalSong::getSongId, JournalSong::getId)); List updatedJournalSong = new ArrayList<>(); - for (int i = 0; i < songList.size(); i++) { - SongInfo song = songList.get(i); +// for (int i = 0; i < songList.size(); i++) { update: zjb from:gary 歌曲保存顺序问题 +// SongInfo song = songList.get(i); + for (int i = 0; i < param.getSongs().size(); i++) { + int finalI = i; + SongInfo song = songList.stream() + .filter(e -> e.getId().equals(param.getSongs().get(finalI))) + .findFirst().orElse(null); + if(null == song){ + continue; + } JournalSong journalSong = new JournalSong(); journalSong.setId(songId2JournalSongIdMap.getOrDefault(song.getId(), String.valueOf(idWorker.nextId())));