| 
					
				 | 
			
			
				@@ -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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |