| 
					
				 | 
			
			
				@@ -1,5 +1,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ym.mec.biz.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.google.common.collect.Lists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.microsvc.toolkit.middleware.oss.OssPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.microsvc.toolkit.middleware.oss.OssPluginService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.auth.api.client.SysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.auth.api.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.dao.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -25,6 +29,7 @@ import com.ym.mec.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jetbrains.annotations.NotNull; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.http.HttpStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -89,9 +94,15 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private StudentLessonExaminationDao studentLessonExaminationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private StudentLessonTrainingDetailService studentLessonTrainingDetailService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private StudentLessonExaminationDetailService studentLessonExaminationDetailService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ExtracurricularExercisesDao extracurricularExercisesDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private OssPluginContext ossPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public BaseDAO<Long, StudentCourseHomework> getDAO() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return studentCourseHomeworkDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -827,6 +838,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentCourseHomework studentCourseHomework = studentCourseHomeworkByCourse.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .findByStudentIdsAndCourseScheduleId(studentIds, studentCourseHomework.getCourseHomeworkId(),studentCourseHomework.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTrainingDetailFileJsonFormat(studentCourseHomework.getType(), studentCourseHomework.getCourseHomeworkId(), studentLessonTrainingDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isNotEmpty(studentLessonTrainingDetails)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //设置曲目名称 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -850,6 +862,49 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void studentLessonTrainingDetailFileJsonFormat(ELessonTrainingType type, Long homeworkId, List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date expireDate = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer fileExpireDay = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (type == ELessonTrainingType.HOMEWORK) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CourseHomework courseHomework = courseHomeworkDao.get(homeworkId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (courseHomework != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                expireDate = courseHomework.getExpiryDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                fileExpireDay = courseHomework.getFileExpireDay(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ExtracurricularExercises extracurricularExercises = extracurricularExercisesDao.get(homeworkId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (extracurricularExercises != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                expireDate = extracurricularExercises.getExpireDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                fileExpireDay = extracurricularExercises.getFileExpireDay(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTrainingDetailFileJsonFormat(studentLessonTrainingDetails, expireDate, fileExpireDay); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void studentLessonTrainingDetailFileJsonFormat(List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails, Date expireDate, Integer fileExpireDay) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean expireFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (fileExpireDay != null && fileExpireDay >0 && expireDate != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            expireFlag = DateUtil.addDays(expireDate, fileExpireDay).before(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail studentLessonTrainingDetail : studentLessonTrainingDetails) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotBlank(studentLessonTrainingDetail.getFileJsons())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<CourseHomeworkWrapper.FileJson> fileJsons = JSON.parseArray(studentLessonTrainingDetail.getFileJsons(), CourseHomeworkWrapper.FileJson.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setFileJson(fileJsons); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setFileJsons(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!CollectionUtils.isEmpty(studentLessonTrainingDetail.getFileJson())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (CourseHomeworkWrapper.FileJson fileJson : studentLessonTrainingDetail.getFileJson()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    fileJson.setExpireFlag(expireFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public List<StudentCourseHomework> findExtraExerciseStudentsV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentCourseHomework> extraExerciseStudents = extracurricularExercisesReplyService.findExtraExerciseStudents(query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -882,6 +937,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return BaseController.failed(HttpStatus.NO_CONTENT,"作业不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail.setSubmitTime(homework.getSubmitTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            courseHomeworkDetail.setStandardFlag(homework.getStandardFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail = courseHomeworkService.findCourseExtraHomeworkDetail(query.getCourseScheduleId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ExtracurricularExercisesReply exercisesReply = extracurricularExercisesReplyDao.getByExtraIdAndUserId(courseHomeworkDetail.getCourseHomeworkId(), query.getUserId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -889,19 +945,28 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return BaseController.failed(HttpStatus.NO_CONTENT,"作业不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail.setSubmitTime(exercisesReply.getSubmitTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            courseHomeworkDetail.setStandardFlag(exercisesReply.getStandardFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 获取作业信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> detailList = studentLessonTrainingDetailService.getBaseLessonTrainingDetail( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail.getCourseHomeworkId(), query.getType(), query.getUserId(),null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        long count = detailList.stream().filter(o -> o.getTrainingTimes() < o.getTimes()).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (count >0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (courseHomeworkDetail.getStandardFlag() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail.setFinishStatus(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if( courseHomeworkDetail.getStandardFlag().equals(StandardEnum.STANDARD) || courseHomeworkDetail.getStandardFlag().equals(StandardEnum.EXCELLENT)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            courseHomeworkDetail.setFinishStatus(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseHomeworkDetail.setFinishStatus(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        courseHomeworkDetail.setTrainingDetailList(detailList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(detailList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //设置训练说明 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            courseHomeworkDetail.setMemo(detailList.get(0).getMemo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 过滤 描述 类的作业 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            courseHomeworkDetail.setTrainingDetailList(detailList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return BaseController.succeed(courseHomeworkDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -925,14 +990,21 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (studentLessonTrainingDetail == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("练习记录不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 设置个人作业练习详情记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentLessonTrainingDetail.setTrainingTimes(studentLessonTrainingDetail.getTrainingTimes() +1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (record.getFileJson() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 设置个人作业练习详情记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentLessonTrainingDetail.setTrainingTimes(studentLessonTrainingDetail.getTrainingTimes() + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentLessonTrainingDetail.getTrainingTimes() >= studentLessonTrainingDetail.getTimes()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentLessonTrainingDetail.setTrainingStatus(StandardEnum.STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentLessonTrainingDetail.setTrainingStatus(StandardEnum.NOT_STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentLessonTrainingDetail.getTrainingTimes() >= studentLessonTrainingDetail.getTimes()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setTrainingStatus(StandardEnum.STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setTrainingStatus(StandardEnum.NOT_STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (studentLessonTrainingDetail.getTrainingStatus() == StandardEnum.NOT_START) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentLessonTrainingDetail.setTrainingStatus(StandardEnum.STANDARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(record.getFileJson())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentLessonTrainingDetail.setFileJson(JSON.toJSONString(record.getFileJson())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentLessonTrainingDetail.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentLessonTrainingDetailService.updateById(studentLessonTrainingDetail); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1048,7 +1120,6 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public StudentLessonTrainingDetailWrapper.StudentLessonTraining findCourseHomeworkStudentDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 作业信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         CourseHomeworkStudentDetailDto courseHomeworkStudentDetail = studentCourseHomeworkDao.findCourseHomeworkStudentDetail( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1056,13 +1127,20 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (courseHomeworkStudentDetail == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("作业不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentLessonTraining.setStandardFlag(courseHomeworkStudentDetail.getStandardFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return getStudentLessonTrainingDetails(courseHomeworkStudentDetail.getCourseHomeworkId(), userId, type, courseHomeworkStudentDetail.getStandardFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private StudentLessonTrainingDetailWrapper.StudentLessonTraining getStudentLessonTrainingDetails(Long homeworkId, Long userId, ELessonTrainingType type, StandardEnum standardFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTraining.setStandardFlag(standardFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 作业完成情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (courseHomeworkStudentDetail.getStandardFlag() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (standardFlag == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             studentLessonTraining.setFinishFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if( courseHomeworkStudentDetail.getStandardFlag().equals(StandardEnum.STANDARD) || courseHomeworkStudentDetail.getStandardFlag().equals(StandardEnum.EXCELLENT)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if( standardFlag.equals(StandardEnum.STANDARD) || standardFlag.equals(StandardEnum.EXCELLENT)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             studentLessonTraining.setFinishFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             studentLessonTraining.setFinishFlag(false); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1070,16 +1148,17 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 练习内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), courseHomeworkStudentDetail.getCourseHomeworkId(),type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), homeworkId, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentLessonTrainingDetailFileJsonFormat(type, homeworkId, studentLessonTrainingDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return studentLessonTraining; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public StudentLessonTrainingDetailWrapper.StudentLessonTraining findExtracurricularExercisesDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 作业信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1088,23 +1167,8 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (exercisesReply == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("作业不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentLessonTraining.setStandardFlag(exercisesReply.getStandardFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 作业完成情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (exercisesReply.getStandardFlag() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentLessonTraining.setFinishFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if( exercisesReply.getStandardFlag().equals(StandardEnum.STANDARD) || exercisesReply.getStandardFlag().equals(StandardEnum.EXCELLENT)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentLessonTraining.setFinishFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentLessonTraining.setFinishFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 练习内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), exercisesReply.getExtracurricularExercisesId(),type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return studentLessonTraining; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return getStudentLessonTrainingDetails(exercisesReply.getExtracurricularExercisesId(), userId, type, exercisesReply.getStandardFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1147,6 +1211,76 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 删除过期作业 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void deleteOverdueHomework() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OssPluginService pluginService = ossPluginContext.getPluginService("tencent"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 删练习作业 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<StudentLessonTrainingDetail> trainingDetails = studentLessonTrainingDetailService.queryExpired(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> delFileList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<StudentLessonTrainingDetail> updateList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (StudentLessonTrainingDetail trainingDetail : trainingDetails) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                StudentLessonTrainingDetail studentLessonTrainingDetail = new StudentLessonTrainingDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setId(trainingDetail.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setHomeworkType(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String fileJson = trainingDetail.getFileJson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<CourseHomeworkWrapper.FileJson> fileJsonList = JSON.parseArray(fileJson, CourseHomeworkWrapper.FileJson.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<String> delFiles = fileJsonList.stream().map(CourseHomeworkWrapper.FileJson::getFilePath) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .filter(StringUtils::isNotBlank) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                delFileList.addAll(delFiles); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetail.setFileDelFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateList.add(studentLessonTrainingDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!org.springframework.util.CollectionUtils.isEmpty(delFileList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<List<String>> partition = Lists.partition(delFileList, 10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (List<String> strings : partition) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pluginService.batchDeleteFile(strings); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (CollectionUtils.isNotEmpty(updateList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonTrainingDetailService.updateBatchById(updateList, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 删评测作业 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<StudentLessonExaminationDetail> studentLessonExaminationDetails = studentLessonExaminationDao.queryExpired(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> delFileList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<StudentLessonExaminationDetail> updateList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (StudentLessonExaminationDetail examinationDetail : studentLessonExaminationDetails) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                StudentLessonExaminationDetail lessonExaminationDetail = new StudentLessonExaminationDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lessonExaminationDetail.setId(examinationDetail.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String fileJson = examinationDetail.getFileJson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<CourseHomeworkWrapper.FileJson> fileJsonList = JSON.parseArray(fileJson, CourseHomeworkWrapper.FileJson.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<String> delFiles = fileJsonList.stream().map(CourseHomeworkWrapper.FileJson::getFilePath) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .filter(StringUtils::isNotBlank) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                delFileList.addAll(delFiles); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lessonExaminationDetail.setFileDelFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateList.add(lessonExaminationDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!org.springframework.util.CollectionUtils.isEmpty(delFileList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<List<String>> partition = Lists.partition(delFileList, 10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (List<String> strings : partition) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pluginService.batchDeleteFile(strings); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (CollectionUtils.isNotEmpty(updateList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentLessonExaminationDetailService.updateBatchById(updateList, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @NotNull 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private StudentLessonTrainingDetailWrapper.StudentLessonTraining getUserInfo(Long userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SysUser sysUser = sysUserFeignService.queryUserById(userId.intValue()); 
			 |