|  | @@ -1,5 +1,9 @@
 | 
											
												
													
														|  |  package com.ym.mec.biz.service.impl;
 |  |  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.client.SysUserFeignService;
 | 
											
												
													
														|  |  import com.ym.mec.auth.api.entity.SysUser;
 |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dao.*;
 |  |  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.collections.CollectionUtils;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  |  import org.jetbrains.annotations.NotNull;
 |  |  import org.jetbrains.annotations.NotNull;
 | 
											
												
													
														|  | 
 |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.http.HttpStatus;
 |  |  import org.springframework.http.HttpStatus;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
										
											
												
													
														|  | @@ -89,9 +94,15 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |      private StudentLessonExaminationDao studentLessonExaminationDao;
 |  |      private StudentLessonExaminationDao studentLessonExaminationDao;
 | 
											
												
													
														|  |      @Resource
 |  |      @Resource
 | 
											
												
													
														|  |      private StudentLessonTrainingDetailService studentLessonTrainingDetailService;
 |  |      private StudentLessonTrainingDetailService studentLessonTrainingDetailService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private StudentLessonExaminationDetailService studentLessonExaminationDetailService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      @Resource
 |  |      @Resource
 | 
											
												
													
														|  |      private ExtracurricularExercisesDao extracurricularExercisesDao;
 |  |      private ExtracurricularExercisesDao extracurricularExercisesDao;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private OssPluginContext ossPluginContext;
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public BaseDAO<Long, StudentCourseHomework> getDAO() {
 |  |      public BaseDAO<Long, StudentCourseHomework> getDAO() {
 | 
											
												
													
														|  |          return studentCourseHomeworkDao;
 |  |          return studentCourseHomeworkDao;
 | 
											
										
											
												
													
														|  | @@ -827,6 +838,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |          StudentCourseHomework studentCourseHomework = studentCourseHomeworkByCourse.get(0);
 |  |          StudentCourseHomework studentCourseHomework = studentCourseHomeworkByCourse.get(0);
 | 
											
												
													
														|  |          List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
 |  |          List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
 | 
											
												
													
														|  |              .findByStudentIdsAndCourseScheduleId(studentIds, studentCourseHomework.getCourseHomeworkId(),studentCourseHomework.getType());
 |  |              .findByStudentIdsAndCourseScheduleId(studentIds, studentCourseHomework.getCourseHomeworkId(),studentCourseHomework.getType());
 | 
											
												
													
														|  | 
 |  | +        studentLessonTrainingDetailFileJsonFormat(studentCourseHomework.getType(), studentCourseHomework.getCourseHomeworkId(), studentLessonTrainingDetails);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          if (CollectionUtils.isNotEmpty(studentLessonTrainingDetails)) {
 |  |          if (CollectionUtils.isNotEmpty(studentLessonTrainingDetails)) {
 | 
											
												
													
														|  |              //设置曲目名称
 |  |              //设置曲目名称
 | 
											
										
											
												
													
														|  | @@ -850,6 +862,49 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @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) {
 |  |      public List<StudentCourseHomework> findExtraExerciseStudentsV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query) {
 | 
											
												
													
														|  |          List<StudentCourseHomework> extraExerciseStudents = extracurricularExercisesReplyService.findExtraExerciseStudents(query);
 |  |          List<StudentCourseHomework> extraExerciseStudents = extracurricularExercisesReplyService.findExtraExerciseStudents(query);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -882,6 +937,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |                  return BaseController.failed(HttpStatus.NO_CONTENT,"作业不存在");
 |  |                  return BaseController.failed(HttpStatus.NO_CONTENT,"作业不存在");
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              courseHomeworkDetail.setSubmitTime(homework.getSubmitTime());
 |  |              courseHomeworkDetail.setSubmitTime(homework.getSubmitTime());
 | 
											
												
													
														|  | 
 |  | +            courseHomeworkDetail.setStandardFlag(homework.getStandardFlag());
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |              courseHomeworkDetail = courseHomeworkService.findCourseExtraHomeworkDetail(query.getCourseScheduleId());
 |  |              courseHomeworkDetail = courseHomeworkService.findCourseExtraHomeworkDetail(query.getCourseScheduleId());
 | 
											
												
													
														|  |              ExtracurricularExercisesReply exercisesReply = extracurricularExercisesReplyDao.getByExtraIdAndUserId(courseHomeworkDetail.getCourseHomeworkId(), query.getUserId());
 |  |              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,"作业不存在");
 |  |                  return BaseController.failed(HttpStatus.NO_CONTENT,"作业不存在");
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              courseHomeworkDetail.setSubmitTime(exercisesReply.getSubmitTime());
 |  |              courseHomeworkDetail.setSubmitTime(exercisesReply.getSubmitTime());
 | 
											
												
													
														|  | 
 |  | +            courseHomeworkDetail.setStandardFlag(exercisesReply.getStandardFlag());
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          // 获取作业信息
 |  |          // 获取作业信息
 | 
											
												
													
														|  |          List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> detailList = studentLessonTrainingDetailService.getBaseLessonTrainingDetail(
 |  |          List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> detailList = studentLessonTrainingDetailService.getBaseLessonTrainingDetail(
 | 
											
												
													
														|  |              courseHomeworkDetail.getCourseHomeworkId(), query.getType(), query.getUserId(),null);
 |  |              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);
 |  |              courseHomeworkDetail.setFinishStatus(false);
 | 
											
												
													
														|  | 
 |  | +        } else
 | 
											
												
													
														|  | 
 |  | +        if( courseHomeworkDetail.getStandardFlag().equals(StandardEnum.STANDARD) || courseHomeworkDetail.getStandardFlag().equals(StandardEnum.EXCELLENT)) {
 | 
											
												
													
														|  | 
 |  | +            courseHomeworkDetail.setFinishStatus(true);
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |              courseHomeworkDetail.setFinishStatus(true);
 |  |              courseHomeworkDetail.setFinishStatus(true);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        courseHomeworkDetail.setTrainingDetailList(detailList);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isNotEmpty(detailList)) {
 | 
											
												
													
														|  | 
 |  | +            //设置训练说明
 | 
											
												
													
														|  | 
 |  | +            courseHomeworkDetail.setMemo(detailList.get(0).getMemo());
 | 
											
												
													
														|  | 
 |  | +            // 过滤 描述 类的作业
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            courseHomeworkDetail.setTrainingDetailList(detailList);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return BaseController.succeed(courseHomeworkDetail);
 |  |          return BaseController.succeed(courseHomeworkDetail);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -925,14 +990,21 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |          if (studentLessonTrainingDetail == null) {
 |  |          if (studentLessonTrainingDetail == null) {
 | 
											
												
													
														|  |              throw new BizException("练习记录不存在");
 |  |              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());
 |  |          studentLessonTrainingDetail.setUpdateTime(new Date());
 | 
											
												
													
														|  |          studentLessonTrainingDetailService.updateById(studentLessonTrainingDetail);
 |  |          studentLessonTrainingDetailService.updateById(studentLessonTrainingDetail);
 | 
											
										
											
												
													
														|  | @@ -1048,7 +1120,6 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public StudentLessonTrainingDetailWrapper.StudentLessonTraining findCourseHomeworkStudentDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
 |  |      public StudentLessonTrainingDetailWrapper.StudentLessonTraining findCourseHomeworkStudentDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId);
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          // 作业信息
 |  |          // 作业信息
 | 
											
												
													
														|  |          CourseHomeworkStudentDetailDto courseHomeworkStudentDetail = studentCourseHomeworkDao.findCourseHomeworkStudentDetail(
 |  |          CourseHomeworkStudentDetailDto courseHomeworkStudentDetail = studentCourseHomeworkDao.findCourseHomeworkStudentDetail(
 | 
											
										
											
												
													
														|  | @@ -1056,13 +1127,20 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |          if (courseHomeworkStudentDetail == null) {
 |  |          if (courseHomeworkStudentDetail == null) {
 | 
											
												
													
														|  |              throw new BizException("作业不存在");
 |  |              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);
 |  |              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);
 |  |              studentLessonTraining.setFinishFlag(true);
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |              studentLessonTraining.setFinishFlag(false);
 |  |              studentLessonTraining.setFinishFlag(false);
 | 
											
										
											
												
													
														|  | @@ -1070,16 +1148,17 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          // 练习内容
 |  |          // 练习内容
 | 
											
												
													
														|  |          List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
 |  |          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);
 |  |          studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails);
 | 
											
												
													
														|  |          return studentLessonTraining;
 |  |          return studentLessonTraining;
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public StudentLessonTrainingDetailWrapper.StudentLessonTraining findExtracurricularExercisesDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
 |  |      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) {
 |  |          if (exercisesReply == null) {
 | 
											
												
													
														|  |              throw new BizException("作业不存在");
 |  |              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
 |  |      @NotNull
 | 
											
												
													
														|  |      private StudentLessonTrainingDetailWrapper.StudentLessonTraining getUserInfo(Long userId) {
 |  |      private StudentLessonTrainingDetailWrapper.StudentLessonTraining getUserInfo(Long userId) {
 | 
											
												
													
														|  |          SysUser sysUser = sysUserFeignService.queryUserById(userId.intValue());
 |  |          SysUser sysUser = sysUserFeignService.queryUserById(userId.intValue());
 |