|
@@ -494,6 +494,29 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
//按照sortNumber排序
|
|
|
// background.sort(Comparator.comparing(MusicSheetAccompaniment::getSortNumber));
|
|
|
detailVo.setBackground(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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -588,33 +611,33 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
}
|
|
|
throw new BizException("未找到曲目信息");
|
|
|
}
|
|
|
- //获取乐器名称
|
|
|
- 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(",");
|
|
|
+ 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());
|
|
|
}
|
|
|
- sb.append(instrument.getName());
|
|
|
}
|
|
|
+ accompaniment.setMusicalInstrumentName(sb.toString());
|
|
|
}
|
|
|
- accompaniment.setMusicalInstrumentName(sb.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if(detailVo.getDelFlag()){
|
|
|
return detailVo;
|
|
|
}
|
|
|
MusicSheetDetailVo detail = this.getCbsDetail(Long.parseLong(id));
|