| | |
| | | long count1 = courseUserFavoriteService.count(new LambdaQueryWrapper<CourseUserFavorite>() |
| | | .eq(CourseUserFavorite::getCourseId, record.getId())); |
| | | record.setCollectCount(count1); |
| | | // 查询学习人数 |
| | | // record.setCount(remoteAppUserService.getUserByCourseId(record.getId()).getData().size()); |
| | | int size1 = courseLearningRecordService.lambdaQuery().eq(CourseLearningRecord::getCourseId, record.getId()) |
| | | .groupBy(CourseLearningRecord::getAppUserId).list().size(); |
| | | List<CourseChapter> list = courseChapterService.lambdaQuery() |
| | | .eq(CourseChapter::getCourseId, record.getId()).list(); |
| | | // 章节列表累加虚拟学习人数 |
| | | int temp = 0; |
| | | int a = 0; |
| | | int b = 0; |
| | | for (CourseChapter courseChapter : list) { |
| | | temp+=courseChapter.getVirtualLearnedNum(); |
| | | a+= courseChapter.getVirtualLearnedNum(); |
| | | Long data1 = remoteAppUserService.getCourseChapterHistoryCount(courseChapter.getId()).getData(); |
| | | b+=data1; |
| | | courseChapter.setRealLearnedNum(Integer.valueOf(data1+"")); |
| | | } |
| | | record.setCount(size1+temp); |
| | | record.setCount(a+b); |
| | | } |
| | | return R.ok(PageDTO.of(page, Course.class)); |
| | | } |
| | |
| | | a+= courseChapter.getVirtualLearnedNum(); |
| | | Long data1 = remoteAppUserService.getCourseChapterHistoryCount(courseChapter.getId()).getData(); |
| | | b+=data1; |
| | | courseChapter.setRealLearnedNum(Integer.valueOf(data1+"")); |
| | | } |
| | | int size1 = courseLearningRecordService.lambdaQuery() |
| | | .eq(CourseLearningRecord::getCourseId, uid).groupBy(CourseLearningRecord::getAppUserId) |
| | | .list().size(); |
| | | |
| | | byId.setVirtualLearnedNum(a); |
| | | byId.setRealLearnedNum(b); |
| | | byId.setCount(a+b); |
| | |
| | | @ApiImplicitParam(value = "课程id", name = "id", required = true, dataType = "String"), |
| | | }) |
| | | public R<ClientCourseVO> getPayCourseInfoById(@RequestParam(value = "id")Long id) { |
| | | |
| | | Course byId = courseService.getById(id); |
| | | ClientCourseVO clientCourseVO = new ClientCourseVO(); |
| | | BeanUtils.copyProperties(byId, clientCourseVO); |
| | |
| | | course.setRealLearnedNum(a+b); |
| | | course.setVirtualLearnedNum(0); |
| | | BeanUtils.copyProperties(course, courseVO); |
| | | List<Long> collect = courseVOS.stream().map(CourseVO::getId).collect(Collectors.toList()); |
| | | if (!collect.contains(courseVO.getId())){ |
| | | courseVOS.add(courseVO); |
| | | } |
| | | } |
| | | } |
| | | List<Long> data1 = remoteAppUserService.getCourseHistoryByUserId(userId).getData(); |
| | |
| | | courseVO.setVirtualLearnedNum(0); |
| | | courseVO.setId(byId.getId()); |
| | | courseVO.setCoverUrl(byId.getCoverUrl()); |
| | | List<Long> collect = courseVOS.stream().map(CourseVO::getId).collect(Collectors.toList()); |
| | | if (!collect.contains(courseVO.getId())){ |
| | | courseVOS.add(courseVO); |
| | | } |
| | | } |
| | | } |
| | | // 查询两个相同类型的线上免费课程 |
| | |
| | | courseVO.setVirtualLearnedNum(0); |
| | | courseVO.setId(byId.getId()); |
| | | courseVO.setCoverUrl(byId.getCoverUrl()); |
| | | List<Long> collect = courseVOS.stream().map(CourseVO::getId).collect(Collectors.toList()); |
| | | if (!collect.contains(courseVO.getId())){ |
| | | courseVOS.add(courseVO); |
| | | } |
| | | } |
| | | } |
| | | studyPageVO.setCourseList(courseVOS); |
| | | return R.ok(studyPageVO); |
| | | }else{ |