|
@@ -34,7 +34,6 @@ import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMusicMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.TenantGroupAlbumMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.UserTenantAlbumRecordMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.cbs.CbsMusicScoreService;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.*;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.*;
|
|
@@ -139,8 +138,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
@Resource
|
|
|
private TenantAlbumMusicService tenantAlbumMusicService;
|
|
|
@Resource
|
|
|
- private CbsMusicScoreService cbsMusicScoreService;
|
|
|
- @Resource
|
|
|
private TenantGroupAlbumMapper tenantGroupAlbumMapper;
|
|
|
@Resource
|
|
|
private TenantAlbumMusicMapper tenantAlbumMusicMapper;
|
|
@@ -202,7 +199,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
@Override
|
|
|
public IPage<MusicSheetVoResult> selectCbsPage(IPage<MusicSheetVo> page, MusicSheetSearch query) {
|
|
|
List<MusicSheetVo> musicSheets = baseMapper.selectPage(page, query);
|
|
|
- IPage<MusicSheetVo> info = page.setRecords(musicDataFormat(musicSheets));
|
|
|
+ IPage<MusicSheetVo> info = page.setRecords(musicDataFormat(musicSheets,query.getProviderType()));
|
|
|
List<MusicSheetVo> rows = info.getRecords();
|
|
|
List<MusicSheetVoResult> musicSheetVoResults = new ArrayList<>();
|
|
|
for (MusicSheetVo row : rows) {
|
|
@@ -213,7 +210,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return com.yonge.cooleshow.biz.dal.dto.PageUtil.transPageInfo(info, musicSheetVoResults);
|
|
|
}
|
|
|
|
|
|
- public List<MusicSheetVo> musicDataFormat(List<MusicSheetVo> musicSheets) {
|
|
|
+ public List<MusicSheetVo> musicDataFormat(List<MusicSheetVo> musicSheets,SourceTypeEnum sourceType) {
|
|
|
if (CollectionUtils.isEmpty(musicSheets)) {
|
|
|
return musicSheets;
|
|
|
}
|
|
@@ -221,11 +218,15 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if (CollectionUtils.isEmpty(cbsMusicSheetIds)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
+ Long appId = Long.parseLong(openFeignClientConfigProperties.getAppId());
|
|
|
+ if (sourceType!=null && sourceType==SourceTypeEnum.TENANT) {
|
|
|
+ appId = Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.CBS_TENANT_APP_ID));
|
|
|
+ }
|
|
|
// 调用内容平台查询曲目信息
|
|
|
R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService
|
|
|
.musicSheetPageByApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery.builder()
|
|
|
.musicSheetIds(cbsMusicSheetIds).detailFlag(false).rows(-1).delFlag(true)
|
|
|
- .applicationId(Long.parseLong(openFeignClientConfigProperties.getAppId())).build());
|
|
|
+ .applicationId(appId).build());
|
|
|
List<CbsMusicSheetWrapper.MusicSheetApplication> rows;
|
|
|
try {
|
|
|
PageInfo<CbsMusicSheetWrapper.MusicSheetApplication> musicSheetApplicationPageInfo = pageInfoR.feignData();
|
|
@@ -303,24 +304,17 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if (musicSheet == null) {
|
|
|
throw new BizException("未找到曲目信息");
|
|
|
}
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
- query.setApplicationId(applicationId);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
|
|
|
query.setMusicSheetIds(Collections.singletonList(musicSheet.getCbsMusicSheetId()));
|
|
|
- query.setDelFlag(true);
|
|
|
- query.setPage(1);
|
|
|
query.setRows(1);
|
|
|
- R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(query);
|
|
|
- if (pageInfoR.getCode() != 200) {
|
|
|
- throw new BizException("获取曲目信息异常,{}", pageInfoR.getMessage());
|
|
|
- }
|
|
|
- List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
if (CollectionUtils.isEmpty(rows)) {
|
|
|
throw new BizException("获取曲目信息失败");
|
|
|
}
|
|
|
CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = rows.get(0);
|
|
|
CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus extendStatus = new CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus();
|
|
|
extendStatus.setIds(musicSheetApplication.getApplicationExtendId().toString());
|
|
|
- extendStatus.setStatus(musicSheet.getState()!=YesOrNoEnum.YES);
|
|
|
+ extendStatus.setStatus(!musicSheet.getClientState());
|
|
|
R<JSONObject> jsonObjectR = musicFeignClientService.musicSheetApplicationExtendStatus(extendStatus);
|
|
|
if (jsonObjectR.getCode() != 200) {
|
|
|
throw new BizException("修改曲目状态失败,{}", jsonObjectR.getMessage());
|
|
@@ -398,7 +392,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return musicSheetShareVo;
|
|
|
}
|
|
|
|
|
|
- public MusicSheetDetailVo getCbsDetail(Long id) {
|
|
|
+ public MusicSheetDetailVo getCbsDetail(Long id,SourceTypeEnum sourceTypeEnum) {
|
|
|
MusicSheet musicSheet = this.baseMapper.get(id);
|
|
|
if (musicSheet == null) {
|
|
|
throw new BizException("未找到曲目信息");
|
|
@@ -407,7 +401,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
throw new BizException("曲目信息未同步");
|
|
|
}
|
|
|
MusicSheetDetailVo detailVo = JSON.parseObject(JSON.toJSONString(musicSheet), MusicSheetDetailVo.class);
|
|
|
- this.initMusicSheetDetailVo(detailVo,musicSheet);
|
|
|
+ this.initMusicSheetDetailVo(detailVo,musicSheet,sourceTypeEnum);
|
|
|
+ detailVo.setProviderType(musicSheet.getProviderType());
|
|
|
return detailVo;
|
|
|
}
|
|
|
|
|
@@ -433,93 +428,91 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return detailVo;
|
|
|
}
|
|
|
|
|
|
- public void initMusicSheetDetailVo(MusicSheetDetailVo detailVo,MusicSheet musicSheet) {
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
- query.setPage(1);
|
|
|
+
|
|
|
+ public void initMusicSheetDetailVo(MusicSheetDetailVo detailVo,MusicSheet musicSheet,SourceTypeEnum sourceTypeEnum) {
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery(sourceTypeEnum);
|
|
|
query.setRows(1);
|
|
|
+ query.setDelFlag(true);
|
|
|
query.setMusicSheetIds(Collections.singletonList(musicSheet.getCbsMusicSheetId()));
|
|
|
- query.setDetailFlag(true);
|
|
|
- R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = cbsMusicScoreService.selectPage(query);
|
|
|
- if(pageInfoR.getCode() != 200){
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
+ if(CollectionUtils.isEmpty(rows)){
|
|
|
throw new BizException("获取曲目信息失败");
|
|
|
}
|
|
|
- PageInfo<CbsMusicSheetWrapper.MusicSheetApplication> pageInfo = pageInfoR.getData();
|
|
|
- if(pageInfo != null && CollectionUtils.isNotEmpty(pageInfo.getRows())){
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplication musicSheet1 = pageInfo.getRows().get(0);
|
|
|
- CbsMusicSheetWrapper.MusicSheetExtend musicSheetExtend = musicSheet1.getMusicSheetExtend();
|
|
|
- if (musicSheetExtend != null && musicSheetExtend.getUserId() != null) {
|
|
|
- detailVo.setUserName(musicSheetExtend.getUserName());
|
|
|
- detailVo.setUserId(musicSheetExtend.getUserId());
|
|
|
- //获取用户头像
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserById(musicSheetExtend.getUserId());
|
|
|
- if (sysUser != null) {
|
|
|
- detailVo.setUserAvatar(sysUser.getAvatar());
|
|
|
- }
|
|
|
- }
|
|
|
- detailVo.setMusicPrice(musicSheet1.getMusicPrice());
|
|
|
- detailVo.setSubjectNames(musicSheet1.getSubjectNames());
|
|
|
- detailVo.setCode(musicSheet1.getSubjectCodes());
|
|
|
- detailVo.setId(musicSheet.getId());
|
|
|
- detailVo.setCbsMusicSheetId(musicSheet1.getId());
|
|
|
- detailVo.setMp3Type(AudioTypeEnum.valueOf(musicSheet1.getIsPlayBeat()&&musicSheet1.getIsUseSystemBeat()?"MP3":"MP3_METRONOME"));
|
|
|
- detailVo.setIsPlayBeat(musicSheet1.getIsPlayBeat());
|
|
|
- detailVo.setAudioType(AudioTypeEnum.valueOf(musicSheet1.getPlayMode().getCode()));
|
|
|
- detailVo.setCanEvaluate(musicSheet1.getIsEvaluated() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
- detailVo.setShowFingering(musicSheet1.getIsShowFingering() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
- detailVo.setMusicTagNames(musicSheet1.getMusicTagNames());
|
|
|
- detailVo.setMusicImg(musicSheet1.getMusicImg());
|
|
|
- detailVo.setTitleImg(musicSheet1.getMusicCover());
|
|
|
- detailVo.setPlaySpeed(musicSheet1.getPlaySpeed());
|
|
|
- List<CbsMusicSheetWrapper.MusicSheetAccompaniment> accompanimentList = musicSheet1.getMusicSheetAccompanimentList();
|
|
|
- if (CollectionUtils.isNotEmpty(accompanimentList)) {
|
|
|
- detailVo.setMetronomeUrl(accompanimentList.get(0).getAudioFileUrl());
|
|
|
- }
|
|
|
- detailVo.setXmlFileUrl(musicSheet1.getXmlFileUrl());
|
|
|
- detailVo.setMidiUrl(musicSheet1.getMidiFileUrl());
|
|
|
- detailVo.setAuditVersion(musicSheet1.getAppAuditFlag() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
- detailVo.setHasBeat((musicSheet1.getIsPlayBeat() && !musicSheet1.getIsUseSystemBeat()) ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
- detailVo.setExtConfigJson(musicSheet1.getExtConfigJson());
|
|
|
- detailVo.setMusicJSON(musicSheet1.getMusicJson());
|
|
|
- detailVo.setMusicJianSvg(musicSheet1.getMusicJianSvg());
|
|
|
- detailVo.setMusicFirstSvg(musicSheet1.getMusicFirstSvg());
|
|
|
- detailVo.setFirstTone(musicSheet1.getMusicFirstImg());
|
|
|
- detailVo.setFixedTone(musicSheet1.getMusicJianImg());
|
|
|
- List<CbsMusicSheetWrapper.MusicSheetSound> soundList = musicSheet1.getMusicSheetSoundList();
|
|
|
- if (CollectionUtils.isNotEmpty(soundList)) {
|
|
|
- List<MusicSheetAccompaniment> background = new ArrayList<>();
|
|
|
- for (CbsMusicSheetWrapper.MusicSheetSound sound : soundList) {
|
|
|
- MusicSheetAccompaniment accompaniment = new MusicSheetAccompaniment();
|
|
|
- accompaniment.setMusicSheetId(musicSheet.getId());
|
|
|
- accompaniment.setAudioFileUrl(sound.getAudioFileUrl());
|
|
|
- accompaniment.setSortNumber(sound.getSortNumber());
|
|
|
- accompaniment.setTrack(sound.getTrack());
|
|
|
- accompaniment.setMusicalInstrumentId(sound.getMusicalInstrumentId());
|
|
|
- background.add(accompaniment);
|
|
|
- }
|
|
|
- //按照sortNumber排序
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplication musicSheet1 = rows.get(0);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetExtend musicSheetExtend = musicSheet1.getMusicSheetExtend();
|
|
|
+ if (musicSheetExtend != null && musicSheetExtend.getUserId() != null) {
|
|
|
+ detailVo.setUserName(musicSheetExtend.getUserName());
|
|
|
+ detailVo.setUserId(musicSheetExtend.getUserId());
|
|
|
+ //获取用户头像
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(musicSheetExtend.getUserId());
|
|
|
+ if (sysUser != null) {
|
|
|
+ detailVo.setUserAvatar(sysUser.getAvatar());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ detailVo.setCategoryId(musicSheet1.getMusicCategoryId()!=null?musicSheet1.getMusicCategoryId().toString():"");
|
|
|
+ detailVo.setMusicPrice(musicSheet1.getMusicPrice());
|
|
|
+ detailVo.setSubjectNames(musicSheet1.getSubjectNames());
|
|
|
+ detailVo.setCode(musicSheet1.getSubjectCodes());
|
|
|
+ detailVo.setId(musicSheet.getId());
|
|
|
+ detailVo.setCbsMusicSheetId(musicSheet1.getId());
|
|
|
+ detailVo.setMp3Type(AudioTypeEnum.valueOf(musicSheet1.getIsPlayBeat()&&musicSheet1.getIsUseSystemBeat()?"MP3":"MP3_METRONOME"));
|
|
|
+ detailVo.setIsPlayBeat(musicSheet1.getIsPlayBeat());
|
|
|
+ detailVo.setAudioType(AudioTypeEnum.valueOf(musicSheet1.getPlayMode().getCode()));
|
|
|
+ detailVo.setCanEvaluate(musicSheet1.getIsEvaluated() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ detailVo.setShowFingering(musicSheet1.getIsShowFingering() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ detailVo.setMusicTagNames(musicSheet1.getMusicTagNames());
|
|
|
+ detailVo.setMusicImg(musicSheet1.getMusicImg());
|
|
|
+ detailVo.setTitleImg(musicSheet1.getMusicCover());
|
|
|
+ detailVo.setPlaySpeed(musicSheet1.getPlaySpeed());
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetAccompaniment> accompanimentList = musicSheet1.getMusicSheetAccompanimentList();
|
|
|
+ if (CollectionUtils.isNotEmpty(accompanimentList)) {
|
|
|
+ detailVo.setMetronomeUrl(accompanimentList.get(0).getAudioFileUrl());
|
|
|
+ }
|
|
|
+ detailVo.setXmlFileUrl(musicSheet1.getXmlFileUrl());
|
|
|
+ detailVo.setMidiUrl(musicSheet1.getMidiFileUrl());
|
|
|
+ detailVo.setAuditVersion(musicSheet1.getAppAuditFlag() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ detailVo.setHasBeat((musicSheet1.getIsPlayBeat() && !musicSheet1.getIsUseSystemBeat()) ? YesOrNoEnum.YES : YesOrNoEnum.NO);
|
|
|
+ detailVo.setExtConfigJson(musicSheet1.getExtConfigJson());
|
|
|
+ detailVo.setMusicJSON(musicSheet1.getMusicJson());
|
|
|
+ detailVo.setMusicJianSvg(musicSheet1.getMusicJianSvg());
|
|
|
+ detailVo.setMusicFirstSvg(musicSheet1.getMusicFirstSvg());
|
|
|
+ detailVo.setFirstTone(musicSheet1.getMusicFirstImg());
|
|
|
+ detailVo.setFixedTone(musicSheet1.getMusicJianImg());
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetSound> soundList = musicSheet1.getMusicSheetSoundList();
|
|
|
+ if (CollectionUtils.isNotEmpty(soundList)) {
|
|
|
+ List<MusicSheetAccompaniment> background = new ArrayList<>();
|
|
|
+ for (CbsMusicSheetWrapper.MusicSheetSound sound : soundList) {
|
|
|
+ MusicSheetAccompaniment accompaniment = new MusicSheetAccompaniment();
|
|
|
+ accompaniment.setMusicSheetId(musicSheet.getId());
|
|
|
+ accompaniment.setAudioFileUrl(sound.getAudioFileUrl());
|
|
|
+ accompaniment.setSortNumber(sound.getSortNumber());
|
|
|
+ accompaniment.setTrack(sound.getTrack());
|
|
|
+ accompaniment.setMusicalInstrumentId(sound.getMusicalInstrumentId());
|
|
|
+ background.add(accompaniment);
|
|
|
+ }
|
|
|
+ //按照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());
|
|
|
+ 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());
|
|
|
}
|
|
|
+ accompaniment.setMusicalInstrumentName(sb.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -564,12 +557,9 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if (musicSheetApplication.getAudioType() != null) {
|
|
|
sheet.setAccompanimentType(AccompanimentTypeEnum.valueOf(musicSheetApplication.getAudioType().getCode()));
|
|
|
}
|
|
|
+ sheet.setCategoryName(musicSheetApplication.getMusicSheetCategoryName());
|
|
|
sheet.setMusicTagNames(musicSheetApplication.getMusicTagNames());
|
|
|
- if(musicSheetApplication.getMusicSheetType() == EMusicSheetType.CONCERT){
|
|
|
- sheet.setSubjectNames(null);
|
|
|
- }else {
|
|
|
- sheet.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
- }
|
|
|
+ sheet.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
sheet.setPaymentType(musicSheetApplication.getPaymentType());
|
|
|
sheet.setSortNumber(musicSheetApplication.getSortNo());
|
|
|
if (musicSheetApplication.getTopFlag() != null){
|
|
@@ -629,7 +619,43 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
throw new BizException("未找到曲目信息");
|
|
|
}
|
|
|
}
|
|
|
- MusicSheetDetailVo detail = this.getCbsDetail(Long.parseLong(id));
|
|
|
+ MusicSheetDetailVo detail ;
|
|
|
+ if (sysUser == null || userType == ClientEnum.SYSTEM) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.PLATFORM);
|
|
|
+ } catch (Exception e) {
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.TENANT);
|
|
|
+ }
|
|
|
+ } else
|
|
|
+ if (StringUtil.isEmpty(tenantAlbumId)) {
|
|
|
+
|
|
|
+ // 如果是机构用户,判断机构专辑
|
|
|
+
|
|
|
+ // 机构学生,查询购买过的机构专辑,是否存在当前曲目
|
|
|
+ Long tenantId = userTenantId(sysUser.getId(), userType);
|
|
|
+
|
|
|
+ if (tenantId >0L) {
|
|
|
+ if (userType == ClientEnum.STUDENT) {
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.TENANT);
|
|
|
+ } else {
|
|
|
+ if (detailVo.getProviderType().contains(SourceTypeEnum.PLATFORM.getCode())) {
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.PLATFORM);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.TENANT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.PLATFORM);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ detail = this.getCbsDetail(Long.parseLong(id),SourceTypeEnum.TENANT);
|
|
|
+ }
|
|
|
+ detail.setPlay(YesOrNoEnum.NO);
|
|
|
+ detail.setTenantFlag(false);
|
|
|
//兼容审批数据
|
|
|
MusicSheetAuthRecord one = musicSheetAuthRecordService.lambdaQuery().eq(MusicSheetAuthRecord::getMusicSheetId, detail.getId()).last("limit 1").one();
|
|
|
if (one != null) {
|
|
@@ -638,7 +664,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
// 设置收藏人数
|
|
|
detail.setFavoriteCount(detail.getFavoriteCount() + detail.getVirtualNumber());
|
|
|
|
|
|
- if (sysUser == null) {
|
|
|
+ if (sysUser == null || userType == ClientEnum.SYSTEM) {
|
|
|
return detail;
|
|
|
}
|
|
|
|
|
@@ -665,22 +691,60 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
detail.setReason(reason);
|
|
|
}
|
|
|
if (StringUtil.isEmpty(tenantAlbumId)) {
|
|
|
- if (detail.getPaymentType().contains(ChargeTypeEnum.FREE.getCode())) {
|
|
|
- detail.setPlay(YesOrNoEnum.YES);
|
|
|
- } else if (ClientEnum.STUDENT.getCode().equals(userType.getCode())
|
|
|
- || ClientEnum.TEACHER.getCode().equals(userType.getCode())) {
|
|
|
- // 2022 7 20 老师也能购买曲目
|
|
|
- if (ClientEnum.TEACHER.getCode().equals(userType.getCode()) && sysUser.getId().equals(detail.getUserId())) {
|
|
|
- detail.setPlay(YesOrNoEnum.YES);
|
|
|
- } else {
|
|
|
- setMusicSheetPlay(sysUser.getId(), detail, userType);
|
|
|
+
|
|
|
+ // 如果是机构用户,判断机构专辑
|
|
|
+
|
|
|
+ // 机构学生,查询购买过的机构专辑,是否存在当前曲目
|
|
|
+ Long tenantId = userTenantId(sysUser.getId(), userType);
|
|
|
+
|
|
|
+ if (tenantId >0L) {
|
|
|
+
|
|
|
+ if (detail.getProviderType().contains(SourceTypeEnum.TENANT.getCode())) {
|
|
|
+ if (userType == ClientEnum.STUDENT) {
|
|
|
+ detail.setTenantFlag(true);
|
|
|
+ // 机构学生
|
|
|
+ List<Long> tenantAlbumIds = userTenantAlbumRecordMapper.selectTenantIds(sysUser.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(tenantAlbumIds)) {
|
|
|
+ List<Long> musicSheetIds = tenantAlbumMusicService.getMusicIdsByIds(tenantAlbumIds);
|
|
|
+ if (musicSheetIds.contains(detail.getId())) {
|
|
|
+ detail.setPlay(YesOrNoEnum.YES);
|
|
|
+ detail.setBuyed(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 老师所在机构启用的专辑
|
|
|
+ Teacher teacher = teacherService.getById(sysUser.getId());
|
|
|
+ if (teacher.getTenantId() >0) {
|
|
|
+ List<Long> musicSheetIds = tenantAlbumMusicService.getMusicIdsByTenantIds(teacher.getTenantId());
|
|
|
+ if (musicSheetIds.contains(detail.getId())) {
|
|
|
+ detail.setPlay(YesOrNoEnum.YES);
|
|
|
+ detail.setBuyed(true);
|
|
|
+ detail.setTenantFlag(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (detail.getPlay() ==YesOrNoEnum.NO) {
|
|
|
+ platformMusicUseCheck(sysUser, userType, detail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (!detail.getProviderType().contains(SourceTypeEnum.PLATFORM.getCode())) {
|
|
|
+ return detail;
|
|
|
+ }
|
|
|
+ platformMusicUseCheck(sysUser, userType, detail);
|
|
|
}
|
|
|
} else {
|
|
|
- detail.setPlay(YesOrNoEnum.YES);
|
|
|
+ if (!detail.getProviderType().contains(SourceTypeEnum.PLATFORM.getCode())) {
|
|
|
+ return detail;
|
|
|
+ }
|
|
|
+ platformMusicUseCheck(sysUser, userType, detail);
|
|
|
}
|
|
|
} else {
|
|
|
+ detail.setTenantFlag(true);
|
|
|
+ if (!detail.getProviderType().contains(SourceTypeEnum.TENANT.getCode())) {
|
|
|
+ return detail;
|
|
|
+ }
|
|
|
// 机构专辑购买
|
|
|
- detail.setPlay(YesOrNoEnum.NO);
|
|
|
+// detail.setPlay(YesOrNoEnum.NO);
|
|
|
List<Long> collected = Arrays.stream(tenantAlbumId.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
|
|
// 学生生效中的机构专辑
|
|
@@ -707,9 +771,49 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (detail.getTenantFlag()) {
|
|
|
+ detail.setNotation(detail.getTenantNotation() !=null&& detail.getTenantNotation()?YesOrNoEnum.YES:YesOrNoEnum.NO);
|
|
|
+ detail.setScoreType(detail.getTenantScoreType());
|
|
|
+
|
|
|
+ }
|
|
|
return detail;
|
|
|
}
|
|
|
|
|
|
+ private void platformMusicUseCheck(SysUser sysUser, ClientEnum userType, MusicSheetDetailVo detail) {
|
|
|
+ if (!detail.getProviderType().contains(SourceTypeEnum.PLATFORM.getCode())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (detail.getPaymentType().contains(ChargeTypeEnum.FREE.getCode())) {
|
|
|
+ detail.setPlay(YesOrNoEnum.YES);
|
|
|
+ } else if (ClientEnum.STUDENT.getCode().equals(userType.getCode())
|
|
|
+ || ClientEnum.TEACHER.getCode().equals(userType.getCode())) {
|
|
|
+ // 2022 7 20 老师也能购买曲目
|
|
|
+ if (ClientEnum.TEACHER.getCode().equals(userType.getCode()) && sysUser.getId().equals(detail.getUserId())) {
|
|
|
+ detail.setPlay(YesOrNoEnum.YES);
|
|
|
+ } else {
|
|
|
+ setMusicSheetPlay(sysUser.getId(), detail, userType);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ detail.setPlay(YesOrNoEnum.YES);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long userTenantId(Long userId, ClientEnum userType) {
|
|
|
+ if (ClientEnum.STUDENT == userType) {
|
|
|
+ Student student = studentService.getById(userId);
|
|
|
+ if (student != null&& student.getTenantId() !=null && student.getTenantId() >0) {
|
|
|
+ return student.getTenantId();
|
|
|
+ }
|
|
|
+ } else if (ClientEnum.TEACHER == userType) {
|
|
|
+ Teacher teacher = teacherService.getById(userId);
|
|
|
+ if (teacher != null && teacher.getTenantId() !=null && teacher.getTenantId() >0) {
|
|
|
+ return teacher.getTenantId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return -1L;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设置学生曲目信息
|
|
|
* <p>
|
|
@@ -720,7 +824,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
* @param userType 用户类型
|
|
|
*/
|
|
|
private void setMusicSheetPlay(Long studentId, MusicSheetDetailVo detail, ClientEnum userType) {
|
|
|
- detail.setPlay(YesOrNoEnum.NO);
|
|
|
+// detail.setPlay(YesOrNoEnum.NO);
|
|
|
// 单曲购买 判断购买记录,有记录课播放
|
|
|
if (detail.getPaymentType().contains(ChargeTypeEnum.CHARGE.getCode())) {
|
|
|
// 学生须判断是否能播放曲目
|
|
@@ -761,6 +865,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (detail.getDelFlag() ||detail.getState() == YesOrNoEnum.NO) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 判断专辑购买
|
|
|
|
|
|
// 1 查询曲目所在的专辑
|
|
@@ -786,41 +894,12 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if (count > 0) {
|
|
|
detail.setPlay(YesOrNoEnum.YES);
|
|
|
detail.setBuyed(true);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 机构专辑购买
|
|
|
-
|
|
|
- // 学生生效中的机构专辑
|
|
|
- if (ClientEnum.STUDENT == userType) {
|
|
|
- List<Long> tenantAlbumIds = userTenantAlbumRecordMapper.selectTenantIds(studentId);
|
|
|
- if (CollectionUtils.isNotEmpty(tenantAlbumIds)) {
|
|
|
- List<Long> musicSheetIds = tenantAlbumMusicService.getMusicIdsByIds(tenantAlbumIds);
|
|
|
- if (musicSheetIds.contains(detail.getId())) {
|
|
|
- detail.setPlay(YesOrNoEnum.YES);
|
|
|
- detail.setBuyed(true);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (ClientEnum.TEACHER == userType) {
|
|
|
- // 老师所在机构启用的专辑
|
|
|
- Teacher teacher = teacherService.getById(studentId);
|
|
|
- if (teacher.getTenantId() !=null) {
|
|
|
- List<Long> musicSheetIds = tenantAlbumMusicService.getMusicIdsByTenantIds(teacher.getTenantId());
|
|
|
- if (musicSheetIds.contains(detail.getId())) {
|
|
|
- detail.setPlay(YesOrNoEnum.YES);
|
|
|
- detail.setBuyed(true);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void initMusicSheetVo(MusicSheetVo record,CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication){
|
|
|
- if (musicSheetApplication.getMusicSheetType() == EMusicSheetType.CONCERT) {
|
|
|
- record.setSubjectNames(null);
|
|
|
- } else {
|
|
|
- record.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
- }
|
|
|
+ record.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
record.setMusicPrice(musicSheetApplication.getMusicPrice());
|
|
|
record.setCbsMusicSheetId(musicSheetApplication.getId());
|
|
|
record.setAudioType(AudioTypeEnum.valueOf(musicSheetApplication.getPlayMode().getCode()));
|
|
@@ -847,28 +926,26 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
record.setTitleImg(musicSheetApplication.getMusicCover());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public void initMusicSheetVos(List<MusicSheetVo> records) {
|
|
|
+ initMusicSheetVos(records,SourceTypeEnum.PLATFORM);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void initMusicSheetVos(List<MusicSheetVo> records,SourceTypeEnum sourceTypeEnum) {
|
|
|
if(CollectionUtils.isNotEmpty(records)){
|
|
|
List<Long> cbsMusicSheetIds = records.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
- query.setPage(1);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery(sourceTypeEnum);
|
|
|
query.setRows(cbsMusicSheetIds.size());
|
|
|
query.setMusicSheetIds(cbsMusicSheetIds);
|
|
|
- query.setDetailFlag(true);
|
|
|
- R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = cbsMusicScoreService.selectPage(query);
|
|
|
- if(pageInfoR.getCode() != 200){
|
|
|
- throw new BizException("获取曲目信息失败");
|
|
|
- }
|
|
|
- PageInfo<CbsMusicSheetWrapper.MusicSheetApplication> pageInfo = pageInfoR.getData();
|
|
|
- if(pageInfo != null && CollectionUtils.isNotEmpty(pageInfo.getRows())){
|
|
|
- Map<Long, CbsMusicSheetWrapper.MusicSheetApplication> musicSheetApplicationMap = pageInfo.getRows()
|
|
|
- .stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, Function.identity()));
|
|
|
- for (MusicSheetVo record : records) {
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = musicSheetApplicationMap.get(record.getCbsMusicSheetId());
|
|
|
- if(musicSheetApplication != null){
|
|
|
- this.initMusicSheetVo(record,musicSheetApplication);
|
|
|
- }
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
+ if(CollectionUtils.isEmpty(rows)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<Long, CbsMusicSheetWrapper.MusicSheetApplication> musicSheetApplicationMap = rows
|
|
|
+ .stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, Function.identity()));
|
|
|
+ for (MusicSheetVo record : records) {
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = musicSheetApplicationMap.get(record.getCbsMusicSheetId());
|
|
|
+ if(musicSheetApplication != null){
|
|
|
+ this.initMusicSheetVo(record,musicSheetApplication);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -879,7 +956,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
public IPage<MusicSheetVo> selectStudentPage(IPage<MusicSheetVo> page, StudentMusicSheetSearch query, ClientEnum clientType) {
|
|
|
List<MusicSheetVo> records = baseMapper.selectStudentMusicPage(page, query, clientType);
|
|
|
//设置内容平台曲目信息
|
|
|
- this.initMusicSheetVos(records);
|
|
|
+ this.initMusicSheetVos(records,query.getProviderType());
|
|
|
if (CollectionUtils.isNotEmpty(records)) {
|
|
|
|
|
|
// 统计单曲归属专辑数
|
|
@@ -953,6 +1030,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
@Override
|
|
|
public IPage<MusicSheetVo> myMusic(IPage<MusicSheetVo> page, StudentMusicSheetSearch query) {
|
|
|
query.setDelFlag(null);
|
|
|
+ query.setProviderType(SourceTypeEnum.PLATFORM);
|
|
|
|
|
|
List<MusicSheetVo> records = baseMapper.selectMyMusicPage(page, query);
|
|
|
//设置内容平台曲目信息
|
|
@@ -996,6 +1074,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
|
|
|
// 设置学生端收藏联系
|
|
|
query.setClientType(ClientEnum.STUDENT);
|
|
|
+ query.setState(null);
|
|
|
+ query.setDelFlag(null);
|
|
|
// 构建分页信息
|
|
|
List<MusicSheetVo> musicSheetVos = baseMapper.selectPracticeMusicPage(query, practiceMusicIdList);
|
|
|
//设置内容平台曲目信息
|
|
@@ -1011,6 +1091,21 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
// 更新曲目专辑数量
|
|
|
musicSheetService.updateMusicAlbumNumInfo(page.getRecords());
|
|
|
}
|
|
|
+ for (MusicSheetVo record : page.getRecords()) {
|
|
|
+ // 1失效 0 有效
|
|
|
+ MusicSheetDetailVo detail = detail(record.getId(), sysUserFeignService.queryUserById(query.getStudentId()), ClientEnum.STUDENT);
|
|
|
+ record.setTitleImg(detail.getTitleImg());
|
|
|
+ record.setPlay(YesOrNoEnum.YES);
|
|
|
+ if (query.getProviderType() == SourceTypeEnum.PLATFORM) {
|
|
|
+ if (Boolean.TRUE.equals(detail.getBuyed())) {
|
|
|
+ record.setPlay(YesOrNoEnum.NO);
|
|
|
+ } else if(detail.getProviderType().contains(SourceTypeEnum.PLATFORM.getCode())) {
|
|
|
+ record.setPlay(detail.getState() ==YesOrNoEnum.YES && !detail.getDelFlag()?YesOrNoEnum.NO:YesOrNoEnum.YES);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ record.setPlay(detail.getPlay()==YesOrNoEnum.YES?YesOrNoEnum.NO:YesOrNoEnum.YES);
|
|
|
+ }
|
|
|
+ }
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -1031,17 +1126,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if (musicSheet == null) {
|
|
|
throw new BizException("曲目不存在");
|
|
|
}
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
- query.setApplicationId(applicationId);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
|
|
|
query.setMusicSheetIds(Collections.singletonList(musicSheet.getCbsMusicSheetId()));
|
|
|
- query.setDelFlag(true);
|
|
|
- query.setPage(1);
|
|
|
query.setRows(1);
|
|
|
- R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(query);
|
|
|
- if (pageInfoR.getCode() != 200) {
|
|
|
- throw new BizException("获取曲目信息异常,{}", pageInfoR.getMessage());
|
|
|
- }
|
|
|
- List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
if (CollectionUtils.isEmpty(rows)) {
|
|
|
throw new BizException("获取曲目信息失败");
|
|
|
}
|
|
@@ -1405,6 +1493,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
teacherMusicSheetListVo.setEntryFlag(teacherVo.getEntryFlag());
|
|
|
teacherMusicSheetListVo.setMusicianFlag(teacherVo.getMusicianFlag());
|
|
|
teacherMusicSheetListVo.setTag(teacherVo.getTag());
|
|
|
+ teacherMusicSheetListVo.setVipType(teacherVo.getVipType());
|
|
|
|
|
|
TeacherTotal total = totalService.getTotalById(detail.getUserId());
|
|
|
if (total != null) {
|
|
@@ -1513,8 +1602,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
addMusicSheetApplicationExtend.setMusicTagIds(musicSheet.getMusicTag());
|
|
|
addMusicSheetApplicationExtend.setMusicPrice(musicSheet.getMusicPrice());
|
|
|
addMusicSheetApplicationExtend.setPaymentType(musicSheet.getPaymentType());
|
|
|
- addMusicSheetApplicationExtend.setAvailableType(EMusicAvailableType.valueOf("TEACHER".equals(musicSheet.getPaymentType()) ?
|
|
|
- "PERSON" : "PLATFORM".equals(musicSheet.getPaymentType()) ? "PLATFORM":"ORG"));
|
|
|
+ addMusicSheetApplicationExtend.setAvailableType(StringUtils.isNotBlank(musicSheet.getProviderType())&& musicSheet.getProviderType().equals("TENANT")
|
|
|
+ ?EMusicAvailableType.ORG:EMusicAvailableType.PLATFORM);
|
|
|
addMusicSheetApplicationExtend.setExquisiteFlag(musicSheet.getExquisiteFlag() == YesOrNoEnum.YES);
|
|
|
addMusicSheetApplicationExtend.setSortNo(musicSheet.getSortNumber());
|
|
|
addMusicSheetApplicationExtend.setIsConvertibleScore(musicSheet.getNotation() == YesOrNoEnum.YES);
|
|
@@ -1533,17 +1622,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
List<Long> musicSheets = Arrays.stream(reasonDto.getMusicSheetIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
List<MusicSheet> musicSheetList = musicSheetService.lambdaQuery().in(MusicSheet::getId, musicSheets).list();
|
|
|
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
- query.setApplicationId(applicationId);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
|
|
|
query.setMusicSheetIds(musicSheetList.stream().map(MusicSheet::getCbsMusicSheetId).collect(Collectors.toList()));
|
|
|
- query.setDelFlag(true);
|
|
|
- query.setPage(1);
|
|
|
query.setRows(musicSheets.size());
|
|
|
- R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(query);
|
|
|
- if (pageInfoR.getCode() != 200) {
|
|
|
- throw new BizException("获取曲目信息异常,{}", pageInfoR.getMessage());
|
|
|
- }
|
|
|
- List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
if (CollectionUtils.isEmpty(rows)) {
|
|
|
throw new BizException("获取曲目信息失败");
|
|
|
}
|
|
@@ -1572,17 +1654,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if(CollectionUtils.isEmpty(sheetDetailVos)){
|
|
|
return;
|
|
|
}
|
|
|
- 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);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
|
|
|
+ query.setMusicSheetIds(sheetDetailVos.stream().map(MusicSheet::getCbsMusicSheetId).collect(Collectors.toList()));
|
|
|
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();
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
if (CollectionUtils.isEmpty(rows)){
|
|
|
throw new BizException("查询曲谱信息失败");
|
|
|
}
|
|
@@ -1597,11 +1672,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
if(musicSheetApplication == null){
|
|
|
continue;
|
|
|
}
|
|
|
- if(musicSheetApplication.getMusicSheetType() == EMusicSheetType.CONCERT){
|
|
|
- record.setSubjectNames(null);
|
|
|
- }else {
|
|
|
- record.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
- }
|
|
|
+ record.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
record.setMusicPrice(musicSheetApplication.getMusicPrice());
|
|
|
record.setCbsMusicSheetId(musicSheetApplication.getId());
|
|
|
record.setAudioType(AudioTypeEnum.valueOf(musicSheetApplication.getPlayMode().getCode()));
|
|
@@ -1912,6 +1983,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
|
|
|
MusicSheetSearch musicSheetSearch = new MusicSheetSearch();
|
|
|
musicSheetSearch.setMusicSheetIdlist(musicIds);
|
|
|
+ musicSheetSearch.setProviderType(SourceTypeEnum.TENANT);
|
|
|
IPage<MusicSheetVo> musicSheetVoIPage = selectPage(PageUtil.getPage(queryInfo), musicSheetSearch);
|
|
|
List<MusicSheetVo> records = musicSheetVoIPage.getRecords();
|
|
|
if (CollectionUtils.isNotEmpty(records)) {
|
|
@@ -2030,7 +2102,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
musicSheetAudit.setCreateBy(userId);
|
|
|
musicSheetAudit.setUpdateBy(userId);
|
|
|
musicSheetAudit.setSubmitAuditTime(new Date());
|
|
|
- musicSheetAudit.setProviderType(SourceTypeEnum.TEACHER);
|
|
|
+ musicSheetAudit.setProviderType(SourceTypeEnum.PLATFORM.getCode());
|
|
|
musicSheetAudit.setSourceType(SourceTypeEnum.TEACHER);
|
|
|
musicSheetAudit.setAuditStatus(AuthStatusEnum.DOING);
|
|
|
musicSheetAudit.setState(YesOrNoEnum.NO);
|
|
@@ -2106,6 +2178,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
musicSheetAudit.setTitleImg(addMusicSheet.getMusicCover());
|
|
|
musicSheetAudit.setExtConfigJson(addMusicSheet.getExtConfigJson());
|
|
|
musicSheetAudit.setRemark(addMusicSheet.getRemark());
|
|
|
+ if (CollectionUtils.isNotEmpty(addMusicSheet.getAddMusicSheetApplicationExtend())) {
|
|
|
+ EDefaultScoreType scoreType = addMusicSheet.getAddMusicSheetApplicationExtend().get(0).getScoreType();
|
|
|
+ musicSheetAudit.setScoreType(scoreType!=null?scoreType.name():EDefaultScoreType.STAVE.getCode());
|
|
|
+ }
|
|
|
if(addMusicSheet.getAudioType() != null){
|
|
|
musicSheetAudit.setAccompanimentType(AccompanimentTypeEnum.valueOf(addMusicSheet.getAudioType().getCode()));
|
|
|
}
|
|
@@ -2223,6 +2299,9 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
musicSheetAudit.setPaymentType(applicationExtend.getPaymentType());
|
|
|
musicSheetAudit.setChargeType(ChargeTypeEnum.valueOf(applicationExtend.getPaymentType()));
|
|
|
}
|
|
|
+
|
|
|
+ EDefaultScoreType scoreType = addMusicSheet.getAddMusicSheetApplicationExtend().get(0).getScoreType();
|
|
|
+ musicSheetAudit.setScoreType(scoreType!=null?scoreType.name():EDefaultScoreType.STAVE.getCode());
|
|
|
if(applicationExtend.getTopFlag() != null){
|
|
|
musicSheetAudit.setTopFlag(applicationExtend.getTopFlag()? YesOrNoEnum.YES: YesOrNoEnum.NO);
|
|
|
}
|
|
@@ -2255,7 +2334,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
}
|
|
|
@Override
|
|
|
public void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, MusicSheetDetailVo musicSheetAudit) {
|
|
|
- musicSheetAudit.setProviderType(SourceTypeEnum.TEACHER);
|
|
|
+ musicSheetAudit.setProviderType(SourceTypeEnum.PLATFORM.getCode());
|
|
|
musicSheetAudit.setSourceType(SourceTypeEnum.TEACHER);
|
|
|
musicSheetAudit.setMusicSheetName(addMusicSheet.getName());
|
|
|
musicSheetAudit.setMusicSubject(addMusicSheet.getSubjectIds());
|
|
@@ -2318,6 +2397,9 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
musicSheetAudit.setPaymentType(applicationExtend.getPaymentType());
|
|
|
musicSheetAudit.setChargeType(ChargeTypeEnum.valueOf(applicationExtend.getPaymentType()));
|
|
|
}
|
|
|
+
|
|
|
+ EDefaultScoreType scoreType = addMusicSheet.getAddMusicSheetApplicationExtend().get(0).getScoreType();
|
|
|
+ musicSheetAudit.setScoreType(scoreType!=null?scoreType.name():EDefaultScoreType.STAVE.getCode());
|
|
|
if(applicationExtend.getTopFlag() != null){
|
|
|
musicSheetAudit.setTopFlag(applicationExtend.getTopFlag()? YesOrNoEnum.YES: YesOrNoEnum.NO);
|
|
|
}
|
|
@@ -2381,11 +2463,20 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
|
|
|
@Override
|
|
|
public CbsMusicSheetWrapper.MusicSheetApplicationQuery getMusicSheetApplicationQuery() {
|
|
|
+ return getMusicSheetApplicationQuery(SourceTypeEnum.PLATFORM);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public CbsMusicSheetWrapper.MusicSheetApplicationQuery getMusicSheetApplicationQuery(SourceTypeEnum sourceType) {
|
|
|
CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
query.setDetailFlag(true);
|
|
|
query.setDelFlag(true);
|
|
|
query.setPage(1);
|
|
|
- query.setApplicationId(applicationId);
|
|
|
+ query.setAudioPlayTypeFlag(false);
|
|
|
+ if (sourceType == null || sourceType == SourceTypeEnum.PLATFORM) {
|
|
|
+ query.setApplicationId(applicationId);
|
|
|
+ } else {
|
|
|
+ query.setApplicationId(Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.CBS_TENANT_APP_ID)));
|
|
|
+ }
|
|
|
return query;
|
|
|
}
|
|
|
|
|
@@ -2422,12 +2513,58 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
throw new BizException("曲目不存在");
|
|
|
}
|
|
|
queryInfo.setMusicSheetType(musicSheet.getMusicSheetType());
|
|
|
- if (musicSheet.getMusicSheetType() == MusicSheetTypeEnum.CONCERT) {
|
|
|
- queryInfo.setSubjectId(null);
|
|
|
- }
|
|
|
return musicSheetDao.queryTenantRelatedList(page,queryInfo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageInfo<MusicSheetWrapper.MusicSheetApplication> tenantPage(CbsMusicSheetWrapper.MusicSheetApplicationQuery query) {
|
|
|
+ String cbsTenantAppId = sysConfigService.findConfigValue(SysConfigConstant.CBS_TENANT_APP_ID);
|
|
|
+ query.setApplicationId(Long.parseLong(cbsTenantAppId));
|
|
|
+ try {
|
|
|
+ PageInfo<CbsMusicSheetWrapper.MusicSheetApplication> feignedData = this.musicFeignClientService.musicSheetPageByApplication(query).feignData();
|
|
|
+ PageInfo<MusicSheetWrapper.MusicSheetApplication> convert = feignedData.convert(o -> JSON.parseObject(JSON.toJSONString(o),MusicSheetWrapper.MusicSheetApplication.class));
|
|
|
+
|
|
|
+ List<MusicSheetWrapper.MusicSheetApplication> rows = convert.getRows();
|
|
|
+ if (CollectionUtils.isEmpty(rows)) {
|
|
|
+ return convert;
|
|
|
+ }
|
|
|
+ // 查询曲目对应的业务ID
|
|
|
+ List<Long> cbsMusicSheetIds = rows.stream().map(CbsMusicSheetWrapper.MusicSheetApplication::getId).collect(Collectors.toList());
|
|
|
+ Map<Long, MusicSheet> mapByCbsIds = getMapByCbsIds(cbsMusicSheetIds);
|
|
|
+ rows = rows.stream().map(o->{
|
|
|
+ MusicSheet musicSheet = mapByCbsIds.get(o.getId());
|
|
|
+ if (musicSheet != null) {
|
|
|
+ o.setBizId(musicSheet.getId());
|
|
|
+ return o;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ convert.setRows(rows);
|
|
|
+ return convert;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询曲目应用拓展表异常", e);
|
|
|
+ if(e instanceof com.microsvc.toolkit.common.webportal.exception.BizException) {
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ throw com.microsvc.toolkit.common.webportal.exception.BizException.from("内容平台服务异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delPractice(Long musicSheetId,Long userId,ClientEnum clientEnum) {
|
|
|
+ baseMapper.delPractice(musicSheetId,userId,clientEnum);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<Long,MusicSheet> getMapByCbsIds(List<Long> cbsMusicSheetIds) {
|
|
|
+ if (CollectionUtils.isEmpty(cbsMusicSheetIds)) {
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ List<MusicSheet> musicSheets = this.lambdaQuery().in(MusicSheet::getCbsMusicSheetId, cbsMusicSheetIds).list();
|
|
|
+ return musicSheets.stream().collect(Collectors.toMap(MusicSheet::getCbsMusicSheetId,o->o, (o1,o2)->o2));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private void syncMusicSheet(MusicSheet record, Date date) {
|
|
|
List<MusicSheetAccompaniment> list = musicSheetAccompanimentService.lambdaQuery().eq(MusicSheetAccompaniment::getMusicSheetId, record.getId()).list();
|
|
@@ -2583,7 +2720,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
addMusicSheetApplicationExtend.setPaymentType(from.getPaymentType());
|
|
|
addMusicSheetApplicationExtend.setTopFlag(from.getTopFlag() !=null && from.getTopFlag() == YesOrNoEnum.YES);
|
|
|
addMusicSheetApplicationExtend.setExquisiteFlag(from.getExquisiteFlag() !=null && from.getExquisiteFlag() == YesOrNoEnum.YES);
|
|
|
- addMusicSheetApplicationExtend.setAvailableType(from.getProviderType() !=null && from.getProviderType() == SourceTypeEnum.TENANT?EMusicAvailableType.ORG:EMusicAvailableType.PLATFORM);
|
|
|
+ addMusicSheetApplicationExtend.setAvailableType(StringUtils.isNotBlank(from.getProviderType())&& from.getProviderType().equals(SourceTypeEnum.TENANT.getCode())?EMusicAvailableType.ORG:EMusicAvailableType.PLATFORM);
|
|
|
addMusicSheetApplicationExtend.setMusicTagIds(from.getMusicTag());
|
|
|
addMusicSheetApplicationExtend.setMusicPrice(from.getMusicPrice());
|
|
|
addMusicSheet.setAddMusicSheetApplicationExtend(Lists.newArrayList(addMusicSheetApplicationExtend));
|