From 8a025d3351fe4c6087c0dbf430624f4349e33d69 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 14 十一月 2024 08:59:08 +0800
Subject: [PATCH] 代码提交

---
 xinquan-modules/xinquan-course/src/main/java/com/xinquan/course/controller/client/ClientCourseChapterController.java |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/xinquan-modules/xinquan-course/src/main/java/com/xinquan/course/controller/client/ClientCourseChapterController.java b/xinquan-modules/xinquan-course/src/main/java/com/xinquan/course/controller/client/ClientCourseChapterController.java
index 7c5f30d..cbb3ee4 100644
--- a/xinquan-modules/xinquan-course/src/main/java/com/xinquan/course/controller/client/ClientCourseChapterController.java
+++ b/xinquan-modules/xinquan-course/src/main/java/com/xinquan/course/controller/client/ClientCourseChapterController.java
@@ -11,14 +11,17 @@
 import com.xinquan.course.domain.CourseLearningRecord;
 import com.xinquan.course.service.CourseChapterService;
 import com.xinquan.course.service.CourseLearningRecordService;
+import com.xinquan.user.api.feign.RemoteAppUserService;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.util.Arrays;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -55,9 +58,12 @@
         }
         for (CourseChapter record : page.getRecords()) {
             record.setUid(record.getId()+"");
-            int size = courseLearningRecordService.lambdaQuery()
-                    .eq(CourseLearningRecord::getChapterId, record.getId()).list().size();
-            record.setRealLearnedNum(size);
+            int a = 0;
+            int b = 0;
+            a+= record.getVirtualLearnedNum();
+            Long data1 = remoteAppUserService.getCourseChapterHistoryCount(record.getId()).getData();
+            b+=data1;
+            record.setRealLearnedNum(a+b);
         }
 
         return R.ok(PageDTO.of(page, CourseChapter.class));
@@ -69,13 +75,18 @@
         homeBackgroundMusic.setCreateTime(LocalDateTime.now());
         return R.ok(courseChapterService.save(homeBackgroundMusic));
     }
+    @Resource
+    private RemoteAppUserService remoteAppUserService;
     @GetMapping("/detailCourseChapter")
     @ApiOperation(value = "查看详情章节管理", tags = "管理后台-章节管理")
     public R<CourseChapter> detailCourseChapter(String uid) {
         CourseChapter byId = courseChapterService.getById(uid);
-        int size = courseLearningRecordService.lambdaQuery()
-                .eq(CourseLearningRecord::getChapterId, byId.getId()).list().size();
-        byId.setRealLearnedNum(size);
+        int a = 0;
+        int b = 0;
+        a+= byId.getVirtualLearnedNum();
+        Long data1 = remoteAppUserService.getCourseChapterHistoryCount(byId.getId()).getData();
+        b+=data1;
+        byId.setRealLearnedNum(a+b);
         return R.ok(byId);
     }
     @PostMapping("/updateCourseChapter")

--
Gitblit v1.7.1