|
@@ -5,8 +5,13 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
|
|
|
+import com.ym.mec.biz.dal.dao.SubjectDao;
|
|
|
+import com.ym.mec.biz.dal.entity.SysMusicScore;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -25,12 +30,16 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
@Service
|
|
|
public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integer, SysMusicScoreAccompaniment> implements SysMusicScoreAccompanimentService {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
+ private SubjectDao subjectDao;
|
|
|
+ @Resource
|
|
|
private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
|
|
|
|
|
|
@Override
|
|
@@ -57,7 +66,53 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
|
|
|
public List<SysMusicScoreAccompaniment> queryAll(SysExamSongQueryInfo queryInfo) {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
- return sysMusicScoreAccompanimentDao.queryPage(params);
|
|
|
+ List<SysMusicScoreAccompaniment> accompaniments = sysMusicScoreAccompanimentDao.queryPage(params);
|
|
|
+
|
|
|
+ return accompaniments;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void initAccompaniment(List<SysMusicScoreAccompaniment> accompaniments){
|
|
|
+ /*List<Subject> subjects = subjectDao.queryCbsList(null);
|
|
|
+ Map<Long, Subject> subjectMap = subjects.stream().collect(Collectors.toMap(Subject::getCbsSubjectId, Function.identity()));
|
|
|
+ if(StringUtils.isNotEmpty(musicSheetApplication.getSubjectIds())){
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : musicSheetApplication.getSubjectIds().split(",")) {
|
|
|
+ Subject subject = subjectMap.get(Long.parseLong(s));
|
|
|
+ if(subject != null){
|
|
|
+ if (sb.length() > 0) {
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(subject.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ record.setSubjectName(sb.toString());
|
|
|
+ }
|
|
|
+ record.setCbsMusicSheetId(musicSheetApplication.getId());
|
|
|
+ record.setPlayMode(SysMusicScore.PlayMode.valueOf(musicSheetApplication.getPlayMode().getCode()));
|
|
|
+ record.setExtConfigJson(musicSheetApplication.getExtConfigJson());
|
|
|
+ record.setExtStyleConfigJson(musicSheetApplication.getExtStyleConfigJson());
|
|
|
+ if(musicSheetApplication.getMusicSheetCategoryId() != null){
|
|
|
+ record.setMusicScoreCategoriesId(musicSheetApplication.getMusicSheetCategoryId().intValue());
|
|
|
+ record.setCategoriesId(musicSheetApplication.getMusicSheetCategoryId().intValue());
|
|
|
+ }
|
|
|
+ record.setName(musicSheetApplication.getName());
|
|
|
+ record.setCategoriesName(musicSheetApplication.getMusicSheetCategoryName());
|
|
|
+ record.setSpeed(musicSheetApplication.getPlaySpeed());
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetAccompaniment> accompanimentList = musicSheetApplication.getMusicSheetAccompanimentList();
|
|
|
+ if (CollectionUtils.isNotEmpty(accompanimentList)) {
|
|
|
+ record.setMetronomeUrl(accompanimentList.get(0).getAudioFileUrl());
|
|
|
+ record.setUrl(accompanimentList.get(0).getAudioFileUrl());
|
|
|
+ }
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetSound> soundList = musicSheetApplication.getMusicSheetSoundList();
|
|
|
+ if (CollectionUtils.isNotEmpty(soundList)) {
|
|
|
+ record.setAccompanimentMetronomeUrl(soundList.get(0).getAudioFileUrl());
|
|
|
+ record.setAccompanimentUrl(soundList.get(0).getAudioFileUrl());
|
|
|
+ }
|
|
|
+ record.setXmlUrl(musicSheetApplication.getXmlFileUrl());
|
|
|
+ record.setMidiUrl(musicSheetApplication.getMidiFileUrl());
|
|
|
+ record.setOrder(musicSheetApplication.getSortNo());
|
|
|
+ record.setEnableEvaluation(musicSheetApplication.getIsEvaluated());
|
|
|
+ record.setIsOpenMetronome(musicSheetApplication.getIsUseSystemBeat() && musicSheetApplication.getIsPlayBeat());*/
|
|
|
}
|
|
|
|
|
|
@Override
|