|
@@ -39,10 +39,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -202,6 +199,14 @@ public class TenantAlbumController {
|
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
|
throw new BizException("当前机构已有专辑");
|
|
|
}
|
|
|
+ // 检查曲目重复
|
|
|
+ if (CollectionUtils.isNotEmpty(album.getMusicSheetData())) {
|
|
|
+ List<Long> musicIds = album.getMusicSheetData().stream().flatMap(o -> o.getMusicSheetList().stream().map(m -> m.getId())).collect(Collectors.toList());
|
|
|
+ Set<Long> musicSet = new HashSet<>(musicIds);
|
|
|
+ if (musicSet.size() < musicIds.size()) {
|
|
|
+ throw new BizException("不予许添加相同的曲目");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
TenantAlbum tenantAlbum = JSON.parseObject(album.jsonString(), TenantAlbum.class);
|
|
|
List<TenantAlbumVo.MusicSheetData> musicSheetData = album.getMusicSheetData();
|
|
@@ -241,6 +246,15 @@ public class TenantAlbumController {
|
|
|
});
|
|
|
|
|
|
}
|
|
|
+ // 检查曲目重复
|
|
|
+ if (CollectionUtils.isNotEmpty(album.getMusicSheetData())) {
|
|
|
+ List<Long> musicIds = album.getMusicSheetData().stream().flatMap(o -> o.getMusicSheetList().stream().map(m -> m.getId())).collect(Collectors.toList());
|
|
|
+ Set<Long> musicSet = new HashSet<>(musicIds);
|
|
|
+ if (musicSet.size() < musicIds.size()) {
|
|
|
+ throw new BizException("不予许添加相同的曲目");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
TenantAlbum tenantAlbum = JSON.parseObject(album.jsonString(), TenantAlbum.class);
|
|
|
List<TenantAlbumVo.MusicSheetData> musicSheetData = album.getMusicSheetData();
|
|
|
|