Преглед изворни кода

Merge branch 'zx_saas_cbs' of http://git.dayaedu.com/yonge/mec into test

zouxuan пре 1 година
родитељ
комит
65bee52f01
22 измењених фајлова са 293 додато и 345 уклоњено
  1. 3 11
      mec-application/src/main/java/com/ym/mec/student/controller/SysMusicScoreController.java
  2. 3 15
      mec-application/src/main/java/com/ym/mec/teacher/controller/SysMusicScoreAccompanimentController.java
  3. 4 4
      mec-application/src/main/java/com/ym/mec/web/controller/MusicSheetApplicationExtendController.java
  4. 0 16
      mec-application/src/main/java/com/ym/mec/web/controller/SysMusicScoreAccompanimentController.java
  5. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentMusicScoreDao.java
  6. 1 12
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicScoreAccompanimentDao.java
  7. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentMusicScore.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicScoreAccompaniment.java
  9. 4 3
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicScoreAccompanimentService.java
  10. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicScoreService.java
  11. 116 28
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreAccompanimentServiceImpl.java
  12. 28 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java
  13. 1 47
      mec-biz/src/main/resources/config/mybatis/SysMusicScoreAccompanimentMapper.xml
  14. 2 8
      mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml
  15. 3 8
      mec-biz/src/main/resources/config/mybatis/courseScheduleStudentMusicScoreMapper.xml
  16. 25 0
      mec-common/common-core/src/main/java/com/ym/mec/common/page/PageUtil.java
  17. 1 1
      mec-im/src/main/java/com/ym/mec/im/message/DeviceStateChangedMessage.java
  18. 4 41
      mec-im/src/main/java/com/ym/pojo/MusicScoreData.java
  19. 4 98
      mec-im/src/main/java/com/ym/pojo/MusicScoreMessage.java
  20. 3 3
      mec-im/src/main/java/com/ym/pojo/ReqDeviceControlData.java
  21. 6 2
      mec-im/src/main/java/com/ym/pojo/RoomResult.java
  22. 73 38
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

+ 3 - 11
mec-application/src/main/java/com/ym/mec/student/controller/SysMusicScoreController.java

@@ -11,25 +11,17 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+
 @RequestMapping("${app-config.url.student:}/sysMusicScore")
 @Api(tags = "曲库")
 @RestController
 public class SysMusicScoreController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysMusicScoreService sysMusicScoreService;
 
     @ApiOperation(value = "分页查询")
