刘俊驰 преди 3 месеца
родител
ревизия
c50a1a1cfe

+ 88 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicPracticeRecordController.java

@@ -0,0 +1,88 @@
+package com.yonge.cooleshow.admin.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.dayaedu.cbs.common.enums.music.EEvaluationStandard;
+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;
+import com.yonge.cooleshow.biz.dal.service.*;
+import com.yonge.cooleshow.biz.dal.wrapper.MusicPracticeRecordWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+import java.util.Objects;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.admin:}/musicPracticeRecord")
+@Api(tags = "曲目练习记录")
+public class MusicPracticeRecordController {
+
+    @Autowired
+    private MusicPracticeRecordService musicPracticeRecordService;
+
+    @Autowired
+    private UserMusicService userMusicService;
+
+    @Autowired
+    private MusicSheetService musicSheetService;
+
+
+    /**
+     * 查询单条
+     * @param id 详情ID
+     * @return R<MusicPracticeRecordVo.MusicPracticeRecord>
+     */
+    @ApiOperation(value = "详情", notes = "曲目练习记录-根据详情ID查询单条, 传入id")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @GetMapping("/detail/{id}")
+    public R<MusicPracticeRecordWrapper.MusicPracticeRecord> detail(@PathVariable("id") Long id) {
+
+        MusicPracticeRecordWrapper.Entity wrapper = musicPracticeRecordService.detail(id);
+
+        if (wrapper == null) {
+            throw new BizException("记录不存在");
+        }
+
+        // 上传过作品,用作品视频路径覆盖上传视频路径
+        // ID集合
+        Map<Long, UserMusic> userMusicMap = userMusicService.getMapByMusicPracticeRecordIds(Lists.newArrayList(Long.parseLong(wrapper.getId())));
+
+        UserMusic userMusic = userMusicMap.get(Long.parseLong(wrapper.getId()));
+        if (Objects.nonNull(userMusic)) {
+            wrapper.setVideoFilePath(userMusic.getVideoUrl());
+        }
+        MusicPracticeRecordWrapper.MusicPracticeRecord from = MusicPracticeRecordWrapper.MusicPracticeRecord.from(JSON.toJSONString(wrapper));
+        // 曲目信息
+        MusicSheet musicSheet = musicSheetService.getDao().get(Long.parseLong(wrapper.getMusicSheetId()));
+        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);
+    }
+
+
+}

+ 139 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenMusicSheetCbsController.java

