|
@@ -199,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) {
|
|
@@ -210,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;
|
|
|
}
|
|
@@ -218,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();
|
|
@@ -310,7 +314,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
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());
|
|
@@ -388,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("未找到曲目信息");
|
|
@@ -397,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;
|
|
|
}
|
|
|
|
|
@@ -423,9 +428,11 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return detailVo;
|
|
|
}
|
|
|
|
|
|
- public void initMusicSheetDetailVo(MusicSheetDetailVo detailVo,MusicSheet musicSheet) {
|
|
|
- CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
|
|
|
+
|
|
|
+ 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()));
|
|
|
List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
|
|
|
if(CollectionUtils.isEmpty(rows)){
|
|
@@ -442,6 +449,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
detailVo.setUserAvatar(sysUser.getAvatar());
|
|
|
}
|
|
|
}
|
|
|
+ detailVo.setCategoryId(musicSheet1.getMusicCategoryId()!=null?musicSheet1.getMusicCategoryId().toString():"");
|
|
|
detailVo.setMusicPrice(musicSheet1.getMusicPrice());
|
|
|
detailVo.setSubjectNames(musicSheet1.getSubjectNames());
|
|
|
detailVo.setCode(musicSheet1.getSubjectCodes());
|
|
@@ -549,6 +557,7 @@ 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());
|
|
|
sheet.setSubjectNames(musicSheetApplication.getSubjectNames());
|
|
|
sheet.setPaymentType(musicSheetApplication.getPaymentType());
|
|
@@ -610,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) {
|
|
@@ -619,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;
|
|
|
}
|
|
|
|
|
@@ -646,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());
|
|
|
|
|
|
// 学生生效中的机构专辑
|
|
@@ -688,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>
|
|
@@ -701,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())) {
|
|
|
// 学生须判断是否能播放曲目
|
|
@@ -742,6 +865,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (detail.getDelFlag() ||detail.getState() == YesOrNoEnum.NO) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 判断专辑购买
|
|
|
|
|
|
// 1 查询曲目所在的专辑
|
|
@@ -767,31 +894,6 @@ 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);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -925,6 +1027,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);
|
|
|
//设置内容平台曲目信息
|
|
@@ -968,6 +1071,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);
|
|
|
//设置内容平台曲目信息
|
|
@@ -983,6 +1088,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;
|
|
|
}
|
|
|
|
|
@@ -1370,6 +1490,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) {
|
|
@@ -1478,7 +1599,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
addMusicSheetApplicationExtend.setMusicTagIds(musicSheet.getMusicTag());
|
|
|
addMusicSheetApplicationExtend.setMusicPrice(musicSheet.getMusicPrice());
|
|
|
addMusicSheetApplicationExtend.setPaymentType(musicSheet.getPaymentType());
|
|
|
- addMusicSheetApplicationExtend.setAvailableType(musicSheet.getProviderType() !=null&& musicSheet.getProviderType()==SourceTypeEnum.TENANT
|
|
|
+ addMusicSheetApplicationExtend.setAvailableType(StringUtils.isNotBlank(musicSheet.getProviderType())&& musicSheet.getProviderType().equals("TENANT")
|
|
|
?EMusicAvailableType.ORG:EMusicAvailableType.PLATFORM);
|
|
|
addMusicSheetApplicationExtend.setExquisiteFlag(musicSheet.getExquisiteFlag() == YesOrNoEnum.YES);
|
|
|
addMusicSheetApplicationExtend.setSortNo(musicSheet.getSortNumber());
|
|
@@ -1859,6 +1980,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)) {
|
|
@@ -1977,7 +2099,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);
|
|
@@ -2053,6 +2175,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()));
|
|
|
}
|
|
@@ -2170,6 +2296,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);
|
|
|
}
|
|
@@ -2202,7 +2331,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());
|
|
@@ -2265,6 +2394,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);
|
|
|
}
|
|
@@ -2328,12 +2460,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.setAudioPlayTypeFlag(false);
|
|
|
- query.setApplicationId(applicationId);
|
|
|
+ if (sourceType == SourceTypeEnum.PLATFORM) {
|
|
|
+ query.setApplicationId(applicationId);
|
|
|
+ } else {
|
|
|
+ query.setApplicationId(Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.CBS_TENANT_APP_ID)));
|
|
|
+ }
|
|
|
return query;
|
|
|
}
|
|
|
|
|
@@ -2373,6 +2513,55 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
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();
|
|
@@ -2528,7 +2717,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));
|