| | |
| | | package com.tcm.training.admin.app.course.controller; |
| | | |
| | | import com.tcm.training.admin.app.course.dto.AppHealthCourseDownloadBatchDeleteRequest; |
| | | import com.tcm.training.admin.app.course.dto.AppHealthCourseDownloadReportRequest; |
| | | import com.tcm.training.admin.app.course.dto.AppHealthCourseFavoriteBatchCancelRequest; |
| | | import com.tcm.training.admin.app.course.dto.AppHealthCoursePlayRecordUploadRequest; |
| | | import com.tcm.training.admin.app.course.dto.AppHealthCoursePurchaseRequest; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseDownloadItemVO; |
| | | import com.tcm.training.admin.app.course.service.AppHealthCourseService; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseCategoryOptionVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseDetailVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseFavoriteItemVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseFavoriteResultVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseListItemVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCoursePlayRecordUploadResultVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCoursePurchaseResultVO; |
| | | import com.tcm.training.admin.app.course.vo.AppMyHealthCourseDetailVO; |
| | | import com.tcm.training.admin.app.course.vo.AppMyHealthCourseItemVO; |
| | | import com.tcm.training.admin.common.ApiResponse; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录用户的收藏课程列表。 |
| | | */ |
| | | @GetMapping("/health-courses/favorites") |
| | | public ApiResponse<List<AppHealthCourseFavoriteItemVO>> favorites() { |
| | | return ApiResponse.ok(appHealthCourseService.favorites()); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录用户的下载记录列表。 |
| | | */ |
| | | @GetMapping("/health-course-downloads") |
| | | public ApiResponse<List<AppHealthCourseDownloadItemVO>> downloads() { |
| | | return ApiResponse.ok(appHealthCourseService.downloads()); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录用户的我的课程列表。 |
| | | */ |
| | | @GetMapping("/my-health-courses") |
| | | public ApiResponse<List<AppMyHealthCourseItemVO>> myCourses() { |
| | | return ApiResponse.ok(appHealthCourseService.myCourses()); |
| | | } |
| | | |
| | | /** |
| | | * 删除当前登录用户的会员加课课程。 |
| | | */ |
| | | @DeleteMapping("/my-health-courses/{courseId}") |
| | | public ApiResponse<Void> removeMyCourse(@PathVariable("courseId") Long courseId) { |
| | | appHealthCourseService.removeMyCourse(courseId); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录用户的我的课程详情。 |
| | | */ |
| | | @GetMapping("/my-health-courses/{courseId}") |
| | | public ApiResponse<AppMyHealthCourseDetailVO> myCourseDetail(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(appHealthCourseService.myCourseDetail(courseId)); |
| | | } |
| | | |
| | | /** |
| | | * 上报当前登录用户的我的课程播放记录。 |
| | | */ |
| | | @PostMapping("/my-health-courses/{courseId}/videos/{videoId}/play-records") |
| | | public ApiResponse<AppHealthCoursePlayRecordUploadResultVO> uploadMyCoursePlayRecord(@PathVariable("courseId") Long courseId, |
| | | @PathVariable("videoId") Long videoId, |
| | | @Valid @RequestBody AppHealthCoursePlayRecordUploadRequest request) { |
| | | return ApiResponse.ok(appHealthCourseService.uploadMyCoursePlayRecord(courseId, videoId, request)); |
| | | } |
| | | |
| | | /** |
| | | * 上报当前登录用户完成下载的课程小节。 |
| | | */ |
| | | @PostMapping("/health-course-downloads") |
| | | public ApiResponse<Void> reportDownload(@Valid @RequestBody AppHealthCourseDownloadReportRequest request) { |
| | | appHealthCourseService.reportDownload(request); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除当前登录用户的下载记录。 |
| | | */ |
| | | @DeleteMapping("/health-course-downloads") |
| | | public ApiResponse<Void> batchDeleteDownloads(@Valid @RequestBody AppHealthCourseDownloadBatchDeleteRequest request) { |
| | | appHealthCourseService.batchDeleteDownloads(request); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | |
| | | /** |
| | | * 收藏 APP 养生课程。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/favorite") |
| | | public ApiResponse<AppHealthCourseFavoriteResultVO> favorite(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(appHealthCourseService.favorite(courseId)); |
| | | } |
| | | |
| | | /** |
| | | * 取消收藏 APP 养生课程。 |
| | | */ |
| | | @DeleteMapping("/health-courses/{courseId}/favorite") |
| | | public ApiResponse<AppHealthCourseFavoriteResultVO> cancelFavorite(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(appHealthCourseService.cancelFavorite(courseId)); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消 APP 养生课程收藏。 |
| | | */ |
| | | @DeleteMapping("/health-courses/favorites") |
| | | public ApiResponse<Void> batchCancelFavorite(@Valid @RequestBody AppHealthCourseFavoriteBatchCancelRequest request) { |
| | | appHealthCourseService.batchCancelFavorite(request); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | |
| | | /** |
| | | * 购买 APP 养生课程整课。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/purchase") |
| | | public ApiResponse<AppHealthCoursePurchaseResultVO> purchaseCourse(@PathVariable("courseId") Long courseId, |
| | | @Valid @RequestBody AppHealthCoursePurchaseRequest request) { |
| | | return ApiResponse.ok(appHealthCourseService.purchaseCourse(courseId, request)); |
| | | } |
| | | |
| | | /** |
| | | * 购买 APP 养生课程小节。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/videos/{videoId}/purchase") |
| | | public ApiResponse<AppHealthCoursePurchaseResultVO> purchaseVideo(@PathVariable("courseId") Long courseId, |
| | | @PathVariable("videoId") Long videoId, |
| | | @Valid @RequestBody AppHealthCoursePurchaseRequest request) { |
| | | return ApiResponse.ok(appHealthCourseService.purchaseVideo(courseId, videoId, request)); |
| | | } |
| | | |
| | | /** |
| | | * 会员将 APP 养生课程加入我的课程。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/member-join") |
| | | public ApiResponse<Boolean> memberJoinCourse(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(Boolean.valueOf(appHealthCourseService.memberJoinCourse(courseId))); |
| | | } |
| | | |
| | | /** |
| | | * 获取 APP 养生课程主题筛选项。 |
| | | */ |
| | | @GetMapping("/health-course-themes") |