|
@@ -3,11 +3,8 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.extension.service.additional.update.impl.LambdaUpdateChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.beust.jcommander.internal.Lists;
|
|
|
-import com.dayaedu.cbs.common.enums.music.EMusicAvailableType;
|
|
|
-import com.dayaedu.cbs.common.enums.music.EMusicSourceType;
|
|
|
import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
|
|
|
import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
|
|
|
import com.dayaedu.cbs.openfeign.properties.OpenFeignClientConfigProperties;
|
|
@@ -35,7 +32,6 @@ 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.support.WrapperUtil;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.*;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
|
|
@@ -84,8 +80,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
|
|
|
@Resource
|
|
|
private MusicSheetDao musicSheetDao;
|
|
|
-// @Resource
|
|
|
-// private MusicSheetAccompanimentService musicSheetAccompanimentService;
|
|
|
@Resource
|
|
|
private MusicFavoriteService musicFavoriteService;
|
|
|
@Resource
|
|
@@ -163,34 +157,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return musicSheetDao;
|
|
|
}
|
|
|
|
|
|
- /*@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean saveMp3AndAccompaniment(MusicSheetDto musicSheetDto, Long userId, Long originalMusicSheetId, Long lastMusicSheetId) {
|
|
|
- MusicSheet musicSheet = new MusicSheet();
|
|
|
- BeanUtils.copyProperties(musicSheetDto, musicSheet);
|
|
|
- //保存主表
|
|
|
- musicSheet.setUpdateBy(userId);
|
|
|
- musicSheet.setUpdateTime(new Date());
|
|
|
- //musicSheet.setState(YesOrNoEnum.NO);
|
|
|
- this.saveOrUpdate(musicSheet);
|
|
|
-
|
|
|
- if (musicSheet.getMusicSheetType() !=null && MusicSheetTypeEnum.CONCERT.equals(musicSheet.getMusicSheetType())) {
|
|
|
- this.lambdaUpdate()
|
|
|
- .eq(MusicSheet::getId, musicSheet.getId())
|
|
|
- .set(MusicSheet::getMusicSubject,"")
|
|
|
- .update();
|
|
|
- }
|
|
|
-
|
|
|
- if (musicSheet.getAuditStatus() == null || AuthStatusEnum.DOING.getCode().equals(musicSheet.getAuditStatus().getCode())) {
|
|
|
- musicSheetAuthRecordService.setAuditDoing(musicSheet.getId(), originalMusicSheetId, lastMusicSheetId);
|
|
|
- }
|
|
|
-
|
|
|
- Long sheetId = musicSheet.getId();
|
|
|
- List<MusicSheetAccompaniment> list = musicSheetDto.getBackground();
|
|
|
- list.forEach(musicSheetAccompaniment -> musicSheetAccompaniment.setMusicSheetId(sheetId).setCreateBy(userId).setCreateTime(new Date()));
|
|
|
- return musicSheetAccompanimentService.saveBatch(list);
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
@Override
|
|
|
public IPage<MusicSheetVo> selectPage(IPage<MusicSheetVo> page, MusicSheetSearch query) {
|
|
|
|
|
@@ -503,87 +469,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return detail(id, sysUser, userType,null);
|
|
|
}
|
|
|
|
|
|
- /*public MusicSheetDetailVo getCbsDetail(Long id) {
|
|
|
- MusicSheetDetailVo musicSheet = baseMapper.detail(id);
|
|
|
- if (musicSheet == null) {
|
|
|
- throw new BizException("未找到曲目信息");
|
|
|
- }
|
|
|
- if (musicSheet.getCbsMusicSheetId() == null) {
|
|
|
- throw new BizException("曲目信息异常");
|
|
|
- }
|
|
|
- try {
|
|
|
- CbsMusicSheetWrapper.MusicSheet musicSheet1 = musicFeignClientService.musicSheetDetail(musicSheet.getCbsMusicSheetId(), Long.parseLong(openFeignClientConfigProperties.getAppId())).feignData();
|
|
|
- musicSheetApplicationToMusicSheet(musicSheet1, musicSheet);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("调用内容平台服务异常", e);
|
|
|
- throw com.microsvc.toolkit.common.webportal.exception.BizException.from("内容平台服务异常");
|
|
|
- }
|
|
|
- return musicSheet;
|
|
|
- }*/
|
|
|
-
|
|
|
- private void musicSheetApplicationToMusicSheet(CbsMusicSheetWrapper.MusicSheet musicSheetApplication, MusicSheetDetailVo sheet) {
|
|
|
- sheet.setMusicSheetName(musicSheetApplication.getName());
|
|
|
- if (musicSheetApplication.getMusicSheetType() != null) {
|
|
|
- sheet.setMusicSheetType(MusicSheetTypeEnum.valueOf(musicSheetApplication.getMusicSheetType().name()));
|
|
|
- }
|
|
|
- sheet.setTitleImg(musicSheetApplication.getMusicCover());
|
|
|
- if(musicSheetApplication.getSourceType() != null){
|
|
|
- sheet.setSourceType(musicSheetApplication.getSourceType() == EMusicSourceType.PERSON ? SourceTypeEnum.TEACHER :
|
|
|
- musicSheetApplication.getSourceType() == EMusicSourceType.ORG ? SourceTypeEnum.TENANT :SourceTypeEnum.PLATFORM);
|
|
|
- }
|
|
|
- sheet.setComposer(musicSheetApplication.getComposer());
|
|
|
- sheet.setAudioType(AudioTypeEnum.valueOf(musicSheetApplication.getPlayMode().getCode()));
|
|
|
- sheet.setMp3Type(AudioTypeEnum.valueOf(musicSheetApplication.getIsPlayBeat()&&musicSheetApplication.getIsUseSystemBeat()?"MP3":"MP3_METRONOME"));
|
|
|
- if (StringUtils.isNotEmpty(musicSheetApplication.getPlaySpeed())) {
|
|
|
- sheet.setPlaySpeed(musicSheetApplication.getPlaySpeed());
|
|
|
- }
|
|
|
- if (musicSheetApplication.getIsConvertibleScore() != null){
|
|
|
- sheet.setNotation(musicSheetApplication.getIsConvertibleScore()?YesOrNoEnum.YES:YesOrNoEnum.NO);
|
|
|
- }
|
|
|
- if (musicSheetApplication.getIsEvaluated() != null){
|
|
|
- sheet.setCanEvaluate(musicSheetApplication.getIsEvaluated()?YesOrNoEnum.YES:YesOrNoEnum.NO);
|
|
|
- }
|
|
|
- if (musicSheetApplication.getIsShowFingering() != null){
|
|
|
- sheet.setShowFingering(musicSheetApplication.getIsShowFingering()?YesOrNoEnum.YES:YesOrNoEnum.NO);
|
|
|
- }
|
|
|
- if (musicSheetApplication.getAudioType() != null) {
|
|
|
- sheet.setAccompanimentType(AccompanimentTypeEnum.valueOf(musicSheetApplication.getAudioType().getCode()));
|
|
|
- }
|
|
|
- sheet.setMusicTagNames(musicSheetApplication.getMusicTagNames());
|
|
|
- sheet.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
- if (CollectionUtils.isNotEmpty(musicSheetApplication.getMusicSheetAccompanimentList())) {
|
|
|
- CbsMusicSheetWrapper.MusicSheetAccompaniment accompaniment = musicSheetApplication.getMusicSheetAccompanimentList().get(0);
|
|
|
- sheet.setAudioFileUrl(accompaniment.getAudioFileUrl());
|
|
|
- sheet.setMetronomeUrl(accompaniment.getAudioFileUrl());
|
|
|
- sheet.setUrl(accompaniment.getAudioFileUrl());
|
|
|
- }
|
|
|
- sheet.setXmlFileUrl(musicSheetApplication.getXmlFileUrl());
|
|
|
- sheet.setMidiUrl(musicSheetApplication.getMidiFileUrl());
|
|
|
- if (musicSheetApplication.getAppAuditFlag() != null){
|
|
|
- sheet.setAuditVersion(musicSheetApplication.getAppAuditFlag()?YesOrNoEnum.YES:YesOrNoEnum.NO);
|
|
|
- }
|
|
|
- if(musicSheetApplication.getAvailableType() != null){
|
|
|
- sheet.setProviderType(musicSheetApplication.getAvailableType() == EMusicAvailableType.PERSON ? SourceTypeEnum.TEACHER :
|
|
|
- musicSheetApplication.getAvailableType() == EMusicAvailableType.ORG ? SourceTypeEnum.TENANT :SourceTypeEnum.PLATFORM);
|
|
|
- }
|
|
|
- sheet.setUpdateBy(musicSheetApplication.getUpdateBy());
|
|
|
- sheet.setExtConfigJson(musicSheetApplication.getExtConfigJson());
|
|
|
- sheet.setMusicJSON(musicSheetApplication.getMusicJson());
|
|
|
- sheet.setMusicSvg(musicSheetApplication.getMusicSvg());
|
|
|
- sheet.setMusicJianSvg(musicSheetApplication.getMusicJianImg());
|
|
|
- sheet.setMusicFirstSvg(musicSheetApplication.getMusicFirstImg());
|
|
|
- if(musicSheetApplication.getMusicSheetType() != null){
|
|
|
- sheet.setMusicSheetType(musicSheetApplication.getMusicSheetType() == EMusicSheetType.SINGLE ? MusicSheetTypeEnum.SINGLE : MusicSheetTypeEnum.CONCERT);
|
|
|
- }
|
|
|
- sheet.setBackground(musicSheetApplication.getMusicSheetSoundList().stream().map(musicSheetSound -> {
|
|
|
- MusicSheetAccompaniment accompaniment = new MusicSheetAccompaniment();
|
|
|
- accompaniment.setAudioFileUrl(musicSheetSound.getAudioFileUrl());
|
|
|
- accompaniment.setSortNumber(musicSheetSound.getSortNumber());
|
|
|
- accompaniment.setTrack(musicSheetSound.getTrack());
|
|
|
- return accompaniment;
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- }
|
|
|
-
|
|
|
private void musicSheetApplicationToMusicSheet(CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication, MusicSheetVo sheet) {
|
|
|
sheet.setMusicSheetName(musicSheetApplication.getName());
|
|
|
if (musicSheetApplication.getMusicSheetType() != null) {
|
|
@@ -1115,149 +1000,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return page.setRecords(baseMapper.selectTeacherPage(page, query));
|
|
|
}
|
|
|
|
|
|
- /*@Override
|
|
|
- public IPage<TeacherMusicSheetVo> selectAuditPage(IPage<TeacherMusicSheetVo> page, TeacherMusicSheetAuditSearch query) {
|
|
|
- return page.setRecords(baseMapper.selectAuditPage(page, query));
|
|
|
- }*/
|
|
|
-
|
|
|
- /*@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean audit(TeacherMusicSheetAuditReq param, Long userId) {
|
|
|
-
|
|
|
- MusicSheet musicSheet = this.getById(param.getMusicSheetId());
|
|
|
- if (musicSheet == null) {
|
|
|
- throw new BizException("未找到曲目信息");
|
|
|
- }
|
|
|
- if (!AuthStatusEnum.DOING.getCode().equals(musicSheet.getAuditStatus().getCode())) {
|
|
|
- throw new BizException("曲目已经过审批");
|
|
|
- }
|
|
|
-
|
|
|
- boolean flag;
|
|
|
- Long originalMusicSheetId = musicSheetAuthRecordService.audit(param, userId);
|
|
|
- musicSheet.setAuditStatus(param.getAuthStatus());
|
|
|
- // 生成图片统一使用开放接口,去掉当前校验规则
|
|
|
- *//*if (param.getAuthStatus().equals(AuthStatusEnum.PASS) && StringUtil.isEmpty(param.getMusicImg())) {
|
|
|
- throw new BizException("曲目渲染失败");
|
|
|
- } else*//*
|
|
|
-
|
|
|
- if (param.getAuthStatus().equals(AuthStatusEnum.PASS) && !StringUtil.isEmpty(param.getMusicImg())) {
|
|
|
- musicSheet.setMusicImg(param.getMusicImg());
|
|
|
- }
|
|
|
-
|
|
|
- musicSheet.setUpdateBy(userId);
|
|
|
- musicSheet.setUpdateTime(new Date());
|
|
|
- if (AuthStatusEnum.PASS.getCode().equals(param.getAuthStatus().getCode())) {
|
|
|
-
|
|
|
- // 更新曲谱评测,指法、简谱、节拍器状态
|
|
|
- musicSheet
|
|
|
- .notation(param.getNotation())
|
|
|
- .canEvaluate(param.getCanEvaluate())
|
|
|
- .showFingering(param.getShowFingering())
|
|
|
- //.hasBeat(param.getHasBeat())
|
|
|
- .mp3Type(param.getMp3Type())
|
|
|
- .firstTone(Optional.ofNullable(param.getFirstTone()).orElse(musicSheet.getFirstTone()))
|
|
|
- .fixedTone(Optional.ofNullable(param.getFixedTone()).orElse(musicSheet.getFixedTone()))
|
|
|
- //.audioType(param.getAudioType())
|
|
|
- //.audioFileUrl(param.getAudioFileUrl())
|
|
|
- .setState(YesOrNoEnum.YES);
|
|
|
- // 替换曲目id
|
|
|
- replaceMusicSheet(param, musicSheet, originalMusicSheetId);
|
|
|
-
|
|
|
- // 修改老师标签
|
|
|
- teacherService.setTeacherTag(musicSheet.getUserId(), TeacherTagEnum.MUSIC);
|
|
|
-
|
|
|
- // 设置首次通过审核时间
|
|
|
- musicSheet.setFirstPassAuditTime(new Date());
|
|
|
-
|
|
|
- //同步到内容平台
|
|
|
- this.auditSyncCbs(musicSheet.getCbsMusicSheetId());
|
|
|
- }
|
|
|
- flag = this.updateById(musicSheet);
|
|
|
-
|
|
|
-
|
|
|
- // 发送审核通知
|
|
|
- Map<Long, String> receivers = new HashMap<>();
|
|
|
- SysUser teacher = sysUserFeignService.queryUserById(musicSheet.getUserId());
|
|
|
- receivers.put(musicSheet.getUserId(), teacher.getPhone());
|
|
|
- try {
|
|
|
- sendMusicSheetAuditMessage(param, musicSheet, receivers);
|
|
|
- } catch (Exception e) {
|
|
|
- log.warn("曲目审核消息发送失败,{}", e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- return flag;
|
|
|
- }*/
|
|
|
-
|
|
|
- /*@Override
|
|
|
- public void auditSyncCbs(Long cbsMusicSheetId){
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
- query.setApplicationId(applicationId);
|
|
|
- query.setMusicSheetIds(Collections.singletonList(cbsMusicSheetId));
|
|
|
- query.setDelFlag(true);
|
|
|
- query.setPage(1);
|
|
|
- query.setRows(1);
|
|
|
- R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(query);
|
|
|
- if (pageInfoR.getCode() != 200) {
|
|
|
- throw new BizException("获取曲目信息异常,{}", pageInfoR.getMessage());
|
|
|
- }
|
|
|
- List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
|
|
|
- if (CollectionUtils.isEmpty(rows)) {
|
|
|
- throw new BizException("获取曲目信息失败");
|
|
|
- }*//*
|
|
|
- R<CbsMusicSheetWrapper.MusicSheet> musicSheetR = musicFeignClientService.musicSheetDetail(cbsMusicSheetId, applicationId);
|
|
|
- if (musicSheetR.getCode() != 200) {
|
|
|
- throw new BizException("获取曲目详情失败,{}", musicSheetR.getMessage());
|
|
|
- }*//*
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = rows.get(0);
|
|
|
- CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus extendStatus = new CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus();
|
|
|
- extendStatus.setIds(musicSheetApplication.getApplicationExtendId().toString());
|
|
|
- extendStatus.setStatus(true);
|
|
|
- musicFeignClientService.musicSheetApplicationExtendStatus(extendStatus);
|
|
|
- }
|
|
|
-
|
|
|
- private void replaceMusicSheet(TeacherMusicSheetAuditReq param, MusicSheet musicSheet, Long originalMusicSheetId) {
|
|
|
- if (!musicSheet.getId().equals(originalMusicSheetId)) {
|
|
|
- MusicSheet originalMusicSheet = getById(originalMusicSheetId);
|
|
|
- originalMusicSheet.setId(param.getMusicSheetId());
|
|
|
- this.saveOrUpdate(originalMusicSheet);
|
|
|
-
|
|
|
- // 替换 伴奏
|
|
|
- List<MusicSheetAccompaniment> musicSheetAccompanimentList = musicSheetAccompanimentService.getByMusicSheetId(
|
|
|
- musicSheet.getId()).stream()
|
|
|
- .peek(musicSheetAccompaniment -> musicSheetAccompaniment.setMusicSheetId(
|
|
|
- originalMusicSheetId))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<MusicSheetAccompaniment> originalMusicSheetAccompanimentList = musicSheetAccompanimentService.getByMusicSheetId(
|
|
|
- originalMusicSheetId).stream()
|
|
|
- .peek(musicSheetAccompaniment -> musicSheetAccompaniment.setMusicSheetId(
|
|
|
- musicSheet.getId()))
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- if (originalMusicSheet.getFirstPassAuditTime() != null) {
|
|
|
- musicSheet.setFirstPassAuditTime(originalMusicSheet.getFirstPassAuditTime());
|
|
|
- }
|
|
|
- musicSheetAccompanimentList.addAll(originalMusicSheetAccompanimentList);
|
|
|
- if (CollectionUtils.isEmpty(musicSheetAccompanimentList)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- musicSheetAccompanimentService.saveOrUpdateBatch(musicSheetAccompanimentList);
|
|
|
- musicSheet.setId(originalMusicSheetId);
|
|
|
- musicSheet.setFavoriteCount(originalMusicSheet.getFavoriteCount());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 发送曲目审核消息
|
|
|
- private void sendMusicSheetAuditMessage(TeacherMusicSheetAuditReq param, MusicSheet musicSheet, Map<Long, String> receivers) {
|
|
|
- if (AuthStatusEnum.PASS.getCode().equals(param.getAuthStatus().getCode())) {
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_SHEET_AUTH_PASS,
|
|
|
- receivers, null, 0, null, ClientEnum.TEACHER.getCode(), musicSheet.getMusicSheetName());
|
|
|
- } else if (AuthStatusEnum.UNPASS.getCode().equals(param.getAuthStatus().getCode())) {
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_SHEET_AUTH_UNPASS,
|
|
|
- receivers, null, 0, null, ClientEnum.TEACHER.getCode(), musicSheet.getMusicSheetName(),
|
|
|
- param.getRemark());
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean del(Long id) {
|
|
@@ -1284,113 +1026,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
.count();
|
|
|
}
|
|
|
|
|
|
- /*@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean saveMusicSheet(MusicSheetDto musicSheetDto, Long userId) {
|
|
|
-
|
|
|
- String[] split = musicSheetDto.getMusicTag().split(",");
|
|
|
- if (split.length >3) {
|
|
|
- throw new BizException("曲目标签数不能超过3个");
|
|
|
- }
|
|
|
- MusicSheet oldMusicSheet = null;
|
|
|
- Long originalMusicSheetId = null;
|
|
|
- Long lastMusicSheetId = musicSheetDto.getId();
|
|
|
- if (musicSheetDto.getId() != null) {
|
|
|
- oldMusicSheet = getById(musicSheetDto.getId());
|
|
|
- }
|
|
|
- // 保存审核拒绝的数据
|
|
|
- if (musicSheetDto.getId() != null && AuthStatusEnum.DOING.getCode().equals(musicSheetDto.getAuditStatus().getCode())) {
|
|
|
- // 保存删除的曲目
|
|
|
- if (oldMusicSheet != null && !AuthStatusEnum.DOING.equals(oldMusicSheet.getAuditStatus())) {
|
|
|
- oldMusicSheet.setDelFlag(true);
|
|
|
- this.saveOrUpdate(oldMusicSheet);
|
|
|
- List<MusicSheetAuthRecord> list = musicSheetAuthRecordService.lambdaQuery()
|
|
|
- .eq(MusicSheetAuthRecord::getMusicSheetId,
|
|
|
- musicSheetDto.getId())
|
|
|
- .list();
|
|
|
- if (!CollectionUtils.isEmpty(list)) {
|
|
|
- originalMusicSheetId = list.get(0).getOriginalMusicSheetId();
|
|
|
- }
|
|
|
- musicSheetDto.setId(null);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (musicSheetDto.getId() != null) {
|
|
|
- musicSheetAccompanimentService.delByMusicSheetId(musicSheetDto.getId());
|
|
|
- }
|
|
|
-
|
|
|
- if (musicSheetDto.getAuditVersion() == null) {
|
|
|
- musicSheetDto.setAuditVersion(YesOrNoEnum.NO);
|
|
|
- }
|
|
|
- List<String> collect = Arrays.stream(musicSheetDto.getPaymentType().split(",")).collect(Collectors.toList());
|
|
|
- // 非付费方式,默认曲目价格为0
|
|
|
- if (!collect.contains(ChargeTypeEnum.CHARGE.getCode())) {
|
|
|
- musicSheetDto.setMusicPrice(BigDecimal.ZERO);
|
|
|
- }
|
|
|
-
|
|
|
- *//*if (musicSheetDto.getChargeType().equals(ChargeTypeEnum.VIP) || musicSheetDto.getChargeType().equals(ChargeTypeEnum.FREE)) {
|
|
|
- musicSheetDto.setMusicPrice(BigDecimal.ZERO);
|
|
|
- }*//*
|
|
|
-
|
|
|
- // 删除曲目专辑关联
|
|
|
- if (oldMusicSheet != null && oldMusicSheet.getMusicSubject() != null
|
|
|
- && !oldMusicSheet.getMusicSubject().equals(musicSheetDto.getMusicSubject())) {
|
|
|
- delAlbumSheetRef(musicSheetDto.getId(), musicSheetDto.getMusicSubject());
|
|
|
- }
|
|
|
-
|
|
|
- List<MusicSheetAccompaniment> list;
|
|
|
- if (!AudioTypeEnum.MIDI.getCode().equals(musicSheetDto.getAudioType().getCode())) {
|
|
|
- list = musicSheetDto.getBackground();
|
|
|
- if (CollectionUtils.isEmpty(list)) {
|
|
|
- throw new BizException("mp3音频文件对应的主音或者伴奏文件没有提供");
|
|
|
- }
|
|
|
- return saveMp3AndAccompaniment(musicSheetDto, userId,originalMusicSheetId,lastMusicSheetId);
|
|
|
- } else {
|
|
|
- MusicSheet musicSheet = new MusicSheet();
|
|
|
- BeanUtils.copyProperties(musicSheetDto, musicSheet);
|
|
|
- musicSheet.setUpdateTime(new Date());
|
|
|
- musicSheet.setUpdateBy(userId);
|
|
|
- //musicSheet.setState(YesOrNoEnum.NO);
|
|
|
- this.saveOrUpdate(musicSheet);
|
|
|
-
|
|
|
- if (musicSheet.getMusicSheetType() !=null && MusicSheetTypeEnum.CONCERT.equals(musicSheet.getMusicSheetType())) {
|
|
|
- this.lambdaUpdate()
|
|
|
- .eq(MusicSheet::getId, musicSheet.getId())
|
|
|
- .set(MusicSheet::getMusicSubject,"")
|
|
|
- .update();
|
|
|
- }
|
|
|
- if (musicSheet.getAuditStatus() == null || AuthStatusEnum.DOING.getCode().equals(musicSheet.getAuditStatus().getCode())) {
|
|
|
- musicSheetAuthRecordService.setAuditDoing(musicSheet.getId(),originalMusicSheetId,lastMusicSheetId);
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除专辑曲目关联
|
|
|
- *
|
|
|
- * @param id 曲目id
|
|
|
- * @param subjectId 声部id
|
|
|
- */
|
|
|
- private void delAlbumSheetRef(Long id, String subjectId) {
|
|
|
-
|
|
|
- if (id == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- MusicSheet musicSheet = this.getById(id);
|
|
|
- if (musicSheet == null) {
|
|
|
- throw new BizException("曲目不存在");
|
|
|
- }
|
|
|
- if (musicSheet.getMusicSubject().equals(subjectId)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- albumMusicRelateService.delByMusicSheet(musicSheet.getId());
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public HttpResponseResult<OrderCreateRes> buyMusicSheetCheck(OrderReq.OrderReqInfo orderReqInfo) {
|
|
|
|
|
@@ -1714,120 +1349,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return homeMusicSheetVo;
|
|
|
}
|
|
|
|
|
|
- /*@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public void importExcel(List<ExcelDataReaderProperty<MusicSheetExport>> dataList, Long userId) {
|
|
|
-
|
|
|
- List<ErrMsg> errMsgList = new ArrayList<>();
|
|
|
- dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
|
|
|
- List<MusicSheetDto> musicSheetDtoList = new ArrayList<>();
|
|
|
- List<MusicTagVo> musicTagVoList = musicTagService.selectMusicTagTree("MUSIC");
|
|
|
- List<Subject> subjects = subjectService.subjectSelect(null, null);
|
|
|
- Date date = new Date();
|
|
|
- for (ExcelDataReaderProperty<MusicSheetExport> readerProperty : dataList) {
|
|
|
- MusicSheetDto musicSheetDto = new MusicSheetDto();
|
|
|
- musicSheetDto.setUserId(userId);
|
|
|
- musicSheetDto.setAuditVersion(YesOrNoEnum.NO);
|
|
|
- musicSheetDto.setSourceType(SourceTypeEnum.PLATFORM);
|
|
|
- musicSheetDto.setChargeType(ChargeTypeEnum.FREE);
|
|
|
- musicSheetDto.setAuditStatus(AuthStatusEnum.PASS);
|
|
|
- musicSheetDto.setState(YesOrNoEnum.NO);
|
|
|
- musicSheetDto.setDelFlag(false);
|
|
|
- musicSheetDto.setCreateBy(userId);
|
|
|
- musicSheetDto.setUpdateBy(userId);
|
|
|
- musicSheetDto.setCreateTime(date);
|
|
|
- musicSheetDto.setUpdateTime(date);
|
|
|
-
|
|
|
- String errMsg = readerProperty.getErrorMessage();
|
|
|
- if (!StringUtil.isEmpty(errMsg)) {
|
|
|
- errMsgList.add(new ErrMsg(readerProperty.getRowIndex(), errMsg));
|
|
|
- continue;
|
|
|
- }
|
|
|
- MusicSheetExport sheetExport = readerProperty.getClazz();
|
|
|
- BeanUtils.copyProperties(sheetExport, musicSheetDto);
|
|
|
-
|
|
|
- if (AudioTypeEnum.MIDI.getCode().equals(musicSheetDto.getAudioType().getCode())) {
|
|
|
- musicSheetDto.setMp3Type(null);
|
|
|
- }
|
|
|
-
|
|
|
- if (musicSheetDto.getAudioType().equals(AudioTypeEnum.MP3)) {
|
|
|
- musicSheetDto.setUrl(musicSheetDto.getMidiUrl());
|
|
|
- musicSheetDto.setMidiUrl("");
|
|
|
- }
|
|
|
-
|
|
|
- String musicTags = sheetExport.getMusicTags();
|
|
|
- StringBuilder musicTagIds = new StringBuilder();
|
|
|
- if (musicTags == null || musicTags.equals("")) {
|
|
|
- errMsgList.add(new ErrMsg(readerProperty.getRowIndex(), "曲目标签不能为空"));
|
|
|
- } else {
|
|
|
- String[] stringList = musicTags.split("[,,]");
|
|
|
- List<MusicTag> childrenMusicTag = new ArrayList<>();
|
|
|
- for (MusicTagVo musicTagVo : musicTagVoList) {
|
|
|
- childrenMusicTag.addAll(musicTagVo.getChildren());
|
|
|
- }
|
|
|
- for (String s : stringList) {
|
|
|
- boolean b = false;
|
|
|
- for (MusicTag musicTag : childrenMusicTag) {
|
|
|
- if (musicTag.getName().equals(s)) {
|
|
|
- if (musicTagIds.length() != 0) {
|
|
|
- musicTagIds.append(",");
|
|
|
- }
|
|
|
- musicTagIds.append(musicTag.getId());
|
|
|
- b = true;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!b) {
|
|
|
- errMsgList.add(new ErrMsg(readerProperty.getRowIndex(), "曲目名称错误:" + s));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (StringUtil.isEmpty(sheetExport.getComposer())) {
|
|
|
- errMsgList.add(new ErrMsg(readerProperty.getRowIndex(), "音乐人不能为空"));
|
|
|
- }
|
|
|
- if (StringUtil.isEmpty(sheetExport.getMusicSubjects())) {
|
|
|
- errMsgList.add(new ErrMsg(readerProperty.getRowIndex(), "曲目声部不能为空"));
|
|
|
- } else {
|
|
|
- List<Subject> childrenSubject = new ArrayList<>();
|
|
|
- for (Subject subject : subjects) {
|
|
|
- if (CollectionUtils.isEmpty(subject.getSubjects())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- childrenSubject.addAll(subject.getSubjects());
|
|
|
- }
|
|
|
- List<Subject> collect = childrenSubject.stream()
|
|
|
- .filter(subject -> subject.getName().equals(sheetExport.getMusicSubjects()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(collect)) {
|
|
|
- errMsgList.add(new ErrMsg(readerProperty.getRowIndex(), "曲目声部名错误:" + sheetExport.getMusicSubjects()));
|
|
|
- } else {
|
|
|
- musicSheetDto.setMusicSubject(collect.get(0).getId().toString());
|
|
|
- }
|
|
|
- }
|
|
|
- if (!StringUtil.isEmpty(sheetExport.getAudioFileUrls())) {
|
|
|
-
|
|
|
- List<MusicSheetAccompaniment> background = new ArrayList<>();
|
|
|
- String[] audioFileUrls = sheetExport.getAudioFileUrls().split("[,,]");
|
|
|
- for (String audioFileUrl : audioFileUrls) {
|
|
|
- MusicSheetAccompaniment musicSheetAccompaniment = new MusicSheetAccompaniment();
|
|
|
- musicSheetAccompaniment.setAudioFileUrl(audioFileUrl);
|
|
|
- background.add(musicSheetAccompaniment);
|
|
|
- }
|
|
|
- musicSheetDto.setBackground(background);
|
|
|
- }
|
|
|
-
|
|
|
- musicSheetDto.setMusicTag(musicTagIds.toString());
|
|
|
-
|
|
|
- musicSheetDtoList.add(musicSheetDto);
|
|
|
- }
|
|
|
-
|
|
|
- if (!CollectionUtils.isEmpty(errMsgList)) {
|
|
|
- throw new ExcelException("导入异常", errMsgList);
|
|
|
- }
|
|
|
-
|
|
|
- musicSheetDtoList.forEach(musicSheetDto -> saveMusicSheet(musicSheetDto, userId));
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
@Override
|
|
|
public MusicSheetWebsiteDetailVo websiteDetail(Long musicSheetId, SysUser sysUser, ClientEnum clientType) {
|
|
|
MusicSheetDetailVo detail = detail(musicSheetId, null, null);
|
|
@@ -1941,70 +1462,59 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
@Override
|
|
|
public Boolean top(Long musicSheetId) {
|
|
|
MusicSheet musicSheet = getById(musicSheetId);
|
|
|
-
|
|
|
if (musicSheet == null) {
|
|
|
throw new BizException("曲目不存在");
|
|
|
}
|
|
|
-
|
|
|
if (YesOrNoEnum.NO.equals(musicSheet.getState())) {
|
|
|
throw new BizException("下架的曲目不能置顶");
|
|
|
}
|
|
|
-
|
|
|
- if (YesOrNoEnum.YES.equals(musicSheet.getTopFlag())) {
|
|
|
- musicSheet.setTopFlag(YesOrNoEnum.NO);
|
|
|
- return this.saveOrUpdate(musicSheet);
|
|
|
- }
|
|
|
- String subjectIdsStr = musicSheet.getMusicSubject();
|
|
|
-
|
|
|
- // 置顶不做限制
|
|
|
- // for (String subjectId : subjectIdsStr.split(",")) {
|
|
|
- // Integer count = this.lambdaQuery().eq(MusicSheet::getDelFlag, YesOrNoEnum.NO).eq(MusicSheet::getTopFlag, YesOrNoEnum.YES)
|
|
|
- // .eq(MusicSheet::getState, YesOrNoEnum.YES).apply(!subjectId.isEmpty(), "FIND_IN_SET ('" + subjectId + "',music_subject_)").count();
|
|
|
- // String topNum = sysConfigService.findConfigValue(SysConfigConstant.MUSIC_SHEET_TOP_NUM);
|
|
|
- // if (StringUtil.isEmpty(topNum)) {
|
|
|
- // throw new BizException("获取置顶配置失败");
|
|
|
- // }
|
|
|
- // if (count >= Integer.parseInt(topNum)) {
|
|
|
- // throw new BizException("首页推荐数量达到[" +topNum+"]上限,请先取消其他曲谱推荐");
|
|
|
- // }
|
|
|
- // }
|
|
|
- musicSheet.setTopFlag(YesOrNoEnum.YES);
|
|
|
- return this.saveOrUpdate(musicSheet);
|
|
|
+ CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend addMusicSheetApplicationExtend = new CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend();
|
|
|
+ addMusicSheetApplicationExtend.setApplicationId(applicationId);
|
|
|
+ addMusicSheetApplicationExtend.setMusicSheetId(musicSheetId);
|
|
|
+ addMusicSheetApplicationExtend.setTopFlag(musicSheet.getTopFlag() != YesOrNoEnum.YES);
|
|
|
+ R<JSONObject> jsonObjectR = musicFeignClientService.musicSheetApplicationExtendUpdate(addMusicSheetApplicationExtend);
|
|
|
+ if (jsonObjectR.getCode() != 200) {
|
|
|
+ throw new BizException("修改失败,{}",jsonObjectR.getMessage());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Boolean stateList(ReasonDto reasonDto) {
|
|
|
- List<Long> idList = WrapperUtil.toLongList(reasonDto.getMusicSheetIds());
|
|
|
-
|
|
|
- Collection<MusicSheet> musicSheets = this.listByIds(idList);
|
|
|
- List<MusicSheet> musicSheetList = musicSheets.stream()
|
|
|
- .filter(musicSheet -> !musicSheet.getState().equals(reasonDto.getState()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(musicSheetList)) {
|
|
|
- return true;
|
|
|
+ List<Long> musicSheets = Arrays.stream(reasonDto.getMusicSheetIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
+ query.setApplicationId(applicationId);
|
|
|
+ query.setMusicSheetIds(musicSheets);
|
|
|
+ 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());
|
|
|
}
|
|
|
- LambdaUpdateChainWrapper<MusicSheet> wrapper = this.lambdaUpdate()
|
|
|
- .in(MusicSheet::getId, musicSheetList.stream()
|
|
|
- .map(MusicSheet::getId)
|
|
|
- .collect(Collectors.toList()))
|
|
|
- .set(MusicSheet::getState, reasonDto.getState());
|
|
|
- if (reasonDto.getState().equals(YesOrNoEnum.NO)) {
|
|
|
- wrapper.set(MusicSheet::getTopFlag,0);
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
|
|
|
+ if (CollectionUtils.isEmpty(rows)) {
|
|
|
+ throw new BizException("获取曲目信息失败");
|
|
|
+ }
|
|
|
+ String applicationExtendIds = rows.stream().map(e -> e.getApplicationExtendId().toString()).collect(Collectors.joining(","));
|
|
|
+ CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus extendStatus = new CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus();
|
|
|
+ extendStatus.setIds(applicationExtendIds);
|
|
|
+ extendStatus.setStatus(reasonDto.getState()==YesOrNoEnum.YES);
|
|
|
+ R<JSONObject> jsonObjectR = musicFeignClientService.musicSheetApplicationExtendStatus(extendStatus);
|
|
|
+ if (jsonObjectR.getCode() != 200) {
|
|
|
+ throw new BizException("修改曲目状态失败,{}", jsonObjectR.getMessage());
|
|
|
}
|
|
|
- wrapper.update();
|
|
|
-
|
|
|
// 发送推送
|
|
|
if (reasonDto.getState().equals(YesOrNoEnum.YES)){
|
|
|
return true;
|
|
|
}
|
|
|
+ List<MusicSheet> musicSheetList = musicSheetService.lambdaQuery().in(MusicSheet::getId, musicSheets).list();
|
|
|
for (MusicSheet musicSheet : musicSheetList) {
|
|
|
if (SourceTypeEnum.TEACHER.equals(musicSheet.getSourceType())) {
|
|
|
sendOutSaleMessage(reasonDto.getReason(),musicSheet);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return true;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|