|
@@ -2,7 +2,6 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.additional.update.impl.LambdaUpdateChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.beust.jcommander.internal.Lists;
|
|
@@ -54,6 +53,7 @@ import com.yonge.toolset.utils.easyexcel.ErrMsg;
|
|
|
import com.yonge.toolset.utils.easyexcel.ExcelDataReaderProperty;
|
|
|
import com.yonge.toolset.utils.easyexcel.ExcelException;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -1993,12 +1993,78 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
public List<MusicSheetDetailVo> auditDetailList(Long authMusicSheetId) {
|
|
|
MusicSheetAuthRecord musicSheetAuthRecord = musicSheetAuthRecordService.getById(authMusicSheetId);
|
|
|
List<MusicSheetDetailVo> sheetDetailVos = baseMapper.auditDetailList(musicSheetAuthRecord.getOriginalMusicSheetId(), authMusicSheetId);
|
|
|
- for (MusicSheetDetailVo next : sheetDetailVos) {
|
|
|
- if (CollectionUtils.isNotEmpty(next.getBackground())) {
|
|
|
- next.getBackground().sort(Comparator.comparing(MusicSheetAccompaniment::getSortNumber));
|
|
|
+ this.initMusicSheetDetailVo(sheetDetailVos);
|
|
|
+ return sheetDetailVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void initMusicSheetDetailVo(List<MusicSheetDetailVo> sheetDetailVos){
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
+ query.setApplicationId(applicationId);
|
|
|
+ query.setMusicSheetIds(sheetDetailVos.stream().map(e->e.getCbsMusicSheetId()).collect(Collectors.toList()));
|
|
|
+ query.setDelFlag(true);
|
|
|
+ query.setPage(1);
|
|
|
+ query.setRows(query.getMusicSheetIds().size());
|
|
|
+ R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(query);
|
|
|
+ if(pageInfoR.getCode() != 200){
|
|
|
+ throw new BizException("查询曲谱信息异常");
|
|
|
+ }
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
|
|
|
+ if (CollectionUtils.isEmpty(rows)){
|
|
|
+ throw new BizException("查询曲谱信息失败");
|
|
|
+ }
|
|
|
+ CbsSubjectApiWrapper.SubjectQuery subjectQuery = new CbsSubjectApiWrapper.SubjectQuery();
|
|
|
+ subjectQuery.setCbsSubjectIds(rows.stream().map(CbsMusicSheetWrapper.MusicSheetApplication::getSubjectIds).
|
|
|
+ filter(StringUtils::isNotEmpty).map(Long::parseLong).distinct().collect(Collectors.toList()));
|
|
|
+ List<Subject> subjects = subjectService.getDao().getByCbsSubjectIds(rows.stream().map(CbsMusicSheetWrapper.MusicSheetApplication::getSubjectIds).
|
|
|
+ filter(StringUtils::isNotEmpty).collect(Collectors.joining(",")));
|
|
|
+ Map<Long, String> subjectMap = subjects.stream().collect(Collectors.toMap(Subject::getCbsSubjectId, Subject::getName));
|
|
|
+
|
|
|
+ Map<Long,CbsMusicSheetWrapper.MusicSheetApplication> musicSheetMap =
|
|
|
+ rows.stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, Function.identity()));
|
|
|
+ for (MusicSheetDetailVo record : sheetDetailVos) {
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = musicSheetMap.get(record.getCbsMusicSheetId());
|
|
|
+ if(musicSheetApplication == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(musicSheetApplication.getSubjectIds())){
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : musicSheetApplication.getSubjectIds().split(",")) {
|
|
|
+ String subjectName = subjectMap.get(Long.parseLong(s));
|
|
|
+ if(StringUtils.isNotEmpty(subjectName)){
|
|
|
+ if (sb.length() > 0) {
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(subjectName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ record.setSubjectNames(sb.toString());
|
|
|
+ }
|
|
|
+ record.setCbsMusicSheetId(musicSheetApplication.getId());
|
|
|
+ record.setAudioType(AudioTypeEnum.valueOf(musicSheetApplication.getPlayMode().getCode()));
|
|
|
+ record.setCanEvaluate(musicSheetApplication.getIsEvaluated() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ record.setShowFingering(musicSheetApplication.getIsShowFingering() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ record.setMusicTag(musicSheetApplication.getMusicTagIds());
|
|
|
+ record.setMusicTagNames(musicSheetApplication.getMusicTagNames());
|
|
|
+ record.setXmlFileUrl(musicSheetApplication.getXmlFileUrl());
|
|
|
+ record.setMidiUrl(musicSheetApplication.getMidiFileUrl());
|
|
|
+ record.setAuditVersion(musicSheetApplication.getAppAuditFlag() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ record.setHasBeat((musicSheetApplication.getIsPlayBeat() && !musicSheetApplication.getIsUseSystemBeat()) ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ record.setExtConfigJson(musicSheetApplication.getExtConfigJson());
|
|
|
+ record.setMusicJSON(musicSheetApplication.getMusicJson());
|
|
|
+ record.setMusicJianSvg(musicSheetApplication.getMusicJianSvg());
|
|
|
+ record.setMusicFirstSvg(musicSheetApplication.getMusicFirstSvg());
|
|
|
+ record.setFirstTone(musicSheetApplication.getMusicFirstImg());
|
|
|
+ record.setFixedTone(musicSheetApplication.getMusicJianImg());
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetAccompaniment> accompanimentList = musicSheetApplication.getMusicSheetAccompanimentList();
|
|
|
+ if (CollectionUtils.isNotEmpty(accompanimentList)) {
|
|
|
+ List<MusicSheetAccompaniment> background = new ArrayList<>();
|
|
|
+ for (CbsMusicSheetWrapper.MusicSheetAccompaniment accompaniment : accompanimentList) {
|
|
|
+ MusicSheetAccompaniment musicSheetAccompaniment = new MusicSheetAccompaniment();
|
|
|
+ musicSheetAccompaniment.setAudioFileUrl(accompaniment.getAudioFileUrl());
|
|
|
+ background.add(musicSheetAccompaniment);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return sheetDetailVos;
|
|
|
}
|
|
|
|
|
|
@Override
|