Browse Source

曲目详情新增字段

zouxuan 4 months ago
parent
commit
f3632a1e96

+ 14 - 3
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetCbsController.java

@@ -7,6 +7,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
@@ -21,6 +22,7 @@ import com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
+import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.mybatis.support.PageUtil;
 import io.swagger.annotations.Api;
@@ -36,6 +38,7 @@ import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -83,8 +86,16 @@ public class MusicSheetCbsController extends BaseController {
         if (sysUser == null  || sysUser.getId() == null) {
             sysUser = null;
         }
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(id);
-        musicSheet.setBizId(id);
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new BizException("曲目信息不存在");
+        }
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new BizException("曲目信息异常");
+        }
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        cbsMusicSheet.setBizId(id);
 
         // 设置查询机构 还是平台数据
         if (StringUtils.isNotBlank(providerType) && SourceTypeEnum.PLATFORM.name().equals(providerType)) {
@@ -93,7 +104,7 @@ public class MusicSheetCbsController extends BaseController {
             tenantAlbumId = StringUtils.isBlank(tenantAlbumId) ? null : "1";
         }
 
-        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(musicSheet), MusicSheetVo.MusicSheetDetail.class);
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
         MusicSheetDetailVo detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.SYSTEM, tenantAlbumId);
         if (detail == null) {
         } else {

+ 12 - 4
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/MusicPracticeRecordController.java

@@ -6,6 +6,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.google.common.collect.Lists;
 import com.microsvc.toolkit.common.response.template.R;
 import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.UserMusic;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
@@ -72,10 +73,17 @@ public class MusicPracticeRecordController {
             wrapper.setVideoFilePath(userMusic.getVideoUrl());
         }
         MusicPracticeRecordWrapper.MusicPracticeRecord from = MusicPracticeRecordWrapper.MusicPracticeRecord.from(JSON.toJSONString(wrapper));
-
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(Long.parseLong(wrapper.getMusicSheetId()));
-        if (musicSheet != null) {
-            from.setRhythmFlag(musicSheet.getEvaluationStandard() != EEvaluationStandard.FREQUENCY);
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new com.yonge.toolset.base.exception.BizException("曲目信息不存在");
+        }
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new com.yonge.toolset.base.exception.BizException("曲目信息异常");
+        }
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        if (cbsMusicSheet != null) {
+            from.setRhythmFlag(cbsMusicSheet.getEvaluationStandard() != EEvaluationStandard.FREQUENCY);
         }
 
         return R.from(from);

+ 27 - 22
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/MusicSheetCbsController.java

