|
@@ -1,12 +1,31 @@
|
|
|
package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.CourseMusicAlbumRelationDto;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.CourseRelationMusicAlbum;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.MusicTag;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.course.CourseRelationTypeEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.course.CourseTypeEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.queryInfo.CourseRelationQueryInfo;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.CourseRelationMusicAlbumService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.MusicSheetPurchaseRecordService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.MusicTagService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupDetailService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.VideoLessonPurchaseRecordService;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.course.CourseRelationWrapper;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.VideoLessonGroupDetailDto;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -76,6 +95,9 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
private final static Logger log = LoggerFactory.getLogger(VideoLessonGroupServiceImpl.class);
|
|
|
|
|
|
@Autowired
|
|
|
+ private MusicTagService musicTagService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private VideoLessonGroupDao videoLessonGroupDao;
|
|
|
@Autowired
|
|
|
private VideoLessonGroupDetailDao videoLessonGroupDetailDao;
|
|
@@ -96,6 +118,17 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
|
|
|
@Autowired
|
|
|
private VideoLessonGroupLogService videoLessonGroupLogService;
|
|
|
+ @Autowired
|
|
|
+ private VideoLessonGroupDetailService videoLessonGroupDetailService;
|
|
|
+ @Autowired
|
|
|
+ private CourseRelationMusicAlbumService courseRelationMusicAlbumService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MusicSheetPurchaseRecordService musicSheetPurchaseRecordService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private VideoLessonPurchaseRecordService videoLessonPurchaseRecordService;
|
|
|
|
|
|
public VideoLessonGroupDao getDao() {
|
|
|
return videoLessonGroupDao;
|
|
@@ -164,6 +197,7 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
|
|
|
if (examineVo.getAuditStatus().equals("PASS")) {
|
|
|
examineVo.setShelvesFlag(1);
|
|
|
+ examineVo.setShelvesTime(new Date());
|
|
|
}
|
|
|
//改主表
|
|
|
videoLessonGroupDao.updateExamine(examineVo);
|
|
@@ -187,6 +221,10 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
// 设置标签
|
|
|
if (AuthStatusEnum.PASS.getCode().equals(examineVo.getAuditStatus())) {
|
|
|
teacherService.setTeacherTag(lessonGroup.getTeacherId(), TeacherTagEnum.VIDEO);
|
|
|
+
|
|
|
+ // 设置关联的曲目
|
|
|
+ courseRelationMusicAlbumService.asyncUpdateCourseRelationMusicAlbumInfo(examineVo.getId(),CourseTypeEnum.VIDEO);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//推送
|
|
@@ -215,8 +253,99 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理课程曲目关联关系
|
|
|
+ */
|
|
|
+ private void courseMusicAlbumRelation(List<VideoLessonGroupDetailDto> lessonList, Long lessonGroupId, Long userBy) {
|
|
|
+ // 设置关联曲目
|
|
|
+
|
|
|
+ // 需要更新的关联数据
|
|
|
+ List<CourseRelationMusicAlbum> updateCourseRelationMusicAlbums = new ArrayList<>();
|
|
|
+ // 需要添加的关联数据
|
|
|
+ List<CourseRelationMusicAlbum> addCourseRelationMusicAlbums = new ArrayList<>();
|
|
|
+
|
|
|
+ // 查询课程组所有的关联曲目
|
|
|
+ List<CourseRelationMusicAlbum> relationMusicAlbumList = courseRelationMusicAlbumService.lambdaQuery()
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseGroupId, lessonGroupId)
|
|
|
+ .ne(CourseRelationMusicAlbum::getDelFlog, 0)
|
|
|
+ .list();
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(relationMusicAlbumList)) {
|
|
|
+ relationMusicAlbumList = new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 需要更新的id
|
|
|
+ List<Long> updateCourseRelationIdList = new ArrayList<>();
|
|
|
+ for (VideoLessonGroupDetailDto videoLessonGroupDetailDto : lessonList) {
|
|
|
+ // 需要修改的关联数据
|
|
|
+ List<CourseMusicAlbumRelationDto> relationList = Optional.ofNullable(videoLessonGroupDetailDto.getRelationList())
|
|
|
+ .orElse(Lists.newArrayList());
|
|
|
+
|
|
|
+ videoLessonGroupDetailDto.setCourseRelationMusicAlbumList(new ArrayList<>());
|
|
|
+
|
|
|
+ for (CourseMusicAlbumRelationDto courseMusicAlbumRelationDto : relationList) {
|
|
|
+ CourseRelationMusicAlbum courseRelationMusicAlbum = new CourseRelationMusicAlbum();
|
|
|
+ // 修改的数据
|
|
|
+ if (courseMusicAlbumRelationDto.getRelationId() != null && courseMusicAlbumRelationDto.getRelationId() != 0) {
|
|
|
+ for (CourseRelationMusicAlbum relationMusicAlbum : relationMusicAlbumList) {
|
|
|
+ if (relationMusicAlbum.getId().equals(courseMusicAlbumRelationDto.getRelationId())) {
|
|
|
+ updateCourseRelationIdList.add(courseMusicAlbumRelationDto.getRelationId());
|
|
|
+ courseRelationMusicAlbum = relationMusicAlbum;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ courseRelationMusicAlbum.setCourseGroupId(videoLessonGroupDetailDto.getVideoLessonGroupId());
|
|
|
+ courseRelationMusicAlbum.setCourseId(videoLessonGroupDetailDto.getId());
|
|
|
+ courseRelationMusicAlbum.setCourseType(CourseTypeEnum.VIDEO);
|
|
|
+ courseRelationMusicAlbum.setMusicAlbumId(courseMusicAlbumRelationDto.getMusicAlbumId());
|
|
|
+ // 推荐该赠送
|
|
|
+ if (courseRelationMusicAlbum.getUseRelationType() != null
|
|
|
+ && courseRelationMusicAlbum.getUseRelationType().equals(CourseRelationTypeEnum.RECOMMEND)
|
|
|
+ && courseMusicAlbumRelationDto.getUseRelationType().equals(CourseRelationTypeEnum.GIFT)) {
|
|
|
+ courseRelationMusicAlbum.setDelFlog(2);
|
|
|
+ } else if (courseRelationMusicAlbum.getDelFlog() == null) {
|
|
|
+ courseRelationMusicAlbum.setDelFlog(1);
|
|
|
+ }
|
|
|
+ courseRelationMusicAlbum.setRelationType(courseMusicAlbumRelationDto.getRelationMusicAlbum());
|
|
|
+ courseRelationMusicAlbum.setUseRelationType(courseMusicAlbumRelationDto.getUseRelationType());
|
|
|
+ courseRelationMusicAlbum.setUpdateBy(userBy);
|
|
|
+ courseRelationMusicAlbum.setUpdateTime(new Date());
|
|
|
+ if (courseRelationMusicAlbum.getId() == null) {
|
|
|
+ courseRelationMusicAlbum.setCreateBy(userBy);
|
|
|
+ courseRelationMusicAlbum.setCreateTime(new Date());
|
|
|
+ courseRelationMusicAlbum.setDelFlog(2);
|
|
|
+ addCourseRelationMusicAlbums.add(courseRelationMusicAlbum);
|
|
|
+ } else {
|
|
|
+ updateCourseRelationMusicAlbums.add(courseRelationMusicAlbum);
|
|
|
+ }
|
|
|
+ videoLessonGroupDetailDto.getCourseRelationMusicAlbumList().add(courseRelationMusicAlbum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 删除关联数据
|
|
|
+ courseRelationMusicAlbumService.lambdaUpdate()
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseGroupId, lessonGroupId)
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseType,CourseTypeEnum.VIDEO)
|
|
|
+ .notIn(CourseRelationMusicAlbum::getId,updateCourseRelationIdList)
|
|
|
+ .set(CourseRelationMusicAlbum::getDelFlog,0)
|
|
|
+ .set(CourseRelationMusicAlbum::getUpdateTime,new Date())
|
|
|
+ .update();
|
|
|
+
|
|
|
+ // 保存更新的关联数据
|
|
|
+ if (CollectionUtils.isNotEmpty(updateCourseRelationMusicAlbums)) {
|
|
|
+ courseRelationMusicAlbumService.updateBatchById(updateCourseRelationMusicAlbums);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(addCourseRelationMusicAlbums)) {
|
|
|
+ courseRelationMusicAlbumService.saveOrUpdateBatch(addCourseRelationMusicAlbums);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void updateShelves(VideoLessonShelvesVo shelvesVo) {
|
|
|
+ VideoLessonGroup videoLessonGroup = getById(shelvesVo.getId());
|
|
|
+ if (videoLessonGroup.getDraftFlag() != null && videoLessonGroup.getDraftFlag().equals(YesOrNoEnum.YES)) {
|
|
|
+ throw new BizException("草稿状态不能上架");
|
|
|
+ }
|
|
|
//改主表
|
|
|
videoLessonGroupDao.updateShelves(shelvesVo);
|
|
|
if(shelvesVo.getShelvesFlag() == 0 && ClientEnum.SYSTEM.equals(shelvesVo.getClientType())){
|
|
@@ -256,12 +385,16 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
* @Description: 新增视频课组&视频课
|
|
|
* @Author: cy
|
|
|
* @Date: 2022/4/1
|
|
|
+ * @return
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void add(VideoLessonVo lessonVo, SysUser sysUser) {
|
|
|
+ public Long add(VideoLessonVo lessonVo, SysUser sysUser) {
|
|
|
VideoLessonGroup lessonGroup = lessonVo.getLessonGroup();
|
|
|
- List<VideoLessonGroupDetail> lessonList = lessonVo.getLessonList();
|
|
|
+ List<VideoLessonGroupDetailDto> lessonList = lessonVo.getLessonList();
|
|
|
+ if (CollectionUtils.isEmpty(lessonList)) {
|
|
|
+ lessonList = new ArrayList<>();
|
|
|
+ }
|
|
|
lessonGroup.setLessonCount(lessonList.size());
|
|
|
|
|
|
//校验声部
|
|
@@ -274,6 +407,24 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
|
+ // 设置默认置顶和排序
|
|
|
+ if (lessonGroup.getTopFlag() == null) {
|
|
|
+ lessonGroup.setTopFlag(0);
|
|
|
+ }
|
|
|
+ if (lessonGroup.getSortNumber() == null) {
|
|
|
+ lessonGroup.setSortNumber(0);
|
|
|
+ }
|
|
|
+ lessonGroup.setAuditStatus(AuthStatusEnum.DOING);
|
|
|
+
|
|
|
+ // 草稿状态不审核
|
|
|
+ if (lessonGroup.getDraftFlag() == null) {
|
|
|
+ lessonGroup.setDraftFlag(YesOrNoEnum.NO);
|
|
|
+ }
|
|
|
+ if (lessonGroup.getDraftFlag().equals(YesOrNoEnum.YES)) {
|
|
|
+ lessonGroup.setAuditStatus(null);
|
|
|
+ lessonGroup.setShelvesFlag(0);
|
|
|
+ }
|
|
|
+
|
|
|
//添加组
|
|
|
lessonGroup.setTeacherId(sysUser.getId());
|
|
|
lessonGroup.setAuditVersion(YesOrNoEnum.NO);
|
|
@@ -285,7 +436,9 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
}
|
|
|
|
|
|
//添加课程
|
|
|
- videoLessonGroupDetailDao.insertVideoLesson(lessonList);
|
|
|
+ if (CollectionUtils.isNotEmpty(lessonList)) {
|
|
|
+ videoLessonGroupDetailDao.insertVideoLesson(lessonList);
|
|
|
+ }
|
|
|
|
|
|
//刷新统计
|
|
|
VideoLessonGroupUpVo groupUpVo = new VideoLessonGroupUpVo();
|
|
@@ -299,23 +452,30 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
record.setAuditStatus(AuthStatusEnum.DOING.getCode());
|
|
|
record.setAuthType(AuthTypeEnum.ADD);
|
|
|
recordDao.insert(record);*/
|
|
|
-
|
|
|
- VideoLessonGroupLog videoLessonGroupLog = new VideoLessonGroupLog();
|
|
|
-
|
|
|
- try {
|
|
|
- org.springframework.beans.BeanUtils.copyProperties(lessonGroup, videoLessonGroupLog);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("属性复制失败");
|
|
|
- }
|
|
|
- videoLessonGroupLog.setId(null);
|
|
|
- videoLessonGroupLog.setVideoLessonGroupId(lessonGroup.getId());
|
|
|
- videoLessonGroupLog.setCreateTime(date);
|
|
|
- videoLessonGroupLog.setUpdateTime(date);
|
|
|
- videoLessonGroupLog.setModifierId(sysUser.getId());
|
|
|
- videoLessonGroupLog.setVideoDetailJson(JsonUtil.toJSONString(lessonList));
|
|
|
- videoLessonGroupLog.setVersion(videoLessonGroupLogService.queryMaxVersion(lessonGroup.getId()) + 1);
|
|
|
-
|
|
|
- videoLessonGroupLogService.insert(videoLessonGroupLog);
|
|
|
+
|
|
|
+
|
|
|
+ // 设置关联曲目
|
|
|
+ courseMusicAlbumRelation(lessonList, lessonGroup.getId(), lessonVo.getUserBy());
|
|
|
+
|
|
|
+ if (YesOrNoEnum.NO.equals(lessonGroup.getDraftFlag())) {
|
|
|
+ VideoLessonGroupLog videoLessonGroupLog = new VideoLessonGroupLog();
|
|
|
+
|
|
|
+ try {
|
|
|
+ org.springframework.beans.BeanUtils.copyProperties(lessonGroup, videoLessonGroupLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("属性复制失败");
|
|
|
+ }
|
|
|
+ videoLessonGroupLog.setId(null);
|
|
|
+ videoLessonGroupLog.setVideoLessonGroupId(lessonGroup.getId());
|
|
|
+ videoLessonGroupLog.setCreateTime(date);
|
|
|
+ videoLessonGroupLog.setUpdateTime(date);
|
|
|
+ videoLessonGroupLog.setModifierId(sysUser.getId());
|
|
|
+ videoLessonGroupLog.setVideoDetailJson(JsonUtil.toJSONString(lessonList));
|
|
|
+ videoLessonGroupLog.setVersion(videoLessonGroupLogService.queryMaxVersion(lessonGroup.getId()) + 1);
|
|
|
+
|
|
|
+ videoLessonGroupLogService.insert(videoLessonGroupLog);
|
|
|
+ }
|
|
|
+ return lessonGroup.getId();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -370,6 +530,22 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
VideoLessonSearch search = new VideoLessonSearch();
|
|
|
search.setVideoLessonGroupId(groupId);
|
|
|
lessonStudentVo.setDetailList(videoLessonGroupDetailDao.selectPage(null, search));
|
|
|
+
|
|
|
+ // 课程关联曲目/专辑信息
|
|
|
+ List<CourseRelationMusicAlbum> recordInfos = courseRelationMusicAlbumService.lambdaQuery()
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseGroupId, groupId)
|
|
|
+ .list();
|
|
|
+
|
|
|
+ List<CourseRelationWrapper.MusicAlbumInfo> musicAlbumInfos;
|
|
|
+ if (CollectionUtils.isNotEmpty(recordInfos)) {
|
|
|
+
|
|
|
+ musicAlbumInfos = videoLessonGroupDetailService.getCourseRelationMusicAlbumInfos(recordInfos);
|
|
|
+
|
|
|
+ // 填充课程关联曲目、专辑信息
|
|
|
+ videoLessonGroupDetailService.updateCourseRelationMusicAlbumInfo(lessonStudentVo.getDetailList(), musicAlbumInfos);
|
|
|
+ }
|
|
|
+ //lessonStudentVo.setMusicAlbumInfos(musicAlbumInfos);
|
|
|
+
|
|
|
return lessonStudentVo;
|
|
|
}
|
|
|
|
|
@@ -387,12 +563,16 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
* @Description: 修改视频课组&视频课
|
|
|
* @Author: cy
|
|
|
* @Date: 2022/4/7
|
|
|
+ * @return
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void update(VideoLessonVo lessonVo, SysUser sysUser) {
|
|
|
+ public VideoLessonVo update(VideoLessonVo lessonVo, SysUser sysUser) {
|
|
|
VideoLessonGroup lessonGroup = lessonVo.getLessonGroup();
|
|
|
- List<VideoLessonGroupDetail> lessonList = lessonVo.getLessonList();
|
|
|
+ List<VideoLessonGroupDetailDto> lessonList = lessonVo.getLessonList();
|
|
|
+ if (CollectionUtils.isEmpty(lessonList)) {
|
|
|
+ lessonList = new ArrayList<>();
|
|
|
+ }
|
|
|
lessonGroup.setLessonCount(lessonList.size());
|
|
|
lessonGroup.setTeacherId(sysUser.getId());
|
|
|
//判断是否有正在审核中
|
|
@@ -422,45 +602,72 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
authRecord.setVideoGroupId(lessonGroup.getId());
|
|
|
//提交审核
|
|
|
recordDao.insert(authRecord);*/
|
|
|
-
|
|
|
- videoLessonGroupDetailDao.deleteByGroupId(lessonGroup.getId());
|
|
|
- if (lessonList != null && lessonList.size() > 0) {
|
|
|
- for (VideoLessonGroupDetail detail : lessonList) {
|
|
|
- detail.setVideoLessonGroupId(lessonGroup.getId());
|
|
|
- detail.setTeacherId(sysUser.getId());
|
|
|
- detail.setUpdateBy(sysUser.getId());
|
|
|
- }
|
|
|
- // 添加课程
|
|
|
- videoLessonGroupDetailDao.insertVideoLesson(lessonList);
|
|
|
- }
|
|
|
-
|
|
|
- VideoLessonGroupLog videoLessonGroupLog = new VideoLessonGroupLog();
|
|
|
-
|
|
|
- try {
|
|
|
- org.springframework.beans.BeanUtils.copyProperties(lessonGroup, videoLessonGroupLog);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("属性复制失败");
|
|
|
- }
|
|
|
- videoLessonGroupLog.setId(null);
|
|
|
- videoLessonGroupLog.setVideoLessonGroupId(lessonGroup.getId());
|
|
|
- videoLessonGroupLog.setCreateTime(date);
|
|
|
- videoLessonGroupLog.setUpdateTime(date);
|
|
|
- videoLessonGroupLog.setModifierId(sysUser.getId());
|
|
|
- videoLessonGroupLog.setVideoDetailJson(JsonUtil.toJSONString(lessonList));
|
|
|
- videoLessonGroupLog.setVersion(videoLessonGroupLogService.queryMaxVersion(lessonGroup.getId()) + 1);
|
|
|
-
|
|
|
- videoLessonGroupLogService.insert(videoLessonGroupLog);
|
|
|
+
|
|
|
+ // 提交第一页不删除课程
|
|
|
+ if (lessonVo.getPage() == 2) {
|
|
|
+ videoLessonGroupDetailDao.deleteByGroupId(lessonGroup.getId());
|
|
|
+ if (lessonList != null && lessonList.size() > 0) {
|
|
|
+ for (VideoLessonGroupDetail detail : lessonList) {
|
|
|
+ detail.setVideoLessonGroupId(lessonGroup.getId());
|
|
|
+ detail.setTeacherId(sysUser.getId());
|
|
|
+ detail.setUpdateBy(sysUser.getId());
|
|
|
+ }
|
|
|
+ // 添加课程
|
|
|
+ videoLessonGroupDetailDao.insertVideoLesson(lessonList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 草稿状态不审核
|
|
|
+ if (lessonGroup.getDraftFlag() == null) {
|
|
|
+ lessonGroup.setDraftFlag(YesOrNoEnum.NO);
|
|
|
+ }
|
|
|
|
|
|
//修改课程组记录
|
|
|
lessonGroup.setAuditVersion(YesOrNoEnum.NO);
|
|
|
lessonGroup.setAuditStatus(AuthStatusEnum.DOING);
|
|
|
+
|
|
|
+ if (lessonGroup.getDraftFlag().equals(YesOrNoEnum.YES)) {
|
|
|
+ lessonGroup.setAuditStatus(null);
|
|
|
+ lessonGroup.setShelvesFlag(0);
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .eq(VideoLessonGroup::getId,lessonGroup.getId())
|
|
|
+ .set(VideoLessonGroup::getAuditStatus,null)
|
|
|
+ .update();
|
|
|
+ }
|
|
|
lessonGroup.setUpdateTime(date);
|
|
|
videoLessonGroupDao.updateById(lessonGroup);
|
|
|
|
|
|
+ // 设置关联曲目
|
|
|
+ if (lessonVo.getPage() == 2) {
|
|
|
+ courseMusicAlbumRelation(lessonList, lessonGroup.getId(), lessonVo.getUserBy());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (lessonGroup.getDraftFlag().equals(YesOrNoEnum.NO)) {
|
|
|
+
|
|
|
+ VideoLessonGroupLog videoLessonGroupLog = new VideoLessonGroupLog();
|
|
|
+
|
|
|
+ try {
|
|
|
+ org.springframework.beans.BeanUtils.copyProperties(lessonGroup, videoLessonGroupLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("属性复制失败");
|
|
|
+ }
|
|
|
+ videoLessonGroupLog.setId(null);
|
|
|
+ videoLessonGroupLog.setVideoLessonGroupId(lessonGroup.getId());
|
|
|
+ videoLessonGroupLog.setCreateTime(date);
|
|
|
+ videoLessonGroupLog.setUpdateTime(date);
|
|
|
+ videoLessonGroupLog.setModifierId(sysUser.getId());
|
|
|
+ videoLessonGroupLog.setVideoDetailJson(JsonUtil.toJSONString(lessonList));
|
|
|
+ videoLessonGroupLog.setVersion(videoLessonGroupLogService.queryMaxVersion(lessonGroup.getId()) + 1);
|
|
|
+
|
|
|
+ videoLessonGroupLogService.insert(videoLessonGroupLog);
|
|
|
+ }
|
|
|
+
|
|
|
//刷新统计
|
|
|
VideoLessonGroupUpVo groupUpVo = new VideoLessonGroupUpVo();
|
|
|
groupUpVo.setId(lessonGroup.getId());
|
|
|
videoLessonGroupDao.updateGroup(groupUpVo);
|
|
|
+ return lessonVo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -505,7 +712,18 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
public IPage<VideoLessonAuthGroup> queryGroupHistoryList(IPage<VideoLessonAuthGroup> page, VideoGroupSearch query) {
|
|
|
List<VideoLessonAuthGroup> list = baseMapper.queryGroupHistoryList(page, query);
|
|
|
for(VideoLessonAuthGroup g : list){
|
|
|
- g.setVideoList(JsonUtil.parseArray(g.getVideoDetailJson(), VideoLessonGroupDetail.class));
|
|
|
+ List<VideoLessonGroupDetailDto> videoLessonGroupDetailDtoList = JsonUtil.parseArray(g.getVideoDetailJson(),
|
|
|
+ VideoLessonGroupDetailDto.class);
|
|
|
+ g.setVideoList(videoLessonGroupDetailDtoList);
|
|
|
+
|
|
|
+
|
|
|
+ List<CourseRelationMusicAlbum> recordInfos = videoLessonGroupDetailDtoList.stream()
|
|
|
+ .filter(x -> CollectionUtils.isNotEmpty(x.getCourseRelationMusicAlbumList()))
|
|
|
+ .flatMap(x -> x.getCourseRelationMusicAlbumList().stream()).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(recordInfos)) {
|
|
|
+ // 设置曲目关联信息
|
|
|
+ setCourseRelationInfo(videoLessonGroupDetailDtoList, recordInfos);
|
|
|
+ }
|
|
|
}
|
|
|
return page.setRecords(list);
|
|
|
}
|
|
@@ -514,20 +732,47 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
public VideoLessonAuthGroup authGroupDetil(Long videoGroupId) {
|
|
|
VideoLessonAuthGroup videoLessonAuthGroup = baseMapper.authGroupDetil(videoGroupId);
|
|
|
|
|
|
- List<VideoLessonGroupDetail> details = videoLessonGroupDetailDao.queryByVideoLessonGroupId(videoGroupId);
|
|
|
+ List<VideoLessonGroupDetailDto> details = videoLessonGroupDetailDao.queryByVideoLessonGroupId(videoGroupId);
|
|
|
videoLessonAuthGroup.setVideoList(details);
|
|
|
|
|
|
+ // 查询当前的关联曲目
|
|
|
+ List<CourseRelationMusicAlbum> list = courseRelationMusicAlbumService.lambdaQuery()
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseGroupId, videoGroupId)
|
|
|
+ .ne(CourseRelationMusicAlbum::getDelFlog, 0) .list();
|
|
|
+ // 设置曲目关联信息
|
|
|
+ setCourseRelationInfo(details, list);
|
|
|
+
|
|
|
//查询上一次的提交
|
|
|
VideoLessonGroupLog lastDetil = videoLessonGroupLogService.queryByVideoLessonGroupId(videoGroupId, videoLessonAuthGroup.getVersion());
|
|
|
videoLessonAuthGroup.setLastVideoLessonGroupLog(lastDetil);
|
|
|
|
|
|
if(lastDetil != null){
|
|
|
- lastDetil.setVideoList(JsonUtil.parseArray(lastDetil.getVideoDetailJson(), VideoLessonGroupDetail.class));
|
|
|
+ List<VideoLessonGroupDetailDto> videoLessonGroupDetailDtoList = JsonUtil.parseArray(
|
|
|
+ lastDetil.getVideoDetailJson(), VideoLessonGroupDetailDto.class);
|
|
|
+ lastDetil.setVideoList(videoLessonGroupDetailDtoList);
|
|
|
+
|
|
|
+
|
|
|
+ List<CourseRelationMusicAlbum> recordInfos = videoLessonGroupDetailDtoList.stream()
|
|
|
+ .filter(x -> CollectionUtils.isNotEmpty(x.getCourseRelationMusicAlbumList()))
|
|
|
+ .flatMap(x -> x.getCourseRelationMusicAlbumList().stream()).collect(Collectors.toList());
|
|
|
+ // 设置曲目关联信息
|
|
|
+ setCourseRelationInfo(videoLessonGroupDetailDtoList, recordInfos);
|
|
|
}
|
|
|
|
|
|
return videoLessonAuthGroup;
|
|
|
}
|
|
|
|
|
|
+ private void setCourseRelationInfo(List<VideoLessonGroupDetailDto> details, List<CourseRelationMusicAlbum> list) {
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+
|
|
|
+ List<CourseRelationWrapper.MusicAlbumInfo> musicAlbumInfos = videoLessonGroupDetailService.getCourseRelationMusicAlbumInfos(
|
|
|
+ list);
|
|
|
+
|
|
|
+ // 填充课程关联曲目、专辑信息
|
|
|
+ videoLessonGroupDetailService.updateCourseRelationMusicAlbumInfo(details, musicAlbumInfos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Description: 学生端-我的-我的课程-购买的视频课组
|
|
|
* @Author: cy
|
|
@@ -567,5 +812,76 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean top(Long videoLessonGroupId) {
|
|
|
+ VideoLessonGroup videoLessonGroup = getById(videoLessonGroupId);
|
|
|
+ if (videoLessonGroup == null) {
|
|
|
+ throw new BizException("未找到视频课信息");
|
|
|
+ }
|
|
|
+ VideoLessonGroup lessonGroup = new VideoLessonGroup();
|
|
|
+ lessonGroup.setTopFlag(videoLessonGroup.getTopFlag() == 1?0:1);
|
|
|
+ lessonGroup.setId(videoLessonGroupId);
|
|
|
+ return this.updateById(lessonGroup);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<CourseRelationWrapper.MusicAlbumInfo> queryRelationMusicAlbum(IPage<CourseRelationWrapper.MusicAlbumInfo> page, CourseRelationQueryInfo queryInfo) {
|
|
|
+ IPage courseRelationMusicAlbumIPage = new Page<>(page.getCurrent(),page.getSize());
|
|
|
+ courseRelationMusicAlbumIPage = courseRelationMusicAlbumService.lambdaQuery()
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseGroupId,queryInfo.getCourseGroupId())
|
|
|
+ .eq(CourseRelationMusicAlbum::getCourseType, queryInfo.getCourseType())
|
|
|
+ .ne(CourseRelationMusicAlbum::getDelFlog,0)
|
|
|
+ .orderByAsc(CourseRelationMusicAlbum::getCourseId)
|
|
|
+ .orderByDesc( CourseRelationMusicAlbum::getId)
|
|
|
+ .page(courseRelationMusicAlbumIPage);
|
|
|
+ List<CourseRelationMusicAlbum> records = courseRelationMusicAlbumIPage.getRecords();
|
|
|
+ List<CourseRelationWrapper.MusicAlbumInfo> courseRelationMusicAlbumInfos = videoLessonGroupDetailService.getCourseRelationMusicAlbumInfos(
|
|
|
+ records);
|
|
|
+
|
|
|
+ // 课程id集合
|
|
|
+ List<Long> courseIdList = courseRelationMusicAlbumInfos.stream()
|
|
|
+ .map(CourseRelationWrapper.MusicAlbumInfo::getCourseId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ // 查询课程名
|
|
|
+ List<VideoLessonGroupDetail> list = videoLessonGroupDetailService.lambdaQuery()
|
|
|
+ .in(VideoLessonGroupDetail::getId,courseIdList)
|
|
|
+ .list();
|
|
|
+
|
|
|
+ Map<Long, String> collect = list.stream()
|
|
|
+ .collect(Collectors.toMap(VideoLessonGroupDetail::getId,
|
|
|
+ VideoLessonGroupDetail::getVideoTitle));
|
|
|
+ for (CourseRelationWrapper.MusicAlbumInfo courseRelationMusicAlbumInfo : courseRelationMusicAlbumInfos) {
|
|
|
+ courseRelationMusicAlbumInfo.setVideoTitle(collect.get(courseRelationMusicAlbumInfo.getCourseId()));
|
|
|
+ }
|
|
|
+ //查询标签
|
|
|
+ List<Long> tagIdList = courseRelationMusicAlbumInfos.stream()
|
|
|
+ .map(CourseRelationWrapper.MusicAlbumInfo::getTagIds)
|
|
|
+ .map(s -> Arrays.asList(s.split(",")))
|
|
|
+ .flatMap(Collection::stream)
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(tagIdList)) {
|
|
|
+ List<MusicTag> musicTagList = musicTagService.lambdaQuery()
|
|
|
+ .in(MusicTag::getId, tagIdList)
|
|
|
+ .eq(MusicTag::getDelFlag, 0)
|
|
|
+ .list();
|
|
|
+ Map<String, String> musicTagIdNameMap = musicTagList.stream()
|
|
|
+ .collect(Collectors.toMap(o -> o.getId().toString(),
|
|
|
+ MusicTag::getName));
|
|
|
+ for (CourseRelationWrapper.MusicAlbumInfo courseRelationMusicAlbumInfo : courseRelationMusicAlbumInfos) {
|
|
|
+ String tagIds = courseRelationMusicAlbumInfo.getTagIds();
|
|
|
+ String tagName = Arrays.stream(tagIds.split(","))
|
|
|
+ .map(musicTagIdNameMap::get)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ courseRelationMusicAlbumInfo.setTagName(tagName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ courseRelationMusicAlbumIPage.setRecords(courseRelationMusicAlbumInfos);
|
|
|
+ return courseRelationMusicAlbumIPage;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|