|
@@ -13,6 +13,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
|
|
import com.microsvc.toolkit.common.response.template.R;
|
|
import com.microsvc.toolkit.common.response.template.R;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.biz.dal.dao.MusicSheetAuthRecordDao;
|
|
import com.yonge.cooleshow.biz.dal.dao.MusicSheetAuthRecordDao;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.PageUtil;
|
|
import com.yonge.cooleshow.biz.dal.dto.req.TeacherMusicSheetAuditReq;
|
|
import com.yonge.cooleshow.biz.dal.dto.req.TeacherMusicSheetAuditReq;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.TeacherMusicSheetAuditSearch;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.TeacherMusicSheetAuditSearch;
|
|
import com.yonge.cooleshow.biz.dal.entity.*;
|
|
import com.yonge.cooleshow.biz.dal.entity.*;
|
|
@@ -25,6 +26,7 @@ import com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo;
|
|
import com.yonge.cooleshow.biz.dal.wrapper.AddMusicSheetWrapper;
|
|
import com.yonge.cooleshow.biz.dal.wrapper.AddMusicSheetWrapper;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper;
|
|
import com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper;
|
|
import com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper;
|
|
import com.yonge.cooleshow.common.enums.YesOrNoEnum;
|
|
import com.yonge.cooleshow.common.enums.YesOrNoEnum;
|
|
import com.yonge.cooleshow.common.service.IdGeneratorService;
|
|
import com.yonge.cooleshow.common.service.IdGeneratorService;
|
|
@@ -363,6 +365,32 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
|
|
CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
|
|
musicSheetService.initMusicSheetDetailVo(addMusicSheet,sheetDetailVo);
|
|
musicSheetService.initMusicSheetDetailVo(addMusicSheet,sheetDetailVo);
|
|
|
|
+ //获取乐器名称
|
|
|
|
+ List<MusicSheetAccompaniment> background = sheetDetailVo.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());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ accompaniment.setMusicalInstrumentName(sb.toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
sheetDetailVo.setMusicSheetJson(null);
|
|
sheetDetailVo.setMusicSheetJson(null);
|
|
sheetDetailVo.setSubmitAuditTime(sheetDetailVo.getCreateTime());
|
|
sheetDetailVo.setSubmitAuditTime(sheetDetailVo.getCreateTime());
|
|
//获取声部
|
|
//获取声部
|
|
@@ -393,16 +421,18 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
|
|
collect.stream().collect(Collectors.groupingBy(TeacherMusicSheetVo::getAuditStatus));
|
|
collect.stream().collect(Collectors.groupingBy(TeacherMusicSheetVo::getAuditStatus));
|
|
for (AuthStatusEnum authStatusEnum : statusEnumListMap.keySet()) {
|
|
for (AuthStatusEnum authStatusEnum : statusEnumListMap.keySet()) {
|
|
List<TeacherMusicSheetVo> records = statusEnumListMap.get(authStatusEnum);
|
|
List<TeacherMusicSheetVo> records = statusEnumListMap.get(authStatusEnum);
|
|
- List<Long> musicSheetIds = records.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> musicSheetIds = records.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
|
|
List<MusicSheetAuthRecord> recordList = this.baseMapper.findByMusicSheetIds(musicSheetIds, authStatusEnum.getCode());
|
|
List<MusicSheetAuthRecord> recordList = this.baseMapper.findByMusicSheetIds(musicSheetIds, authStatusEnum.getCode());
|
|
if (CollectionUtils.isNotEmpty(recordList)){
|
|
if (CollectionUtils.isNotEmpty(recordList)){
|
|
Map<Long,MusicSheetAuthRecord> authRecordMap = recordList.stream()
|
|
Map<Long,MusicSheetAuthRecord> authRecordMap = recordList.stream()
|
|
.collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
|
|
.collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
|
|
for (TeacherMusicSheetVo musicSheetVo : records) {
|
|
for (TeacherMusicSheetVo musicSheetVo : records) {
|
|
- MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(musicSheetVo.getMusicSheetId());
|
|
|
|
|
|
+ MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(Long.parseLong(musicSheetVo.getMusicSheetId()));
|
|
if(sheetDetailVo == null){
|
|
if(sheetDetailVo == null){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ musicSheetVo.setId(sheetDetailVo.getId().toString());
|
|
|
|
+ musicSheetVo.setMusicSheetId(sheetDetailVo.getId().toString());
|
|
String musicSheetJson = sheetDetailVo.getMusicSheetJson();
|
|
String musicSheetJson = sheetDetailVo.getMusicSheetJson();
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
|
|
CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
|
|
@@ -422,7 +452,7 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void convertMusicDetail(IPage<MusicSheetVo> musicSheetVoIPage, AuthStatusEnum auditStatus) {
|
|
|
|
|
|
+ public IPage convertMusicDetail(IPage<MusicSheetVo> musicSheetVoIPage, AuthStatusEnum auditStatus) {
|
|
List<MusicSheetVo> records = musicSheetVoIPage.getRecords();
|
|
List<MusicSheetVo> records = musicSheetVoIPage.getRecords();
|
|
if (CollectionUtils.isNotEmpty(records)){
|
|
if (CollectionUtils.isNotEmpty(records)){
|
|
List<Long> musicSheetIds = records.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
List<Long> musicSheetIds = records.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
@@ -430,30 +460,37 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
|
|
if (CollectionUtils.isNotEmpty(recordList)){
|
|
if (CollectionUtils.isNotEmpty(recordList)){
|
|
Map<Long,MusicSheetAuthRecord> authRecordMap = recordList.stream()
|
|
Map<Long,MusicSheetAuthRecord> authRecordMap = recordList.stream()
|
|
.collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
|
|
.collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
|
|
|
|
+ List<MusicSheetWrapper.MusicSheetVo> results = new ArrayList<>();
|
|
for (MusicSheetVo musicSheetVo : records) {
|
|
for (MusicSheetVo musicSheetVo : records) {
|
|
|
|
+ MusicSheetWrapper.MusicSheetVo vo = JSON.parseObject(JSON.toJSONString(musicSheetVo), MusicSheetWrapper.MusicSheetVo.class);
|
|
|
|
+ vo.setId(musicSheetVo.getId().toString());
|
|
|
|
+ vo.setCbsMusicSheetId(musicSheetVo.getCbsMusicSheetId().toString());
|
|
MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(musicSheetVo.getId());
|
|
MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(musicSheetVo.getId());
|
|
if(sheetDetailVo == null){
|
|
if(sheetDetailVo == null){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ vo.setId(sheetDetailVo.getId().toString());
|
|
String musicSheetJson = sheetDetailVo.getMusicSheetJson();
|
|
String musicSheetJson = sheetDetailVo.getMusicSheetJson();
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
|
|
CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
|
|
- musicSheetService.initMusicSheetDetailVo(addMusicSheet,musicSheetVo);
|
|
|
|
|
|
+ musicSheetService.initMusicSheetDetailVo(addMusicSheet,vo);
|
|
//获取声部
|
|
//获取声部
|
|
- String musicSubject = musicSheetVo.getMusicSubject();
|
|
|
|
|
|
+ String musicSubject = vo.getMusicSubject();
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
if(StringUtils.isNotEmpty(musicSheetJson)){
|
|
List<Subject> list = subjectService.findBySubjectByIdList(musicSubject);
|
|
List<Subject> list = subjectService.findBySubjectByIdList(musicSubject);
|
|
- musicSheetVo.setSubjectNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
|
|
|
|
|
|
+ vo.setSubjectNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
|
|
}
|
|
}
|
|
//获取标签
|
|
//获取标签
|
|
- String musicTagIds = musicSheetVo.getMusicTag();
|
|
|
|
|
|
+ String musicTagIds = vo.getMusicTag();
|
|
if(StringUtils.isNotEmpty(musicTagIds)){
|
|
if(StringUtils.isNotEmpty(musicTagIds)){
|
|
List<MusicTag> list = musicTagService.lambdaQuery().in(MusicTag::getId, musicTagIds.split(",")).list();
|
|
List<MusicTag> list = musicTagService.lambdaQuery().in(MusicTag::getId, musicTagIds.split(",")).list();
|
|
- musicSheetVo.setMusicTagNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
|
|
|
|
|
|
+ vo.setMusicTagNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return PageUtil.transPageInfo(musicSheetVoIPage,results);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return musicSheetVoIPage;
|
|
}
|
|
}
|
|
}
|
|
}
|