Selaa lähdekoodia

Merge branch 'zx_online_cbs' of http://git.dayaedu.com/yonge/cooleshow into develop-new

zouxuan 1 vuosi sitten
vanhempi
commit
ee91d8af0d

+ 1 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CbsMusicSheetServiceImpl.java

@@ -99,10 +99,7 @@ public class CbsMusicSheetServiceImpl implements CbsMusicSheetService {
 
     public PageInfo<CbsMusicSheetExtendWrapper.MusicSheetExtend> ownerList(CbsMusicSheetExtendWrapper.MusicSheetExtendQuery queryInfo){
         IPage<CbsMusicSheetExtendWrapper.MusicSheetExtend> page = QueryInfo.getPage(queryInfo);
-        if (queryInfo.getSourceType() == null){
-            throw new BizException("请选择来源类型");
-        }
-        if(queryInfo.getSourceType() == EMusicSourceType.PERSON){
+        if (queryInfo.getSourceType() == null || queryInfo.getSourceType() == EMusicSourceType.PERSON){
             return QueryInfo.pageInfo(musicSheetService.getDao().personOwnerList(page, queryInfo));
         }else {
             return QueryInfo.pageInfo(musicSheetService.getDao().orgOwnerList(page, queryInfo));

+ 44 - 21
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -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));