@@ -0,0 +1,139 @@
+package com.yonge.cooleshow.admin.controller.open;
+
+import com.alibaba.fastjson.JSON;
+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.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;
+import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
+import com.yonge.cooleshow.biz.dal.service.UserMusicService;
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
+import com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.enums.YesOrNoEnum;
+import com.yonge.toolset.base.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+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;
+
+/**
+ * 曲谱表 web 控制层
+ * @author yzp
+ * @date 2022-03-26 00:21:46
+ * @version v1.0
+ **/
+@RestController
+@RequestMapping("${app-config.url.admin:}/open/musicSheet")
+@Api(tags = "曲谱表 API接口")
+public class OpenMusicSheetCbsController extends BaseController {
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+
+	@Resource
+	private MusicSheetService musicSheetService;
+
+
+    @Autowired
+    private InstrumentService instrumentService;
+
+    @Autowired
+    private UserMusicService userMusicService;
+
+    /**
+     * 查询单条
+     *
+     * @param id 详情ID
+     * @return R<MusicSheetVo.MusicSheet>
+     */
+    @ApiOperation(value = "查询内容平台数据")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @GetMapping("/cbsDetail/{id}")
+    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);
+
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
+//
+//
+//        MusicSheetDetailVo detail;
+//        if (userMusicId != null) {
+//            UserMusic userMusic = userMusicService.detail(userMusicId);
+//            if (userMusic == null) {
+//                throw new BizException("参数错误");
+//            } else {
+//                SysUser sysUser = sysUserFeignService.queryUserById(userMusic.getUserId());
+//                detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.SYSTEM, tenantAlbumId);
+//            }
+//        } else {
+//
+//            detail = musicSheetService.detail(id.toString(), null, ClientEnum.SYSTEM, tenantAlbumId);
+//        }
+//        if (detail != null) {
+//            // 设置曲目付费类型
+//            musicSheetDetail.setPaymentType(detail.getPaymentType());
+//            // 设置业务端曲目分类
+////            musicSheetDetail.setBizMusicCategoryId(detail.getCategoriesId() == null ? null : detail.getCategoriesId().longValue());
+//            musicSheetDetail.setScoreType(detail.getScoreType());
+//            musicSheetDetail.setIsConvertibleScore(detail.getNotation() ==YesOrNoEnum.YES);
+//            musicSheetDetail.setPlay(detail.getPlay());
+//            musicSheetDetail.setBuyed(detail.getBuyed());
+//            musicSheetDetail.setMusicPrice(detail.getMusicPrice());
+//        }
+//
+//        // 如果是合奏 并且乐器ID = 2268
+//        musicSheetDetail.setSpecialPercussionFlag(false);
+//        if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
+//            musicSheetDetail.setSpecialPercussionFlag(true);
+//        }
+//
+//        // 设置乐器信息
+//        if (StringUtils.isNotBlank(musicSheetDetail.getMusicalInstrumentIds())) {
+//            List<Long> instrumentIds = Arrays.stream(musicSheetDetail.getMusicalInstrumentIds().split(","))
+//                .map(Long::parseLong).collect(Collectors.toList());
+//
+//            if (CollectionUtils.isNotEmpty(instrumentIds) && CollectionUtils.isNotEmpty(musicSheetDetail.getMusicalInstruments())) {
+//                Map<Long, InstrumentWrapper.Instrument> instrumentMap = instrumentService.getMapByIds(instrumentIds);
+//                for (CbsMusicSheetWrapper.MusicalInstrument musicalInstrument : musicSheetDetail.getMusicalInstruments()) {
+//                    InstrumentWrapper.Instrument instrument = instrumentMap.get(musicalInstrument.getId().longValue());
+//                    if (instrument != null) {
+//                        musicalInstrument.setOrientation(instrument.getOrientation());
+//                    }
+//
+//                }
+//            }
+//        }
+        return R.from(musicSheetDetail);
+    }
+
+}

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

