release- 音乐人查询接口新增播放次数+关注数量,专辑查询接口新增播放次数

release-2024-08-08
pikaqiudeshujia 5 months ago
parent 9d0ab8c0d7
commit 2b2093d76a

@ -2,10 +2,7 @@ package com.luoo.music.controller;
import api.PageResult; import api.PageResult;
import api.Result; import api.Result;
import com.luoo.music.dto.response.AlbumAddDTO; import com.luoo.music.dto.response.*;
import com.luoo.music.dto.response.AlbumSearchDTO;
import com.luoo.music.dto.response.AlbumSongAddDTO;
import com.luoo.music.dto.response.AlbumUpdateDTO;
import com.luoo.music.pojo.ArtistAlbum; import com.luoo.music.pojo.ArtistAlbum;
import com.luoo.music.service.AlbumService; import com.luoo.music.service.AlbumService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -34,7 +31,7 @@ public class AlbumController {
@ApiOperation(value = "分页查询专辑列表", notes = "查询专辑") @ApiOperation(value = "分页查询专辑列表", notes = "查询专辑")
@RequestMapping(value = "/list/{page}/{size}", method = RequestMethod.POST) @RequestMapping(value = "/list/{page}/{size}", method = RequestMethod.POST)
public Result<PageResult<ArtistAlbum>> search(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, public Result<PageResult<AlbumResultDTO>> search(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "专辑查询对象", required = true) @RequestBody AlbumSearchDTO albumSearchDTO, @ApiParam(value = "专辑查询对象", required = true) @RequestBody AlbumSearchDTO albumSearchDTO,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size @ApiParam(value = "每页条数", required = true) @PathVariable Integer size

@ -0,0 +1,150 @@
package com.luoo.music.dto.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.luoo.music.pojo.SongInfo;
import com.luoo.music.pojo.Tag;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.Transient;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* @Author: yawei.huang
* @Package: com.luoo.music.dto.response
* @Project: luoo_parent
* @Date: 2024/6/19 13:44
* @Filename: AlbumResultDTO
* @Describe:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class AlbumResultDTO implements Serializable {
private String id;
/**
*
*/
@ApiModelProperty("专辑名称")
private String name;
/**
*
*/
@ApiModelProperty("专辑类型")
private Integer type;
/**
*
*/
@ApiModelProperty("专辑封面")
private String image;
/**
*
*/
@ApiModelProperty("专辑状态 -1不可抗力原因不允许显示 0新建 1待审核 2退回 3待上架 4已上架 5已删除")
private Integer state;
/**
*
*/
@ApiModelProperty("发行日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date publishDate;
/**
*
*/
@ApiModelProperty("风格str")
private String mainStyle;
/**
*
*/
@ApiModelProperty("专辑条码")
private String barcode;
/**
*
*/
@ApiModelProperty("专辑描述")
private String description;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@CreatedDate
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@LastModifiedDate
@ApiModelProperty("修改时间")
private LocalDateTime updateTime;
/**
* id
*/
@ApiModelProperty("音乐人id")
private String artistId;
/**
*
*/
@ApiModelProperty("音乐人昵称")
private String artistName;
/**
*
*/
@ApiModelProperty("创建人")
private String createUser;
/**
*
*/
@ApiModelProperty("修改人")
private String updateUser;
// @ApiModelProperty("收费类型 1-下载 2-试听及下载")
// private Integer chargeType;
@Transient
@ApiModelProperty("专辑歌曲绑定关系")
private List<SongInfo> songList;
@Transient
@ApiModelProperty("价格")
private BigDecimal price;
@Transient
@ApiModelProperty("风格列表")
private List<Tag> style;
@Transient
@ApiModelProperty("专辑状态-中文")
private String stateStr;
@ApiModelProperty("专辑版本")
private Integer version;
@ApiModelProperty("播放次数")
private Long playsCount;
}

@ -85,7 +85,7 @@ public class AlbumService {
@Autowired @Autowired
private ApproveDao approveDao; private ApproveDao approveDao;
public PageResult<ArtistAlbum> getList(AlbumSearchDTO albumSearchDTO, Integer page, Integer size) { public PageResult<AlbumResultDTO> getList(AlbumSearchDTO albumSearchDTO, Integer page, Integer size) {
List<ArtistAlbum> result = new ArrayList<>(); List<ArtistAlbum> result = new ArrayList<>();
Sort sort = new Sort(Sort.Direction.DESC, "createTime"); Sort sort = new Sort(Sort.Direction.DESC, "createTime");
PageRequest pageRequest = PageRequest.of(page - 1, size, sort); PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
@ -98,6 +98,8 @@ public class AlbumService {
} }
result = albumPage.getContent(); result = albumPage.getContent();
List<AlbumResultDTO> albumResultDTOList = new ArrayList<>();
for (ArtistAlbum artistAlbum : result) { for (ArtistAlbum artistAlbum : result) {
if (artistAlbum.getState() != null) { if (artistAlbum.getState() != null) {
@ -106,11 +108,14 @@ public class AlbumService {
artistAlbum.setStateStr(byStatus != null ? byStatus.getDesc() : ""); artistAlbum.setStateStr(byStatus != null ? byStatus.getDesc() : "");
} }
//todo 传递点赞,喜欢,评论,收益 //todo 传递点赞,喜欢,评论,收益
AlbumResultDTO albumResultDTO = new AlbumResultDTO();
BeanUtils.copyProperties(result, albumResultDTO);
albumResultDTOList.add(albumResultDTO);
} }
long totalElements = albumPage.getTotalElements(); long totalElements = albumPage.getTotalElements();
return new PageResult<>(totalElements, result); return new PageResult<>(totalElements, albumResultDTOList);
} }
/** /**

@ -116,4 +116,11 @@ public class ArtistRegister implements Serializable {
@ApiModelProperty("编号") @ApiModelProperty("编号")
private String serialNo; private String serialNo;
@ApiModelProperty("关注数量")
private Long followCount;
@ApiModelProperty("播放次数")
private Long playsCount;
} }

Loading…
Cancel
Save