liujc il y a 7 mois
Parent
commit
f7bb237112

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/MusicSheetService.java

@@ -12,6 +12,7 @@ import com.yonge.cooleshow.biz.dal.dto.search.*;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
 import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
 import com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper;
@@ -412,6 +413,8 @@ public interface MusicSheetService extends IService<MusicSheet> {
 
     CbsMusicSheetWrapper.MusicSheetApplicationQuery getMusicSheetApplicationQuery();
 
+    CbsMusicSheetWrapper.MusicSheetApplicationQuery getMusicSheetApplicationQuery(SourceTypeEnum sourceType);
+
     PageInfo<CbsMusicSheetWrapper.MusicSheetAccApplication> queryCbsMusicSheetSoundApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery query);
 
     List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery query);

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

@@ -253,6 +253,7 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
         musicSheet.setUserId(userId);
         musicSheet.setCreateBy(userId);
         musicSheet.setUpdateBy(userId);
+        musicSheet.setScoreType(EDefaultScoreType.STAVE.name());
         musicSheet.setCbsMusicSheetId(IdWorker.getId());
         musicSheetService.save(musicSheet);
         List<MusicSheetAccompaniment> musicSheetAccompaniments = musicSheetAccompanimentService.initMusicSheetAccompaniment(musicSheetAuthRecord.getMusicSheetJson(),musicSheet.getId());

+ 47 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -392,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("未找到曲目信息");
@@ -401,7 +401,7 @@ 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);
         return detailVo;
     }
 
@@ -427,9 +427,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)){
@@ -616,7 +618,33 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                 throw new BizException("未找到曲目信息");
             }
         }
-        MusicSheetDetailVo detail = this.getCbsDetail(Long.parseLong(id));
+        MusicSheetDetailVo detail ;
+        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);
         //兼容审批数据
@@ -661,10 +689,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
             Long tenantId = userTenantId(sysUser.getId(), userType);
 
             if (tenantId >0L) {
-                detail.setTenantFlag(true);
 
                 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)) {
@@ -682,6 +710,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                             if (musicSheetIds.contains(detail.getId())) {
                                 detail.setPlay(YesOrNoEnum.YES);
                                 detail.setBuyed(true);
+                                detail.setTenantFlag(true);
                             }
                         }
                         if (detail.getPlay() ==YesOrNoEnum.NO) {
@@ -727,8 +756,11 @@ 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;
     }
@@ -2403,12 +2435,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;
     }
 

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

@@ -18,6 +18,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.MusicSheetCategoriesWrapper;
 import com.microsvc.toolkit.common.response.paging.PageInfo;
 import com.yonge.cooleshow.biz.dal.entity.*;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMusicMapper;
 import com.yonge.cooleshow.biz.dal.service.*;
@@ -112,7 +113,7 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
             if (CollectionUtils.isEmpty(musicSheets)) {
                 return page.setRecords(musicSheets);
             }
-            CbsMusicSheetWrapper.MusicSheetApplicationQuery cbsQuery = musicSheetService.getMusicSheetApplicationQuery();
+            CbsMusicSheetWrapper.MusicSheetApplicationQuery cbsQuery = musicSheetService.getMusicSheetApplicationQuery(SourceTypeEnum.TENANT);
             List<Long> cbsMusicSheetIds = musicSheets.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
             cbsQuery.setMusicSheetIds(cbsMusicSheetIds);
             cbsQuery.setRows(cbsMusicSheetIds.size());