| 
					
				 | 
			
			
				@@ -129,6 +129,9 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private StudentLessonTrainingDetailService studentLessonTrainingDetailService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ExtracurricularExercisesDao extracurricularExercisesDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public BaseDAO<Long, StudentCourseHomework> getDAO() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return studentCourseHomeworkDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -434,18 +437,25 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 乐团信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 乐团信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, MusicGroup> musicGroupMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<String> musicGroupIds = dataList.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<MusicGroup> musicGroups = musicGroupService.queryListByIds(new HashSet<>(musicGroupIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, MusicGroup> musicGroupMap = musicGroups.stream().collect(Collectors.toMap(MusicGroup::getId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!CollectionUtils.isEmpty(musicGroupIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<MusicGroup> musicGroups = musicGroupService.queryListByIds(new HashSet<>(musicGroupIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            musicGroupMap = musicGroups.stream().collect(Collectors.toMap(MusicGroup::getId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 班级名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Integer> classIds = dataList.stream().map(e -> e.getClassGroupId()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, ClassGroup> classGroupMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!CollectionUtils.isEmpty(classIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ClassGroup> classGroups = classGroupDao.queryByIds(classIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ClassGroup> classGroups = classGroupDao.queryByIds(classIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer, ClassGroup> classGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (StudentHomeworkRecordDto studentHomeworkRecordDto : dataList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 乐团信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -462,11 +472,16 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 设置完成状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (studentHomeworkRecordDto.getStatus() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentHomeworkRecordDto.getStandardFlag() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentHomeworkRecordDto.setFinishStatus(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentHomeworkRecordDto.getStandardFlag().equals(StandardEnum.STANDARD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || studentHomeworkRecordDto.getStandardFlag().equals(StandardEnum.EXCELLENT)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentHomeworkRecordDto.setFinishStatus(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentHomeworkRecordDto.setFinishStatus(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentHomeworkRecordDto.setType(ELessonTrainingType.HOMEWORK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pageInfo.setRows(dataList); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -775,7 +790,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return studentCourseHomeworkByCourse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 转map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer, Student> studentMap = students.stream().collect(Collectors.toMap(Student::getId, s -> s, (s1, s2) -> s1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, Student> studentMap = students.stream().collect(Collectors.toMap(Student::getUserId, s -> s, (s1, s2) -> s1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (StudentCourseHomework studentCourseHomework : studentCourseHomeworkByCourse) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (studentMap.containsKey(studentCourseHomework.getUserId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Student student = studentMap.get(studentCourseHomework.getUserId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -868,7 +883,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public CourseHomeworkWrapper.CourseHomeworkList findStudentHomeworkRecordDetail(CourseHomeworkWrapper.StudentCourseHomeworkQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         CourseHomeworkWrapper.CourseHomeworkList courseHomeworkDetail = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (ELessonTrainingType.HOMEWORK.equals(query)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ELessonTrainingType.HOMEWORK.equals(query.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail= courseHomeworkService.findCourseHomeworkDetail( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 query.getCourseScheduleId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -899,10 +914,108 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param record 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean addStudentHomeworkRecord(CourseHomeworkWrapper.AddStudentHomeworkRecord record) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StudentLessonTrainingDetail studentLessonTrainingDetail = studentLessonTrainingDetailService.getById(record.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (studentLessonTrainingDetail == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("练习记录不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 设置个人作业练习详情记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTrainingDetail.setTrainingTimes(studentLessonTrainingDetail.getTrainingTimes() +1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (studentLessonTrainingDetail.getTrainingTimes() >= studentLessonTrainingDetail.getTimes()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentLessonTrainingDetail.setTrainingStatus(StandardEnum.STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentLessonTrainingDetail.setTrainingStatus(StandardEnum.NOT_STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTrainingDetail.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTrainingDetailService.updateById(studentLessonTrainingDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 查询当前作业的其他作业,判断是否全部完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<StudentLessonTrainingDetail> list = studentLessonTrainingDetailService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                   .eq(StudentLessonTrainingDetail::getCourseHomeworkId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       studentLessonTrainingDetail.getCourseHomeworkId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                   .eq(StudentLessonTrainingDetail::getUserId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       record.getUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                   .eq(StudentLessonTrainingDetail::getType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       studentLessonTrainingDetail.getType()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                   .in(StudentLessonTrainingDetail::getTrainingStatus, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       StandardEnum.NOT_START, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                       StandardEnum.NOT_STANDARD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                   .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!CollectionUtils.isEmpty(list)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 设置个人作业练习记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (studentLessonTrainingDetail.getType().equals(ELessonTrainingType.HOMEWORK)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            StudentCourseHomework studentCourseHomework = studentCourseHomeworkDao.getHomeworkByUserIdAndCourseHomeworkId( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                record.getUserId(), studentLessonTrainingDetail.getCourseHomeworkId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentCourseHomework == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("学生作业记录不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentCourseHomework.getStandardFlag() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentCourseHomework.getStandardFlag().equals(StandardEnum.STANDARD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || studentCourseHomework.getStandardFlag().equals(StandardEnum.EXCELLENT)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 设置作业完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentCourseHomework.setStandardFlag(StandardEnum.STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentCourseHomework.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentCourseHomework.setSubmitTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentCourseHomeworkDao.update(studentCourseHomework); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 添加完成人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CourseHomework courseHomework = courseHomeworkDao.get(studentLessonTrainingDetail.getCourseHomeworkId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (courseHomework == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("课程作业不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (courseHomework.getExpiryDate().compareTo(new Date()) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("作业已截止"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            courseHomeworkDao.updateFinishNum(studentLessonTrainingDetail.getCourseHomeworkId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ExtracurricularExercisesReply exercisesReply = extracurricularExercisesReplyDao.getByExtraIdAndUserId( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.getCourseHomeworkId(), record.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (exercisesReply == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("学生作业记录不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (exercisesReply.getStandardFlag() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (exercisesReply.getStandardFlag().equals(StandardEnum.STANDARD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || exercisesReply.getStandardFlag().equals(StandardEnum.EXCELLENT)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 设置作业完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            exercisesReply.setStandardFlag(StandardEnum.STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            exercisesReply.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            exercisesReply.setSubmitTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            extracurricularExercisesReplyDao.update(exercisesReply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 添加完成人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ExtracurricularExercises extracurricularExercises = extracurricularExercisesDao.get(studentLessonTrainingDetail.getCourseHomeworkId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (extracurricularExercises == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("课外作业不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (extracurricularExercises.getExpireDate().compareTo(new Date()) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("作业已截止"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            extracurricularExercisesDao.updateFinishNum(studentLessonTrainingDetail.getCourseHomeworkId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 老师查看学生作业练习详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 |