Forráskód Böngészése

购买专辑详情

haonan 1 éve
szülő
commit
5c07c9e86a

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserTenantAlbumRecordService.java

@@ -60,4 +60,6 @@ public interface UserTenantAlbumRecordService extends IService<UserTenantAlbumRe
      * @return
      */
     List<Long> getUseAlbumIdsByUserId(Long userId,ClientEnum clientType);
+
+    TenantAlbumWrapper.TenantAlbum detailAlbum(String albumId);
 }

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

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

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

@@ -126,6 +126,9 @@ public class TenantAlbumMusicWrapper {
     @ApiModel(" TenantAlbumMusicQuery-学生端专辑曲目分页查询")
     public static class StudentTenantAlbumMusicQuery implements QueryInfo {
 
+        @ApiModelProperty(value = "详情专辑id")
+        private String albumId;
+
         @ApiModelProperty("当前页")
         private Integer page;
 

+ 15 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/UserTenantAlbumRecordController.java

@@ -4,6 +4,8 @@ import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.microsvc.toolkit.common.response.template.R;
 
 import com.alibaba.fastjson.JSONObject;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumMusicWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.base.page.PageInfo;
@@ -12,6 +14,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -56,6 +59,18 @@ public class UserTenantAlbumRecordController {
         return HttpResponseResult.succeed(PageUtil.pageInfo(pages));
     }
 
+
+    @ApiOperation(value = "查询详情")
+    @PostMapping("/detail")
+    public TenantAlbumWrapper.TenantAlbum Albumdetail(@RequestParam(defaultValue = "") String albumId) {
+        TenantAlbumWrapper.TenantAlbum tenantAlbum= userTenantAlbumRecordService.detailAlbum(albumId);
+        return tenantAlbum ;
+    }
+
+
+
+
+
     @ApiOperation(value = "新增", notes = "购买训练工具记录- 传入 UserTenantAlbumRecordWrapper.UserTenantAlbumRecord")
     @PreAuthorize("@auditsvc.hasPermissions('userTenantAlbumRecord/save', {'BACKEND'})")
     //@PostMapping("/save")