release- 处理专辑不可抗力原因状态

release-2024-08-08
pikaqiudeshujia 7 months ago
parent f8343b1f1f
commit a1354429fb

@ -12,6 +12,8 @@ import lombok.Getter;
*/ */
@Getter @Getter
public enum AlbumStateEnum { public enum AlbumStateEnum {
FORCE(-1 ,"不可抗力原因不允许显示"),
SAVE(0, "新建"), SAVE(0, "新建"),
IN_APPROVE(1, "待审核"), IN_APPROVE(1, "待审核"),
@ -20,7 +22,9 @@ public enum AlbumStateEnum {
WAIT_ARRIVE(3, "待上架"), WAIT_ARRIVE(3, "待上架"),
ARRIVED(4, "已上架") ARRIVED(4, "已上架"),
DELETE(5, "已删除")
; ;
private Integer code; private Integer code;

@ -102,6 +102,7 @@ public class AlbumService {
private Specification<ArtistAlbum> buildSearchSpecification(AlbumSearchDTO param) { private Specification<ArtistAlbum> buildSearchSpecification(AlbumSearchDTO param) {
return (Root<ArtistAlbum> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> { return (Root<ArtistAlbum> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
List<Predicate> predicateList = new ArrayList<Predicate>(); List<Predicate> predicateList = new ArrayList<Predicate>();
predicateList.add(builder.notEqual(root.get("state"), AlbumStateEnum.FORCE.getCode()));
if (StringUtils.isNotBlank(param.getArtistId())) { if (StringUtils.isNotBlank(param.getArtistId())) {
// 音乐人id // 音乐人id
predicateList.add(builder.equal(root.get("artistId"), param.getArtistId())); predicateList.add(builder.equal(root.get("artistId"), param.getArtistId()));
@ -169,6 +170,9 @@ public class AlbumService {
if (artistAlbum == null) { if (artistAlbum == null) {
throw new RuntimeException("专辑不存在,请刷新后重试"); throw new RuntimeException("专辑不存在,请刷新后重试");
} }
if (ObjectUtils.equals(AlbumStateEnum.FORCE.getCode(), artistAlbum.getState())) {
throw new RuntimeException("专辑因不可抗力原因无法显示");
}
// 整个数据库所有的tag // 整个数据库所有的tag
List<Tag> tagAllList = tagDao.findAll(); List<Tag> tagAllList = tagDao.findAll();

Loading…
Cancel
Save