|
@@ -5503,6 +5503,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if (ObjectUtils.isNull(bo)){
|
|
|
return;
|
|
|
}
|
|
|
+ x.setPaolivayVideoUrl(x.getRecordingUrl());
|
|
|
+ x.setPaolivayVideoTime(x.getDurationTime());
|
|
|
x.setTencentVideoUrl(bo.getSectionUrl());
|
|
|
x.setTencentVideoTime(Long.valueOf(bo.getSectionTime()));
|
|
|
});
|
|
@@ -5510,6 +5512,157 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return iCourseSectionService.updateBatchById(sections);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean updateGoodsVideo(UpdateGoodsVideoBo bo) {
|
|
|
+ Goods goods = getById(bo.getGoodsId());
|
|
|
+ if (ObjectUtils.isNull(goods)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //获取商品 课程/模块/章/节
|
|
|
+ List<GoodsCourse> courseList = iGoodsCourseService.list(new LambdaQueryWrapper<GoodsCourse>().eq(GoodsCourse::getGoodsId, goods.getGoodsId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(courseList)){
|
|
|
+ List<Long> courseIds = courseList.stream().map(GoodsCourse::getCourseId).collect(Collectors.toList());
|
|
|
+ List<CourseMenu> menuList = iCourseMenuService.list(new LambdaQueryWrapper<CourseMenu>().in(CourseMenu::getCourseId, courseIds).eq(CourseMenu::getStatus, 1));
|
|
|
+ menuList.forEach(x -> {
|
|
|
+ if (x.getType() == 1){
|
|
|
+ //模块
|
|
|
+ CourseModule courseModule = iCourseModuleService.getById(x.getMenuId());
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ courseModule.setViewSign(2);
|
|
|
+ iCourseModuleService.updateById(courseModule);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ courseModule.setViewSign(1);
|
|
|
+ iCourseModuleService.updateById(courseModule);
|
|
|
+ }
|
|
|
+ List<CourseModuleChapter> moduleChapters = iCourseModuleChapterService.list(new LambdaQueryWrapper<CourseModuleChapter>().eq(CourseModuleChapter::getModuleId, x.getMenuId()));
|
|
|
+ if (CollectionUtils.isEmpty(moduleChapters)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> chapterIds = moduleChapters.stream().map(CourseModuleChapter::getChapterId).collect(Collectors.toList());
|
|
|
+ List<CourseChapter> courseChapters = iCourseChapterService.listByIds(chapterIds);
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ courseChapters.stream().forEach(k -> k.setViewSign(2));
|
|
|
+ iCourseChapterService.updateBatchById(courseChapters);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ courseChapters.stream().forEach(k -> k.setViewSign(1));
|
|
|
+ iCourseChapterService.updateBatchById(courseChapters);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CourseChapterSection> courseChapterSections = iCourseChapterSectionService.list(new LambdaQueryWrapper<CourseChapterSection>().in(CourseChapterSection::getChapterId, chapterIds));
|
|
|
+ if (CollectionUtils.isEmpty(courseChapterSections)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> sectionIds = courseChapterSections.stream().map(CourseChapterSection::getSectionId).collect(Collectors.toList());
|
|
|
+ List<CourseSection> courseSections = iCourseSectionService.listByIds(sectionIds);
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ courseSections.stream().forEach(j -> {
|
|
|
+ j.setViewSign(2);
|
|
|
+ j.setRecordingUrl(j.getTencentVideoUrl());
|
|
|
+ j.setDurationTime(j.getTencentVideoTime());
|
|
|
+ });
|
|
|
+ iCourseSectionService.updateBatchById(courseSections);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ courseSections.stream().forEach(j -> {
|
|
|
+ j.setViewSign(1);
|
|
|
+ j.setRecordingUrl(j.getPaolivayVideoUrl());
|
|
|
+ j.setDurationTime(j.getPaolivayVideoTime());
|
|
|
+ });
|
|
|
+ iCourseSectionService.updateBatchById(courseSections);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (x.getType() == 2){
|
|
|
+ //章
|
|
|
+ CourseChapter courseChapter = iCourseChapterService.getById(x.getMenuId());
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ courseChapter.setViewSign(2);
|
|
|
+ iCourseChapterService.updateById(courseChapter);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ courseChapter.setViewSign(1);
|
|
|
+ iCourseChapterService.updateById(courseChapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CourseChapterSection> courseChapterSections = iCourseChapterSectionService.list(new LambdaQueryWrapper<CourseChapterSection>().eq(CourseChapterSection::getChapterId, courseChapter.getChapterId()));
|
|
|
+ if (CollectionUtils.isEmpty(courseChapterSections)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> sectionIds = courseChapterSections.stream().map(CourseChapterSection::getSectionId).collect(Collectors.toList());
|
|
|
+ List<CourseSection> courseSections = iCourseSectionService.listByIds(sectionIds);
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ courseSections.stream().forEach(j -> {
|
|
|
+ j.setViewSign(2);
|
|
|
+ j.setRecordingUrl(j.getTencentVideoUrl());
|
|
|
+ j.setDurationTime(j.getTencentVideoTime());
|
|
|
+ });
|
|
|
+ iCourseSectionService.updateBatchById(courseSections);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ courseSections.stream().forEach(j -> {
|
|
|
+ j.setViewSign(1);
|
|
|
+ j.setRecordingUrl(j.getPaolivayVideoUrl());
|
|
|
+ j.setDurationTime(j.getPaolivayVideoTime());
|
|
|
+ });
|
|
|
+ iCourseSectionService.updateBatchById(courseSections);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (x.getType() == 3){
|
|
|
+ //节
|
|
|
+ CourseSection j = iCourseSectionService.getById(x.getMenuId());
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ j.setViewSign(2);
|
|
|
+ j.setRecordingUrl(j.getTencentVideoUrl());
|
|
|
+ j.setDurationTime(j.getTencentVideoTime());
|
|
|
+ iCourseSectionService.updateById(j);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ j.setViewSign(1);
|
|
|
+ j.setRecordingUrl(j.getPaolivayVideoUrl());
|
|
|
+ j.setDurationTime(j.getPaolivayVideoTime());
|
|
|
+ iCourseSectionService.updateById(j);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ List<Course> courses = iCourseService.list(new LambdaQueryWrapper<Course>().in(Course::getCourseId, courseIds));
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ courses.forEach(k -> k.setViewSign(2));
|
|
|
+ iCourseService.updateBatchById(courses);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ courses.forEach(k -> k.setViewSign(1));
|
|
|
+ iCourseService.updateBatchById(courses);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 2){
|
|
|
+ //切换腾讯
|
|
|
+ goods.setViewSign(2);
|
|
|
+ }
|
|
|
+ if (bo.getSign() == 1){
|
|
|
+ //切换保利威
|
|
|
+ goods.setViewSign(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ return updateById(goods);
|
|
|
+ }
|
|
|
+
|
|
|
private void updateHandoutsId(Long goodsId, Long tenantId, Long handoutsId) {
|
|
|
baseMapper.updateHandoutsId(goodsId, tenantId, handoutsId);
|
|
|
}
|