@@ -89,53 +89,53 @@ public class OpenMusicSheetCbsController extends BaseController {
         cbsMusicSheet.setBizId(id);
 
         MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
-        MusicSheetDetailVo detail;
-        if (userMusicId != null) {
-            UserMusic userMusic = userMusicService.detail(userMusicId);
-            if (userMusic == null) {
-                throw new BizException("参数错误");
-            } else {
-                SysUser sysUser = sysUserFeignService.queryUserById(userMusic.getUserId());
-                detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.STUDENT, tenantAlbumId);
-            }
-        } else {
-
-            detail = musicSheetService.detail(id.toString(), null, ClientEnum.STUDENT, tenantAlbumId);
-        }
-        if (detail != null) {
-            // 设置曲目付费类型
-            musicSheetDetail.setPaymentType(detail.getPaymentType());
-            // 设置业务端曲目分类
-//            musicSheetDetail.setBizMusicCategoryId(detail.getCategoriesId() == null ? null : detail.getCategoriesId().longValue());
-            musicSheetDetail.setScoreType(detail.getScoreType());
-            musicSheetDetail.setIsConvertibleScore(detail.getNotation() ==YesOrNoEnum.YES);
-            musicSheetDetail.setPlay(detail.getPlay());
-            musicSheetDetail.setBuyed(detail.getBuyed());
-            musicSheetDetail.setMusicPrice(detail.getMusicPrice());
-        }
-
-        // 如果是合奏 并且乐器ID = 2268
-        musicSheetDetail.setSpecialPercussionFlag(false);
-        if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
-            musicSheetDetail.setSpecialPercussionFlag(true);
-        }
-
-        // 设置乐器信息
-        if (StringUtils.isNotBlank(musicSheetDetail.getMusicalInstrumentIds())) {
-            List<Long> instrumentIds = Arrays.stream(musicSheetDetail.getMusicalInstrumentIds().split(","))
-                .map(Long::parseLong).collect(Collectors.toList());
-
-            if (CollectionUtils.isNotEmpty(instrumentIds) && CollectionUtils.isNotEmpty(musicSheetDetail.getMusicalInstruments())) {
-                Map<Long, InstrumentWrapper.Instrument> instrumentMap = instrumentService.getMapByIds(instrumentIds);
-                for (CbsMusicSheetWrapper.MusicalInstrument musicalInstrument : musicSheetDetail.getMusicalInstruments()) {
-                    InstrumentWrapper.Instrument instrument = instrumentMap.get(musicalInstrument.getId().longValue());
-                    if (instrument != null) {
-                        musicalInstrument.setOrientation(instrument.getOrientation());
-                    }
-
-                }
-            }
-        }
+//        MusicSheetDetailVo detail;
+//        if (userMusicId != null) {
+//            UserMusic userMusic = userMusicService.detail(userMusicId);
+//            if (userMusic == null) {
+//                throw new BizException("参数错误");
+//            } else {
+//                SysUser sysUser = sysUserFeignService.queryUserById(userMusic.getUserId());
+//                detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.STUDENT, tenantAlbumId);
+//            }
+//        } else {
+//
+//            detail = musicSheetService.detail(id.toString(), null, ClientEnum.STUDENT, tenantAlbumId);
+//        }
+//        if (detail != null) {
+//            // 设置曲目付费类型
+//            musicSheetDetail.setPaymentType(detail.getPaymentType());
+//            // 设置业务端曲目分类
+////            musicSheetDetail.setBizMusicCategoryId(detail.getCategoriesId() == null ? null : detail.getCategoriesId().longValue());
+//            musicSheetDetail.setScoreType(detail.getScoreType());
+//            musicSheetDetail.setIsConvertibleScore(detail.getNotation() ==YesOrNoEnum.YES);
+//            musicSheetDetail.setPlay(detail.getPlay());
+//            musicSheetDetail.setBuyed(detail.getBuyed());
+//            musicSheetDetail.setMusicPrice(detail.getMusicPrice());
+//        }
+//
+//        // 如果是合奏 并且乐器ID = 2268
+//        musicSheetDetail.setSpecialPercussionFlag(false);
+//        if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
+//            musicSheetDetail.setSpecialPercussionFlag(true);
+//        }
+//
+//        // 设置乐器信息
+//        if (StringUtils.isNotBlank(musicSheetDetail.getMusicalInstrumentIds())) {
+//            List<Long> instrumentIds = Arrays.stream(musicSheetDetail.getMusicalInstrumentIds().split(","))
+//                .map(Long::parseLong).collect(Collectors.toList());
+//
+//            if (CollectionUtils.isNotEmpty(instrumentIds) && CollectionUtils.isNotEmpty(musicSheetDetail.getMusicalInstruments())) {
+//                Map<Long, InstrumentWrapper.Instrument> instrumentMap = instrumentService.getMapByIds(instrumentIds);
+//                for (CbsMusicSheetWrapper.MusicalInstrument musicalInstrument : musicSheetDetail.getMusicalInstruments()) {
+//                    InstrumentWrapper.Instrument instrument = instrumentMap.get(musicalInstrument.getId().longValue());
+//                    if (instrument != null) {
+//                        musicalInstrument.setOrientation(instrument.getOrientation());
+//                    }
+//
+//                }
+//            }
+//        }
         return R.from(musicSheetDetail);
     }
 

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

