From d209cc9b4fb5ae32a77db20d1f4ed0e290db1810 Mon Sep 17 00:00:00 2001 From: pikaqiudeshujia Date: Tue, 30 Apr 2024 10:24:27 +0800 Subject: [PATCH] =?UTF-8?q?release-=E4=B8=93=E8=BE=91=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8E=9F=E5=9E=8B=E5=9B=BE=E5=BE=AE=E8=B0=83?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/enums/SongVersionEnum.java | 34 ++++++++++++++++++ .../luoo/music/dto/response/AlbumAddDTO.java | 12 ++----- .../music/dto/response/AlbumSongAddDTO.java | 19 ++++++---- .../java/com/luoo/music/pojo/ArtistAlbum.java | 18 ++++------ .../java/com/luoo/music/pojo/SongInfo.java | 7 ++-- .../com/luoo/music/service/AlbumService.java | 35 +++++++++++++------ .../src/main/resources/sql/20240428.sql | 3 +- 7 files changed, 88 insertions(+), 40 deletions(-) create mode 100644 luoo_common/src/main/java/enums/SongVersionEnum.java diff --git a/luoo_common/src/main/java/enums/SongVersionEnum.java b/luoo_common/src/main/java/enums/SongVersionEnum.java new file mode 100644 index 0000000..195a8ef --- /dev/null +++ b/luoo_common/src/main/java/enums/SongVersionEnum.java @@ -0,0 +1,34 @@ +package enums; + +import lombok.Getter; + +/** + * @Author: yawei.huang + * @Package: enums + * @Project: luoo_parent + * @Date: 2024/4/30 9:47 + * @Filename: AlbumVersionEnum + * @Describe: 歌曲版本参数 + */ +@Getter +public enum SongVersionEnum { + RECORDING_STUDIO(1, "录音室"), + + LIVE(1, "Live"), + + DEMO(2, "Demo"), + + ACCOMPANIMENT(3, "伴奏"), + + OTHER(4, "其他"); + + private Integer code; + + private String desc; + + + SongVersionEnum(Integer code, String desc) { + this.code = code; + this.desc = desc; + } +} diff --git a/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumAddDTO.java b/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumAddDTO.java index b27e778..0c90b3f 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumAddDTO.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumAddDTO.java @@ -29,7 +29,6 @@ public class AlbumAddDTO implements Serializable { * 专辑封面 */ @ApiModelProperty("专辑封面") - @NotNull(message = "专辑封面不能为空") private String image; /** * 专辑版本 @@ -44,15 +43,10 @@ public class AlbumAddDTO implements Serializable { /** * 主要风格 */ - @ApiModelProperty("主要风格") - @NotNull(message = "主要风格不能为空") + @ApiModelProperty("风格") + @NotNull(message = "风格不能为空") private String mainStyle; - /** - * 次要风格 - */ - @NotNull(message = "次要风格不能为空") - @ApiModelProperty("次要风格") - private String subStyle; + /** * 专辑条码 */ diff --git a/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumSongAddDTO.java b/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumSongAddDTO.java index 235cc80..fca1c14 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumSongAddDTO.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/response/AlbumSongAddDTO.java @@ -3,6 +3,7 @@ package com.luoo.music.dto.response; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.List; @@ -23,15 +24,12 @@ public class AlbumSongAddDTO implements Serializable { private String name; @ApiModelProperty("语种") - @NotNull(message = "语种不能为空") private Integer language; @ApiModelProperty("曲风") - @NotNull(message = "曲风不能为空") private List tags; @ApiModelProperty("售价") - @NotNull(message = "售价不能为空") private float price; @ApiModelProperty("作词") @@ -40,8 +38,8 @@ public class AlbumSongAddDTO implements Serializable { @ApiModelProperty("作曲") private String compositionName; - @ApiModelProperty("编曲") - private String arrangementName; +// @ApiModelProperty("编曲") +// private String arrangementName; @ApiModelProperty("歌词") private String lyric; @@ -50,8 +48,15 @@ public class AlbumSongAddDTO implements Serializable { @NotNull(message = "歌曲不能为空") private String url; - @ApiModelProperty("mv") - private String mvUrl; + @ApiModelProperty("歌曲版本") + private Integer version; + + @ApiModelProperty("歌手") + @NotBlank(message = "歌手不能为空") + private String albumStr; + +// @ApiModelProperty("mv") +// private String mvUrl; } diff --git a/luoo_music/src/main/java/com/luoo/music/pojo/ArtistAlbum.java b/luoo_music/src/main/java/com/luoo/music/pojo/ArtistAlbum.java index e0d5bf0..85a6741 100644 --- a/luoo_music/src/main/java/com/luoo/music/pojo/ArtistAlbum.java +++ b/luoo_music/src/main/java/com/luoo/music/pojo/ArtistAlbum.java @@ -51,11 +51,7 @@ public class ArtistAlbum implements Serializable { */ @ApiModelProperty("专辑状态") private Integer state; - /** - * 专辑版本 - */ - @ApiModelProperty("专辑版本") - private Integer version; + /** * 发行日期 */ @@ -64,13 +60,9 @@ public class ArtistAlbum implements Serializable { /** * 主要风格 */ - @ApiModelProperty("主要风格") + @ApiModelProperty("风格") private String mainStyle; - /** - * 次要风格 - */ - @ApiModelProperty("次要风格") - private String subStyle; + /** * 专辑条码 */ @@ -123,6 +115,10 @@ public class ArtistAlbum implements Serializable { @ApiModelProperty("专辑歌曲绑定关系") private List songList; + @Transient + @ApiModelProperty("价格") + private Float price; + } diff --git a/luoo_music/src/main/java/com/luoo/music/pojo/SongInfo.java b/luoo_music/src/main/java/com/luoo/music/pojo/SongInfo.java index 4723f06..b1c9ea8 100644 --- a/luoo_music/src/main/java/com/luoo/music/pojo/SongInfo.java +++ b/luoo_music/src/main/java/com/luoo/music/pojo/SongInfo.java @@ -104,12 +104,15 @@ public class SongInfo implements Serializable { @ApiModelProperty("作曲") private String compositionName; - @ApiModelProperty("编曲") - private String arrangementName; +// @ApiModelProperty("编曲") +// private String arrangementName; @ApiModelProperty("mv") private String mvUrl; @ApiModelProperty("语种") private Integer language; + + @ApiModelProperty("歌曲版本") + private Integer version; } diff --git a/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java b/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java index 9087fa8..cd9d308 100644 --- a/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java +++ b/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java @@ -19,6 +19,7 @@ import enums.AlbumStateEnum; import enums.SongInfoStateEnum; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -85,6 +86,9 @@ public class AlbumService { } result = albumPage.getContent(); + for (ArtistAlbum artistAlbum : result) { + + } long totalElements = albumPage.getTotalElements(); @@ -137,17 +141,17 @@ public class AlbumService { } } - if(StringUtils.isNotBlank(param.getName())) { + if (StringUtils.isNotBlank(param.getName())) { // 专辑名称 String likeExpression = "%" + param.getName() + "%"; predicateList.add(builder.and(builder.like(root.get("name"), likeExpression))); } - if(param.getStartTime() != null) { + if (param.getStartTime() != null) { predicateList.add(builder.greaterThanOrEqualTo(root.get("createTime"), param.getStartTime())); } - if(param.getEndTime() != null) { + if (param.getEndTime() != null) { predicateList.add(builder.lessThanOrEqualTo(root.get("createTime"), param.getEndTime())); } @@ -201,7 +205,6 @@ public class AlbumService { } else { for (AlbumSongAddDTO albumSongAddDTO : songAddList) { addSongForAlbum(albumSongAddDTO, user, artistAlbum); - } } } @@ -321,12 +324,24 @@ public class AlbumService { } // 专辑-音乐绑定 - ArtistAlbumSong artistAlbumSong = ArtistAlbumSong.builder() - .id(String.valueOf(idWorker.nextId())) - .songId(id) - .albumId(artistAlbum.getId()) - .build(); - artistAlbumSongDao.save(artistAlbumSong); + String albumStr = albumSongAddDTO.getAlbumStr(); + String[] albumArr = albumStr.split(","); + List artistAlbumSongList = new ArrayList<>(); + for (String s : albumArr) { + if (StringUtils.isNotBlank(s)) { + ArtistAlbumSong artistAlbumSong = ArtistAlbumSong.builder() + .id(String.valueOf(idWorker.nextId())) + .songId(id) + .albumId(artistAlbum.getId()) + .build(); + artistAlbumSongList.add(artistAlbumSong); + if (ObjectUtils.notEqual(user.getUserId(), s)) { + // todo 如果当前用户不是选定的歌手,需要发送站内消息 + } + } + } + artistAlbumSongDao.saveAll(artistAlbumSongList); + } diff --git a/luoo_music/src/main/resources/sql/20240428.sql b/luoo_music/src/main/resources/sql/20240428.sql index d9ee92c..989ff50 100644 --- a/luoo_music/src/main/resources/sql/20240428.sql +++ b/luoo_music/src/main/resources/sql/20240428.sql @@ -5,7 +5,6 @@ create table tb_artist_album name varchar(255) null comment '专辑名称', image varchar(255) null comment '专辑封面', state int null comment '专辑状态', - version int null comment '专辑版本', publish_date date null comment '发行日期', main_style varchar(500) null comment '主要风格', sub_style varchar(500) null comment '次要风格', @@ -47,4 +46,6 @@ alter table tb_song_info alter table tb_song_info add price float null comment '价格'; +alter table tb_song_info + add version int null comment '歌曲版本';