release-专辑功能根据原型图微调字段

release-2024-08-08
pikaqiudeshujia 7 months ago
parent 1cfd9c23ed
commit d209cc9b4f

@ -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;
}
}

@ -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;
/**
*
*/

@ -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<String> 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;
}

@ -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<SongInfo> songList;
@Transient
@ApiModelProperty("价格")
private Float price;
}

@ -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;
}

@ -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 {
}
// 专辑-音乐绑定
String albumStr = albumSongAddDTO.getAlbumStr();
String[] albumArr = albumStr.split(",");
List<ArtistAlbumSong> 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();
artistAlbumSongDao.save(artistAlbumSong);
artistAlbumSongList.add(artistAlbumSong);
if (ObjectUtils.notEqual(user.getUserId(), s)) {
// todo 如果当前用户不是选定的歌手,需要发送站内消息
}
}
}
artistAlbumSongDao.saveAll(artistAlbumSongList);
}

@ -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 '歌曲版本';

Loading…
Cancel
Save