|
@@ -7,9 +7,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.dayaedu.cbs.common.enums.EClientType;
|
|
|
import com.dayaedu.cbs.common.enums.school.ECourseType;
|
|
|
import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
|
|
|
+import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsCourseTypeWrapper;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
|
|
|
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
|
|
|
import com.microsvc.toolkit.common.response.paging.PageInfo;
|
|
|
+import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.*;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
@@ -24,6 +27,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -55,10 +59,6 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
|
|
|
private TenantAlbumMusicMapper tenantAlbumMusicMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserMapper sysUserMapper;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
private TenantAlbumMusicService tenantAlbumMusicService;
|
|
|
|
|
|
@Autowired
|
|
@@ -68,7 +68,7 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
|
|
|
private MusicFavoriteService musicFavoriteService;
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ private MusicFeignClientService musicFeignClientService;
|
|
|
|
|
|
@Autowired
|
|
|
private TenantAlbumCategoryDetailService tenantAlbumCategoryDetailService;
|
|
@@ -76,6 +76,9 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
|
|
|
@Autowired
|
|
|
private CoursewareFeignService coursewareFeignService;
|
|
|
|
|
|
+ @Value("${openfeign-client.app-id:1745637981387108354}")
|
|
|
+ public Long applicationId;
|
|
|
+
|
|
|
/**
|
|
|
* 查询详情
|
|
|
* @param id 详情ID
|
|
@@ -103,15 +106,20 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
|
|
|
if (CollectionUtils.isEmpty(musicSheets)) {
|
|
|
return page.setRecords(musicSheets);
|
|
|
}
|
|
|
-
|
|
|
- // 设置声部
|
|
|
- List<String> subjectIds = musicSheets.stream()
|
|
|
- .map(TenantAlbumMusicWrapper.StudentTenantAlbumMusic::getMusicSubject)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .flatMap(x -> Arrays.stream(x.split(",")))
|
|
|
- .distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- Map<Integer, Subject> subjectMap = subjectService.getMapByIds(subjectIds);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery cbsQuery = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
|
|
|
+ cbsQuery.setApplicationId(applicationId);
|
|
|
+ List<Long> cbsMusicSheetIds = musicSheets.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
|
|
|
+ cbsQuery.setMusicSheetIds(cbsMusicSheetIds);
|
|
|
+ cbsQuery.setDelFlag(true);
|
|
|
+ cbsQuery.setPage(1);
|
|
|
+ cbsQuery.setRows(cbsMusicSheetIds.size());
|
|
|
+ R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(cbsQuery);
|
|
|
+ if (pageInfoR.getCode() != 200) {
|
|
|
+ log.error("查询内容平台曲目失败,{}", pageInfoR.getMessage());
|
|
|
+ throw new BizException("查询内容平台曲目失败");
|
|
|
+ }
|
|
|
+ Map<Long,CbsMusicSheetWrapper.MusicSheetApplication> recordMap = pageInfoR.getData().getRows()
|
|
|
+ .stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, o -> o));
|
|
|
|
|
|
// 设置上传人
|
|
|
List<Long> userIds = musicSheets.stream()
|
|
@@ -135,20 +143,13 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
|
|
|
.eq(MusicFavorite::getClientType, query.getClientType().equals(ClientEnum.TENANT_STUDENT) ? ClientEnum.STUDENT : query.getClientType())
|
|
|
.list();
|
|
|
favoriteIds = favoriteList.stream().map(MusicFavorite::getMusicSheetId).distinct().collect(Collectors.toList());
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
for (TenantAlbumMusicWrapper.StudentTenantAlbumMusic m : musicSheets) {
|
|
|
- if (StringUtils.isNotBlank(m.getMusicSubject())) {
|
|
|
- String subjectNames = Arrays.stream(m.getMusicSubject().split(","))
|
|
|
- .distinct()
|
|
|
- .map(Integer::parseInt)
|
|
|
- .map(subjectMap::get)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .map(Subject::getName)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- m.setMusicSubjectName(subjectNames);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplication sheetApplication = recordMap.get(m.getCbsMusicSheetId());
|
|
|
+ if (sheetApplication != null) {
|
|
|
+ m.setMusicSheetName(sheetApplication.getSubjectNames());
|
|
|
+ m.setTitleImg(sheetApplication.getMusicCover());
|
|
|
}
|
|
|
SysUser sysUser = userMap.get(m.getUserId());
|
|
|
if (sysUser != null) {
|