| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | } |
| | | for (CourseChapter record : page.getRecords()) { |
| | | record.setUid(record.getId()+""); |
| | | int size = courseLearningRecordService.lambdaQuery() |
| | | .eq(CourseLearningRecord::getChapterId, record.getId()).list().size(); |
| | | record.setRealLearnedNum(size); |
| | | int b = 0; |
| | | Long data1 = remoteAppUserService.getCourseChapterHistoryCount(record.getId()).getData(); |
| | | b+=data1; |
| | | record.setRealLearnedNum(b); |
| | | } |
| | | |
| | | return R.ok(PageDTO.of(page, CourseChapter.class)); |
| | |
| | | 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") |