|  | @@ -10,28 +10,28 @@ import java.util.Objects;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetOrderSearch;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.entity.*;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.ActivityPlanService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.*;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.ActivityPlanVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.ShareProfitVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dao.AlbumMusicRelateDao;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dao.MusicSheetDao;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dao.MusicSheetPurchaseRecordDao;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.MusicSheetPurchaseRecord;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ChargeTypeEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.album.PurchaseRecordTypeEnum;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.MusicSheetPurchaseRecordService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.StudentMusicAlbumOrderVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.constant.SysConfigConstant;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.enums.ActivityShareEnum;
 | 
	
		
			
				|  |  |  import org.apache.commons.collections.CollectionUtils;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -47,14 +47,6 @@ import com.yonge.cooleshow.biz.dal.dto.MusicAlbumSheetSortDto;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.search.MusicAlbumDetailSearch;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.search.MusicAlbumSearch;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicAlbumSearch;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.AlbumFavorite;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.AlbumMusicRelate;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.MusicAlbum;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.AlbumFavoriteService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.AlbumMusicRelateService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.MusicAlbumService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.service.MusicTagService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.AlbumDetailVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.MusicAlbumVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 | 
	
	
		
			
				|  | @@ -96,6 +88,22 @@ public class MusicAlbumServiceImpl extends ServiceImpl<MusicAlbumDao,MusicAlbum>
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private MusicSheetPurchaseRecordService musicSheetPurchaseRecordService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TeacherService teacherService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TenantAlbumMusicService tenantAlbumMusicService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TenantAlbumService tenantAlbumService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TenantStaffService tenantStaffService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserFeignService sysUserFeignService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      public MusicAlbumDao getDao() {
 | 
	
		
			
				|  |  |          return musicAlbumDao;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -457,6 +465,125 @@ public class MusicAlbumServiceImpl extends ServiceImpl<MusicAlbumDao,MusicAlbum>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public TenantAlbumWrapper.TenantAlbum detailAlbum(String albumId) {
 | 
	
		
			
				|  |  | +        Long tenantAlbumId;
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(albumId)){
 | 
	
		
			
				|  |  | +            //如果没传专辑id  则查询对应机构的专辑详情
 | 
	
		
			
				|  |  | +            SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +            Long id = sysUser.getId();
 | 
	
		
			
				|  |  | +            List<Teacher> list = teacherService.lambdaQuery().eq(Teacher::getUserId, id).list();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isEmpty(list)) {
 | 
	
		
			
				|  |  | +                throw new BizException("老师账号未找到");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            Teacher teacher = list.get(0);
 | 
	
		
			
				|  |  | +            //获取机构Id
 | 
	
		
			
				|  |  | +            Long tenantId = teacher.getTenantId();
 | 
	
		
			
				|  |  | +            //查询对应专辑id
 | 
	
		
			
				|  |  | +            List<TenantAlbumMusic> tenantAlbumMusicList = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getTenantId, tenantId)
 | 
	
		
			
				|  |  | +                    .eq(TenantAlbumMusic::getDelFlag,false).list();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isEmpty(tenantAlbumMusicList)) {
 | 
	
		
			
				|  |  | +                return null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            TenantAlbumMusic tenantAlbumMusic = tenantAlbumMusicList.get(0);
 | 
	
		
			
				|  |  | +            tenantAlbumId = tenantAlbumMusic.getTenantAlbumId();
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            //如果传专辑id   则查询这个专辑的详情
 | 
	
		
			
				|  |  | +            tenantAlbumId = Long.parseLong(albumId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        TenantAlbumWrapper.TenantAlbum album = new TenantAlbumWrapper.TenantAlbum();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //查询对应专辑的详情
 | 
	
		
			
				|  |  | +        List<TenantAlbum> list = tenantAlbumService.lambdaQuery().eq(TenantAlbum::getStatus, true).eq(TenantAlbum::getId, tenantAlbumId).list();
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(list)){
 | 
	
		
			
				|  |  | +            throw new BizException("机构专辑不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        TenantAlbum tenantAlbum = list.get(0);
 | 
	
		
			
				|  |  | +        //机构专辑名称
 | 
	
		
			
				|  |  | +        String name = tenantAlbum.getName();
 | 
	
		
			
				|  |  | +        //机构专辑封面
 | 
	
		
			
				|  |  | +        String coverImg = tenantAlbum.getCoverImg();
 | 
	
		
			
				|  |  | +        //机构专辑曲目数
 | 
	
		
			
				|  |  | +        List<TenantAlbumMusic> tenantAlbumMusiclist = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getTenantAlbumId, tenantAlbumId).list();
 | 
	
		
			
				|  |  | +        List<Long> MusicSheetIds = tenantAlbumMusiclist.stream().map(TenantAlbumMusic::getMusicSheetId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        int size = MusicSheetIds.size();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //Integer musicNum = tenantAlbum.getMusicNum();
 | 
	
		
			
				|  |  | +        //机构专辑简介
 | 
	
		
			
				|  |  | +        String describe = tenantAlbum.getDescribe();
 | 
	
		
			
				|  |  | +        //声部
 | 
	
		
			
				|  |  | +        String subjectTypes = tenantAlbum.getSubjectTypes();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        album.setName(name);
 | 
	
		
			
				|  |  | +        album.setCoverImg(coverImg);
 | 
	
		
			
				|  |  | +        album.setMusicNum(size);
 | 
	
		
			
				|  |  | +        album.setDescribe(describe);
 | 
	
		
			
				|  |  | +        album.setSubjectTypes(subjectTypes);
 | 
	
		
			
				|  |  | +        return album;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public TenantAlbumWrapper.TenantAlbum tenantDetailAlbum(String albumId) {
 | 
	
		
			
				|  |  | +        Long tenantAlbumId;
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(albumId)){
 | 
	
		
			
				|  |  | +            //如果没传专辑id  则查询对应机构的专辑详情
 | 
	
		
			
				|  |  | +            SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +            Long id = sysUser.getId();
 | 
	
		
			
				|  |  | +            //List<Teacher> list = teacherService.lambdaQuery().eq(Teacher::getUserId, id).list();
 | 
	
		
			
				|  |  | +            //查询对应机构Id
 | 
	
		
			
				|  |  | +            List<TenantStaff> list = tenantStaffService.lambdaQuery().eq(TenantStaff::getUserId,id).list();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isEmpty(list)) {
 | 
	
		
			
				|  |  | +                throw new BizException("未绑定机构");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            TenantStaff tenantStaff = list.get(0);
 | 
	
		
			
				|  |  | +            //获取机构Id
 | 
	
		
			
				|  |  | +            Long tenantId = tenantStaff.getTenantId();
 | 
	
		
			
				|  |  | +            //查询对应专辑id
 | 
	
		
			
				|  |  | +            List<TenantAlbumMusic> tenantAlbumMusicList = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getTenantId, tenantId)
 | 
	
		
			
				|  |  | +                    .eq(TenantAlbumMusic::getDelFlag,false).list();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isEmpty(tenantAlbumMusicList)) {
 | 
	
		
			
				|  |  | +                return null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            TenantAlbumMusic tenantAlbumMusic = tenantAlbumMusicList.get(0);
 | 
	
		
			
				|  |  | +            tenantAlbumId = tenantAlbumMusic.getTenantAlbumId();
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            //如果传专辑id   则查询这个专辑的详情
 | 
	
		
			
				|  |  | +            tenantAlbumId = Long.parseLong(albumId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        TenantAlbumWrapper.TenantAlbum album = new TenantAlbumWrapper.TenantAlbum();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //查询对应专辑的详情
 | 
	
		
			
				|  |  | +        List<TenantAlbum> list = tenantAlbumService.lambdaQuery().eq(TenantAlbum::getStatus, true).eq(TenantAlbum::getId, tenantAlbumId).list();
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(list)){
 | 
	
		
			
				|  |  | +            throw new BizException("机构专辑不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        TenantAlbum tenantAlbum = list.get(0);
 | 
	
		
			
				|  |  | +        //机构专辑名称
 | 
	
		
			
				|  |  | +        String name = tenantAlbum.getName();
 | 
	
		
			
				|  |  | +        //机构专辑封面
 | 
	
		
			
				|  |  | +        String coverImg = tenantAlbum.getCoverImg();
 | 
	
		
			
				|  |  | +        //机构专辑曲目数
 | 
	
		
			
				|  |  | +        List<TenantAlbumMusic> tenantAlbumMusiclist = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getTenantAlbumId, tenantAlbumId).list();
 | 
	
		
			
				|  |  | +        List<Long> MusicSheetIds = tenantAlbumMusiclist.stream().map(TenantAlbumMusic::getMusicSheetId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        int size = MusicSheetIds.size();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //Integer musicNum = tenantAlbum.getMusicNum();
 | 
	
		
			
				|  |  | +        //机构专辑简介
 | 
	
		
			
				|  |  | +        String describe = tenantAlbum.getDescribe();
 | 
	
		
			
				|  |  | +        //声部
 | 
	
		
			
				|  |  | +        String subjectTypes = tenantAlbum.getSubjectTypes();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        album.setName(name);
 | 
	
		
			
				|  |  | +        album.setCoverImg(coverImg);
 | 
	
		
			
				|  |  | +        album.setMusicNum(size);
 | 
	
		
			
				|  |  | +        album.setDescribe(describe);
 | 
	
		
			
				|  |  | +        album.setSubjectTypes(subjectTypes);
 | 
	
		
			
				|  |  | +        return album;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private boolean checkNameRepeat(String albumName, Long id) {
 | 
	
		
			
				|  |  |          LambdaQueryChainWrapper<MusicAlbum> eq = this.lambdaQuery()
 | 
	
		
			
				|  |  |                                                       .eq(MusicAlbum::getDelFlag,0)
 |