|  | @@ -4,15 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 |  |  import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.education.base.BaseResponse;
 | 
											
												
													
														|  |  import com.ym.mec.education.base.PageResponse;
 |  |  import com.ym.mec.education.base.PageResponse;
 | 
											
												
													
														|  | -import com.ym.mec.education.entity.StudentCourseHomework;
 |  | 
 | 
											
												
													
														|  | -import com.ym.mec.education.entity.SysUser;
 |  | 
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.education.entity.*;
 | 
											
												
													
														|  |  import com.ym.mec.education.enums.ReturnCodeEnum;
 |  |  import com.ym.mec.education.enums.ReturnCodeEnum;
 | 
											
												
													
														|  |  import com.ym.mec.education.mapper.StudentCourseHomeworkMapper;
 |  |  import com.ym.mec.education.mapper.StudentCourseHomeworkMapper;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.education.req.HomeWorkDetailReq;
 | 
											
												
													
														|  |  import com.ym.mec.education.req.HomeWorkReq;
 |  |  import com.ym.mec.education.req.HomeWorkReq;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.education.resp.HomeWrokDetailResp;
 | 
											
												
													
														|  |  import com.ym.mec.education.resp.HomeWrokResp;
 |  |  import com.ym.mec.education.resp.HomeWrokResp;
 | 
											
												
													
														|  | -import com.ym.mec.education.service.IStudentCourseHomeworkService;
 |  | 
 | 
											
												
													
														|  | -import com.ym.mec.education.service.ISysUserService;
 |  | 
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.education.resp.HomeworkReplyResp;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.education.service.*;
 | 
											
												
													
														|  |  import org.springframework.beans.BeanUtils;
 |  |  import org.springframework.beans.BeanUtils;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
										
											
												
													
														|  | @@ -38,7 +40,14 @@ public class StudentCourseHomeworkServiceImpl extends ServiceImpl<StudentCourseH
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private ISysUserService sysUserService;
 |  |      private ISysUserService sysUserService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private IClassGroupService classGroupService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private IMusicGroupService musicGroupService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private IStudentCourseHomeworkReplyService studentCourseHomeworkReplyService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public PageResponse workList(HomeWorkReq req) {
 |  |      public PageResponse workList(HomeWorkReq req) {
 | 
											
										
											
												
													
														|  | @@ -87,4 +96,50 @@ public class StudentCourseHomeworkServiceImpl extends ServiceImpl<StudentCourseH
 | 
											
												
													
														|  |          response.setTotal(Math.toIntExact(homeworkIPage.getTotal()));
 |  |          response.setTotal(Math.toIntExact(homeworkIPage.getTotal()));
 | 
											
												
													
														|  |          return response;
 |  |          return response;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 查询作业详情
 | 
											
												
													
														|  | 
 |  | +     * @param req
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    @Override
 | 
											
												
													
														|  | 
 |  | +    public BaseResponse getHomeWorkDetail(HomeWorkDetailReq req) {
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        HomeWrokDetailResp resp = new HomeWrokDetailResp();
 | 
											
												
													
														|  | 
 |  | +        MusicGroup musicGroup = musicGroupService.getById(req.getMusicGroupId());
 | 
											
												
													
														|  | 
 |  | +        if(musicGroup == null){
 | 
											
												
													
														|  | 
 |  | +            return  BaseResponse.noDataExists();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        ClassGroup classGroup =  classGroupService.getById(req.getClassGroupId());
 | 
											
												
													
														|  | 
 |  | +        if(classGroup == null){
 | 
											
												
													
														|  | 
 |  | +            return  BaseResponse.noDataExists();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        StudentCourseHomework homework = this.getById(req.getWorkId());
 | 
											
												
													
														|  | 
 |  | +        if(homework == null){
 | 
											
												
													
														|  | 
 |  | +            return  BaseResponse.noDataExists();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        BeanUtils.copyProperties(homework,resp);
 | 
											
												
													
														|  | 
 |  | +        resp.setGroupName(musicGroup.getName());
 | 
											
												
													
														|  | 
 |  | +        resp.setClassName(classGroup.getName());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //回复留言
 | 
											
												
													
														|  | 
 |  | +        QueryWrapper<StudentCourseHomeworkReply> queryWrapper = new QueryWrapper<>();
 | 
											
												
													
														|  | 
 |  | +        queryWrapper.eq("student_course_homework_id_",req.getWorkId());
 | 
											
												
													
														|  | 
 |  | +        List<StudentCourseHomeworkReply> replyList = studentCourseHomeworkReplyService.list(queryWrapper);
 | 
											
												
													
														|  | 
 |  | +        List<HomeworkReplyResp> replyResps = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        if(!CollectionUtils.isEmpty(replyList)){
 | 
											
												
													
														|  | 
 |  | +            replyList.forEach(r ->{
 | 
											
												
													
														|  | 
 |  | +                HomeworkReplyResp replyResp = new HomeworkReplyResp();
 | 
											
												
													
														|  | 
 |  | +                BeanUtils.copyProperties(r,replyResp);
 | 
											
												
													
														|  | 
 |  | +                SysUser sysUser = sysUserService.getById(r.getUserId());
 | 
											
												
													
														|  | 
 |  | +                if(sysUser != null){
 | 
											
												
													
														|  | 
 |  | +                    replyResp.setName(sysUser.getRealName());
 | 
											
												
													
														|  | 
 |  | +                    replyResp.setAvatar(sysUser.getAvatar());
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                replyResps.add(replyResp);
 | 
											
												
													
														|  | 
 |  | +            });
 | 
											
												
													
														|  | 
 |  | +            resp.setHomeworkReplyList(replyResps);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return BaseResponse.success(resp);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |  }
 |  |  }
 |