|  | @@ -1,8 +1,6 @@
 | 
											
												
													
														|  |  package com.yonge.cooleshow.teacher.controller;
 |  |  package com.yonge.cooleshow.teacher.controller;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 |  |  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.yonge.cooleshow.biz.dal.dto.CourseHomeworkReviewDto;
 |  |  import com.yonge.cooleshow.biz.dal.dto.CourseHomeworkReviewDto;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.dto.CourseHomeworkSaveDto;
 |  |  import com.yonge.cooleshow.biz.dal.dto.CourseHomeworkSaveDto;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.dto.CourseScheduleHomeworkSearch;
 |  |  import com.yonge.cooleshow.biz.dal.dto.CourseScheduleHomeworkSearch;
 | 
											
										
											
												
													
														|  | @@ -12,6 +10,7 @@ import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.service.CourseHomeworkService;
 |  |  import com.yonge.cooleshow.biz.dal.service.CourseHomeworkService;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
 |  |  import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 |  |  import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 | 
											
												
													
														|  | 
 |  | +import com.yonge.cooleshow.biz.dal.service.SysUserService;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.vo.CountVo;
 |  |  import com.yonge.cooleshow.biz.dal.vo.CountVo;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkDetailVo;
 |  |  import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkDetailVo;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo;
 |  |  import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo;
 | 
											
										
											
												
													
														|  | @@ -25,14 +24,9 @@ import io.swagger.annotations.Api;
 | 
											
												
													
														|  |  import io.swagger.annotations.ApiOperation;
 |  |  import io.swagger.annotations.ApiOperation;
 | 
											
												
													
														|  |  import io.swagger.annotations.ApiParam;
 |  |  import io.swagger.annotations.ApiParam;
 | 
											
												
													
														|  |  import org.apache.commons.collections.CollectionUtils;
 |  |  import org.apache.commons.collections.CollectionUtils;
 | 
											
												
													
														|  | -import org.springframework.beans.factory.annotation.Autowired;
 |  | 
 | 
											
												
													
														|  | -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.RestController;
 |  | 
 | 
											
												
													
														|  | 
 |  | +import org.springframework.web.bind.annotation.*;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +import javax.annotation.Resource;
 | 
											
												
													
														|  |  import javax.validation.Valid;
 |  |  import javax.validation.Valid;
 | 
											
												
													
														|  |  import java.util.ArrayList;
 |  |  import java.util.ArrayList;
 | 
											
												
													
														|  |  import java.util.List;
 |  |  import java.util.List;
 | 
											
										
											
												
													
														|  | @@ -48,28 +42,24 @@ import java.util.List;
 | 
											
												
													
														|  |  @RequestMapping("${app-config.url.teacher:}/homework")
 |  |  @RequestMapping("${app-config.url.teacher:}/homework")
 | 
											
												
													
														|  |  public class CourseHomeworkController extends BaseController {
 |  |  public class CourseHomeworkController extends BaseController {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @Autowired
 |  | 
 | 
											
												
													
														|  | -    private SysUserFeignService sysUserFeignService;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @Resource
 | 
											
												
													
														|  | 
 |  | +    private SysUserService sysUserService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @Autowired
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @Resource
 | 
											
												
													
														|  |      private CourseScheduleService courseScheduleService;
 |  |      private CourseScheduleService courseScheduleService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @Autowired
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @Resource
 | 
											
												
													
														|  |      private CourseHomeworkService courseHomeworkService;
 |  |      private CourseHomeworkService courseHomeworkService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @Autowired
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @Resource
 | 
											
												
													
														|  |      private ImGroupService imGroupService;
 |  |      private ImGroupService imGroupService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @ApiOperation(value = "未布置的课后作业数量")
 |  |      @ApiOperation(value = "未布置的课后作业数量")
 | 
											
												
													
														|  |      @GetMapping(value="/count")
 |  |      @GetMapping(value="/count")
 | 
											
												
													
														|  |      public HttpResponseResult<CountVo> countTeacherNoDecorateHomework() {
 |  |      public HttpResponseResult<CountVo> countTeacherNoDecorateHomework() {
 | 
											
												
													
														|  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 |  | 
 | 
											
												
													
														|  | -        if (sysUser == null  || sysUser.getId() == null) {
 |  | 
 | 
											
												
													
														|  | -            return failed("用户信息获取失败");
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  |          HomeworkSearch homeworkSearch = new HomeworkSearch();
 |  |          HomeworkSearch homeworkSearch = new HomeworkSearch();
 | 
											
												
													
														|  |          // 默认查当前老师,陪练课 课程状态为完成, 没有学生课程记录
 |  |          // 默认查当前老师,陪练课 课程状态为完成, 没有学生课程记录
 | 
											
												
													
														|  | -        homeworkSearch.setTeacherId(sysUser.getId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        homeworkSearch.setTeacherId(sysUserService.getUserId());
 | 
											
												
													
														|  |          homeworkSearch.setCourseStatus(CourseScheduleEnum.COMPLETE);
 |  |          homeworkSearch.setCourseStatus(CourseScheduleEnum.COMPLETE);
 | 
											
												
													
														|  |          List<CourseScheduleEnum> list = new ArrayList<>();
 |  |          List<CourseScheduleEnum> list = new ArrayList<>();
 | 
											
												
													
														|  |          list.add(CourseScheduleEnum.PIANO_ROOM_CLASS);
 |  |          list.add(CourseScheduleEnum.PIANO_ROOM_CLASS);
 | 
											
										
											
												
													
														|  | @@ -88,8 +78,7 @@ public class CourseHomeworkController extends BaseController {
 | 
											
												
													
														|  |                                                                   @PathVariable("courseId") Long courseId,
 |  |                                                                   @PathVariable("courseId") Long courseId,
 | 
											
												
													
														|  |                                                               @PathVariable("studentId") Long studentId) {
 |  |                                                               @PathVariable("studentId") Long studentId) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 |  | 
 | 
											
												
													
														|  | -        HttpResponseResult info = checkCourseSchedule(courseId,sysUser);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        HttpResponseResult info = checkCourseSchedule(courseId,sysUserService.getUserId());
 | 
											
												
													
														|  |          if (info != null) return info;
 |  |          if (info != null) return info;
 | 
											
												
													
														|  |          CourseHomeworkDetailVo detailVo = courseHomeworkService.getCourseHomeworkDetailByCourseId(courseId, studentId);
 |  |          CourseHomeworkDetailVo detailVo = courseHomeworkService.getCourseHomeworkDetailByCourseId(courseId, studentId);
 | 
											
												
													
														|  |          if (detailVo != null) {
 |  |          if (detailVo != null) {
 | 
											
										
											
												
													
														|  | @@ -103,18 +92,13 @@ public class CourseHomeworkController extends BaseController {
 | 
											
												
													
														|  |      @ApiOperation(value = "首页-我的课程-课程详情(琴房)-课后作业列表",notes = "传入课程编号ID")
 |  |      @ApiOperation(value = "首页-我的课程-课程详情(琴房)-课后作业列表",notes = "传入课程编号ID")
 | 
											
												
													
														|  |      @PostMapping(value = "/detail/list")
 |  |      @PostMapping(value = "/detail/list")
 | 
											
												
													
														|  |      public HttpResponseResult<CourseScheduleHomeworkVo> detail(@RequestBody @Valid CourseScheduleHomeworkSearch query) {
 |  |      public HttpResponseResult<CourseScheduleHomeworkVo> detail(@RequestBody @Valid CourseScheduleHomeworkSearch query) {
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 |  | 
 | 
											
												
													
														|  | -        HttpResponseResult info = checkCourseSchedule(query.getCourseId(),sysUser);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        HttpResponseResult info = checkCourseSchedule(query.getCourseId(),sysUserService.getUserId());
 | 
											
												
													
														|  |          if (info != null) return info;
 |  |          if (info != null) return info;
 | 
											
												
													
														|  |          return succeed(courseHomeworkService.getCourseHomeworkDetailByCourseId(query));
 |  |          return succeed(courseHomeworkService.getCourseHomeworkDetailByCourseId(query));
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    private HttpResponseResult checkCourseSchedule(Long courseId,SysUser sysUser) {
 |  | 
 | 
											
												
													
														|  | -        if (sysUser == null  || sysUser.getId() == null) {
 |  | 
 | 
											
												
													
														|  | -            return failed("用户信息获取失败");
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        if (!courseScheduleService.checkTeacherCourseSchedule(sysUser.getId(), courseId)) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private HttpResponseResult checkCourseSchedule(Long courseId,Long userId) {
 | 
											
												
													
														|  | 
 |  | +        if (!courseScheduleService.checkTeacherCourseSchedule(userId, courseId)) {
 | 
											
												
													
														|  |              return failed("老师只能看自己的课程详情");
 |  |              return failed("老师只能看自己的课程详情");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          return null;
 |  |          return null;
 | 
											
										
											
												
													
														|  | @@ -123,31 +107,27 @@ public class CourseHomeworkController extends BaseController {
 | 
											
												
													
														|  |      @ApiOperation(value = "陪练课-布置作业", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 |  |      @ApiOperation(value = "陪练课-布置作业", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 | 
											
												
													
														|  |      @PostMapping(value = "/decorate", consumes = "application/json", produces = "application/json")
 |  |      @PostMapping(value = "/decorate", consumes = "application/json", produces = "application/json")
 | 
											
												
													
														|  |      public HttpResponseResult<Boolean> decorateCourseHomework(@Valid @RequestBody CourseHomeworkSaveDto saveDto) {
 |  |      public HttpResponseResult<Boolean> decorateCourseHomework(@Valid @RequestBody CourseHomeworkSaveDto saveDto) {
 | 
											
												
													
														|  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 |  | 
 | 
											
												
													
														|  | -        HttpResponseResult info = checkCourseSchedule(saveDto.getCourseScheduleId(),sysUser);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Long userId = sysUserService.getUserId();
 | 
											
												
													
														|  | 
 |  | +        HttpResponseResult info = checkCourseSchedule(saveDto.getCourseScheduleId(),userId);
 | 
											
												
													
														|  |          if (info != null) return info;
 |  |          if (info != null) return info;
 | 
											
												
													
														|  | -        saveDto.setTeacherId(sysUser.getId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        saveDto.setTeacherId(userId);
 | 
											
												
													
														|  |          return succeed(courseHomeworkService.decorateCourseHomework(saveDto));
 |  |          return succeed(courseHomeworkService.decorateCourseHomework(saveDto));
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @ApiOperation(value = "陪练课-作业点评", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 |  |      @ApiOperation(value = "陪练课-作业点评", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 | 
											
												
													
														|  |      @PostMapping(value = "/review", consumes = "application/json", produces = "application/json")
 |  |      @PostMapping(value = "/review", consumes = "application/json", produces = "application/json")
 | 
											
												
													
														|  |      public HttpResponseResult<Boolean> reviewCourseHomework(@Valid @RequestBody CourseHomeworkReviewDto reviewDto) {
 |  |      public HttpResponseResult<Boolean> reviewCourseHomework(@Valid @RequestBody CourseHomeworkReviewDto reviewDto) {
 | 
											
												
													
														|  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 |  | 
 | 
											
												
													
														|  | -        HttpResponseResult info = checkCourseSchedule(reviewDto.getCourseScheduleId(),sysUser);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Long userId = sysUserService.getUserId();
 | 
											
												
													
														|  | 
 |  | +        HttpResponseResult info = checkCourseSchedule(reviewDto.getCourseScheduleId(),userId);
 | 
											
												
													
														|  |          if (info != null) return info;
 |  |          if (info != null) return info;
 | 
											
												
													
														|  | -        reviewDto.setTeacherId(sysUser.getId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        reviewDto.setTeacherId(userId);
 | 
											
												
													
														|  |          return succeed(courseHomeworkService.reviewCourseHomework(reviewDto));
 |  |          return succeed(courseHomeworkService.reviewCourseHomework(reviewDto));
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @ApiOperation(value = "课后作业-列表", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 |  |      @ApiOperation(value = "课后作业-列表", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 | 
											
												
													
														|  |      @PostMapping(value = "/list", consumes = "application/json", produces = "application/json")
 |  |      @PostMapping(value = "/list", consumes = "application/json", produces = "application/json")
 | 
											
												
													
														|  |      public HttpResponseResult<PageInfo<CourseHomeworkVo>> list(@Valid @RequestBody HomeworkSearch query) {
 |  |      public HttpResponseResult<PageInfo<CourseHomeworkVo>> list(@Valid @RequestBody HomeworkSearch query) {
 | 
											
												
													
														|  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 |  | 
 | 
											
												
													
														|  | -        if (query.getDecorate() == null) {
 |  | 
 | 
											
												
													
														|  | -            return failed("布置状态不能为空");
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        query.setTeacherId(sysUser.getId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        query.setTeacherId(sysUserService.getUserId());
 | 
											
												
													
														|  |          query.setCourseStatus(CourseScheduleEnum.COMPLETE);
 |  |          query.setCourseStatus(CourseScheduleEnum.COMPLETE);
 | 
											
												
													
														|  |          List<CourseScheduleEnum> list = new ArrayList<>();
 |  |          List<CourseScheduleEnum> list = new ArrayList<>();
 | 
											
												
													
														|  |          list.add(CourseScheduleEnum.PIANO_ROOM_CLASS);
 |  |          list.add(CourseScheduleEnum.PIANO_ROOM_CLASS);
 |