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 c5e70aa..49903e8 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 @@ -71,6 +71,9 @@ public class CMSJournalService { List journalIdsByTags = null; if (!CollectionUtils.isEmpty(param.getTags())) { journalIdsByTags = journalTagDao.findJournalIdsByTags(param.getTags()); + if (journalIdsByTags.size() == 0) { + return Result.success(new PageResult<>(0L, result)); + } } Specification journalSpecification = buildSearchSpecification(param, journalIdsByTags); journalPage = journalDao.findAll(journalSpecification, pageRequest); @@ -87,9 +90,9 @@ public class CMSJournalService { for (Journal item : content) { JournalVO response = new JournalVO(); response.setId(item.getId()); - response.setJournalNo(Constants.JOURNAL_NO_PREF + item.getJournalNo()); + response.setJournalNo(item.getJournalNo()); response.setTitle(item.getTitle()); - response.setImage(item.getImage()); + response.setImage(Constants.IMAGE_RESOURCE_PREFIX + item.getImage()); response.setCreateTime(item.getCreateTime().format(Constants.formatter)); response.setState(item.getState()); response.setIsPublish(item.getIsPublish()); @@ -184,7 +187,8 @@ public class CMSJournalService { } Tag tag = idTagMap.get(item.getTagId()); if (StringUtils.isNotBlank(tag.getParentId())) { - list.add(tag.getNameCh()); + // list.add(tag.getNameCh()); + list.add(tag.getId()); } journalTagMap.put(journalId, list); } @@ -337,10 +341,10 @@ public class CMSJournalService { songVO.setArtist(item.getArtist()); songVO.setAlbum(item.getAlbum()); if (StringUtils.isNotBlank(item.getUrl())) { - songVO.setUrl(Constants.RESOURCE_PREFIX + Constants.MUSIC_KEY_PREFIX + item.getUrl()); + songVO.setUrl(Constants.MUSIC_RESOURCE_PREFIX + item.getUrl()); } if (StringUtils.isNotBlank(item.getImage())) { - songVO.setImage(Constants.RESOURCE_PREFIX + Constants.MUSIC_KEY_PREFIX + item.getImage()); + songVO.setImage(Constants.MUSIC_RESOURCE_PREFIX + item.getImage()); } list.add(songVO); } diff --git a/luoo_music/src/main/java/com/luoo/music/service/CMSSongService.java b/luoo_music/src/main/java/com/luoo/music/service/CMSSongService.java index 2510a0b..647ca8f 100644 --- a/luoo_music/src/main/java/com/luoo/music/service/CMSSongService.java +++ b/luoo_music/src/main/java/com/luoo/music/service/CMSSongService.java @@ -90,14 +90,14 @@ public class CMSSongService { response.setArtist(item.getArtist()); response.setAlbum(item.getAlbum()); response.setTags(songTagMap.get(id)); - response.setImage(item.getImage()); + response.setImage(Constants.SONG_RESOURCE_PREFIX + item.getImage()); response.setSize(CommonUtil.formatSongSize(item.getSize())); response.setDuration(CommonUtil.formatSongDuration(item.getDuration())); response.setJournal(songJournalMap.get(id)); response.setUpdateTime(item.getUpdateTime().format(Constants.formatter)); response.setState(item.getState()); response.setUserId(item.getUserId()); - response.setUrl(item.getUrl()); + response.setUrl(Constants.SONG_RESOURCE_PREFIX + item.getUrl()); result.add(response); } } @@ -180,7 +180,8 @@ public class CMSSongService { } if (idTagMap.keySet().contains(tagId)) { Tag tag = idTagMap.get(tagId); - list.add(tag.getNameCh()); + // list.add(tag.getNameCh()); + list.add(tag.getId()); } result.put(songId, list); } @@ -319,6 +320,7 @@ public class CMSSongService { */ public Result update(String id, String token, SongAddModel param) { SongInfo song = buildSong(id, param, token); + SongInfo oldSong = songDao.findById(id).get(); String url = null; if (param.getUrl().contains(Constants.TEMP_KEY_PREFIX)) { url = moveSongFile(id, param); @@ -328,6 +330,10 @@ public class CMSSongService { song.setUrl(url); song.setSize(param.getSize()); song.setDuration(param.getDuration()); + } else { + song.setUrl(oldSong.getUrl()); + song.setSize(oldSong.getSize()); + song.setDuration(oldSong.getDuration()); } String image = null; if (param.getImage().contains(Constants.TEMP_KEY_PREFIX)) { @@ -336,8 +342,9 @@ public class CMSSongService { Result.failed("更新失败"); } song.setImage(image); + } else { + song.setImage(oldSong.getImage()); } - SongInfo oldSong = songDao.findById(id).get(); song.setState(oldSong.getState()); songDao.save(song); songTagDao.deleteBySongId(id);