@@ -13,6 +13,7 @@ import com.yonge.cooleshow.biz.dal.dto.AppMusicSheetVo;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicAlbumSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetRelatedQueryInfo;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetSearch;
+import com.yonge.cooleshow.biz.dal.entity.CourseCourseware;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.UserTenantAlbumRecord;
@@ -25,6 +26,7 @@ import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.music.MusicCompareWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
@@ -57,21 +59,18 @@ import java.util.stream.Collectors;
 @Api(tags = "曲谱表 API接口")
 public class MusicSheetCbsController extends BaseController {
     @Resource
-    private SysUserFeignService sysUserFeignService;
-
+    private SysUserService sysUserService;
 	@Resource
 	private MusicSheetService musicSheetService;
-
+	@Resource
+	private MusicFavoriteService musicFavoriteService;
     @Resource
     private AppVersionInfoService appVersionInfoService;
-
     @Resource
     private StudentService studentService;
-
-    @Autowired
+    @Resource
     private InstrumentService instrumentService;
-
-    @Autowired
+    @Resource
     private UserTenantAlbumRecordService userTenantAlbumRecordService;
 
     /**
@@ -88,18 +87,21 @@ public class MusicSheetCbsController extends BaseController {
     public R<MusicSheetVo.MusicSheetDetail> cbsDetail(@PathVariable("id") Long id,
                                                       @RequestParam(required = false) String tenantAlbumId) {
 
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null  || sysUser.getId() == null) {
-            sysUser = null;
+        SysUser sysUser = sysUserService.getUser();
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new BizException("曲目信息不存在");
+        }
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new BizException("曲目信息异常");
         }
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(id);
-        musicSheet.setBizId(id);
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        cbsMusicSheet.setBizId(id);
 
-        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(musicSheet), MusicSheetVo.MusicSheetDetail.class);
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
         MusicSheetDetailVo detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.STUDENT, tenantAlbumId);
-        if (detail == null) {
-//            musicSheetDetail.setBizMusicCategoryId(null);
-        } else {
+        if (detail != null) {
             // 设置曲目付费类型
             musicSheetDetail.setPaymentType(detail.getPaymentType());
             // 设置业务端曲目分类
@@ -110,7 +112,13 @@ public class MusicSheetCbsController extends BaseController {
             musicSheetDetail.setBuyed(detail.getBuyed());
             musicSheetDetail.setMusicPrice(detail.getMusicPrice());
         }
-
+        musicSheetDetail.setFavoriteCount(musicSheet.getFavoriteCount());
+        //获取曲目专辑数量
+        musicSheetDetail.setAlbumNums(musicSheetService.getDao().selectMusicAlbumNum(id));
+        musicSheetDetail.setExquisiteFlag(musicSheet.getExquisiteFlag());
+        musicSheetDetail.setMusicSubject(musicSheet.getMusicSubject());
+        musicSheetDetail.setUserId(musicSheet.getCreateBy());
+        musicSheetDetail.setFavorite(musicFavoriteService.checkFavorite(id,sysUser.getId(),ClientEnum.STUDENT,null));
         // 如果是合奏 并且乐器ID = 2268
         musicSheetDetail.setSpecialPercussionFlag(false);
         if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
@@ -140,10 +148,7 @@ public class MusicSheetCbsController extends BaseController {
     @PostMapping("/page")
     public HttpResponseResult<PageInfo<MusicSheetWrapper.MusicSheetCloud>> cloudPage(@RequestBody MusicSheetWrapper.MusicSheetCloudQuery query) {
 
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
+        SysUser sysUser = sysUserService.getUser();
         Student student = studentService.getById(sysUser.getId());
         if (student == null) {
             return failed("用户信息获取失败");

+ 14 - 6
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/open/OpenMusicSheetCbsController.java

@@ -7,6 +7,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.UserMusic;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
@@ -35,6 +36,7 @@ import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -75,10 +77,18 @@ public class OpenMusicSheetCbsController extends BaseController {
                                                       @RequestParam(required = false) String tenantAlbumId,
                                                       @RequestParam(required = false) Long userMusicId) {
 
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(id);
-        musicSheet.setBizId(id);
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new BizException("曲目信息不存在");
+        }
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new BizException("曲目信息异常");
+        }
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        cbsMusicSheet.setBizId(id);
 
-        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(musicSheet), MusicSheetVo.MusicSheetDetail.class);
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
         MusicSheetDetailVo detail;
         if (userMusicId != null) {
             UserMusic userMusic = userMusicService.detail(userMusicId);
@@ -92,9 +102,7 @@ public class OpenMusicSheetCbsController extends BaseController {
 
             detail = musicSheetService.detail(id.toString(), null, ClientEnum.STUDENT, tenantAlbumId);
         }
-        if (detail == null) {
-//            musicSheetDetail.setBizMusicCategoryId(null);
-        } else {
+        if (detail != null) {
             // 设置曲目付费类型
             musicSheetDetail.setPaymentType(detail.getPaymentType());
             // 设置业务端曲目分类

+ 12 - 4
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicPracticeRecordController.java

@@ -6,6 +6,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.google.common.collect.Lists;
 import com.microsvc.toolkit.common.response.template.R;
 import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.UserMusic;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.MusicPracticeRecordService;
@@ -71,10 +72,17 @@ public class MusicPracticeRecordController {
             wrapper.setVideoFilePath(userMusic.getVideoUrl());
         }
         MusicPracticeRecordWrapper.MusicPracticeRecord from = MusicPracticeRecordWrapper.MusicPracticeRecord.from(JSON.toJSONString(wrapper));
-
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(Long.parseLong(wrapper.getMusicSheetId()));
-        if (musicSheet != null) {
-            from.setRhythmFlag(musicSheet.getEvaluationStandard() != EEvaluationStandard.FREQUENCY);
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new com.yonge.toolset.base.exception.BizException("曲目信息不存在");
+        }
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new com.yonge.toolset.base.exception.BizException("曲目信息异常");
+        }
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        if (cbsMusicSheet != null) {
+            from.setRhythmFlag(cbsMusicSheet.getEvaluationStandard() != EEvaluationStandard.FREQUENCY);
         }
 
         return R.from(from);

+ 38 - 26
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetCbsController.java

@@ -6,10 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.entity.CourseCourseware;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
-import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
@@ -23,6 +22,7 @@ import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
+import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.mybatis.support.PageUtil;
 import io.swagger.annotations.Api;
@@ -31,13 +31,13 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -51,23 +51,20 @@ import java.util.stream.Collectors;
 @Api(tags = "曲谱表 API接口")
 public class MusicSheetCbsController extends BaseController {
     @Resource
-    private SysUserFeignService sysUserFeignService;
-
+    private SysUserService sysUserService;
 	@Resource
 	private MusicSheetService musicSheetService;
-
+    @Resource
+    private MusicFavoriteService musicFavoriteService;
+    @Resource
+    private CourseCoursewareService courseCoursewareService;
     @Resource
     private AppVersionInfoService appVersionInfoService;
-
     @Resource
-    private StudentService studentService;
-
-    @Autowired
     private InstrumentService instrumentService;
-    @Autowired
+    @Resource
     private TeacherService teacherService;
-
-    @Autowired
+    @Resource
     private TenantGroupAlbumMapper tenantGroupAlbumMapper;
 
     /**
@@ -84,18 +81,21 @@ public class MusicSheetCbsController extends BaseController {
     public R<MusicSheetVo.MusicSheetDetail> cbsDetail(@PathVariable("id") Long id,
                                                       @RequestParam(required = false) String tenantAlbumId) {
 
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null  || sysUser.getId() == null) {
-            sysUser = null;
+        SysUser sysUser = sysUserService.getUser();
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new BizException("曲目信息不存在");
         }
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(id);
-        musicSheet.setBizId(id);
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new BizException("曲目信息异常");
+        }
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        cbsMusicSheet.setBizId(id);
 
-        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(musicSheet), MusicSheetVo.MusicSheetDetail.class);
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
         MusicSheetDetailVo detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.TEACHER, tenantAlbumId);
-        if (detail == null) {
-//            musicSheetDetail.setBizMusicCategoryId(null);
-        } else {
+        if (detail != null) {
             // 设置曲目付费类型
             musicSheetDetail.setPaymentType(detail.getPaymentType());
             // 设置业务端曲目分类
@@ -106,6 +106,21 @@ public class MusicSheetCbsController extends BaseController {
             musicSheetDetail.setBuyed(detail.getBuyed());
             musicSheetDetail.setMusicPrice(detail.getMusicPrice());
         }
+        //获取曲目专辑数量
+        musicSheetDetail.setAlbumNums(musicSheetService.getDao().selectMusicAlbumNum(id));
+        musicSheetDetail.setExquisiteFlag(musicSheet.getExquisiteFlag());
+        musicSheetDetail.setMusicSubject(musicSheet.getMusicSubject());
+        musicSheetDetail.setUserId(musicSheet.getCreateBy());
+        musicSheetDetail.setFavorite(musicFavoriteService.checkFavorite(id,sysUser.getId(),ClientEnum.STUDENT,null));
+        CourseCourseware one = courseCoursewareService.lambdaQuery()
+                .eq(CourseCourseware::getMusicSheetId, id)
+                .eq(CourseCourseware::getClientType, ClientEnum.TEACHER)
+                .eq(CourseCourseware::getUserId, sysUser.getId())
+                .eq(CourseCourseware::getDelFlag, false).last("limit 1").one();
+        if (one == null) {
+            musicSheetDetail.setCoursewareStatus(YesOrNoEnum.YES);
+            musicSheetDetail.setCoursewareId(one.getId());
+        }
 
         // 如果是合奏 并且乐器ID = 2268
         musicSheetDetail.setSpecialPercussionFlag(false);
@@ -136,10 +151,7 @@ public class MusicSheetCbsController extends BaseController {
     @PostMapping("/page")
     public HttpResponseResult<PageInfo<MusicSheetWrapper.MusicSheetCloud>> cloudPage(@RequestBody MusicSheetWrapper.MusicSheetCloudQuery query) {
 
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
+        SysUser sysUser = sysUserService.getUser();
         Teacher teacher = teacherService.getById(sysUser.getId());
         if (teacher == null) {
             return failed("用户信息获取失败");

+ 14 - 7
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/open/OpenMusicSheetCbsController.java

@@ -6,6 +6,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.UserMusic;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.InstrumentService;
@@ -30,6 +31,7 @@ import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -69,11 +71,18 @@ public class OpenMusicSheetCbsController extends BaseController {
     public R<MusicSheetVo.MusicSheetDetail> cbsDetail(@PathVariable("id") Long id,
                                                       @RequestParam(required = false) String tenantAlbumId,
                                                       @RequestParam(required = false) Long userMusicId) {
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(id);
+        if (Objects.isNull(musicSheet)) {
+            throw new BizException("曲目信息不存在");
+        }
+        if (musicSheet.getCbsMusicSheetId() ==null) {
+            throw new BizException("曲目信息异常");
+        }
+        CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
+        cbsMusicSheet.setBizId(id);
 
-        CbsMusicSheetWrapper.MusicSheet musicSheet = musicSheetService.cbsDetail(id);
-        musicSheet.setBizId(id);
-
-        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(musicSheet), MusicSheetVo.MusicSheetDetail.class);
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
         MusicSheetDetailVo detail;
         if (userMusicId != null) {
             UserMusic userMusic = userMusicService.detail(userMusicId);
@@ -87,9 +96,7 @@ public class OpenMusicSheetCbsController extends BaseController {
 
             detail = musicSheetService.detail(id.toString(), null, ClientEnum.TEACHER, tenantAlbumId);
         }
-        if (detail == null) {
-//            musicSheetDetail.setBizMusicCategoryId(null);
-        } else {
+        if (detail != null) {
             // 设置曲目付费类型
             musicSheetDetail.setPaymentType(detail.getPaymentType());
             // 设置业务端曲目分类

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/MusicSheetDao.java

@@ -184,6 +184,8 @@ public interface MusicSheetDao extends BaseMapper<MusicSheet> {
      */
     List<StatGroupWrapper> selectMusicAlbumStatInfo(@Param("musicIds") List<Long> musicIds);
 
+    Long selectMusicAlbumNum(@Param("musicId") Long musicId);
+
     /**
      * 修改收藏数
      */

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

@@ -426,7 +426,7 @@ public interface MusicSheetService extends IService<MusicSheet> {
 
     void delPractice(Long musicSheetId,Long userId,ClientEnum clientEnum);
 
-    CbsMusicSheetWrapper.MusicSheet cbsDetail(Long musicSheetId);
+    CbsMusicSheetWrapper.MusicSheet cbsDetail(Long cbsMusicSheetId);
 
     IPage<MusicSheetWrapper.MusicSheetCloud> cloudPage(MusicSheetWrapper.MusicSheetCloudQuery query);
 }

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

@@ -6,6 +6,7 @@ import com.yonge.cooleshow.biz.dal.dao.MusicFavoriteDao;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.MusicFavoriteService;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -50,7 +51,7 @@ public class MusicFavoriteServiceImpl extends ServiceImpl<MusicFavoriteDao,Music
                 .eq(MusicFavorite::getUserId,userId)
                 .eq(MusicFavorite::getMusicSheetId,musicSheetId)
                 .eq(MusicFavorite::getClientType,userType)
-                .eq(MusicFavorite::getProviderType, providerType)
+                .eq(StringUtils.isNotEmpty(providerType),MusicFavorite::getProviderType, providerType)
                 .count() >0?YesOrNoEnum.YES:YesOrNoEnum.NO;
 
     }

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

