|
@@ -349,7 +349,8 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
|
}
|
|
|
|
|
|
//递归处理CbsLessonCoursewareDetailWrapper.KnowledgePointSmall
|
|
|
- private void setTreeResourceId(List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> knowledgePointList,LessonCoursewareWrapper.LessonCoursewareDetailQuery query){
|
|
|
+ @Override
|
|
|
+ public void setTreeResourceId(List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> knowledgePointList,LessonCoursewareWrapper.LessonCoursewareDetailQuery query){
|
|
|
if(CollectionUtils.isNotEmpty(knowledgePointList)){
|
|
|
knowledgePointList.forEach(knowledgePointSmall -> {
|
|
|
this.setResourceId(knowledgePointSmall,query);
|
|
@@ -365,9 +366,19 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
|
private void setResourceId(CbsLessonCoursewareDetailWrapper.KnowledgePointSmall knowledgePointSmall,LessonCoursewareWrapper.LessonCoursewareDetailQuery query){
|
|
|
List<CbsLessonCoursewareDetailWrapper.MaterialSmall> materialList = knowledgePointSmall.getMaterialList();
|
|
|
if(CollectionUtils.isNotEmpty(materialList)){
|
|
|
+ //获取所有曲目的ID
|
|
|
+ List<Long> musicScoreIds = materialList.stream().filter(materialSmall -> materialSmall.getType() == EMaterialType.SONG)
|
|
|
+ .map(materialSmall -> Long.parseLong(materialSmall.getContent())).collect(Collectors.toList());
|
|
|
+ Map<Long, SysMusicScore> musicScoreMap = new HashMap<>();
|
|
|
+ if(CollectionUtils.isNotEmpty(musicScoreIds)){
|
|
|
+ List<SysMusicScore> musicScores = sysMusicScoreService.getDao().findByCbsId(musicScoreIds,false);
|
|
|
+ if(CollectionUtils.isNotEmpty(musicScores)){
|
|
|
+ musicScoreMap = musicScores.stream().collect(Collectors.toMap(e->e.getId().longValue(), o -> o));
|
|
|
+ }
|
|
|
+ }
|
|
|
for (CbsLessonCoursewareDetailWrapper.MaterialSmall materialSmall : materialList) {
|
|
|
if(materialSmall.getType() == EMaterialType.SONG){
|
|
|
- SysMusicScore musicScore = sysMusicScoreService.getDao().getCbsId(Long.parseLong(materialSmall.getContent()));
|
|
|
+ SysMusicScore musicScore = musicScoreMap.get(Long.parseLong(materialSmall.getContent()));
|
|
|
//没有启用的曲目不显示
|
|
|
if(musicScore != null && musicScore.getShowFlag() == 1 && musicScore.getClientShowFlag() == 1) {
|
|
|
materialSmall.setContent(musicScore.getId().toString());
|
|
@@ -378,11 +389,23 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
|
|
|
//
|
|
|
List<CbsMaterialRefWrapper.AddMaterialRef> materialRefs = materialSmall.getMaterialRefs();
|
|
|
if (CollectionUtils.isNotEmpty(materialRefs)){
|
|
|
+ //获取所有曲目的ID
|
|
|
+ List<Long> musicScoreIds1 = materialRefs.stream().filter(materialRef -> materialRef.getRelateMaterialInfo() != null
|
|
|
+ && StringUtils.equals(materialRef.getRelateMaterialInfo().getType(),"SONG")
|
|
|
+ && CollectionUtils.isNotEmpty(materialRef.getRelateMaterialInfo().getApplicationIdList()))
|
|
|
+ .map(materialRef -> materialRef.getRelateMaterialInfo().getId()).collect(Collectors.toList());
|
|
|
+ Map<Long, SysMusicScore> musicScoreMap1 = new HashMap<>();
|
|
|
+ if(CollectionUtils.isNotEmpty(musicScoreIds1)){
|
|
|
+ List<SysMusicScore> musicScores = sysMusicScoreService.getDao().findByCbsId(musicScoreIds1,false);
|
|
|
+ if(CollectionUtils.isNotEmpty(musicScores)){
|
|
|
+ musicScoreMap1 = musicScores.stream().collect(Collectors.toMap(e->e.getId().longValue(), o -> o));
|
|
|
+ }
|
|
|
+ }
|
|
|
for (CbsMaterialRefWrapper.AddMaterialRef materialRef : materialRefs) {
|
|
|
CbsMaterialRefWrapper.RelateMaterialInfo relateMaterialInfo = materialRef.getRelateMaterialInfo();
|
|
|
if(relateMaterialInfo != null && StringUtils.equals(relateMaterialInfo.getType(),"SONG")
|
|
|
&& CollectionUtils.isNotEmpty(relateMaterialInfo.getApplicationIdList())){
|
|
|
- SysMusicScore musicScore = sysMusicScoreService.getDao().getCbsId(relateMaterialInfo.getId());
|
|
|
+ SysMusicScore musicScore = musicScoreMap1.get(relateMaterialInfo.getId());
|
|
|
if(musicScore != null && musicScore.getShowFlag() == 1 && musicScore.getClientShowFlag() == 1
|
|
|
&& query.getTenantCategoriesIdList().contains(musicScore.getCbsMusicCategoriesId())) {
|
|
|
materialRef.setResourceIdStr(musicScore.getId().toString());
|