|
@@ -1,8 +1,7 @@
|
|
|
package com.yonge.cooleshow.student.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
-import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
+import com.microsvc.toolkit.common.webportal.exception.BizException;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.AppAuditVersionSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.PracticeTeacherSearch;
|
|
@@ -10,14 +9,9 @@ import com.yonge.cooleshow.biz.dal.entity.CourseCalendarEntity;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.CourseScheduleReplied;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.TeacherSubjectPrice;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.CourseRepliedService;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.CourseStudent;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.PianoClassVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.PracticeTeacherVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.StudentHomePage;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.*;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.TeacherFreeTimeWrapper;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.cooleshow.common.enums.YesOrNoEnum;
|
|
@@ -27,15 +21,11 @@ import io.swagger.annotations.Api;
|
|
|
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.http.HttpStatus;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-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.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -49,14 +39,16 @@ import java.util.Set;
|
|
|
@RestController
|
|
|
@RequestMapping("${app-config.url.student:}/courseSchedule")
|
|
|
public class StudentCourseScheduleController extends BaseController {
|
|
|
- @Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
+ private SysUserService sysUserService;
|
|
|
+ @Resource
|
|
|
private CourseScheduleService courseScheduleService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CourseRepliedService repliedService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private AppVersionInfoService appVersionInfoService;
|
|
|
+ @Resource
|
|
|
+ private TeacherFreeTimeService teacherFreeTimeService;
|
|
|
|
|
|
@ApiOperation("学生端-查询房间配置")
|
|
|
@GetMapping("/selectRoomConfig")
|
|
@@ -67,12 +59,7 @@ public class StudentCourseScheduleController extends BaseController {
|
|
|
@ApiOperation("学生端-我的-我的课程-陪练课")
|
|
|
@PostMapping("/queryStudentPracticeCourse")
|
|
|
public HttpResponseResult<PageInfo<MyCourseVo>> queryStudentPracticeCourse(@RequestBody MyCourseSearch search) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- search.setStudentId(user.getId());
|
|
|
+ search.setStudentId(sysUserService.getUserId());
|
|
|
IPage<MyCourseVo> pages = courseScheduleService.queryStudentPracticeCourse(PageUtil.getPage(search), search);
|
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
|
}
|
|
@@ -80,25 +67,15 @@ public class StudentCourseScheduleController extends BaseController {
|
|
|
@ApiOperation(value = "学生端-我的-我的课程-课程详情-评价陪练课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
|
@PostMapping(value = "/replied", consumes = "application/json", produces = "application/json")
|
|
|
public HttpResponseResult<Object> replied(@Validated @RequestBody CourseScheduleReplied replied) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
-
|
|
|
replied.setCourseGroupType(CourseScheduleEnum.PRACTICE.getCode());
|
|
|
- repliedService.replied(replied, sysUser);
|
|
|
+ repliedService.replied(replied, sysUserService.getUser());
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学生端-我的-我的课程-课程详情-查询陪练课评价")
|
|
|
@PostMapping(value = "/selectReplied")
|
|
|
public HttpResponseResult<CourseScheduleReplied> selectReplied(@Validated @RequestBody CourseScheduleReplied replied) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- replied.setStudentId(user.getId());
|
|
|
+ replied.setStudentId(sysUserService.getUserId());
|
|
|
replied.setCourseGroupType(CourseScheduleEnum.PRACTICE.getCode());
|
|
|
return succeed(repliedService.selectReplied(replied));
|
|
|
}
|
|
@@ -106,11 +83,7 @@ public class StudentCourseScheduleController extends BaseController {
|
|
|
@ApiOperation("学生端-课表-日历")
|
|
|
@PostMapping("/queryCourseScheduleStudent")
|
|
|
public HttpResponseResult<Set<String>> queryCourseScheduleStudent(@RequestBody MyCourseSearch search) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- search.setStudentId(user.getId());
|
|
|
+ search.setStudentId(sysUserService.getUserId());
|
|
|
return succeed(courseScheduleService.queryCourseScheduleStudent(search));
|
|
|
}
|
|
|
|
|
@@ -124,11 +97,7 @@ public class StudentCourseScheduleController extends BaseController {
|
|
|
@ApiOperation(value = "学生端-课表-日历-用户", notes = "search:{\"classDate\":\"2022-03-27\"}")
|
|
|
@PostMapping("/queryCourseTeacher")
|
|
|
public HttpResponseResult<Map<String, Object>> queryCourseTeacher(@RequestBody MyCourseSearch search) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- search.setStudentId(user.getId());
|
|
|
+ search.setStudentId(sysUserService.getUserId());
|
|
|
return succeed(courseScheduleService.queryCourseTeacher(search));
|
|
|
}
|
|
|
|
|
@@ -149,14 +118,10 @@ public class StudentCourseScheduleController extends BaseController {
|
|
|
@ApiOperation("学生-首页-直播课&视频课&最近课程")
|
|
|
@GetMapping("/queryLiveAndVideo")
|
|
|
public HttpResponseResult<StudentHomePage> queryLiveAndVideo(AppAuditVersionSearch search) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
// 检查app版本审核/正式
|
|
|
YesOrNoEnum appAuditVersion = appVersionInfoService.getAppAuditVersion(search.getPlatform(),
|
|
|
search.getVersion());
|
|
|
- return succeed(courseScheduleService.queryLiveAndVideo(user.getId(),null,appAuditVersion));
|
|
|
+ return succeed(courseScheduleService.queryLiveAndVideo(sysUserService.getUserId(),null,appAuditVersion));
|
|
|
}
|
|
|
|
|
|
@ApiImplicitParams({
|
|
@@ -181,14 +146,23 @@ public class StudentCourseScheduleController extends BaseController {
|
|
|
@ApiOperation("学生端-我的课程-琴房课列表")
|
|
|
@PostMapping("/queryPianoClass")
|
|
|
public HttpResponseResult<PageInfo<PianoClassVo>> queryPianoClass(@RequestBody MyCourseSearch search) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- search.setStudentId(user.getId());
|
|
|
+ search.setStudentId(sysUserService.getUserId());
|
|
|
IPage<PianoClassVo> pages = courseScheduleService.queryPianoClass(PageUtil.getPage(search), search);
|
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("学生端-约课-老师列表")
|
|
|
+ @PostMapping("/queryTeacherList")
|
|
|
+ public HttpResponseResult<PageInfo<PracticeTeacherVo>> queryTeacherList(@RequestBody TeacherFreeTimeWrapper.TeacherSearch query) {
|
|
|
+ //声部和课程类型必填
|
|
|
+ if (query.getSubjectId() == null) {
|
|
|
+ throw new BizException("请选择声部");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(query.getCourseType())) {
|
|
|
+ throw new BizException("请选择课程类型");
|
|
|
+ }
|
|
|
+ IPage<PracticeTeacherVo> pages = teacherFreeTimeService.queryTeacherList(PageUtil.getPage(query),query);
|
|
|
+ return succeed(PageUtil.pageInfo(pages));
|
|
|
+ }
|
|
|
}
|
|
|
|