Kaynağa Gözat

酷乐秀曲目来源改为内容平台

zouxuan 1 yıl önce
ebeveyn
işleme
faffdf4dea

+ 1 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/MusicSheetController.java

@@ -131,7 +131,7 @@ public class MusicSheetController extends BaseController {
 
             //  只能看通过审核 并且 启用的 曲目
             query.setState(YesOrNoEnum.YES);
-            query.setAuditStatus(AuthStatusEnum.PASS);
+//            query.setAuditStatus(AuthStatusEnum.PASS);
             query.setStudentId(sysUser.getId());
             query.setMyself(false);
             query.setProviderType(SourceTypeEnum.PLATFORM);

+ 1 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetController.java

@@ -145,7 +145,7 @@ public class MusicSheetController extends BaseController {
             query.setAuditVersion(appVersionInfoService.getAppAuditVersion(query.getPlatform(),query.getVersion()));
             //  只能看通过审核 并且 启用的 曲目
             query.setState(YesOrNoEnum.YES);
-            query.setAuditStatus(AuthStatusEnum.PASS);
+//            query.setAuditStatus(AuthStatusEnum.PASS);
             query.setStudentId(sysUser.getId());
             query.setMyself(false);
             query.setProviderType(SourceTypeEnum.PLATFORM);

+ 6 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CbsMusicSheetServiceImpl.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.dayaedu.cbs.common.enums.music.EMusicSourceType;
+import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
 import com.dayaedu.cbs.openfeign.service.CbsMusicSheetService;
 import com.dayaedu.cbs.openfeign.wrapper.music.*;
 import com.microsvc.toolkit.common.response.paging.PageInfo;
@@ -43,7 +44,12 @@ public class CbsMusicSheetServiceImpl implements CbsMusicSheetService {
         }
         List<Long> cbsMusicSheetIds = addMusicSheet.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
         for (CbsMusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend extend : addMusicSheet) {
+            //是否合奏曲目
+            EMusicSheetType musicSheetType = extend.getMusicSheetUpdate().getMusicSheetType();
             CbsMusicSheetApiWrapper.MusicSheetUpdate musicSheetUpdate = extend.getMusicSheetUpdate();
+            if(musicSheetType == EMusicSheetType.CONCERT){
+                musicSheetUpdate.setSubjectIds(null);
+            }
             if(StringUtils.isNotBlank(musicSheetUpdate.getSubjectIds())) {
                 List<Subject> subjectIds = subjectService.getDao().getByCbsSubjectIds(musicSheetUpdate.getSubjectIds());
                 if (CollectionUtils.isNotEmpty(subjectIds)) {

+ 26 - 25
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumMusicServiceImpl.java

@@ -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) {

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumMusicWrapper.java

@@ -203,6 +203,9 @@ public class TenantAlbumMusicWrapper {
         @ApiModelProperty(value = "曲目表id")
         private Long id;
 
+        @ApiModelProperty(value = "曲目表id")
+        private Long cbsMusicSheetId;
+
         @ApiModelProperty("机构专辑ID")
         private Long tenantAlbumId;
 

+ 2 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantAlbumMusicMapper.xml

@@ -20,6 +20,7 @@
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumMusicWrapper$StudentTenantAlbumMusic">
 		SELECT
         m.id_ as id,
+        m.cbs_music_sheet_id_ as cbsMusicSheetId,
         m.music_sheet_name_ as musicSheetName,
         m.composer_ as composer,
         m.user_id_ as userId,
@@ -31,7 +32,7 @@
 		FROM music_sheet m
         left join tenant_album_music t on t.music_sheet_id_ = m.id_
         <where>
-            m.state_ = true and m.del_flag_ = 0 and t.del_flag_ = 0
+            m.state_ = true and m.del_flag_ = 0 and t.del_flag_ = 0 AND m.cbs_music_sheet_id_ IS NOT NULL
             <if test="param.musicTagId != null ">
                 and (find_in_set(#{param.musicTagId},m.music_tag_))
             </if>