|
@@ -22,6 +22,7 @@ import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseSectionService;
|
|
|
import com.zhongzheng.modules.course.vo.CourseLiveVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
+import com.zhongzheng.modules.course.vo.LiveListVo;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
@@ -490,37 +491,97 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
info.setCode(HttpStatus.HTTP_OK);
|
|
|
info.setMsg("查询成功");
|
|
|
//获取所有直播课程ID
|
|
|
- List<Long> courseIds = orderGoodsMapper.getCourseIdByLive(userId);
|
|
|
- if (CollectionUtils.isEmpty(courseIds)){
|
|
|
+ List<LiveListVo> liveVos = orderGoodsMapper.getCourseIdByLive(userId);
|
|
|
+ if (CollectionUtils.isEmpty(liveVos)){
|
|
|
return info;
|
|
|
}
|
|
|
+ List<Long> courseIds = liveVos.stream().map(LiveListVo::getCourseId).collect(Collectors.toList());
|
|
|
//课程目录
|
|
|
List<CourseMenu> menus = courseMenuService.list(new LambdaQueryWrapper<CourseMenu>()
|
|
|
.in(CourseMenu::getCourseId, courseIds));
|
|
|
if (CollectionUtils.isEmpty(menus)){
|
|
|
return info;
|
|
|
}
|
|
|
-
|
|
|
- //节ID
|
|
|
- List<Long> sectionIds = menus.stream().filter(x -> x.getType() == 3).map(CourseMenu::getMenuId).collect(Collectors.toList());
|
|
|
- //章ID
|
|
|
- List<Long> chapterIds = menus.stream().filter(x -> x.getType() == 2).map(CourseMenu::getMenuId).collect(Collectors.toList());
|
|
|
- if (!CollectionUtils.isEmpty(chapterIds)){
|
|
|
- List<CourseChapterSection> chapterSections = courseChapterSectionService.list(new LambdaQueryWrapper<CourseChapterSection>()
|
|
|
- .in(CourseChapterSection::getChapterId, chapterIds));
|
|
|
- if (!CollectionUtils.isEmpty(chapterSections)){
|
|
|
- List<Long> ids = chapterSections.stream().map(CourseChapterSection::getSectionId).collect(Collectors.toList());
|
|
|
- sectionIds.addAll(ids);
|
|
|
- }
|
|
|
- }
|
|
|
- //模块ID
|
|
|
- List<Long> moduleIds = menus.stream().filter(x -> x.getType() == 1).map(CourseMenu::getMenuId).collect(Collectors.toList());
|
|
|
- if (!CollectionUtils.isEmpty(moduleIds)){
|
|
|
- List<Long> ids = courseMenuService.getSectionIds(moduleIds);
|
|
|
- if (!CollectionUtils.isEmpty(ids)){
|
|
|
- sectionIds.addAll(ids);
|
|
|
+ List<LiveListVo> listVoList = new ArrayList<>();
|
|
|
+ menus.forEach(item -> {
|
|
|
+ switch (item.getType()){
|
|
|
+ case 3://节
|
|
|
+ LiveListVo vo = new LiveListVo();
|
|
|
+ vo.setCourseId(item.getCourseId());
|
|
|
+ vo.setSectionId(item.getMenuId());
|
|
|
+ listVoList.add(vo);
|
|
|
+ break;
|
|
|
+ case 2://章
|
|
|
+ List<CourseChapterSection> chapterSections = courseChapterSectionService
|
|
|
+ .list(new LambdaQueryWrapper<CourseChapterSection>()
|
|
|
+ .eq(CourseChapterSection::getChapterId, item.getMenuId()));
|
|
|
+ if (!CollectionUtils.isEmpty(chapterSections)){
|
|
|
+ List<LiveListVo> collect = chapterSections.stream().map(chapter -> {
|
|
|
+ LiveListVo chapterVo = new LiveListVo();
|
|
|
+ chapterVo.setCourseId(item.getCourseId());
|
|
|
+ chapterVo.setChapterId(item.getMenuId());
|
|
|
+ chapterVo.setSectionId(chapter.getSectionId());
|
|
|
+ return chapterVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ listVoList.addAll(collect);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 1://模块
|
|
|
+ List<LiveListVo> listVos = courseMenuService.getSectionIds(item.getMenuId());
|
|
|
+ if (!CollectionUtils.isEmpty(listVos)){
|
|
|
+ List<LiveListVo> collect = listVos.stream().map(module -> {
|
|
|
+ LiveListVo chapterVo = new LiveListVo();
|
|
|
+ chapterVo.setCourseId(item.getCourseId());
|
|
|
+ chapterVo.setModuleId(item.getMenuId());
|
|
|
+ chapterVo.setChapterId(module.getChapterId());
|
|
|
+ chapterVo.setSectionId(module.getSectionId());
|
|
|
+ return chapterVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ listVoList.addAll(collect);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ listVoList.forEach(vo -> {
|
|
|
+ liveVos.forEach(item -> {
|
|
|
+ if (vo.getCourseId().equals(item.getCourseId())){
|
|
|
+ vo.setGoodId(item.getGoodId());
|
|
|
+ vo.setOrderGoodId(item.getOrderGoodId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+// //节ID
|
|
|
+// List<LiveListVo> liveListVos = menus.stream().filter(x -> x.getType() == 3).map(item -> {
|
|
|
+// LiveListVo vo = new LiveListVo();
|
|
|
+// vo.setCourseId(item.getCourseId());
|
|
|
+// vo.setSectionId(item.getMenuId());
|
|
|
+// return vo;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //章ID
|
|
|
+// List<Long> chapterIds = menus.stream().filter(x -> x.getType() == 2).map(CourseMenu::getMenuId).collect(Collectors.toList());
|
|
|
+// if (!CollectionUtils.isEmpty(chapterIds)){
|
|
|
+// List<CourseChapterSection> chapterSections = courseChapterSectionService.list(new LambdaQueryWrapper<CourseChapterSection>()
|
|
|
+// .in(CourseChapterSection::getChapterId, chapterIds));
|
|
|
+// if (!CollectionUtils.isEmpty(chapterSections)){
|
|
|
+// chapterSections.stream().map(item -> {
|
|
|
+// LiveListVo vo = new LiveListVo();
|
|
|
+// vo.setCourseId(item.getCourseId());
|
|
|
+// vo.setSectionId(item.getMenuId());
|
|
|
+// return vo;
|
|
|
+// })
|
|
|
+// List<Long> ids = chapterSections.stream().map(CourseChapterSection::getSectionId).collect(Collectors.toList());
|
|
|
+// sectionIds.addAll(ids);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// //模块ID
|
|
|
+// List<Long> moduleIds = menus.stream().filter(x -> x.getType() == 1).map(CourseMenu::getMenuId).collect(Collectors.toList());
|
|
|
+// if (!CollectionUtils.isEmpty(moduleIds)){
|
|
|
+// List<Long> ids = courseMenuService.getSectionIds(moduleIds);
|
|
|
+// if (!CollectionUtils.isEmpty(ids)){
|
|
|
+// sectionIds.addAll(ids);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ List<Long> sectionIds = listVoList.stream().map(LiveListVo::getSectionId).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(sectionIds)){
|
|
|
return info;
|
|
|
}
|
|
@@ -551,6 +612,14 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
return response;
|
|
|
}).collect(Collectors.toList());
|
|
|
list.forEach(item -> {
|
|
|
+ listVoList.forEach(live -> {
|
|
|
+ if (item.getSectionId().equals(live.getSectionId())){
|
|
|
+ item.setOrderGoodId(live.getOrderGoodId());
|
|
|
+ item.setGoodsId(live.getGoodId());
|
|
|
+ item.setModuleId(live.getModuleId());
|
|
|
+ item.setChapterId(live.getChapterId());
|
|
|
+ }
|
|
|
+ });
|
|
|
for (LiveChannelBasicInfoResponse response : result) {
|
|
|
if (StringUtils.isNotBlank(item.getLiveUrl()) && item.getLiveUrl().equals(response.getChannelId())){
|
|
|
item.setWatchStatus(response.getWatchStatus());
|