@@ -83,53 +83,53 @@ public class OpenMusicSheetCbsController extends BaseController {
         cbsMusicSheet.setBizId(id);
 
         MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
-        MusicSheetDetailVo detail;
-        if (userMusicId != null) {
-            UserMusic userMusic = userMusicService.detail(userMusicId);
-            if (userMusic == null) {
-                throw new BizException("参数错误");
-            } else {
-                SysUser sysUser = sysUserFeignService.queryUserById(userMusic.getUserId());
-                detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.TEACHER, tenantAlbumId);
-            }
-        } else {
-
-            detail = musicSheetService.detail(id.toString(), null, ClientEnum.TEACHER, tenantAlbumId);
-        }
-        if (detail != null) {
-            // 设置曲目付费类型
-            musicSheetDetail.setPaymentType(detail.getPaymentType());
-            // 设置业务端曲目分类
-//            musicSheetDetail.setBizMusicCategoryId(detail.getCategoriesId() == null ? null : detail.getCategoriesId().longValue());
-            musicSheetDetail.setScoreType(detail.getScoreType());
-            musicSheetDetail.setIsConvertibleScore(detail.getNotation() ==YesOrNoEnum.YES);
-            musicSheetDetail.setPlay(detail.getPlay());
-            musicSheetDetail.setBuyed(detail.getBuyed());
-            musicSheetDetail.setMusicPrice(detail.getMusicPrice());
-        }
-
-        // 如果是合奏 并且乐器ID = 2268
-        musicSheetDetail.setSpecialPercussionFlag(false);
-        if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
-            musicSheetDetail.setSpecialPercussionFlag(true);
-        }
-
-        // 设置乐器信息
-        if (StringUtils.isNotBlank(musicSheetDetail.getMusicalInstrumentIds())) {
-            List<Long> instrumentIds = Arrays.stream(musicSheetDetail.getMusicalInstrumentIds().split(","))
-                .map(Long::parseLong).collect(Collectors.toList());
-
-            if (CollectionUtils.isNotEmpty(instrumentIds) && CollectionUtils.isNotEmpty(musicSheetDetail.getMusicalInstruments())) {
-                Map<Long, InstrumentWrapper.Instrument> instrumentMap = instrumentService.getMapByIds(instrumentIds);
-                for (CbsMusicSheetWrapper.MusicalInstrument musicalInstrument : musicSheetDetail.getMusicalInstruments()) {
-                    InstrumentWrapper.Instrument instrument = instrumentMap.get(musicalInstrument.getId().longValue());
-                    if (instrument != null) {
-                        musicalInstrument.setOrientation(instrument.getOrientation());
-                    }
-
-                }
-            }
-        }
+//        MusicSheetDetailVo detail;
+//        if (userMusicId != null) {
+//            UserMusic userMusic = userMusicService.detail(userMusicId);
+//            if (userMusic == null) {
+//                throw new BizException("参数错误");
+//            } else {
+//                SysUser sysUser = sysUserFeignService.queryUserById(userMusic.getUserId());
+//                detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.TEACHER, tenantAlbumId);
+//            }
+//        } else {
+//
+//            detail = musicSheetService.detail(id.toString(), null, ClientEnum.TEACHER, tenantAlbumId);
+//        }
+//        if (detail != null) {
+//            // 设置曲目付费类型
+//            musicSheetDetail.setPaymentType(detail.getPaymentType());
+//            // 设置业务端曲目分类
+////            musicSheetDetail.setBizMusicCategoryId(detail.getCategoriesId() == null ? null : detail.getCategoriesId().longValue());
+//            musicSheetDetail.setScoreType(detail.getScoreType());
+//            musicSheetDetail.setIsConvertibleScore(detail.getNotation() ==YesOrNoEnum.YES);
+//            musicSheetDetail.setPlay(detail.getPlay());
+//            musicSheetDetail.setBuyed(detail.getBuyed());
+//            musicSheetDetail.setMusicPrice(detail.getMusicPrice());
+//        }
+//
+//        // 如果是合奏 并且乐器ID = 2268
+//        musicSheetDetail.setSpecialPercussionFlag(false);
+//        if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
+//            musicSheetDetail.setSpecialPercussionFlag(true);
+//        }
+//
+//        // 设置乐器信息
+//        if (StringUtils.isNotBlank(musicSheetDetail.getMusicalInstrumentIds())) {
+//            List<Long> instrumentIds = Arrays.stream(musicSheetDetail.getMusicalInstrumentIds().split(","))
+//                .map(Long::parseLong).collect(Collectors.toList());
+//
+//            if (CollectionUtils.isNotEmpty(instrumentIds) && CollectionUtils.isNotEmpty(musicSheetDetail.getMusicalInstruments())) {
+//                Map<Long, InstrumentWrapper.Instrument> instrumentMap = instrumentService.getMapByIds(instrumentIds);
+//                for (CbsMusicSheetWrapper.MusicalInstrument musicalInstrument : musicSheetDetail.getMusicalInstruments()) {
+//                    InstrumentWrapper.Instrument instrument = instrumentMap.get(musicalInstrument.getId().longValue());
+//                    if (instrument != null) {
+//                        musicalInstrument.setOrientation(instrument.getOrientation());
+//                    }
+//
+//                }
+//            }
+//        }
         return R.from(musicSheetDetail);
     }