|
@@ -1,7 +1,6 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.beust.jcommander.internal.Lists;
|
|
|
import com.dayaedu.cbs.common.enums.EClientType;
|
|
@@ -15,7 +14,6 @@ import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApplicationExtendClientWrapper;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.musicInstrument.CbsMusicalInstrumentWrapper;
|
|
|
-import com.google.common.collect.Maps;
|
|
|
import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.ym.mec.biz.dal.dao.SysMusicScoreAccompanimentDao;
|
|
|
import com.ym.mec.biz.dal.dao.SysMusicScoreCategoriesDao;
|
|
@@ -24,7 +22,10 @@ import com.ym.mec.biz.dal.dto.ReasonDto;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
|
import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
|
|
|
-import com.ym.mec.biz.service.*;
|
|
|
+import com.ym.mec.biz.service.CbsMusicScoreCategoriesService;
|
|
|
+import com.ym.mec.biz.service.InstrumentService;
|
|
|
+import com.ym.mec.biz.service.SubjectService;
|
|
|
+import com.ym.mec.biz.service.SysMusicScoreService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
@@ -36,7 +37,6 @@ import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -56,9 +56,7 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
@Resource
|
|
|
private SysMusicScoreCategoriesDao sysMusicScoreCategoriesDao;
|
|
|
@Resource
|
|
|
- private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
|
|
|
- @Resource
|
|
|
- private OrganizationService organizationService;
|
|
|
+ private CbsMusicScoreCategoriesService cbsMusicScoreCategoriesService;
|
|
|
@Resource
|
|
|
private SubjectService subjectService;
|
|
|
@Resource
|
|
@@ -163,15 +161,13 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
List<String> cbsMusicSheetIds = records.stream().map(SysMusicScore::getCbsMusicSheetId).collect(Collectors.toList());
|
|
|
List<CbsMusicSheetWrapper.MusicSheetApplication> applications = this.queryCbsMusicSheetApplication(cbsMusicSheetIds);
|
|
|
if(CollectionUtils.isNotEmpty(applications)){
|
|
|
- Set<Integer> categoriesIds = records.stream().map(SysMusicScore::getMusicScoreCategoriesId).collect(Collectors.toSet());
|
|
|
+// List<Integer> categoriesIds = records.stream().map(SysMusicScore::getCbsMusicCategoriesId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
//获取分部列表
|
|
|
- Map<Integer, String> organMap = MapUtil.convertMybatisMap(sysMusicScoreCategoriesDao.queryOrganByIds(categoriesIds));
|
|
|
- Map<Integer, String> map = new HashMap<>(categoriesIds.size());
|
|
|
- for (Integer categoriesId : categoriesIds) {
|
|
|
- if(null != categoriesId){
|
|
|
- map.put(categoriesId, getParentTreeName(categoriesId));
|
|
|
- }
|
|
|
- }
|
|
|
+// Map<Integer, String> organMap = MapUtil.convertMybatisMap(sysMusicScoreCategoriesDao.queryOrganByIds(categoriesIds));
|
|
|
+ /*Map<Integer, String> map = new HashMap<>();
|
|
|
+ if(CollectionUtils.isNotEmpty(categoriesIds)){
|
|
|
+ map = cbsMusicScoreCategoriesService.getCategoriesNameMap(categoriesIds);
|
|
|
+ }*/
|
|
|
Map<Long, CbsMusicSheetWrapper.MusicSheetApplication> musicSheetApplicationMap = applications
|
|
|
.stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, Function.identity()));
|
|
|
|
|
@@ -185,21 +181,21 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
musicalInstrumentQueryMap = musicalInstrumentQueryDtos.stream().collect(Collectors.toMap(CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto::getId, o -> o, (o1, o2) -> o1));
|
|
|
}
|
|
|
//获取分类名称
|
|
|
- Map<Integer, String> categoriesMap = new HashMap<>(categoriesIds.size());
|
|
|
+ /*Map<Integer, String> categoriesMap = new HashMap<>(categoriesIds.size());
|
|
|
for (Integer categoriesId : categoriesIds) {
|
|
|
if(null != categoriesId){
|
|
|
categoriesMap.put(categoriesId, getParentTreeName(categoriesId));
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
//获取声部乐器关联
|
|
|
List<Instrument> list = instrumentService.lambdaQuery().list();
|
|
|
Map<Integer, Instrument> instrumentMap = list.stream().collect(Collectors.toMap(Instrument::getSubjectId, o -> o));
|
|
|
for (SysMusicScore record : records) {
|
|
|
- record.setCategoriesName(map.get(record.getMusicScoreCategoriesId()));
|
|
|
- record.setOrganName(organMap.get(record.getMusicScoreCategoriesId()));
|
|
|
+// record.setCategoriesName(map.get(record.getCbsMusicCategoriesId()));
|
|
|
+// record.setOrganName(organMap.get(record.getMusicScoreCategoriesId()));
|
|
|
CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = musicSheetApplicationMap.get(Long.parseLong(record.getCbsMusicSheetId()));
|
|
|
if(musicSheetApplication != null){
|
|
|
- this.initMusicSheetVo(record,musicSheetApplication,musicalInstrumentQueryMap,categoriesMap,instrumentMap);
|
|
|
+ this.initMusicSheetVo(record,musicSheetApplication,musicalInstrumentQueryMap,instrumentMap);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -208,20 +204,19 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
|
|
|
public void initMusicSheetVo(SysMusicScore record,CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication
|
|
|
,Map<Integer,CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto> musicalInstrumentQueryMap,
|
|
|
- Map<Integer, String> categoriesMap,Map<Integer, Instrument> instrumentMap){
|
|
|
+ Map<Integer, Instrument> instrumentMap){
|
|
|
record.setRankIds(StringUtils.equals("FREE",musicSheetApplication.getPaymentType()) ? "" : "1");
|
|
|
record.setCbsMusicSheetId(musicSheetApplication.getId().toString());
|
|
|
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.setClientShowFlag(musicSheetApplication.getStatus()?1:0);
|
|
|
+// if(musicSheetApplication.getMusicSheetCategoryId() != null){
|
|
|
+// record.setMusicScoreCategoriesId(musicSheetApplication.getMusicSheetCategoryId().intValue());
|
|
|
+// record.setCategoriesId(musicSheetApplication.getMusicSheetCategoryId().intValue());
|
|
|
+// }
|
|
|
record.setName(musicSheetApplication.getName());
|
|
|
- if(musicSheetApplication.getMusicSheetCategoryId() != null){
|
|
|
- record.setCategoriesName(categoriesMap.get(musicSheetApplication.getMusicSheetCategoryId().intValue()));
|
|
|
- }
|
|
|
+ record.setCategoriesName(musicSheetApplication.getMusicSheetCategoryName());
|
|
|
record.setSpeed(musicSheetApplication.getPlaySpeed());
|
|
|
record.setIsOpenMetronome(musicSheetApplication.getIsUseSystemBeat());
|
|
|
List<CbsMusicSheetWrapper.MusicSheetAccompaniment> accompanimentList = musicSheetApplication.getMusicSheetAccompanimentList();
|
|
@@ -260,7 +255,7 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
@Override
|
|
|
public List<SysMusicScore> queryMusicScoreAll(SysExamSongQueryInfo queryInfo) {
|
|
|
//封装查询参数
|
|
|
- queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
+// queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
if(queryInfo.getSubjectId() != null){
|
|
|
queryInfo.setSubjectIds(queryInfo.getSubjectId().toString());
|
|
|
}
|
|
@@ -292,18 +287,7 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
|
|
|
private void initCategoryIds(SysExamSongQueryInfo queryInfo){
|
|
|
if(StringUtils.isNotEmpty(queryInfo.getCategoriesId())){
|
|
|
- List<Integer> categoriesIdList = new ArrayList<>();
|
|
|
- Integer categoriesId = Integer.parseInt(queryInfo.getCategoriesId());
|
|
|
-
|
|
|
- SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(categoriesId);
|
|
|
-
|
|
|
- if(sysMusicScoreCategories == null){
|
|
|
- throw new BizException("分类找不到");
|
|
|
- }
|
|
|
- categoriesIdList.add(categoriesId);
|
|
|
- sysMusicScoreCategories = sysMusicScoreCategoriesService.getChildTree(sysMusicScoreCategories);
|
|
|
- getAllCategoryIdList(categoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
|
|
|
-
|
|
|
+ List<Integer> categoriesIdList = cbsMusicScoreCategoriesService.getAllCategoryIdList(queryInfo.getCategoriesId());
|
|
|
queryInfo.setCategoriesIdList(categoriesIdList);
|
|
|
}
|
|
|
}
|
|
@@ -493,7 +477,7 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
}
|
|
|
}
|
|
|
if(addMusicSheet.getMusicSheetType() == null){
|
|
|
- if(Arrays.stream(prodCategoryIds.split(",")).anyMatch(e->e.equals(from.getMusicScoreCategoriesId().toString()))){
|
|
|
+ if(Arrays.stream(prodCategoryIds.split(",")).anyMatch(e->e.equals(from.getCbsMusicCategoriesId().toString()))){
|
|
|
addMusicSheet.setMusicSheetType(EMusicSheetType.CONCERT);
|
|
|
}else {
|
|
|
addMusicSheet.setMusicSheetType(EMusicSheetType.SINGLE);
|
|
@@ -573,8 +557,8 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
|
addMusicSheetApplicationExtend.setSortNo(from.getOrder());
|
|
|
addMusicSheetApplicationExtend.setPaymentType(StringUtils.isNotEmpty(from.getRankIds()) ? "VIP" : "FREE");
|
|
|
addMusicSheetApplicationExtend.setAvailableType(EMusicAvailableType.ORG);
|
|
|
- addMusicSheetApplicationExtend.setMusicSheetCategoryId(from.getMusicScoreCategoriesId().longValue());
|
|
|
- addMusicSheet.setMusicCategoryId(from.getMusicScoreCategoriesId().longValue());
|
|
|
+ addMusicSheetApplicationExtend.setMusicSheetCategoryId(from.getCbsMusicCategoriesId().longValue());
|
|
|
+ addMusicSheet.setMusicCategoryId(from.getCbsMusicCategoriesId().longValue());
|
|
|
addMusicSheet.setAddMusicSheetApplicationExtend(Lists.newArrayList(addMusicSheetApplicationExtend));
|
|
|
addMusicSheet.setIsConvertibleScore(true);
|
|
|
return addMusicSheet;
|