无关风月
2024-11-11 3444605298a981f8db627d8a4055bc7440beddcf
xinquan-modules/xinquan-course/src/main/java/com/xinquan/course/controller/client/ClientCourseController.java
@@ -623,6 +623,7 @@
        Course byId = courseService.getById(id);
        ClientCourseVO clientCourseVO = new ClientCourseVO();
        BeanUtils.copyProperties(byId, clientCourseVO);
        clientCourseVO.setIsBuy(2);
        List<AppUser> data = remoteAppUserService.getUserByCourseId(id).getData();
        if (byId.getChargeType()==1 && tokenService.getLoginUser()==null){
            if (data!=null){
@@ -716,7 +717,7 @@
            }
        }
        clientCourseVO.setList(page);
        clientCourseVO.setIsBuy(2);
        // 查询推荐课程
        List<Course> list = courseService.lambdaQuery().eq(Course::getCateId, byId.getCateId())
                .eq(Course::getCourseType,1)
@@ -1105,6 +1106,18 @@
                List<Course> courses = new ArrayList<>();
                courses.add(list1.get(0));
                courses.add(list1.get(1));
                for (Course cours : courses) {
                    List<CourseChapter> list3 = courseChapterService.lambdaQuery().eq(CourseChapter::getCourseId, cours.getId()).list();
                    int a = 0;
                    int b = 0;
                    for (CourseChapter courseChapter : list3) {
                        a+= courseChapter.getVirtualLearnedNum();
                        Long data2 = remoteAppUserService.getCourseChapterHistoryCount(courseChapter.getId()).getData();
                        b+=data2;
                    }
                    cours.setCount(a+b);
                    cours.setRealLearnedNum(a+b);
                }
                studyPageVO.setFreeCourseList(courses);
            }else if (list1.size()==1){
                List<Course> courses = new ArrayList<>();
@@ -1115,6 +1128,18 @@
                        break;
                    }
                }
                for (Course cours : courses) {
                    List<CourseChapter> list3 = courseChapterService.lambdaQuery().eq(CourseChapter::getCourseId, cours.getId()).list();
                    int a = 0;
                    int b = 0;
                    for (CourseChapter courseChapter : list3) {
                        a+= courseChapter.getVirtualLearnedNum();
                        Long data2 = remoteAppUserService.getCourseChapterHistoryCount(courseChapter.getId()).getData();
                        b+=data2;
                    }
                    cours.setCount(a+b);
                    cours.setRealLearnedNum(a+b);
                }
                studyPageVO.setFreeCourseList(courses);
            }
            studyPageVO.setCourseList(courseVOS);