|
@@ -828,6 +828,22 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
|
|
|
StudentCourseHomework studentCourseHomework = studentCourseHomeworkByCourse.get(0);
|
|
|
List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
|
|
|
.findByStudentIdsAndCourseScheduleId(studentIds, studentCourseHomework.getCourseHomeworkId(),studentCourseHomework.getType());
|
|
|
+ Date expireDate = null;
|
|
|
+ Integer fileExpireDay = null;
|
|
|
+ if (studentCourseHomework.getType() == ELessonTrainingType.HOMEWORK) {
|
|
|
+ CourseHomework courseHomework = courseHomeworkDao.get(studentCourseHomework.getCourseHomeworkId());
|
|
|
+ if (courseHomework != null) {
|
|
|
+ expireDate = courseHomework.getExpiryDate();
|
|
|
+ fileExpireDay = courseHomework.getFileExpireDay();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ExtracurricularExercises extracurricularExercises = extracurricularExercisesDao.get(studentCourseHomework.getCourseHomeworkId());
|
|
|
+ if (extracurricularExercises != null) {
|
|
|
+ expireDate = extracurricularExercises.getExpireDate();
|
|
|
+ fileExpireDay = extracurricularExercises.getFileExpireDay();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ studentLessonTrainingDetailFileJsonFormat(studentLessonTrainingDetails,expireDate,fileExpireDay);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(studentLessonTrainingDetails)) {
|
|
|
//设置曲目名称
|
|
@@ -851,6 +867,28 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
|
|
|
}
|
|
|
|
|
|
@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);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
|
|
@@ -1060,7 +1098,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(
|
|
@@ -1068,13 +1105,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);
|
|
@@ -1082,16 +1126,32 @@ 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);
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
|
|
|
studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails);
|
|
|
return studentLessonTraining;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public StudentLessonTrainingDetailWrapper.StudentLessonTraining findExtracurricularExercisesDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
|
|
|
- StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId);
|
|
|
|
|
|
|
|
|
// 作业信息
|
|
@@ -1100,23 +1160,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());
|
|
|
|
|
|
}
|
|
|
|