-    @GetMapping("/queryPage")
-    public Object queryPage(SysExamSongQueryInfo queryInfo) {
-        queryInfo.setType("COMMON");
-        if(queryInfo.getClientType() == null){
-            queryInfo.setClientType(ClientTypeEnum.NETWORK_ROOM);
-        }
-        return succeed(sysMusicScoreService.queryPage(queryInfo));
-    }
-
-    @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage2")
     public Object queryPage2(SysExamSongQueryInfo queryInfo) {
         queryInfo.setType("COMMON");

+ 3 - 15
mec-application/src/main/java/com/ym/mec/teacher/controller/SysMusicScoreAccompanimentController.java

@@ -18,7 +18,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 @RequestMapping("${app-config.url.teacher:}/sysMusicScoreAccompaniment")
 @Api(tags = "曲库伴奏服务")
@@ -35,20 +37,6 @@ public class SysMusicScoreAccompanimentController extends BaseController {
     @Autowired
     private TenantConfigService tenantConfigService;
 
-    @ApiOperation(value = "修改")
-    @PostMapping("/update")
-    public Object update(@RequestBody SysMusicScoreAccompaniment sysMusicScoreAccompaniment) {
-        sysMusicScoreAccompanimentService.updateAcc(sysMusicScoreAccompaniment);
-        return succeed();
-    }
-
-    @ApiOperation(value = "删除")
-    @PostMapping("/del")
-    public Object del(Integer id) {
-        sysMusicScoreAccompanimentService.delete(id);
-        return succeed();
-    }
-
     @ApiOperation(value = "获取伴奏声部列表")
     @GetMapping("/querySubjectIds")
     public Object querySubjectIds(Integer categoriesId) {

+ 4 - 4
mec-application/src/main/java/com/ym/mec/web/controller/MusicSheetApplicationExtendController.java

@@ -62,7 +62,7 @@ public class MusicSheetApplicationExtendController {
             if (CollectionUtils.isEmpty(rows)) {
                 return R.from(PageUtil.pageInfo(info, new ArrayList<>()));
             }
-            String instrumentIds = rows.stream().map(CbsMusicSheetWrapper.MusicSheet::getMusicalInstrumentIds).filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
+            /*String instrumentIds = rows.stream().map(CbsMusicSheetWrapper.MusicSheet::getMusicalInstrumentIds).filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
             //获取乐器名称
             Map<Integer,CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto> musicalInstrumentQueryMap = new HashMap<>();
             if(StringUtils.isNotEmpty(instrumentIds)){
@@ -70,7 +70,7 @@ public class MusicSheetApplicationExtendController {
                         sysMusicScoreService.queryMusicalInstrument(Arrays.stream(instrumentIds.split(",")).map(Integer::parseInt).distinct().collect(Collectors.toList()));
                 musicalInstrumentQueryMap = musicalInstrumentQueryDtos.stream()
                         .collect(Collectors.toMap(CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto::getId, o -> o, (o1, o2) -> o1));
-            }
+            }*/
             List<Long> cbsMusicIds = rows.stream().map(CbsMusicSheetWrapper.MusicSheet::getId).collect(Collectors.toList());
             List<SysMusicScore> musicSheetList = sysMusicScoreService.getDao().findByCbsId(cbsMusicIds);
             Map<String, SysMusicScore> map = musicSheetList.stream().collect(Collectors.toMap(SysMusicScore::getCbsMusicSheetId, o -> o, (o1, o2) -> o1));
@@ -83,7 +83,7 @@ public class MusicSheetApplicationExtendController {
                 if (Objects.nonNull(musicSheet)) {
                     musicSheetApplication.setBizId(musicSheet.getId().toString());
                 }
-                if(StringUtils.isNotEmpty(musicSheetApplication.getMusicalInstrumentIds())){
+                /*if(StringUtils.isNotEmpty(musicSheetApplication.getMusicalInstrumentIds())){
                     String[] split = musicSheetApplication.getMusicalInstrumentIds().split(",");
                     for (String s : split) {
                         StringBuffer sb = new StringBuffer();
@@ -96,7 +96,7 @@ public class MusicSheetApplicationExtendController {
                         }
                         musicSheetApplication.setSubjectNames(sb.toString());
                     }
-                }
+                }*/
                 musicSheetApplications.add(musicSheetApplication);
             }
             return R.from(PageUtil.pageInfo(info, musicSheetApplications));

+ 0 - 16
mec-application/src/main/java/com/ym/mec/web/controller/SysMusicScoreAccompanimentController.java

@@ -22,22 +22,6 @@ public class SysMusicScoreAccompanimentController extends BaseController {
     @Autowired
     private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
 
-    @ApiOperation(value = "修改")
-    @PostMapping("/update")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScoreAccompaniment/update')")
-    public Object update(@RequestBody SysMusicScoreAccompaniment sysMusicScoreAccompaniment) {
-        sysMusicScoreAccompanimentService.updateAcc(sysMusicScoreAccompaniment);
-        return succeed();
-    }
-
-    @ApiOperation(value = "删除")
-    @PostMapping("/del/{id}")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScoreAccompaniment/del')")
-    public Object del(@ApiParam(value = "收费类型编号", required = true) @PathVariable("id") Integer id) {
-        sysMusicScoreAccompanimentService.delete(id);
-        return succeed();
-    }
-
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('sysMusicScoreAccompaniment/queryPage')")

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentMusicScoreDao.java

@@ -8,7 +8,7 @@ import java.util.List;
 
 public interface CourseScheduleStudentMusicScoreDao extends BaseDAO<Integer, CourseScheduleStudentMusicScore> {
 
-    List<CourseScheduleStudentMusicScore> queryByScoreIdAndCourseId(@Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+    List<CourseScheduleStudentMusicScore> queryByScoreIdAndCourseId(@Param("musicScoreAccompanimentId") String musicScoreAccompanimentId,
                                                                     @Param("courseId") Long courseId,
                                                                     @Param("userId") Integer userId,
                                                                     @Param("downStatus") Integer downStatus,
@@ -21,7 +21,7 @@ public interface CourseScheduleStudentMusicScoreDao extends BaseDAO<Integer, Cou
      * @param scheduleId
      * @param userId
      */
-    void closePlayStatus(@Param("scheduleId") long scheduleId, @Param("userId") Integer userId, @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId);
+    void closePlayStatus(@Param("scheduleId") long scheduleId, @Param("userId") Integer userId, @Param("musicScoreAccompanimentId") String musicScoreAccompanimentId);
 
     /**
      * 开启原音播放
@@ -30,7 +30,7 @@ public interface CourseScheduleStudentMusicScoreDao extends BaseDAO<Integer, Cou
      * @return
      */
     int openPlayStatus(@Param("scheduleId") long scheduleId,
-                       @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+                       @Param("musicScoreAccompanimentId") String musicScoreAccompanimentId,
                        @Param("userId") Integer userId);
 
     /**
@@ -40,6 +40,6 @@ public interface CourseScheduleStudentMusicScoreDao extends BaseDAO<Integer, Cou
      * @return
      */
     int openAccompanimentPlayStatus(@Param("scheduleId") long scheduleId,
-                                    @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+                                    @Param("musicScoreAccompanimentId") String musicScoreAccompanimentId,
                                     @Param("userId") Integer userId);
 }

+ 1 - 12
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicScoreAccompanimentDao.java

@@ -9,22 +9,11 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 import java.util.Map;
 
-public interface SysMusicScoreAccompanimentDao extends BaseDAO<Integer, SysMusicScoreAccompaniment> {
+public interface SysMusicScoreAccompanimentDao extends BaseDAO<String, SysMusicScoreAccompaniment> {
 
 
-    void batchInsert(@Param("sysMusicScoreAccompaniments") List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments,
-                     @Param("sysMusicScoreId") Integer sysMusicScoreId,
-                     @Param("isOpenMetronome") Boolean isOpenMetronome);
-
-    void batchDel(@Param("delExamSongAccompanimentIds") List<Integer> delExamSongAccompanimentIds);
-
     List<Integer> findSubjectByMusicScoreId(@Param("sysMusicScoreId") Integer sysMusicScoreId, @Param("idList") List<Integer> idList);
 
-    void batchUpdate(@Param("sysMusicScoreAccompaniments") List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments,
-                     @Param("isOpenMetronome") Boolean isOpenMetronome);
-
-    void deleteBySongId(Integer id);
-
     List<SysMusicScoreAccompaniment> queryAccPage(Map<String, Object> params);
 
     int findAccCount(Map<String, Object> params);

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentMusicScore.java

@@ -12,7 +12,7 @@ public class CourseScheduleStudentMusicScore extends BaseEntity {
     private Integer downStatus = 0;
     private Integer userId;
     private Integer userType = 0;
-    private Integer musicScoreAccompanimentId;
+    private String musicScoreAccompanimentId;
     private Integer playStatus = 0;
     private Integer accompanimentPlayStatus = 0;
     private String speed;

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicScoreAccompaniment.java

@@ -14,7 +14,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 public class SysMusicScoreAccompaniment {
 
 	/**  */
-	private Integer id;
+	private String id;
 	
 	/**  */
 	private Integer examSongId;

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicScoreAccompanimentService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment;
@@ -10,12 +11,12 @@ import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
 
-public interface SysMusicScoreAccompanimentService extends BaseService<Integer, SysMusicScoreAccompaniment> {
-
-    void updateAcc(SysMusicScoreAccompaniment sysMusicScoreAccompaniment);
+public interface SysMusicScoreAccompanimentService extends BaseService<String, SysMusicScoreAccompaniment> {
 
     List<SysMusicScoreAccompaniment> queryAll(SysExamSongQueryInfo queryInfo);
 
+    SysMusicScoreAccompaniment initSysMusicScoreAccompaniment(CbsMusicSheetWrapper.MusicSheetAccApplication musicSheetApplication);
+
     List<SysMusicScoreAccompaniment> queryAccPage(SysExamSongQueryInfo queryInfo);
 
     List<Subject> querySubjectIds(Integer categoriesId);

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicScoreService.java

@@ -19,6 +19,12 @@ public interface SysMusicScoreService extends BaseService<Integer, SysMusicScore
 
     SysMusicScoreDao getDao();
 
+    CbsMusicSheetWrapper.MusicSheetApplicationQuery getMusicSheetApplicationQuery();
+
+    List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery query);
+
+    PageInfo<CbsMusicSheetWrapper.MusicSheetAccApplication> queryCbsMusicSheetSoundApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery query);
+
     List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<String> cbsMusicSheetIds);
 
     //获取乐器名称

+ 116 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreAccompanimentServiceImpl.java

@@ -1,20 +1,20 @@
 package com.ym.mec.biz.service.impl;
 
 
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetCategoryWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.ym.mec.auth.api.dto.MusicScoreQueryInfo;
 import com.ym.mec.biz.dal.dao.SysMusicScoreAccompanimentDao;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SysMusicScore;
-import com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment;
-import com.ym.mec.biz.dal.entity.SysMusicScoreCategories;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
+import com.ym.mec.biz.service.InstrumentService;
 import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
 import com.ym.mec.biz.service.SysMusicScoreCategoriesService;
 import com.ym.mec.biz.service.SysMusicScoreService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.PageUtil;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.collections.CollectionUtils;
@@ -22,15 +22,12 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
-public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integer, SysMusicScoreAccompaniment> implements SysMusicScoreAccompanimentService {
+public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<String, SysMusicScoreAccompaniment> implements SysMusicScoreAccompanimentService {
 	
 	@Resource
 	private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
@@ -38,25 +35,13 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 	private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
 	@Resource
 	private SysMusicScoreService sysMusicScoreService;
+	@Resource
+	private InstrumentService instrumentService;
 	@Override
-	public BaseDAO<Integer, SysMusicScoreAccompaniment> getDAO() {
+	public BaseDAO<String, SysMusicScoreAccompaniment> getDAO() {
 		return sysMusicScoreAccompanimentDao;
 	}
 
-	@Override
-	public void updateAcc(SysMusicScoreAccompaniment sysMusicScoreAccompaniment) {
-		SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(sysMusicScoreAccompaniment.getId());
-		if(accompaniment == null){
-			throw new BizException("操作失败:伴奏信息不存在");
-		}
-		List<Integer> idList = new ArrayList<>();
-		idList.add(accompaniment.getId());
-		List<Integer> subjectIds = sysMusicScoreAccompanimentDao.findSubjectByMusicScoreId(accompaniment.getExamSongId(),idList);
-		if(CollectionUtils.isNotEmpty(subjectIds) && subjectIds.contains(accompaniment.getId())){
-			throw new BizException("操作失败:请勿提交重复的伴奏声部");
-		}
-		sysMusicScoreAccompanimentDao.update(sysMusicScoreAccompaniment);
-	}
 
 	@Override
 	public List<SysMusicScoreAccompaniment> queryAll(SysExamSongQueryInfo queryInfo) {
@@ -94,10 +79,9 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 				throw new BizException("曲目原音信息不存在,曲目ID:" + accompaniment.getCbsMusicSheetId());
 			}
 			List<SysMusicScoreAccompaniment> childAccompaniments = new ArrayList<>();
-			int num = 1;
 			for (int i = 0; i < musicSheetApplication.getMusicSheetSoundList().size(); i++) {
 				SysMusicScoreAccompaniment record = new SysMusicScoreAccompaniment();
-				record.setId(num++);
+				record.setId(accompaniment.getExamSongId().toString());
 				record.setType(accompaniment.getType());
 				record.setRankIds("FREE".equals(musicSheetApplication.getPaymentType()) ? null : "1");
 				record.setClientType(accompaniment.getClientType());
@@ -138,6 +122,91 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 		return result;
 	}
 
+	public List<SysMusicScoreAccompaniment> initAccompaniments(List<CbsMusicSheetWrapper.MusicSheetAccApplication> applications){
+		List<SysMusicScoreAccompaniment> result = new ArrayList<>();
+		if(CollectionUtils.isEmpty(applications)){
+			return result;
+		}
+		List<Long> musicSheetCategoryIds = applications.stream().map(e -> e.getMusicSheetCategoryId())
+				.filter(Objects::isNull).distinct().collect(Collectors.toList());
+		CbsMusicSheetCategoryWrapper.MusicSheetCategoryQuery categoryQuery = new CbsMusicSheetCategoryWrapper.MusicSheetCategoryQuery();
+		categoryQuery.setIds(musicSheetCategoryIds);
+		List<CbsMusicSheetCategoryWrapper.MusicSheetCategory> musicSheetCategories = sysMusicScoreCategoriesService.getDao().categoryList(categoryQuery);
+		Map<Long, CbsMusicSheetCategoryWrapper.MusicSheetCategory> categoryMap = musicSheetCategories.stream().
+				collect(Collectors.toMap(CbsMusicSheetCategoryWrapper.MusicSheetCategory::getId, Function.identity()));
+		for (CbsMusicSheetWrapper.MusicSheetAccApplication musicSheetApplication : applications) {
+			SysMusicScoreAccompaniment record = new SysMusicScoreAccompaniment();
+			record.setId(musicSheetApplication.getMusicSheetSoundId().toString());
+			record.setRankIds("FREE".equals(musicSheetApplication.getPaymentType()) ? null : "1");
+//			record.setExamSongId(accompaniment.getExamSongId());
+			record.setCbsMusicSheetId(musicSheetApplication.getId().toString());
+			record.setPlayMode(SysMusicScore.PlayMode.valueOf(musicSheetApplication.getPlayMode().getCode()));
+			record.setExtConfigJson(musicSheetApplication.getExtConfigJson());
+//				record.setSubjectId(accompaniment.getSubjectId());
+			record.setExtStyleConfigJson(musicSheetApplication.getExtStyleConfigJson());
+			if(musicSheetApplication.getMusicSheetCategoryId() != null){
+				record.setCategoriesId(musicSheetApplication.getMusicSheetCategoryId().intValue());
+				CbsMusicSheetCategoryWrapper.MusicSheetCategory musicSheetCategory = categoryMap.get(record.getCategoriesId().longValue());
+				if(musicSheetCategory != null){
+					record.setParentCategoriesId(musicSheetCategory.getParentId().intValue());
+				}
+			}
+			record.setMusicSheetType(musicSheetApplication.getMusicSheetType().getCode());
+			record.setExamSongName(musicSheetApplication.getName());
+			record.setCategoriesName(musicSheetApplication.getMusicSheetCategoryName());
+			record.setSpeed(musicSheetApplication.getPlaySpeed());
+			//原音
+			record.setMetronomeMp3Url(musicSheetApplication.getMp3Url());
+			record.setMp3Url(musicSheetApplication.getMp3Url());
+			record.setTrack(musicSheetApplication.getTrack());
+			record.setSubjectName(musicSheetApplication.getTrack());
+			record.setXmlUrl(musicSheetApplication.getXmlFileUrl());
+			record.setMidiUrl(musicSheetApplication.getMidiFileUrl());
+			record.setEnableEvaluation(musicSheetApplication.getIsEvaluated());
+			record.setIsOpenMetronome(musicSheetApplication.getIsUseSystemBeat());
+			//伴奏
+			record.setMetronomeUrl(musicSheetApplication.getUrl());
+			record.setUrl(musicSheetApplication.getUrl());
+			record.setIsShowFingering(musicSheetApplication.getIsShowFingering());
+			result.add(record);
+		}
+		return result;
+	}
+
+	@Override
+	public SysMusicScoreAccompaniment initSysMusicScoreAccompaniment(CbsMusicSheetWrapper.MusicSheetAccApplication musicSheetApplication){
+		SysMusicScoreAccompaniment record = new SysMusicScoreAccompaniment();
+//		record.setType(accompaniment.getType());
+		record.setRankIds("FREE".equals(musicSheetApplication.getPaymentType()) ? null : "1");
+//		record.setClientType(accompaniment.getClientType());
+//		record.setExamSongId(accompaniment.getExamSongId());
+		record.setCbsMusicSheetId(musicSheetApplication.getId().toString());
+		record.setPlayMode(SysMusicScore.PlayMode.valueOf(musicSheetApplication.getPlayMode().getCode()));
+		record.setExtConfigJson(musicSheetApplication.getExtConfigJson());
+//				record.setSubjectId(accompaniment.getSubjectId());
+		record.setExtStyleConfigJson(musicSheetApplication.getExtStyleConfigJson());
+		if(musicSheetApplication.getMusicSheetCategoryId() != null){
+			record.setCategoriesId(musicSheetApplication.getMusicSheetCategoryId().intValue());
+		}
+		record.setMusicSheetType(musicSheetApplication.getMusicSheetType().getCode());
+//		record.setParentCategoriesId(accompaniment.getParentCategoriesId());
+		record.setExamSongName(musicSheetApplication.getName());
+		record.setCategoriesName(musicSheetApplication.getMusicSheetCategoryName());
+		record.setSpeed(musicSheetApplication.getPlaySpeed());
+		record.setTrack(musicSheetApplication.getTrack());
+		record.setSubjectName(musicSheetApplication.getTrack());
+		record.setXmlUrl(musicSheetApplication.getXmlFileUrl());
+		record.setMidiUrl(musicSheetApplication.getMidiFileUrl());
+		record.setEnableEvaluation(musicSheetApplication.getIsEvaluated());
+		record.setIsOpenMetronome(musicSheetApplication.getIsUseSystemBeat());
+		record.setMetronomeUrl(musicSheetApplication.getUrl());
+		record.setUrl(musicSheetApplication.getUrl());
+		record.setMetronomeMp3Url(musicSheetApplication.getMp3Url());
+		record.setMp3Url(musicSheetApplication.getMp3Url());
+		record.setIsShowFingering(musicSheetApplication.getIsShowFingering());
+		return record;
+	}
+
 	@Override
 	public List<SysMusicScoreAccompaniment> queryAccPage(SysExamSongQueryInfo queryInfo) {
 		if(queryInfo.getCategoriesId() != null){
@@ -228,8 +297,27 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 			}
 			queryInfo.setFilterCategoriesIds(filterCategoriesIdList.stream().map(String :: valueOf).collect(Collectors.joining(",")));
 		}
-		return this.queryPage(queryInfo);
-    }
+		//如果声部不为空,关联声部挂的乐器
+		List<Instrument> list = null;
+		if(queryInfo.getSubjectId() != null){
+			list = instrumentService.lambdaQuery().eq(Instrument::getSubjectId, queryInfo.getSubjectId()).list();
+		}else {
+			//获取所有有关联的乐器
+			list = instrumentService.lambdaQuery().list();
+		}
+		if(CollectionUtils.isEmpty(list)){
+			return new PageInfo<>();
+		}
+		CbsMusicSheetWrapper.MusicSheetApplicationQuery applicationQuery = sysMusicScoreService.getMusicSheetApplicationQuery();
+		applicationQuery.setCategoriesIds(queryInfo.getCategoriesIds());
+		applicationQuery.setFilterCategoriesIds(queryInfo.getFilterCategoriesIds());
+		applicationQuery.setMusicalInstrumentIds(list.stream().map(e->e.getId().longValue()).collect(Collectors.toList()));
+		applicationQuery.setPage(queryInfo.getPage());
+		applicationQuery.setRows(queryInfo.getRows());
+		PageInfo<CbsMusicSheetWrapper.MusicSheetAccApplication> musicSheetAccApplicationPageInfo = sysMusicScoreService.queryCbsMusicSheetSoundApplication(applicationQuery);
+		List<SysMusicScoreAccompaniment> accompaniments = this.initAccompaniments(musicSheetAccApplicationPageInfo.getRows());
+		return PageUtil.transPageInfo(musicSheetAccApplicationPageInfo,accompaniments);
+	}
     
     private void getAllCategoryIdList(List<Integer> categoryIdList, List<SysMusicScoreCategories> sysMusicScoreCategoriesList){
     	

+ 28 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java

@@ -26,6 +26,7 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.PageUtil;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -94,14 +95,17 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
     }
 
     @Override
-    public List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<String> cbsMusicSheetIds){
+    public CbsMusicSheetWrapper.MusicSheetApplicationQuery getMusicSheetApplicationQuery() {
         CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
-        query.setMusicSheetIds(cbsMusicSheetIds.stream().map(Long::parseLong).collect(Collectors.toList()));
         query.setDetailFlag(true);
         query.setDelFlag(true);
         query.setPage(1);
-        query.setRows(cbsMusicSheetIds.size());
         query.setApplicationId(applicationId);
+        return query;
+    }
+
+    @Override
+    public List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery query) {
         R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR =
                 musicFeignClientService.musicSheetPageByApplication(query);
         if(pageInfoR.getCode() != 200){
@@ -114,6 +118,25 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
         return new ArrayList<>();
     }
 
+    @Override
+    public PageInfo<CbsMusicSheetWrapper.MusicSheetAccApplication> queryCbsMusicSheetSoundApplication(CbsMusicSheetWrapper.MusicSheetApplicationQuery query) {
+        R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetAccApplication>> pageInfoR =
+                musicFeignClientService.musicSheetAccPageByApplication(query);
+        if(pageInfoR.getCode() != 200){
+            throw new BizException("获取曲目信息失败");
+        }
+        com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetAccApplication> pageInfo = pageInfoR.getData();
+        return PageUtil.pageInfo(pageInfo);
+    }
+
+    @Override
+    public List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<String> cbsMusicSheetIds){
+        CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
+        query.setMusicSheetIds(cbsMusicSheetIds.stream().map(Long::parseLong).collect(Collectors.toList()));
+        query.setRows(cbsMusicSheetIds.size());
+        return this.queryCbsMusicSheetApplication(query);
+    }
+
     //获取乐器名称
     @Override
     public List<CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto> queryMusicalInstrument(List<Integer> musicalInstrumentIds){
@@ -122,7 +145,8 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
         musicalInstrumentQuery.setIds(musicalInstrumentIds);
         musicalInstrumentQuery.setPage(1);
         musicalInstrumentQuery.setRows(musicalInstrumentIds.size());
-        R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto>> infoR = musicFeignClientService.musicalInstrumentPage(musicalInstrumentQuery);
+        R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto>> infoR =
+                musicFeignClientService.musicalInstrumentPage(musicalInstrumentQuery);
         if(infoR.getCode() != 200){
             throw new com.microsvc.toolkit.common.webportal.exception.BizException("获取乐器信息失败,{}",infoR.getMessage());
         }

+ 1 - 47
mec-biz/src/main/resources/config/mybatis/SysMusicScoreAccompanimentMapper.xml

@@ -42,10 +42,6 @@
 		<result column="rank_ids_" property="rankIds" />
 	</resultMap>
 
-	<delete id="deleteBySongId">
-		UPDATE sys_music_score_accompaniment SET del_flag_ = 1,update_time_ = NOW() WHERE exam_song_id_ = #{id}
-	</delete>
-
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="SysMusicScoreAccompaniment" >
 		SELECT sesa.id_,sesa.exam_song_id_,sesa.subject_id_,CASE WHEN sesa.metronome_mp3_url_ IS NULL OR sesa.metronome_mp3_url_ = '' THEN sesa.mp3_url_ ELSE sesa.metronome_mp3_url_ END url_,sesa.speed_,
@@ -67,15 +63,6 @@
 		INSERT INTO sys_music_score_accompaniment (exam_song_id_,subject_id_,mp3_url_,metronome_mp3_url_,speed_,xml_url_,create_time_,update_time_,is_open_metronome_,track_)
 		VALUES(#{examSongId},#{subjectId},#{mp3Url},#{metronomeMp3Url},#{speed},#{xmlUrl},NOW(),NOW(),#{isOpenMetronome},#{track})
 	</insert>
-    <insert id="batchInsert">
-		INSERT INTO sys_music_score_accompaniment (exam_song_id_,subject_id_,mp3_url_,metronome_mp3_url_,speed_,xml_url_,
-		                                           create_time_,update_time_,is_show_fingering_,memo_,is_open_metronome_,track_)
-		VALUES
-		<foreach collection="sysMusicScoreAccompaniments" item="item"  separator=",">
-			(#{sysMusicScoreId},#{item.subjectId},#{item.mp3Url},#{item.metronomeMp3Url},#{item.speed},
-			 #{item.xmlUrl},NOW(),NOW(),#{item.isShowFingering},#{item.memo},#{item.isOpenMetronome},#{item.track})
-		</foreach>
-	</insert>
 
     <!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment">
@@ -103,39 +90,6 @@
 			mp3_url_ = #{mp3Url},metronome_mp3_url_ = #{metronomeMp3Url}, update_time_ = NOW()
 	</set>WHERE id_ = #{id}
 	</update>
-	<update id="batchDel">
-		UPDATE sys_music_score_accompaniment SET del_flag_ = 1,update_time_ = NOW() WHERE id_ IN
-		<foreach collection="delExamSongAccompanimentIds" item="item" open="(" close=")" separator=",">
-			#{item}
-		</foreach>
-	</update>
-	<update id="batchUpdate">
-		<foreach collection="sysMusicScoreAccompaniments" item="item" separator=";">
-			UPDATE sys_music_score_accompaniment
-			<set>
-				<if test="item.isShowFingering != null">
-					is_show_fingering_ = #{item.isShowFingering},
-				</if>
-				<if test="isOpenMetronome != null">
-					is_open_metronome_ = #{isOpenMetronome},
-				</if>
-				<if test="item.memo != null">
-					memo_ = #{item.memo},
-				</if>
-				<if test="item.speed != null">
-					speed_ = #{item.speed},
-				</if>
-				<if test="item.examSongId != null">
-					exam_song_id_ = #{item.examSongId},
-				</if>
-				<if test="item.track != null">
-					track_ = #{item.track},
-				</if>
-				subject_id_ = #{item.subjectId},xml_url_ = #{item.xmlUrl},metronome_mp3_url_ = #{item.metronomeMp3Url},
-				mp3_url_ = #{item.mp3Url}, update_time_ = NOW()
-			</set> WHERE id_ = #{item.id}
-		</foreach>
-	</update>
 
 	<!-- 根据主键删除一条记录 -->
 	<update id="delete" >
@@ -200,7 +154,7 @@
 		SELECT s.* FROM sys_music_score sms
 		LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,sms.subject_ids_)
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = sms.music_score_categories_id_
-		WHERE sms.del_flag_ = 0 AND s.id_ IS NOT NULL
+		WHERE sms.del_flag_ = 0 AND sms.cbs_music_sheet_id_ IS NOT NULL AND s.id_ IS NOT NULL
 		<if test="categoriesIdList != null and categoriesIdList.size > 0">
 			AND sesc.id_ IN
 			<foreach collection="categoriesIdList" separator="," item="item" open="(" close=")">

+ 2 - 8
mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml

@@ -129,10 +129,8 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="SysMusicScore">
-		SELECT ses.*,su.real_name_ create_user_name_,smsc.name_ categories_name_,smsc.id_ categories_id_,
-		smsa.mp3_url_ accompaniment_url_,smsa.metronome_mp3_url_ accompaniment_metronome_url_,smsa.is_open_metronome_,smsa.subject_id_,smsa.xml_url_
+		SELECT ses.*,su.real_name_ create_user_name_,smsc.name_ categories_name_,smsc.id_ categories_id_
 		FROM sys_music_score ses
-		LEFT JOIN sys_music_score_accompaniment smsa ON smsa.exam_song_id_ = ses.id_
 		LEFT JOIN sys_user su ON ses.create_user_id_ = su.id_
 		LEFT JOIN sys_music_score_categories smsc ON smsc.id_ = ses.music_score_categories_id_
 		<include refid="queryPageSql"/>
@@ -142,11 +140,8 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysMusicScore" parameterType="map">
-		SELECT ses.*,su.real_name_ create_user_name_,smsc.name_ categories_name_,smsc.id_ categories_id_,
-		smsa.mp3_url_ accompaniment_url_,smsa.metronome_mp3_url_ accompaniment_metronome_url_,
-		smsa.is_open_metronome_,smsa.subject_id_,ses.subject_ids_,smsa.xml_url_
+		SELECT ses.*,su.real_name_ create_user_name_,smsc.name_ categories_name_,smsc.id_ categories_id_,ses.subject_ids_
 		FROM sys_music_score ses
-		LEFT JOIN sys_music_score_accompaniment smsa ON smsa.exam_song_id_ = ses.id_
 		LEFT JOIN sys_user su ON ses.create_user_id_ = su.id_
 		LEFT JOIN sys_music_score_categories smsc ON smsc.id_ = ses.music_score_categories_id_
 		<include refid="queryPageSql"/>
@@ -159,7 +154,6 @@
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(DISTINCT ses.id_) FROM sys_music_score ses
 		LEFT JOIN sys_music_score_categories smsc ON smsc.id_ = ses.music_score_categories_id_
-		LEFT JOIN sys_music_score_accompaniment smsa ON smsa.exam_song_id_ = ses.id_
 		<include refid="queryPageSql"/>
 	</select>
     <select id="findByIds" resultMap="SysMusicScore">

+ 3 - 8
mec-biz/src/main/resources/config/mybatis/courseScheduleStudentMusicScoreMapper.xml

@@ -71,7 +71,7 @@
     <update id="closePlayStatus">
         UPDATE course_schedule_student_music_score SET play_status_ = 0,accompaniment_play_status_ = 0,update_time_ = NOW()
         WHERE course_schedule_id_ = #{scheduleId}
-        <if test="musicScoreAccompanimentId != null">
+        <if test="musicScoreAccompanimentId != null and musicScoreAccompanimentId != ''">
             AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
         </if>
         <if test="userId != null">
@@ -111,18 +111,13 @@
 	</select>
     <select id="queryByScoreIdAndCourseId"
             resultMap="CourseScheduleStudentMusicScore">
-        SELECT cssm.*,
-        CASE WHEN smsa.metronome_mp3_url_ IS NULL OR smsa.metronome_mp3_url_ = '' THEN smsa.mp3_url_ ELSE smsa.metronome_mp3_url_ END url_,
-        CASE WHEN sms.metronome_url_ IS NULL OR sms.metronome_url_ = '' THEN sms.url_ ELSE sms.metronome_url_ END mp3_url_,
-        sms.name_ music_score_name_
+        SELECT cssm.*
         FROM course_schedule_student_music_score cssm
-        LEFT JOIN sys_music_score_accompaniment smsa ON cssm.music_score_accompaniment_id_ = smsa.id_
-        LEFT JOIN sys_music_score sms ON sms.id_ = smsa.exam_song_id_
         <where>
             <if test="courseId != null">
                 AND cssm.course_schedule_id_ = #{courseId}
             </if>
-            <if test="musicScoreAccompanimentId != null">
+            <if test="musicScoreAccompanimentId != null and musicScoreAccompanimentId != ''">
                 AND cssm.music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
             </if>
             <if test="userType != null">

+ 25 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageUtil.java

@@ -1,8 +1,10 @@
 package com.ym.mec.common.page;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
@@ -72,6 +74,29 @@ public class PageUtil {
                 .map(Integer::valueOf);
     }
 
+    public static <T,E> PageInfo<T> transPageInfo(PageInfo<E> source, List<T> rows) {
+        if (Objects.isNull(source)) {
+            return new PageInfo<>();
+        }
+        PageInfo<T> resultPage = JSON.parseObject(JSON.toJSONString(source),PageInfo.class);
+        resultPage.setRows(rows);
+        return resultPage;
+    }
+
+    public static <T> PageInfo<T> pageInfo(com.microsvc.toolkit.common.response.paging.PageInfo<T> source) {
+        if (Objects.isNull(source)) {
+            return new PageInfo<>(1, 20);
+        }
+        int total = Integer.parseInt(String.valueOf(source.getTotal()));
+        int limit = Integer.parseInt(String.valueOf(source.getLimit()));
+        PageInfo<T> resultPage = new PageInfo<>();
+        resultPage.setRows(source.getRows());
+        resultPage.setPageNo(Long.valueOf(source.getCurrent()).intValue());
+        resultPage.setLimit(limit);
+        resultPage.setTotal(total);
+        return resultPage;
+    }
+
     public static <O, T> Page<T> getPageInfo(Map<String, O> param) {
         int pageSize = getPage(param, "rows").orElse(20);
         int pageIndex = getPage(param, "page").orElse(1);

+ 1 - 1
mec-im/src/main/java/com/ym/mec/im/message/DeviceStateChangedMessage.java

@@ -10,7 +10,7 @@ import lombok.Setter;
 public class DeviceStateChangedMessage extends BaseMessage {
     private @Setter @Getter boolean enable;
     private @Setter @Getter int type;
-    private @Setter @Getter Integer musicScoreAccompanimentId;
+    private @Setter @Getter String musicScoreAccompanimentId;
 
     private @Setter @Getter String userId;
     private @Setter @Getter String userName;

+ 4 - 41
mec-im/src/main/java/com/ym/pojo/MusicScoreData.java

@@ -1,49 +1,12 @@
 package com.ym.pojo;
 
+import lombok.Data;
+
+@Data
 public class MusicScoreData {
 	private String roomId;
-	private Integer musicScoreAccompanimentId;
+	private String musicScoreAccompanimentId;
 	private Integer userId;
 	private Integer userType;
 	private Integer status;
-
-	public Integer getUserId() {
-		return userId;
-	}
-
-	public void setUserId(Integer userId) {
-		this.userId = userId;
-	}
-
-	public Integer getUserType() {
-		return userType;
-	}
-
-	public void setUserType(Integer userType) {
-		this.userType = userType;
-	}
-
-	public Integer getMusicScoreAccompanimentId() {
-		return musicScoreAccompanimentId;
-	}
-
-	public void setMusicScoreAccompanimentId(Integer musicScoreAccompanimentId) {
-		this.musicScoreAccompanimentId = musicScoreAccompanimentId;
-	}
-
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	public String getRoomId() {
-		return roomId;
-	}
-
-	public void setRoomId(String roomId) {
-		this.roomId = roomId;
-	}
 }

+ 4 - 98
mec-im/src/main/java/com/ym/pojo/MusicScoreMessage.java

@@ -1,8 +1,11 @@
 package com.ym.pojo;
 
+import lombok.Data;
+
+@Data
 public class MusicScoreMessage {
     /**  */
-    private Integer id;
+    private String id;
 
     /**  */
     private Integer examSongId;
@@ -36,103 +39,6 @@ public class MusicScoreMessage {
 
     /**  */
     private String url = "";
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getExamSongId() {
-        return examSongId;
-    }
-
-    public void setExamSongId(Integer examSongId) {
-        this.examSongId = examSongId;
-    }
-
-    public Integer getSubjectId() {
-        return subjectId;
-    }
-
-    public void setSubjectId(Integer subjectId) {
-        this.subjectId = subjectId;
-    }
-
-    public String getSubjectName() {
-        return subjectName;
-    }
-
-    public void setSubjectName(String subjectName) {
-        this.subjectName = subjectName;
-    }
-
-    public String getMp3Url() {
-        return mp3Url;
-    }
-
-    public void setMp3Url(String mp3Url) {
-        this.mp3Url = mp3Url;
-    }
-
-    public Integer getSpeed() {
-        return speed;
-    }
-
-    public void setSpeed(Integer speed) {
-        this.speed = speed;
-    }
-
-    public String getXmlUrl() {
-        return xmlUrl;
-    }
-
-    public void setXmlUrl(String xmlUrl) {
-        this.xmlUrl = xmlUrl;
-    }
-
-    public String getExamSongName() {
-        return examSongName;
-    }
-
-    public void setExamSongName(String examSongName) {
-        this.examSongName = examSongName;
-    }
-
-    public String getCategoriesName() {
-        return categoriesName;
-    }
-
-    public void setCategoriesName(String categoriesName) {
-        this.categoriesName = categoriesName;
-    }
-
-    public Integer getCategoriesId() {
-        return categoriesId;
-    }
-
-    public void setCategoriesId(Integer categoriesId) {
-        this.categoriesId = categoriesId;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
     @Override
     public String toString() {
         return "MusicScoreMessage{" +

+ 3 - 3
mec-im/src/main/java/com/ym/pojo/ReqDeviceControlData.java

@@ -22,7 +22,7 @@ public class ReqDeviceControlData {
 	private String ticket;
 	private Integer status;
 	private Integer examSongId;
-	private Integer musicScoreAccompanimentId;
+	private String musicScoreAccompanimentId;
 	//伴奏音量
 	private Integer soundVolume = 100;
 	// 服务提供方
@@ -34,11 +34,11 @@ public class ReqDeviceControlData {
 	private String sendUserName;
 	private String avatar;
 
-	public Integer getMusicScoreAccompanimentId() {
+	public String getMusicScoreAccompanimentId() {
 		return musicScoreAccompanimentId;
 	}
 
-	public void setMusicScoreAccompanimentId(Integer musicScoreAccompanimentId) {
+	public void setMusicScoreAccompanimentId(String musicScoreAccompanimentId) {
 		this.musicScoreAccompanimentId = musicScoreAccompanimentId;
 	}
 

+ 6 - 2
mec-im/src/main/java/com/ym/pojo/RoomResult.java

@@ -2,18 +2,21 @@ package com.ym.pojo;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.middleware.rtc.message.RTCRoomConfig;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentMusicScore;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Getter;
 import lombok.Setter;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -107,8 +110,9 @@ public class RoomResult {
             result.setHandUpOn(member.isHand());
             result.setHeadUrl(member.getHeadUrl());
             result.setPlayMidiJson(JSONObject.parseObject(midiMap.get(Integer.parseInt(member.getUid())),CustomMessage.class));
-            if(scheduleStudentMusicScores != null && scheduleStudentMusicScores.size() > 0){
-                result.setScheduleStudentMusicScores(scheduleStudentMusicScores.stream().filter(e->e.getUserId().equals(Integer.parseInt(result.getUserId()))).collect(Collectors.toList()));
+            if(CollectionUtils.isNotEmpty(scheduleStudentMusicScores)){
+                result.setScheduleStudentMusicScores(scheduleStudentMusicScores.stream()
+                        .filter(e->e.getUserId().equals(Integer.parseInt(result.getUserId()))).collect(Collectors.toList()));
             }
             ExamSongDownloadData examSongDownloadData;
             String json = examSongMap.get(Integer.parseInt(member.getUid()));

+ 73 - 38
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -3,6 +3,7 @@ package com.ym.service.Impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginContext;
@@ -113,9 +114,11 @@ public class RoomServiceImpl implements RoomService {
     @Autowired
     private SysExamSongDao sysExamSongDao;
     @Autowired
+    private SysMusicScoreService sysMusicScoreService;
+    @Autowired
     private CourseScheduleStudentMusicScoreDao courseScheduleStudentMusicScoreDao;
     @Autowired
-    private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
+    private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
     @Autowired
     private SysTenantConfigService sysTenantConfigService;
     @Autowired
@@ -564,7 +567,8 @@ public class RoomServiceImpl implements RoomService {
                     .setGroupId(roomId);
         }
 
-        List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores = courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(null, courseId, null, null, null);
+        List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores =
+                courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(null, courseId, null, null, null);
         Room room = roomDao.findByRid(roomId);
         String display = "";
         if (roleEnum == RoleTeacher || roleEnum == RoleEnum.RoleAssistant) {
@@ -595,8 +599,10 @@ public class RoomServiceImpl implements RoomService {
             }
         }
         //已下载的伴奏列表
-        if (scheduleStudentMusicScores != null && scheduleStudentMusicScores.size() > 0) {
-            List<CourseScheduleStudentMusicScore> musicScores = scheduleStudentMusicScores.stream().filter(e -> e.getUserId().equals(sysUser.getId())).collect(Collectors.toList());
+        this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
+        if (CollectionUtils.isNotEmpty(scheduleStudentMusicScores)) {
+            List<CourseScheduleStudentMusicScore> musicScores = scheduleStudentMusicScores.stream()
+                    .filter(e -> e.getUserId().equals(sysUser.getId())).collect(Collectors.toList());
             String toJSONString = JSON.toJSONString(musicScores, SerializerFeature.DisableCircularReferenceDetect);
             List<CourseScheduleStudentMusicScore> lists = JSON.parseArray(toJSONString, CourseScheduleStudentMusicScore.class);
             userResult.setScheduleStudentMusicScores(lists);
@@ -636,17 +642,8 @@ public class RoomServiceImpl implements RoomService {
             Set<String> userIds = roomMemberList.stream().map(RoomMember::getUid).collect(Collectors.toSet());
             Map<Integer, String> midiMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryMidiByUserIdsAndCourseId(userIds, courseId.toString()));
             Map<Integer, String> examSongMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryExamSongByUserIdsAndCourseId(userIds, courseId.toString()));
+            this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
             roomResult.setMembers(roomMemberList, midiMap, examSongMap, scheduleStudentMusicScores);
-
-            // 全员静音状态开启
-            /*if (muteAll && TencentCloudRTCPlugin.PLUGIN_NAME.equals(courseSchedule.getServiceProvider())) {
-                for (RoomResult.MemberResult item : roomResult.getMembers()) {
-                    // 重置学生用户当前静音状态
-                    if (RoleStudent.getValue() == item.getRole()) {
-                        item.setMicrophone(false);
-                    }
-                }
-            }*/
         }
         roomResult.setWhiteboards(whiteboardDao.findByRid(roomId));
         if (room != null) {
@@ -668,6 +665,27 @@ public class RoomServiceImpl implements RoomService {
         businessLogger.info("join room: roomId = {}, userId = {}, userName={}, role = {}", roomId, userId, userName, roleEnum);
     }
 
+    private void initCourseScheduleStudentMusicScore(List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores) {
+        if(CollectionUtils.isEmpty(scheduleStudentMusicScores)){
+            return;
+        }
+        List<Long> musicSheetSoundIds = scheduleStudentMusicScores.stream().map(e->Long.parseLong(e.getMusicScoreAccompanimentId())).distinct().collect(Collectors.toList());
+        List<CbsMusicSheetWrapper.MusicSheetAccApplication> sheetApplications = this.getSheetApplications(musicSheetSoundIds);
+        Map<Long, CbsMusicSheetWrapper.MusicSheetAccApplication> sheetApplicationMap = sheetApplications.stream()
+                .collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetAccApplication::getMusicSheetSoundId, Function.identity()));
+        for (CourseScheduleStudentMusicScore studentMusicScore : scheduleStudentMusicScores) {
+            CbsMusicSheetWrapper.MusicSheetAccApplication sheetApplication =
+                    sheetApplicationMap.get(Long.parseLong(studentMusicScore.getMusicScoreAccompanimentId()));
+            if(sheetApplication == null) {
+                continue;
+            }
+            studentMusicScore.setMusicScoreName(sheetApplication.getName());
+            studentMusicScore.setMp3Url(sheetApplication.getMp3Url());
+            studentMusicScore.setUrl(sheetApplication.getUrl());
+            courseScheduleStudentMusicScoreDao.update(studentMusicScore);
+        }
+    }
+
     private void joinImGroup(String roomId, Integer actualTeacherId, CourseSchedule courseSchedule) throws Exception {
 
         String joinImGroupKey = "joinImGroup:" + roomId;
@@ -1722,7 +1740,7 @@ public class RoomServiceImpl implements RoomService {
                 .enable(enable)
                 .targetId(userId)
                 .targetName(Optional.ofNullable(data.getUserName()).orElse(authUser.getUsername()))
-                .songId(Optional.ofNullable(data.getMusicScoreAccompanimentId()).map(String::valueOf).orElse(null))
+                .songId(data.getMusicScoreAccompanimentId())
                 .songVolume(data.getSoundVolume())
                 .sendUserInfo(RTCRoomMessage.MessageUser.builder()
                         .sendUserId(data.getSendUserId())
@@ -1731,18 +1749,6 @@ public class RoomServiceImpl implements RoomService {
                         .build())
                 .build();
 
-        // 消息内容
-        /*RTCRoomMessage.MessageContent messageContent = RTCRoomMessage.MessageContent
-                .builder()
-                .type(typeEnum.ordinal())
-                .enable(enable)
-                .sendUserInfo(RTCRoomMessage.MessageUser.builder()
-                        .sendUserId(userId)
-                        .sendUserName(authUser.getUsername())
-                        .avatarUrl(authUser.getAvatar())
-                        .build())
-                .build();*/
-
         // 腾讯云消息推送
         RTCRoomMessage message = RTCRoomMessage.builder()
                 .objectName(RTCRoomMessage.CONTROL_DEVICE_NOTIFY_MESSAGE)
@@ -2231,6 +2237,7 @@ public class RoomServiceImpl implements RoomService {
             Set<String> userIds = roomMemberList.stream().map(RoomMember::getUid).collect(Collectors.toSet());
             Map<Integer, String> midiMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryMidiByUserIdsAndCourseId(userIds, roomId.substring(1)));
             Map<Integer, String> examSongMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryExamSongByUserIdsAndCourseId(userIds, roomId.substring(1)));
+            this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
             roomResult.setMembers(roomMemberList, midiMap, examSongMap, scheduleStudentMusicScores);
 
             // 全员静音开启状态
@@ -2710,6 +2717,28 @@ public class RoomServiceImpl implements RoomService {
         courseScheduleStudentPaymentDao.adjustPlayMidi(Long.parseLong(roomId.substring(1)), playMidiMessageData.getUserId(), content);
     }
 
+    private CbsMusicSheetWrapper.MusicSheetAccApplication getSheetApplication(String musicSheetSoundId){
+        CbsMusicSheetWrapper.MusicSheetApplicationQuery query = sysMusicScoreService.getMusicSheetApplicationQuery();
+        query.setRows(1);
+        query.setMusicSheetSoundId(Long.parseLong(musicSheetSoundId));
+        List<CbsMusicSheetWrapper.MusicSheetAccApplication> applications = sysMusicScoreService.queryCbsMusicSheetSoundApplication(query).getRows();
+        if (CollectionUtils.isEmpty(applications)) {
+            throw new BizException("曲目信息不存在");
+        }
+        return applications.get(0);
+    }
+
+    private List<CbsMusicSheetWrapper.MusicSheetAccApplication> getSheetApplications(List<Long> musicSheetSoundIds){
+        CbsMusicSheetWrapper.MusicSheetApplicationQuery query = sysMusicScoreService.getMusicSheetApplicationQuery();
+        query.setRows(musicSheetSoundIds.size());
+        query.setMusicSheetSoundIds(musicSheetSoundIds);
+        List<CbsMusicSheetWrapper.MusicSheetAccApplication> applications = sysMusicScoreService.queryCbsMusicSheetSoundApplication(query).getRows();
+        if (CollectionUtils.isEmpty(applications)) {
+            throw new BizException("曲目信息不存在");
+        }
+        return applications;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void pushDownloadMusicScoreMsg(MusicScoreData musicScoreData) throws Exception {
@@ -2719,28 +2748,31 @@ public class RoomServiceImpl implements RoomService {
         List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores =
                 courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(musicScoreData.getMusicScoreAccompanimentId(),
                         courseScheduleId, null, null, 0);
-        SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(musicScoreData.getMusicScoreAccompanimentId());
+        //获取曲目信息
+        CbsMusicSheetWrapper.MusicSheetAccApplication sheetApplication = this.getSheetApplication(musicScoreData.getMusicScoreAccompanimentId());
         if (scheduleStudentMusicScores.size() == 0) {
             //第一次下载,生成数据
             List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseScheduleId);
             Set<Integer> studentIds = courseScheduleStudentPayments.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
             studentIds.forEach(e -> {
                 CourseScheduleStudentMusicScore musicScore = new CourseScheduleStudentMusicScore();
-                musicScore.setMusicScoreAccompanimentId(accompaniment.getId());
-                musicScore.setSpeed(accompaniment.getSpeed());
+                musicScore.setMusicScoreAccompanimentId(musicScoreData.getMusicScoreAccompanimentId());
+                musicScore.setSpeed(sheetApplication.getPlaySpeed());
                 musicScore.setCourseScheduleId(courseScheduleId);
                 musicScore.setUserId(e);
                 scheduleStudentMusicScores.add(musicScore);
             });
             CourseScheduleStudentMusicScore musicScore = new CourseScheduleStudentMusicScore();
-            musicScore.setMusicScoreAccompanimentId(accompaniment.getId());
-            musicScore.setSpeed(accompaniment.getSpeed());
+            musicScore.setMusicScoreAccompanimentId(musicScoreData.getMusicScoreAccompanimentId());
+            musicScore.setSpeed(sheetApplication.getPlaySpeed());
             musicScore.setCourseScheduleId(courseScheduleId);
             musicScore.setUserId(authUser.getId());
             musicScore.setUserType(1);
             scheduleStudentMusicScores.add(musicScore);
             courseScheduleStudentMusicScoreDao.batchInsert(scheduleStudentMusicScores);
         }
+        SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentService.initSysMusicScoreAccompaniment(sheetApplication);
+        accompaniment.setId(musicScoreData.getMusicScoreAccompanimentId());
         MusicScoreMessage musicScoreMessage = JSON.parseObject(JSON.toJSONString(accompaniment), MusicScoreMessage.class);
         // 发送消息
         String serviceProvider = getRoomServiceProvider(musicScoreData.getRoomId());
@@ -2819,17 +2851,20 @@ public class RoomServiceImpl implements RoomService {
         Integer studentId = authUser.getId();
         String roomId = musicScoreData.getRoomId();
         Long scheduleId = Long.parseLong(roomId.substring(1));
-        Integer accompanimentId = musicScoreData.getMusicScoreAccompanimentId();
+        String accompanimentId = musicScoreData.getMusicScoreAccompanimentId();
         List<CourseScheduleStudentMusicScore> studentMusicScores = courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(accompanimentId, scheduleId, studentId, null, null);
         if (accompanimentId != null) {
-            SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(accompanimentId);
-            if (accompaniment == null) {
-                throw new BizException("曲目信息不存在");
-            }
             //修改下载状态
-            if (studentMusicScores == null || studentMusicScores.size() == 0) {
+            if (CollectionUtils.isEmpty(studentMusicScores)) {
                 throw new BizException("学员不存在此下载曲目");
             }
+            CbsMusicSheetWrapper.MusicSheetAccApplication sheetApplication = this.getSheetApplication(accompanimentId);
+            for (CourseScheduleStudentMusicScore studentMusicScore : studentMusicScores) {
+                studentMusicScore.setMusicScoreName(sheetApplication.getName());
+                studentMusicScore.setMp3Url(sheetApplication.getMp3Url());
+                studentMusicScore.setUrl(sheetApplication.getUrl());
+                courseScheduleStudentMusicScoreDao.update(studentMusicScore);
+            }
             CourseScheduleStudentMusicScore studentMusicScore = studentMusicScores.get(0);
             studentMusicScore.setDownStatus(musicScoreData.getStatus());
             courseScheduleStudentMusicScoreDao.update(studentMusicScore);