|
@@ -117,6 +117,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
@Resource
|
|
|
private SubjectService subjectService;
|
|
|
@Resource
|
|
|
+ private InstrumentService instrumentService;
|
|
|
+ @Resource
|
|
|
private TeacherService teacherService;
|
|
|
@Resource
|
|
|
private CourseCoursewareService courseCoursewareService;
|
|
@@ -567,6 +569,32 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
throw new BizException("未找到曲目信息");
|
|
|
}
|
|
|
if(detailVo.getDelFlag()){
|
|
|
+ //获取乐器名称
|
|
|
+ List<MusicSheetAccompaniment> background = detailVo.getBackground();
|
|
|
+ if (CollectionUtils.isNotEmpty(background)) {
|
|
|
+ String instrumentIds = background.stream().map(e -> e.getMusicalInstrumentId()).filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
|
|
+ if (StringUtils.isNotEmpty(instrumentIds)) {
|
|
|
+ List<Long> instrumentIsList = Arrays.stream(instrumentIds.split(",")).map(Long::valueOf).distinct().collect(Collectors.toList());
|
|
|
+ List<InstrumentWrapper.Instrument> instruments = instrumentService.getInstruments(instrumentIsList);
|
|
|
+ Map<Long,InstrumentWrapper.Instrument> instrumentMap =
|
|
|
+ instruments.stream().collect(Collectors.toMap(InstrumentWrapper.Instrument::getId, o -> o, (o1, o2) -> o1));
|
|
|
+ for (MusicSheetAccompaniment accompaniment : background) {
|
|
|
+ if (StringUtils.isNotEmpty(accompaniment.getMusicalInstrumentId())){
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : accompaniment.getMusicalInstrumentId().split(",")) {
|
|
|
+ InstrumentWrapper.Instrument instrument = instrumentMap.get(Long.parseLong(s));
|
|
|
+ if (instrument != null){
|
|
|
+ if(sb.length() > 0) {
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(instrument.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ accompaniment.setMusicalInstrumentName(sb.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return detailVo;
|
|
|
}
|
|
|
MusicSheetDetailVo detail = this.getCbsDetail(id);
|