| 
					
				 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.yonge.cooleshow.biz.dal.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.core.util.NumberUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.core.metadata.IPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,6 +35,7 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.stream.Stream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 机构专辑曲目 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -105,20 +107,6 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                              TenantAlbumMusicWrapper.StudentTenantAlbumMusicQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<TenantAlbumMusicWrapper.StudentTenantAlbumMusic> musicSheets = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (query.getSubjectType() != SubjectTypeEnum.COURSEWARE) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 如果分类不为空,查询分类下的曲目 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Long> categoryIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (query.getCategoryId() !=null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Long categoryId = getCategoryId(query.getSubjectType().name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                query.setCategoryId(categoryId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            MusicSheetCategoriesWrapper.MusicSheetCategories musicSheetCategories = musicFeignClientService.getChildTreeById(query.getCategoryId()).feignData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            categoryIds.add(query.getCategoryId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (musicSheetCategories !=null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                formatCategory(categoryIds, musicSheetCategories.getMusicSheetCategoriesList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            query.setCategoryIds(categoryIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicSheets = tenantAlbumMusicMapper.selectPage(page, query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (CollectionUtils.isEmpty(musicSheets)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -227,16 +215,6 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return page.setRecords(musicSheets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private void formatCategory(List<Long> categoryIds, List<MusicSheetCategoriesWrapper.MusicSheetCategories> musicSheetCategoriesList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(musicSheetCategoriesList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (MusicSheetCategoriesWrapper.MusicSheetCategories musicSheetCategories : musicSheetCategoriesList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            categoryIds.add(musicSheetCategories.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            formatCategory(categoryIds,musicSheetCategories.getMusicSheetCategoriesList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param tenantAlbumMusic TenantAlbumMusicWrapper.TenantAlbumMusic 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -307,46 +285,32 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 获取曲目所有分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> categoryIds = musicSheets.stream().map(MusicSheet::getTenantCategoryId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            .filter(StringUtils::isNotBlank).map(Long::parseLong).distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 查询分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        MusicSheetCategoriesWrapper.MusicSheetCategories musicSheetCategories = musicFeignClientService.getChildTreeById(getCategoryId(query.getSubjectType().name())).feignData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 过滤掉不存在的分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> ids = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        getCategory(musicSheetCategories.getMusicSheetCategoriesList(),categoryIds,ids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        filterCategory(musicSheetCategories.getMusicSheetCategoriesList(),ids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        data.setCategoyList(musicSheetCategories.getMusicSheetCategoriesList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<Long> typeIds =list.stream().map(TenantAlbumMusic::getType).distinct().filter(StringUtils::isNotBlank) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                .filter(NumberUtil::isNumber).map(Long::valueOf).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (!typeIds.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            List<TenantAlbumCategoryDetail> typeList = tenantAlbumCategoryDetailService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    .in(TenantAlbumCategoryDetail::getId, typeIds).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            List<String> typeNameList = typeList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    .map(TenantAlbumCategoryDetail::getValue).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            data.setTypes(typeNameList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            data.setTypeList(typeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            data.setTypes(new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        // 级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<Long> levelIds =list.stream().map(TenantAlbumMusic::getLevel).distinct().filter(StringUtils::isNotBlank) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                .filter(NumberUtil::isNumber).map(Long::valueOf).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (!levelIds.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            List<TenantAlbumCategoryDetail> levelList = tenantAlbumCategoryDetailService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    .in(TenantAlbumCategoryDetail::getId, levelIds).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            List<String> levelNameList = levelList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    .map(TenantAlbumCategoryDetail::getValue).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            data.setLevels(levelNameList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            data.setLevelList(levelList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            data.setLevels(new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> typeIds =list.stream().map(TenantAlbumMusic::getType).distinct().filter(StringUtils::isNotBlank) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .filter(NumberUtil::isNumber).map(Long::valueOf).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!typeIds.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<TenantAlbumCategoryDetail> typeList = tenantAlbumCategoryDetailService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .in(TenantAlbumCategoryDetail::getId, typeIds).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> typeNameList = typeList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .map(TenantAlbumCategoryDetail::getValue).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.setTypes(typeNameList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.setTypeList(typeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.setTypes(new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 级别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> levelIds =list.stream().map(TenantAlbumMusic::getLevel).distinct().filter(StringUtils::isNotBlank) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .filter(NumberUtil::isNumber).map(Long::valueOf).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!levelIds.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<TenantAlbumCategoryDetail> levelList = tenantAlbumCategoryDetailService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .in(TenantAlbumCategoryDetail::getId, levelIds).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> levelNameList = levelList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .map(TenantAlbumCategoryDetail::getValue).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.setLevels(levelNameList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.setLevelList(levelList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.setLevels(new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 声部 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String subjectIds = musicSheets.stream() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -376,59 +340,6 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private void filterCategory(List<MusicSheetCategoriesWrapper.MusicSheetCategories> musicSheetCategoriesList, List<Long> ids) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(musicSheetCategoriesList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (int i = 0; i < musicSheetCategoriesList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            MusicSheetCategoriesWrapper.MusicSheetCategories musicSheetCategories = musicSheetCategoriesList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!ids.contains(musicSheetCategories.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                musicSheetCategoriesList.remove(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                i--; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (CollectionUtils.isNotEmpty(musicSheetCategories.getMusicSheetCategoriesList())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                filterCategory(musicSheetCategories.getMusicSheetCategoriesList(), ids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private boolean getCategory(List<MusicSheetCategoriesWrapper.MusicSheetCategories> musicSheetCategoriesList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                List<Long> categoryIds, List<Long> result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        boolean flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(musicSheetCategoriesList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (MusicSheetCategoriesWrapper.MusicSheetCategories musicSheetCategories : musicSheetCategoriesList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (categoryIds.contains(musicSheetCategories.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                result.add(musicSheetCategories.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                flag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (CollectionUtils.isNotEmpty(musicSheetCategories.getMusicSheetCategoriesList())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                boolean b = getCategory(musicSheetCategories.getMusicSheetCategoriesList(), categoryIds, result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (b) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    result.add(musicSheetCategories.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                flag = flag || b; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private Long getCategoryId(String subjectType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (StringUtils.isBlank(subjectType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (SubjectTypeEnum.SUBJECT.name().equals(subjectType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.TENANT_ALBUM_SUBJECT_TYPE_CATEGORY)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if (SubjectTypeEnum.ENSEMBLE.name().equals(subjectType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.TENANT_ALBUM_ENSEMBLE_TYPE_CATEGORY)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } if (SubjectTypeEnum.MUSIC.name().equals(subjectType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.TENANT_ALBUM_MUSIC_TYPE_CATEGORY)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private List<ECourseType> courseTypeBySubject(Long subjectId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<ECourseType> courseTypeList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |