From 05b92c5565638a23ba55d434793927ed9a0bfc25 Mon Sep 17 00:00:00 2001 From: zhangjiabao Date: Thu, 8 Feb 2024 18:33:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=9F=E5=88=8A=20desc:=20=E6=9C=9F?= =?UTF-8?q?=E5=88=8A=E4=BF=9D=E5=AD=98=E6=97=B6=E6=AD=8C=E6=9B=B2=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=E6=9C=AA=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/luoo/music/service/CMSJournalService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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())));