@@ -2601,19 +2601,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
      * @return CbsMusicSheetWrapper.MusicSheet
      */
     @Override
-    public CbsMusicSheetWrapper.MusicSheet cbsDetail(Long musicSheetId) {
-        // 曲目信息
-        MusicSheet musicSheet = getDao().get(musicSheetId);
-        if (Objects.isNull(musicSheet)) {
-            throw new BizException("曲目信息不存在");
-        }
-
-
-        if (musicSheet.getCbsMusicSheetId() ==null) {
-            throw new BizException("曲目信息异常");
-        } try {
+    public CbsMusicSheetWrapper.MusicSheet cbsDetail(Long cbsMusicSheetId) {
+        try {
 
-            R<CbsMusicSheetWrapper.MusicSheet> musicSheetR = musicFeignClientService.musicSheetDetail(musicSheet.getCbsMusicSheetId() , applicationId);
+            R<CbsMusicSheetWrapper.MusicSheet> musicSheetR = musicFeignClientService.musicSheetDetail(cbsMusicSheetId , applicationId);
 
             return musicSheetR.feignData();
         } catch (Exception e) {

+ 25 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/MusicSheetVo.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.vo;
 
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
+import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -82,6 +83,30 @@ public class MusicSheetVo extends MusicSheet {
         @ApiModelProperty(value = "曲谱价格")
         private java.math.BigDecimal musicPrice;  //曲谱价格
 
+        @ApiModelProperty(value = "收藏数")
+        private Integer favoriteCount;
+
+        @ApiModelProperty("单曲专辑数")
+        private Long albumNums;
+
+        @ApiModelProperty(value = "精品标志(0:否;1:是)")
+        private YesOrNoEnum exquisiteFlag;
+
+        @ApiModelProperty(value = "曲谱声部(适用的乐器,可能是多个,用逗号分隔)")
+        private String musicSubject;
+
+        @ApiModelProperty(value = "创建人(老师或者是后台平台用户)")
+        private Long userId;
+
+        @ApiModelProperty(value = "是否收藏")
+        private YesOrNoEnum favorite;
+
+        @ApiModelProperty(value = "是否添加课件")
+        private YesOrNoEnum coursewareStatus = YesOrNoEnum.NO;
+
+        @ApiModelProperty(value = "课件编号")
+        private Long coursewareId;
+
     }
 
 }

+ 5 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -1491,5 +1491,10 @@
 
         t.sort_group_, t.sort_num_, t.sort_num2_, t.alias_
     </select>
+    <select id="selectMusicAlbumNum" resultType="java.lang.Long">
+        SELECT COUNT(DISTINCT t1.id_) AS total
+        FROM album_music_relate t1 JOIN music_sheet t2 ON (t1.music_sheet_id_ = t2.id_)
+        WHERE t1.music_sheet_id_ = #{musicId}
+    </select>
     <!--单曲专辑数量统计-->
 </mapper>