|
@@ -13,8 +13,11 @@ import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import com.yonge.toolset.base.util.StringUtil;
|
|
|
import com.yonge.toolset.mybatis.support.PageUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -49,6 +52,12 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
@Autowired
|
|
|
private MusicSheetService musicSheetService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentService studentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TenantAlbumService tenantAlbumService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询详情
|
|
|
* @param id 详情ID
|
|
@@ -78,7 +87,7 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
if (id != null){
|
|
|
List<Long> tenantAlbumIds = baseMapper.selectTenantIds(id);
|
|
|
if (CollectionUtils.isEmpty(tenantAlbumIds)){
|
|
|
- throw new BizException("当前登录用户未找到对应机构专辑Id");
|
|
|
+ throw new BizException("当前登录用户未找到对应机构专辑");
|
|
|
}
|
|
|
List<TenantAlbum> tenantAlbums = baseMapper.selectTenantAlbumInfo(tenantAlbumIds);
|
|
|
|
|
@@ -203,4 +212,59 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
|
|
|
return list.stream().map(UserTenantAlbumRecord::getTenantAlbumId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TenantAlbumWrapper.TenantAlbum detailAlbum(String albumId) {
|
|
|
+
|
|
|
+ Long tenantAlbumId;
|
|
|
+ if (StringUtils.isEmpty(albumId)){
|
|
|
+ //如果没传专辑id 则查询对应机构的专辑详情
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ Long id = sysUser.getId();
|
|
|
+ List<Student> list = studentService.lambdaQuery().eq(Student::getUserId, id).list();
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ throw new BizException("学生未绑定");
|
|
|
+ }
|
|
|
+ Student student = list.get(0);
|
|
|
+ //获取机构Id
|
|
|
+ Long tenantId = student.getTenantId();
|
|
|
+ //查询对应专辑id
|
|
|
+ List<TenantAlbumMusic> tenantAlbumMusicList = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getTenantId, tenantId)
|
|
|
+ .eq(TenantAlbumMusic::getDelFlag,false).list();
|
|
|
+ if (CollectionUtils.isEmpty(tenantAlbumMusicList)) {
|
|
|
+ throw new BizException("机构未绑定对应专辑");
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ //机构专辑曲目数
|
|
|
+ Integer musicNum = tenantAlbum.getMusicNum();
|
|
|
+ //机构专辑简介
|
|
|
+ String describe = tenantAlbum.getDescribe();
|
|
|
+ //声部
|
|
|
+ String subjectTypes = tenantAlbum.getSubjectTypes();
|
|
|
+
|
|
|
+ album.setName(name);
|
|
|
+ album.setCoverImg(coverImg);
|
|
|
+ album.setMusicNum(musicNum);
|
|
|
+ album.setDescribe(describe);
|
|
|
+ album.setSubjectTypes(subjectTypes);
|
|
|
+ return album;
|
|
|
+ }
|
|
|
}
|