Parcourir la source

Merge branch 'zx_online_cbs' of http://git.dayaedu.com/yonge/cooleshow into test

zouxuan il y a 1 an
Parent
commit
b0effb4710
14 fichiers modifiés avec 363 ajouts et 72 suppressions
  1. 16 1
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/ActivityEvaluationController.java
  2. 1 1
      cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetController.java
  3. 4 5
      cooleshow-app/src/main/java/com/yonge/cooleshow/website/controller/MusicSheetController.java
  4. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/MusicSheetAuthRecordDao.java
  5. 4 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/MusicSheetAuthRecord.java
  6. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/MusicSheetAuthRecordService.java
  7. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/MusicSheetService.java
  8. 24 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CbsSubjectServiceImpl.java
  9. 56 37
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetAuthRecordServiceImpl.java
  10. 25 15
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java
  11. 2 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherMusicSheetVo.java
  12. 224 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/MusicSheetWrapper.java
  13. 3 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetAuthRecordMapper.xml
  14. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

+ 16 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/ActivityEvaluationController.java

@@ -14,6 +14,7 @@ import com.yonge.cooleshow.biz.dal.service.ActivityEvaluationService;
 import com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 import com.yonge.cooleshow.biz.dal.vo.activity.ActivityTeacherWrapper;
+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;
@@ -35,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 
@@ -129,7 +131,7 @@ public class ActivityEvaluationController extends BaseController {
 	@ApiOperation(value = "分页查询曲目", httpMethod="POST", consumes="application/json", produces="application/json")
 	@PostMapping(value="/musicPage", consumes="application/json", produces="application/json")
 	@PreAuthorize("@pcs.hasPermissions('activityEvaluation/musicPage')")
-	public HttpResponseResult<PageInfo<MusicSheetVo>> musicPage(@RequestBody MusicSheetSearch query) {
+	public HttpResponseResult<PageInfo> musicPage(@RequestBody MusicSheetSearch query) {
 		if(null == query.getActivityId()){
 			return failed("活动id不能为空");
 		}
@@ -137,6 +139,19 @@ public class ActivityEvaluationController extends BaseController {
 		query.setState(YesOrNoEnum.YES);
 		query.setAuditVersion(YesOrNoEnum.NO);
 		IPage<MusicSheetVo> musicSheetVoIPage = activityEvaluationService.musicPage(PageUtil.getPage(query), query);
+		List<MusicSheetVo> records = musicSheetVoIPage.getRecords();
+		if(CollectionUtils.isNotEmpty(records)){
+			List<MusicSheetWrapper.MusicSheetVo> musicSheetVos = new ArrayList<>();
+			for (MusicSheetVo record : records) {
+				MusicSheetWrapper.MusicSheetVo vo = JSON.parseObject(JSON.toJSONString(record),MusicSheetWrapper.MusicSheetVo.class);
+				if(record.getCbsMusicSheetId() != null){
+					vo.setCbsMusicSheetId(record.getCbsMusicSheetId().toString());
+				}
+				vo.setId(record.getId().toString());
+				musicSheetVos.add(vo);
+			}
+			return succeed(PageUtil.pageInfo(com.yonge.cooleshow.biz.dal.dto.PageUtil.transPageInfo(musicSheetVoIPage,musicSheetVos)));
+		}
 		return succeed(PageUtil.pageInfo(musicSheetVoIPage));
 	}
 

+ 1 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetController.java

@@ -156,7 +156,7 @@ public class MusicSheetController extends BaseController {
 
         IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectStudentPage(PageUtil.getPage(query), query, ClientEnum.TEACHER);
         if(query.getAuditStatus() != null && !AuthStatusEnum.PASS.getCode().equals(query.getAuditStatus().getCode())){
-            musicSheetAuthRecordService.convertMusicDetail(musicSheetVoIPage,query.getAuditStatus());
+            return succeed(PageUtil.pageInfo(musicSheetAuthRecordService.convertMusicDetail(musicSheetVoIPage,query.getAuditStatus())));
         }
         return succeed(PageUtil.pageInfo(musicSheetVoIPage));
     }

+ 4 - 5
cooleshow-app/src/main/java/com/yonge/cooleshow/website/controller/MusicSheetController.java

@@ -134,7 +134,6 @@ public class MusicSheetController extends BaseController {
         if (sysUser == null  || sysUser.getId() == null) {
             return failed("用户信息获取失败");
         }
-
         // 设置只查老师用户 状态为启用
         query.setCreateBy(sysUser.getId());
         if (query.getAuditStatus() != null && AuthStatusEnum.PASS.getCode().equals(query.getAuditStatus().getCode())) {
@@ -150,15 +149,15 @@ public class MusicSheetController extends BaseController {
         query.setSourceType(SourceTypeEnum.TEACHER);
         query.setMyself(true);
 
-        IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectPage(PageUtil.getPage(query), query);
-        if(query.getAuditStatus() != null && !AuthStatusEnum.PASS.getCode().equals(query.getAuditStatus().getCode())){
-            musicSheetAuthRecordService.convertMusicDetail(musicSheetVoIPage,query.getAuditStatus());
-        }
         TeacherAuditMusicSheetVo teacherAuditMusicSheetVo = musicSheetService.selectTeacherCount(sysUser.getId());
         if (teacherAuditMusicSheetVo == null) {
             teacherAuditMusicSheetVo = new TeacherAuditMusicSheetVo();
         }
+        IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectPage(PageUtil.getPage(query), query);
         teacherAuditMusicSheetVo.setList(PageUtil.pageInfo(musicSheetVoIPage));
+        if(query.getAuditStatus() != null && !AuthStatusEnum.PASS.getCode().equals(query.getAuditStatus().getCode())){
+            teacherAuditMusicSheetVo.setList(PageUtil.pageInfo(musicSheetAuthRecordService.convertMusicDetail(musicSheetVoIPage, query.getAuditStatus())));
+        }
         return succeed(teacherAuditMusicSheetVo);
     }
     /**

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/MusicSheetAuthRecordDao.java

@@ -16,5 +16,5 @@ public interface MusicSheetAuthRecordDao extends BaseMapper<MusicSheetAuthRecord
 
     List<TeacherMusicSheetVo> selectAuditPage(@Param("page") IPage<TeacherMusicSheetVo> page, @Param("param") TeacherMusicSheetAuditSearch query);
 
-    List<MusicSheetAuthRecord> findByMusicSheetIds(@Param("musicSheetIds") List<Long> musicSheetIds, @Param("auditStatus") String auditStatus);
+    List<MusicSheetAuthRecord> findByMusicSheetIds(@Param("musicSheetIds") List musicSheetIds, @Param("auditStatus") String auditStatus);
 }

+ 4 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/MusicSheetAuthRecord.java

@@ -1,18 +1,17 @@
 package com.yonge.cooleshow.biz.dal.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 曲目审核表
@@ -23,7 +22,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 public class MusicSheetAuthRecord implements Serializable {
 	private static final long serialVersionUID = 1L;
     @ApiModelProperty("审核单id ")
-    @TableId(value = "id_", type = IdType.AUTO)
+    @TableId(value = "id_")
     private Long id;
 
     @ApiModelProperty("曲目id ")

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

@@ -58,5 +58,5 @@ public interface MusicSheetAuthRecordService extends IService<MusicSheetAuthReco
     MusicSheetDetailVo auditDetail(String id);
 
     //将曲目信息替换成最新的json中的数据
-    void convertMusicDetail(IPage<MusicSheetVo> musicSheetVoIPage, AuthStatusEnum auditStatus);
+    IPage convertMusicDetail(IPage<MusicSheetVo> musicSheetVoIPage, AuthStatusEnum auditStatus);
 }

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

@@ -401,7 +401,7 @@ public interface MusicSheetService extends IService<MusicSheet> {
 
     void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, MusicSheetWrapper.MusicSheetDetailVo sheetDetailVo);
 
-    void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, MusicSheetVo musicSheetAudit);
+    void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, MusicSheetWrapper.MusicSheetVo musicSheetAudit);
 
     void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, TeacherMusicSheetVo musicSheetAudit);
 

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

@@ -4,12 +4,17 @@ import com.dayaedu.cbs.openfeign.service.CbsSubjectService;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsSubjectApiWrapper;
 import com.yonge.cooleshow.biz.dal.entity.Subject;
 import com.yonge.cooleshow.biz.dal.service.SubjectService;
+import com.yonge.cooleshow.biz.dal.wrapper.SubjectWrapper;
+import com.yonge.toolset.base.page.PageInfo;
+import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class CbsSubjectServiceImpl implements CbsSubjectService {
@@ -28,6 +33,24 @@ public class CbsSubjectServiceImpl implements CbsSubjectService {
     }
 
     public List<CbsSubjectApiWrapper.Subject> list(CbsSubjectApiWrapper.SubjectQuery query) {
-        return subjectService.getDao().queryCbsList(query);
+        SubjectWrapper.SubjectQuery subjectQuery = new SubjectWrapper.SubjectQuery();
+        subjectQuery.setPage(1);
+        subjectQuery.setRows(999);
+        subjectQuery.setEnableFlag(query.getEnable());
+        List<Long> subjectIds = query.getSubjectIds();
+        if (CollectionUtils.isNotEmpty(subjectIds)) {
+            subjectQuery.setSubjectIds(subjectIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
+        }
+        PageInfo<SubjectWrapper.Subject> subjectPageInfo = subjectService.selectPage(subjectQuery);
+        Map<Long, String> cbsSubjectIdNameMap = subjectPageInfo.getRows().stream().collect(Collectors.toMap(SubjectWrapper.Subject::getCbsSubjectId, SubjectWrapper.Subject::getName));
+
+        List<CbsSubjectApiWrapper.Subject> subjects = subjectService.getDao().queryCbsList(query);
+        for (CbsSubjectApiWrapper.Subject subject : subjects) {
+            Long cbsSubjectId = subject.getCbsSubjectId();
+            if (cbsSubjectIdNameMap.containsKey(cbsSubjectId)) {
+                subject.setSubjectName(cbsSubjectIdNameMap.get(cbsSubjectId));
+            }
+        }
+        return subjects;
     }
 }

+ 56 - 37
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetAuthRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dao.MusicSheetAuthRecordDao;
+import com.yonge.cooleshow.biz.dal.dto.PageUtil;
 import com.yonge.cooleshow.biz.dal.dto.req.TeacherMusicSheetAuditReq;
 import com.yonge.cooleshow.biz.dal.dto.search.TeacherMusicSheetAuditSearch;
 import com.yonge.cooleshow.biz.dal.entity.*;
@@ -25,6 +26,7 @@ import com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo;
 import com.yonge.cooleshow.biz.dal.wrapper.AddMusicSheetWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 import com.yonge.cooleshow.common.service.IdGeneratorService;
@@ -75,14 +77,12 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
     @Transactional(rollbackFor = Exception.class)
     public void audit(TeacherMusicSheetAuditReq param, Long userId) {
         // 查询到审核记录
-        List<MusicSheetAuthRecord> list = this.lambdaQuery()
-                                              .eq(MusicSheetAuthRecord::getMusicSheetId, param.getMusicSheetId())
-                                              .eq(MusicSheetAuthRecord::getAuditState, AuthStatusEnum.DOING.getCode())
-                                              .list();
-        if (CollectionUtils.isEmpty(list)) {
+        MusicSheetAuthRecord musicSheetAuthRecord = this.lambdaQuery()
+                                              .eq(MusicSheetAuthRecord::getId, param.getMusicSheetId())
+                                              .eq(MusicSheetAuthRecord::getAuditState, AuthStatusEnum.DOING.getCode()).one();
+        if (musicSheetAuthRecord == null) {
             throw new BizException("没有找到待审核记录");
         }
-        MusicSheetAuthRecord musicSheetAuthRecord = list.get(0);
         musicSheetAuthRecord.setAuditState(param.getAuthStatus());
         musicSheetAuthRecord.setReason(param.getRemark());
         musicSheetAuthRecord.setVerifyUserId(userId);
@@ -126,8 +126,8 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
             addMusicSheet.setSendAppFlag(true);
             addMusicSheet.setMusicSheetExtend(musicSheetExtend);
             addMusicSheet.setMusicImg(param.getMusicImg());
-            addMusicSheet.setMusicFirstImg(Optional.ofNullable(param.getFirstTone()).orElse(musicSheet.getFirstTone()));
-            addMusicSheet.setMusicJianImg(Optional.ofNullable(param.getFixedTone()).orElse(musicSheet.getFixedTone()));
+            addMusicSheet.setMusicFirstImg(param.getMusicFirstImg());
+            addMusicSheet.setMusicJianImg(param.getMusicJianImg());
             addMusicSheet.setExtConfigJson(param.getExtConfigJson());
             addMusicSheet.setIsEvaluated(param.getCanEvaluate()==YesOrNoEnum.YES);
             addMusicSheet.setIsPlayBeat(true);
@@ -258,7 +258,7 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
         if(musicSheetAuthRecord.getId() == null){
             throw new BizException("先选择要修改的曲目");
         }
-        MusicSheetAuthRecord record = this.lambdaQuery().eq(MusicSheetAuthRecord::getId, musicSheetAuthRecord.getId()).last("LIMIT 1").one();
+        MusicSheetAuthRecord record = this.lambdaQuery().eq(MusicSheetAuthRecord::getId, musicSheetAuthRecord.getId()).one();
         if (record == null){
             throw new BizException("审核记录不存在");
         }
@@ -271,32 +271,14 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
         }
         CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = this.checkRecord(musicSheetAuthRecord);
         musicSheetService.initMusicSheet(addMusicSheet);
-//        musicSheet.setCbsMusicSheetId(musicSheet1.getCbsMusicSheetId());
-//        musicSheet.setId(musicSheet1.getId());
-//        musicSheetService.removeById(record.getMusicSheetId());
-//        musicSheetAccompanimentService.delByMusicSheetId(record.getMusicSheetId());
         musicSheet1.setDelFlag(true);
         musicSheetService.updateById(musicSheet1);
+        musicSheetAuthRecord.setId(IdWorker.getId());
         musicSheetAuthRecord.setMusicSheetId(musicSheet1.getId());
         musicSheetAuthRecord.setBatchNo(record.getBatchNo());
         musicSheetAuthRecord.setAuditState(AuthStatusEnum.DOING);
         musicSheetAuthRecord.setMusicSheetJson(JSON.toJSONString(addMusicSheet));
         baseMapper.insert(musicSheetAuthRecord);
-        /*record.setAuditState(AuthStatusEnum.DOING);
-        record.setMusicSheetJson(JSON.toJSONString(addMusicSheet));
-        baseMapper.updateById(record);
-        if(record.getAuditState() == AuthStatusEnum.DOING){
-            //保存曲目信息
-//            musicSheetService.updateById(musicSheet);
-//            List<MusicSheetAccompaniment> musicSheetAccompaniments = musicSheetAccompanimentService.initMusicSheetAccompaniment(musicSheetAuthRecord.getMusicSheetJson(),musicSheet.getId());
-//            musicSheetAccompanimentService.saveBatch(musicSheetAccompaniments);
-            record.setMusicSheetId(musicSheet1.getId());
-        }else {
-            //保存曲目信息
-//            musicSheetService.updateById(musicSheet);
-//            List<MusicSheetAccompaniment> musicSheetAccompaniments = musicSheetAccompanimentService.initMusicSheetAccompaniment(musicSheetAuthRecord.getMusicSheetJson(),musicSheet.getId());
-//            musicSheetAccompanimentService.saveBatch(musicSheetAccompaniments);
-        }*/
     }
 
     @Override
@@ -363,7 +345,32 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
             if(StringUtils.isNotEmpty(musicSheetJson)){
                 CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
                 musicSheetService.initMusicSheetDetailVo(addMusicSheet,sheetDetailVo);
-                sheetDetailVo.setMusicSheetJson(null);
+                //获取乐器名称
+                List<MusicSheetAccompaniment> background = sheetDetailVo.getBackground();
+                if (CollectionUtils.isNotEmpty(background)) {
+                    String instrumentIds = background.stream().map(e -> e.getMusicalInstrumentId()).filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
+                    if (StringUtils.isNotEmpty(instrumentIds)) {
+                        List<Long> instrumentIsList = Arrays.stream(instrumentIds.split(",")).map(Long::valueOf).distinct().collect(Collectors.toList());
+                        List<InstrumentWrapper.Instrument> instruments = instrumentService.getInstruments(instrumentIsList);
+                        Map<Long,InstrumentWrapper.Instrument> instrumentMap =
+                                instruments.stream().collect(Collectors.toMap(InstrumentWrapper.Instrument::getId, o -> o, (o1, o2) -> o1));
+                        for (MusicSheetAccompaniment accompaniment : background) {
+                            if (StringUtils.isNotEmpty(accompaniment.getMusicalInstrumentId())){
+                                StringBuffer sb = new StringBuffer();
+                                for (String s : accompaniment.getMusicalInstrumentId().split(",")) {
+                                    InstrumentWrapper.Instrument instrument = instrumentMap.get(Long.parseLong(s));
+                                    if (instrument != null){
+                                        if(sb.length() > 0) {
+                                            sb.append(",");
+                                        }
+                                        sb.append(instrument.getName());
+                                    }
+                                }
+                                accompaniment.setMusicalInstrumentName(sb.toString());
+                            }
+                        }
+                    }
+                }
                 sheetDetailVo.setSubmitAuditTime(sheetDetailVo.getCreateTime());
                 //获取声部
                 String musicSubject = sheetDetailVo.getMusicSubject();
@@ -393,16 +400,18 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
                         collect.stream().collect(Collectors.groupingBy(TeacherMusicSheetVo::getAuditStatus));
                 for (AuthStatusEnum authStatusEnum : statusEnumListMap.keySet()) {
                     List<TeacherMusicSheetVo> records = statusEnumListMap.get(authStatusEnum);
-                    List<Long> musicSheetIds = records.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
+                    List<String> musicSheetIds = records.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
                     List<MusicSheetAuthRecord> recordList = this.baseMapper.findByMusicSheetIds(musicSheetIds, authStatusEnum.getCode());
                     if (CollectionUtils.isNotEmpty(recordList)){
                         Map<Long,MusicSheetAuthRecord> authRecordMap = recordList.stream()
                                 .collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
                         for (TeacherMusicSheetVo musicSheetVo : records) {
-                            MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(musicSheetVo.getMusicSheetId());
+                            MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(Long.parseLong(musicSheetVo.getMusicSheetId()));
                             if(sheetDetailVo == null){
                                 continue;
                             }
+                            musicSheetVo.setId(sheetDetailVo.getId().toString());
+                            musicSheetVo.setMusicSheetId(sheetDetailVo.getId().toString());
                             String musicSheetJson = sheetDetailVo.getMusicSheetJson();
                             if(StringUtils.isNotEmpty(musicSheetJson)){
                                 CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
@@ -422,7 +431,7 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
     }
 
     @Override
-    public void convertMusicDetail(IPage<MusicSheetVo> musicSheetVoIPage, AuthStatusEnum auditStatus) {
+    public IPage convertMusicDetail(IPage<MusicSheetVo> musicSheetVoIPage, AuthStatusEnum auditStatus) {
         List<MusicSheetVo> records = musicSheetVoIPage.getRecords();
         if (CollectionUtils.isNotEmpty(records)){
             List<Long> musicSheetIds = records.stream().map(e -> e.getId()).collect(Collectors.toList());
@@ -430,30 +439,40 @@ public class MusicSheetAuthRecordServiceImpl extends ServiceImpl<MusicSheetAuthR
             if (CollectionUtils.isNotEmpty(recordList)){
                 Map<Long,MusicSheetAuthRecord> authRecordMap = recordList.stream()
                         .collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
+                List<MusicSheetWrapper.MusicSheetVo> results = new ArrayList<>();
                 for (MusicSheetVo musicSheetVo : records) {
+                    MusicSheetWrapper.MusicSheetVo vo = JSON.parseObject(JSON.toJSONString(musicSheetVo), MusicSheetWrapper.MusicSheetVo.class);
+                    vo.setId(musicSheetVo.getId().toString());
+                    if(musicSheetVo.getCbsMusicSheetId() != null){
+                        vo.setCbsMusicSheetId(musicSheetVo.getCbsMusicSheetId().toString());
+                    }
                     MusicSheetAuthRecord sheetDetailVo = authRecordMap.get(musicSheetVo.getId());
                     if(sheetDetailVo == null){
                         continue;
                     }
+                    vo.setId(sheetDetailVo.getId().toString());
                     String musicSheetJson = sheetDetailVo.getMusicSheetJson();
                     if(StringUtils.isNotEmpty(musicSheetJson)){
                         CbsMusicSheetWrapper.AddMusicSheet addMusicSheet = JSON.parseObject(musicSheetJson, CbsMusicSheetWrapper.AddMusicSheet.class);
-                        musicSheetService.initMusicSheetDetailVo(addMusicSheet,musicSheetVo);
+                        musicSheetService.initMusicSheetDetailVo(addMusicSheet,vo);
                         //获取声部
-                        String musicSubject = musicSheetVo.getMusicSubject();
+                        String musicSubject = vo.getMusicSubject();
                         if(StringUtils.isNotEmpty(musicSheetJson)){
                             List<Subject> list = subjectService.findBySubjectByIdList(musicSubject);
-                            musicSheetVo.setSubjectNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
+                            vo.setSubjectNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
                         }
                         //获取标签
-                        String musicTagIds = musicSheetVo.getMusicTag();
+                        String musicTagIds = vo.getMusicTag();
                         if(StringUtils.isNotEmpty(musicTagIds)){
                             List<MusicTag> list = musicTagService.lambdaQuery().in(MusicTag::getId, musicTagIds.split(",")).list();
-                            musicSheetVo.setMusicTagNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
+                            vo.setMusicTagNames(list.stream().map(e->e.getName()).collect(Collectors.joining(",")));
                         }
                     }
+                    results.add(vo);
                 }
+                return PageUtil.transPageInfo(musicSheetVoIPage,results);
             }
         }
+        return musicSheetVoIPage;
     }
 }

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

@@ -435,15 +435,17 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
             }
         }
 
-        if(StringUtils.isNotEmpty(musicSheet1.getSubjectIds())){
-            CbsSubjectApiWrapper.SubjectQuery subjectQuery = new CbsSubjectApiWrapper.SubjectQuery();
-            subjectQuery.setCbsSubjectIds(Arrays.stream(musicSheet1.getSubjectIds().split(",")).map(Long::parseLong).collect(Collectors.toList()));
-            List<CbsSubjectApiWrapper.Subject> subjects = subjectService.getDao().queryCbsList(subjectQuery);
-            if(CollectionUtils.isNotEmpty(subjects)){
-                detailVo.setSubjectNames(subjects.stream().map(CbsSubjectApiWrapper.Subject::getSubjectName).collect(Collectors.joining(",")));
-                detailVo.setCode(subjects.stream().map(CbsSubjectApiWrapper.Subject::getCode).collect(Collectors.joining(",")));
-            }
-        }
+        detailVo.setSubjectNames(musicSheet1.getSubjectNames());
+        detailVo.setCode(musicSheet1.getSubjectCodes());
+//        if(StringUtils.isNotEmpty(musicSheet1.getSubjectIds())){
+//            CbsSubjectApiWrapper.SubjectQuery subjectQuery = new CbsSubjectApiWrapper.SubjectQuery();
+//            subjectQuery.setCbsSubjectIds(Arrays.stream(musicSheet1.getSubjectIds().split(",")).map(Long::parseLong).collect(Collectors.toList()));
+//            List<CbsSubjectApiWrapper.Subject> subjects = subjectService.getDao().queryCbsList(subjectQuery);
+//            if(CollectionUtils.isNotEmpty(subjects)){
+//                detailVo.setSubjectNames(subjects.stream().map(CbsSubjectApiWrapper.Subject::getSubjectName).collect(Collectors.joining(",")));
+//                detailVo.setCode(subjects.stream().map(CbsSubjectApiWrapper.Subject::getCode).collect(Collectors.joining(",")));
+//            }
+//        }
         detailVo.setId(musicSheet.getId());
         detailVo.setCbsMusicSheetId(musicSheet1.getId());
         detailVo.setMp3Type(AudioTypeEnum.valueOf(musicSheet1.getIsPlayBeat()&&musicSheet1.getIsUseSystemBeat()?"MP3":"MP3_METRONOME"));
@@ -592,16 +594,24 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     @Override
     public MusicSheetDetailVo detail(String id, SysUser sysUser, ClientEnum userType,String tenantAlbumId) {
         MusicSheetDetailVo detailVo = baseMapper.detail(Long.parseLong(id));
-        if (detailVo == null || detailVo.getDelFlag()) {
+        if (detailVo == null) {
             MusicSheetDetailVo result = musicSheetAuthRecordService.auditDetail(id);
             if (result != null) {
-                return result;
+                if(StringUtils.isNotEmpty(result.getMusicSheetJson())){
+                    return result;
+                }else {
+                    MusicSheetAuthRecord authRecord = musicSheetAuthRecordService.getById(id);
+                    detailVo = baseMapper.detail(authRecord.getMusicSheetId());
+                    if(detailVo == null){
+                        throw new BizException("未找到曲目信息");
+                    }
+                }
             }
-            if(detailVo == null){
+            if(result == null){
                 throw new BizException("未找到曲目信息");
             }
         }
-        if(detailVo.getDelFlag()){
+        /*if(detailVo.getDelFlag()){
             //获取乐器名称
             List<MusicSheetAccompaniment> background = detailVo.getBackground();
             if (CollectionUtils.isNotEmpty(background)) {
@@ -629,7 +639,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                 }
             }
             return detailVo;
-        }
+        }*/
         MusicSheetDetailVo detail = this.getCbsDetail(Long.parseLong(id));
         //兼容审批数据
         MusicSheetAuthRecord one = musicSheetAuthRecordService.lambdaQuery().eq(MusicSheetAuthRecord::getMusicSheetId, detail.getId()).last("limit 1").one();
@@ -2177,7 +2187,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     }
 
     @Override
-    public void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, MusicSheetVo musicSheetAudit) {
+    public void initMusicSheetDetailVo(CbsMusicSheetWrapper.AddMusicSheet addMusicSheet, MusicSheetWrapper.MusicSheetVo musicSheetAudit) {
         musicSheetAudit.setProviderType(SourceTypeEnum.TEACHER);
         musicSheetAudit.setSourceType(SourceTypeEnum.TEACHER);
         musicSheetAudit.setMusicSheetName(addMusicSheet.getName());

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherMusicSheetVo.java

@@ -20,7 +20,7 @@ import java.util.Date;
 public class TeacherMusicSheetVo {
 
     @ApiModelProperty("审核id")
-    private Long id;
+    private String id;
 
     @ApiModelProperty("曲目审核id")
     private Long authMusicSheetId;
@@ -41,7 +41,7 @@ public class TeacherMusicSheetVo {
     private String phone;
 
     @ApiModelProperty("曲谱id")
-    private Long musicSheetId;
+    private String musicSheetId;
 
     @ApiModelProperty("曲谱名称")
     private String musicSheetName;

+ 224 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/MusicSheetWrapper.java

@@ -123,6 +123,230 @@ public class MusicSheetWrapper {
         }
     }
 
+
+
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+	@ApiModel(" MusicSheet-曲谱表")
+    public static class MusicSheetVo implements Serializable {
+        @ApiModelProperty("添加人")
+        private String addName;
+
+        @ApiModelProperty("添加头像(老师头像)")
+        private String addUserAvatar;
+
+        @ApiModelProperty("标签名")
+        private String musicTagNames;
+
+        @ApiModelProperty("声部名")
+        private String subjectNames;
+
+        @ApiModelProperty("收藏 0:否,1:是")
+        private YesOrNoEnum favorite = YesOrNoEnum.NO;
+
+        @ApiModelProperty("是否购买/VIP(0:否,1:是) ")
+        private YesOrNoEnum play;
+
+        @ApiModelProperty("专辑中曲目的排序号")
+        private Integer albumSortNumber;  //排序号
+
+        @ApiModelProperty("单曲专辑数")
+        private Integer albumNums;
+
+        @ApiModelProperty("曲目来源名")
+        private String  sourceName;
+
+        @ApiModelProperty("机构专辑ID,逗号隔开")
+        private String tenantAlbumId;
+
+        @ApiModelProperty("所属人信息")
+        private CbsMusicSheetWrapper.MusicSheetExtend musicSheetExtend;
+
+        @ApiModelProperty(value = "主键id")
+        private String id;  //主键ID
+
+        @ApiModelProperty(value = "内容平台曲目ID")
+        private String cbsMusicSheetId;  //主键ID
+
+        @NotBlank(message = "曲谱名称不能为空!")
+        @ApiModelProperty(value = "曲谱名称")
+        private String musicSheetName;  //曲谱名称
+
+
+        @NotBlank(message = "曲谱封面图不能为空!")
+        @ApiModelProperty(value = "封面图")
+        private String titleImg;  //曲谱名称
+
+        @ApiModelProperty(value = "曲谱来源(平台用户ID或者是老师ID)")
+        private Long userId;  //曲谱来源(平台用户ID或者是老师ID)
+
+        @ApiModelProperty("是否可以转简谱(0:否,1:是)")
+        private YesOrNoEnum notation;
+
+        @ApiModelProperty("曲目图片")
+        private String musicImg;
+
+        @ApiModelProperty(value = "曲目来源类型 TEACHER 老师 PLATFORM 平台")
+        private SourceTypeEnum sourceType;
+
+
+        @ApiModelProperty(value = "提供方 TENANT 机构 PLATFORM 平台")
+        private SourceTypeEnum providerType;
+
+        @NotBlank(message = "艺术家不能为空!")
+        @ApiModelProperty(value = "艺术家")
+        private String composer;  //音乐家
+
+        @ApiModelProperty(value = "曲谱声部(适用的乐器,可能是多个,用逗号分隔)")
+        private String musicSubject;  //曲谱声部(适用的乐器,可能是多个,用逗号分隔)
+
+        @ApiModelProperty(value = "曲目音频类型 MP3:mp3, MIDI:midi,")
+        private AudioTypeEnum audioType;
+
+        @ApiModelProperty(value = "mp3类型 MP3:mp3, MP3_METRONOME:MP3_METRONOME,")
+        private AudioTypeEnum mp3Type;
+
+
+        @ApiModelProperty(value = "收藏数")
+        private Integer favoriteCount;
+
+
+        @ApiModelProperty("虚拟人数 ")
+        private Integer virtualNumber;
+
+        @ApiModelProperty(value = "曲谱标签(多个标签用逗号分隔)")
+        private String musicTag;  //曲谱标签(多个标签用逗号分隔)
+
+        @ApiModelProperty(value = "伴奏类型 HOMEMODE:自制伴奏  COMMON:普通伴奏")
+        private AccompanimentTypeEnum accompanimentType;
+
+        // @NotNull(message = "默认播放速度不能为空!")
+        @ApiModelProperty(value = "默认播放速度")
+        private String playSpeed;  //默认播放速度
+
+        @ApiModelProperty(value = "是否可以评测(0:否;1:是)")
+        private YesOrNoEnum canEvaluate;  //是否可以评测(0:否;1:是)
+
+        @ApiModelProperty(value = "是否展示指法(0:否;1:是)")
+        private YesOrNoEnum showFingering;  //是否展示指法(0:否;1:是)
+
+        // @NotNull(message = "收费类型不能为空!")
+        @ApiModelProperty(value = "收费类型(FREE:免费;VIP:会员;CHARGE:单曲收费)")
+        private ChargeTypeEnum chargeType;  //收费类型(0:免费;1:会员;2:单曲收费)
+
+        @NotNull(message = "收费类型不能为空!")
+        @ApiModelProperty(value = "收费类型(FREE:免费;VIP:会员;CHARGE:单曲收费)")
+        private String paymentType;
+
+
+        @ApiModelProperty(value = "曲目状态(0:停用,1:启用)")
+        private YesOrNoEnum state;
+
+        @ApiModelProperty(value = "曲目停用原因")
+        private String reason;
+
+        @ApiModelProperty(value = "审核状态(DOING:待审核;PASS:通过;UNPASS:未通过)")
+        private AuthStatusEnum auditStatus;
+
+        @ApiModelProperty(value = "提交审核时间")
+        private Date submitAuditTime;
+
+        @ApiModelProperty(value = "第一次通过审核时间")
+        private Date firstPassAuditTime;
+
+        @ApiModelProperty(value = "排序号")
+        private Integer sortNumber;  //排序号
+
+        @ApiModelProperty(value = "是否置顶(0:否;1:是)")
+        private YesOrNoEnum topFlag;  //是否置顶(0:否;1:是)
+
+        @ApiModelProperty(value = "是否热门曲谱(0:否;1:是)")
+        private YesOrNoEnum hotFlag;  //是否热门曲谱(0:否;1:是)
+
+        @ApiModelProperty(value = "精品标志(0:否;1:是)")
+        private YesOrNoEnum exquisiteFlag;
+
+        @ApiModelProperty(value = "曲谱价格")
+        private java.math.BigDecimal musicPrice;  //曲谱价格
+
+        @ApiModelProperty(value = "音频文件存储路径")
+        private String audioFileUrl;  //音频文件存储路径
+
+        @ApiModelProperty(value = "XML文件存储路径")
+        private String xmlFileUrl;  //XML文件存储路径
+
+        @ApiModelProperty(value = "midi路径")
+        private String midiUrl;  //XML文件存储路径
+
+        @ApiModelProperty(value = "伴奏含节拍器路径")
+        private String metronomeUrl;  //XML文件存储路径
+
+        @ApiModelProperty(value = "伴奏(不含节拍器)路径")
+        private String url;  //XML文件存储路径
+
+        @ApiModelProperty(value = "是否自带节拍器(0:否;1:是)")
+        private YesOrNoEnum hasBeat;  //是否自带节拍器(0:否;1:是)
+
+        @ApiModelProperty(value = "是否审核时可见 (0:否  1:是)")
+        private YesOrNoEnum auditVersion;
+
+        @ApiModelProperty(value = "创建时间")
+        private java.util.Date createTime;  //创建时间
+
+        @ApiModelProperty(value = "创建人(老师或者是后台平台用户)")
+        private Long createBy;  //创建人(老师或者是后台平台用户)
+
+        @ApiModelProperty(value = "更新时间")
+        private java.util.Date updateTime;  //更新时间
+
+        @ApiModelProperty(value = "更新人(老师或者是后台平台用户)")
+        private Long updateBy;  //更新人(老师或者是后台平台用户)
+
+        @ApiModelProperty(value = "备注")
+        private String remark;  //备注,填写未通过审核的原因
+
+
+        @ApiModelProperty("曲目配置信息")
+        private String extConfigJson;
+
+        private String musicJSON;
+
+        private String musicSvg;
+
+        private String musicJianSvg;
+
+        private String musicFirstSvg;
+
+        @ApiModelProperty("首调")
+        private String firstTone;
+
+        @ApiModelProperty("固定调")
+        private String fixedTone;
+
+        @ApiModelProperty(value = "假删除标识 0:未删除 1:已删除")
+        private Boolean delFlag;
+
+        @ApiModelProperty(value = "数据修复时间")
+        private Date correctTime;
+
+        //曲谱类型 SINGLE/CONCERT ,使用MusicSheetTypeEnum
+        @ApiModelProperty(value = "曲谱类型(SINGLE:单曲,CONCERT:合奏)")
+        private MusicSheetTypeEnum musicSheetType;
+
+        public ChargeTypeEnum getChargeType() {
+            if (Objects.isNull(this.chargeType) && StringUtils.isNotEmpty(getPaymentType())) {
+
+                return ChargeTypeEnum.valueOf(getPaymentType().split(",")[0]);
+            }
+            return chargeType;
+        }
+    }
+
+
+
     @Data
     @Builder
     @NoArgsConstructor

+ 3 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetAuthRecordMapper.xml

@@ -93,7 +93,9 @@
                 and ms.exquisite_flag_ = #{param.exquisiteFlag}
             </if>
         </where>
-        group by msar.music_sheet_id_
+        <if test="param.authStatus != null">
+            group by msar.music_sheet_id_
+        </if>
         order by field(msar.audit_state_,'DOING') desc,  msar.update_time_ desc
     </select>
     <select id="findByMusicSheetIds" resultMap="BaseResultMap">

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

@@ -349,7 +349,7 @@
         left join music_sheet_accompaniment msa on msa.music_sheet_id_ = t.id_
         left join sys_user su on t.create_by_ = su.id_
         left join subject s2 on t.music_subject_ = s2.id_
-        where t.id_ = #{id}
+        where t.id_ = #{id} AND t.cbs_music_sheet_id_ IS NOT NULL
          order by  msa.sort_number_
     </select>