|  | @@ -107,10 +107,11 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
 | 
	
		
			
				|  |  |              dataList = baseMapper.queryPage(params);
 | 
	
		
			
				|  |  |              if(queryInfo.getLessonExaminationId() != null){
 | 
	
		
			
				|  |  |                  Map<Integer, StudentLessonExaminationDetail> examinationIdMap = new HashMap<>();
 | 
	
		
			
				|  |  | -                if(queryInfo.getLessonExaminationId() != null){
 | 
	
		
			
				|  |  | +                LessonExamination lessonExamination = lessonExaminationService.getById(queryInfo.getLessonExaminationId());
 | 
	
		
			
				|  |  | +                if(queryInfo.getLessonExaminationId() != null && lessonExamination !=null){
 | 
	
		
			
				|  |  |                      List<StudentLessonExaminationDetail> list = studentLessonExaminationDetailService.lambdaQuery().
 | 
	
		
			
				|  |  |                              eq(StudentLessonExaminationDetail::getLessonExaminationId, queryInfo.getLessonExaminationId()).list();
 | 
	
		
			
				|  |  | -                    String musicScoreIds = list.stream().filter(o-> "MUSIC_SCORE".equals(o.getType())).map(e->e.getMusicScoreId().toString()).collect(Collectors.joining(","));
 | 
	
		
			
				|  |  | +                    String musicScoreIds = list.stream().filter(o-> "MUSIC_SCORE".equals(o.getHomeworkType())).map(e->e.getMusicScoreId().toString()).collect(Collectors.joining(","));
 | 
	
		
			
				|  |  |                      Map<Integer, SysMusicScore> musicScoreMap = new HashMap<>();
 | 
	
		
			
				|  |  |                      if (StringUtils.isNotEmpty(musicScoreIds)) {
 | 
	
		
			
				|  |  |                          List<SysMusicScore> musicScores = sysMusicScoreDao.findByIds(musicScoreIds);
 | 
	
	
		
			
				|  | @@ -120,16 +121,23 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      examinationIdMap = list.stream().collect(Collectors.groupingBy(StudentLessonExaminationDetail::getUserId,
 | 
	
		
			
				|  |  |                              Collectors.collectingAndThen(Collectors.toList(), e -> e.get(0))));
 | 
	
		
			
				|  |  | +                    boolean expireFlag = false;
 | 
	
		
			
				|  |  | +                    if (lessonExamination.getFileExpireDay() != null && lessonExamination.getFileExpireDay() >0) {
 | 
	
		
			
				|  |  | +                        expireFlag = DateUtil.addDays(lessonExamination.getExpireDate(), lessonExamination.getFileExpireDay()).before(new Date());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      for (StudentLessonExaminationDto dto : dataList) {
 | 
	
		
			
				|  |  |                          StudentLessonExaminationDetail detail = examinationIdMap.get(dto.getUserId());
 | 
	
		
			
				|  |  |                          if (detail != null ) {
 | 
	
		
			
				|  |  |                              StudentLessonExaminationDetailDto detailDto = JSON.parseObject(JSON.toJSONString(detail), StudentLessonExaminationDetailDto.class);
 | 
	
		
			
				|  |  | -                            if(detail.getMusicScoreId() != null && "MUSIC_SCORE".equals(detail.getType())){
 | 
	
		
			
				|  |  | +                            if(detail.getMusicScoreId() != null && "MUSIC_SCORE".equals(detail.getHomeworkType())){
 | 
	
		
			
				|  |  |                                  SysMusicScore musicScore = musicScoreMap.get(detail.getMusicScoreId().intValue());
 | 
	
		
			
				|  |  |                                  if (musicScore != null){
 | 
	
		
			
				|  |  |                                      detailDto.setMusicScoreName(musicScore.getName());
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  | +                            if (detailDto.getFileJson() != null) {
 | 
	
		
			
				|  |  | +                                detailDto.getFileJson().setExpireFlag(expireFlag);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                              dto.setStudentLessonExaminationDetail(detailDto);
 | 
	
		
			
				|  |  |                              dto.setMemo(detailDto.getMemo());
 | 
	
		
			
				|  |  |                          }
 | 
	
	
		
			
				|  | @@ -172,27 +180,36 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
 | 
	
		
			
				|  |  |          studentLessonExamination.setTrainingTime(now);
 | 
	
		
			
				|  |  |          this.updateById(studentLessonExamination);
 | 
	
		
			
				|  |  |          //是否达标
 | 
	
		
			
				|  |  | -        if(submitDto.getScore() >= detail.getStandardScore()){
 | 
	
		
			
				|  |  | -            detail.setStandardFlag(true);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        //训练分数是否比上一次高
 | 
	
		
			
				|  |  | -        Boolean flag = submitDto.getScore() > detail.getTrainingScore();
 | 
	
		
			
				|  |  | -        if(flag){
 | 
	
		
			
				|  |  | -            detail.setTrainingScore(submitDto.getScore());
 | 
	
		
			
				|  |  | -            //计算分数
 | 
	
		
			
				|  |  | -            Double actualScore = detail.getTrainingScore() * 1D / detail.getStandardScore() * detail.getAvgScore();
 | 
	
		
			
				|  |  | -            //更新分数
 | 
	
		
			
				|  |  | -            detail.setActualAvgScore(actualScore.intValue() > detail.getAvgScore() ? detail.getAvgScore():actualScore.intValue());
 | 
	
		
			
				|  |  | +        if (submitDto.getScore() != null) {
 | 
	
		
			
				|  |  | +            if (submitDto.getScore() >= detail.getStandardScore()) {
 | 
	
		
			
				|  |  | +                detail.setStandardFlag(true);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //训练分数是否比上一次高
 | 
	
		
			
				|  |  | +            Boolean flag = submitDto.getScore() > detail.getTrainingScore();
 | 
	
		
			
				|  |  | +            if (flag) {
 | 
	
		
			
				|  |  | +                detail.setTrainingScore(submitDto.getScore());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                detail.setRecordId(submitDto.getRecordId());
 | 
	
		
			
				|  |  | +                //计算分数
 | 
	
		
			
				|  |  | +                Double actualScore = detail.getTrainingScore() * 1D / detail.getStandardScore() * detail.getAvgScore();
 | 
	
		
			
				|  |  | +                //更新分数
 | 
	
		
			
				|  |  | +                detail.setActualAvgScore(actualScore.intValue() > detail.getAvgScore() ? detail.getAvgScore() : actualScore.intValue());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //更新总分
 | 
	
		
			
				|  |  | +            if(flag){
 | 
	
		
			
				|  |  | +                baseMapper.updateTrainingScore(lessonExaminationId,userId);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //更新详情
 | 
	
		
			
				|  |  |          detail.setTrainingTime(now);
 | 
	
		
			
				|  |  | +        if (submitDto.getFileJson() != null) {
 | 
	
		
			
				|  |  | +            submitDto.getFileJson().setExpireFlag(false);
 | 
	
		
			
				|  |  | +            detail.setFileJson(JSON.toJSONString(submitDto.getFileJson()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          studentLessonExaminationDetailService.updateById(detail);
 | 
	
		
			
				|  |  |          //更新达标人数
 | 
	
		
			
				|  |  |          lessonExaminationDao.updateStandardNum(lessonExaminationId);
 | 
	
		
			
				|  |  | -        //更新总分
 | 
	
		
			
				|  |  | -        if(flag){
 | 
	
		
			
				|  |  | -            baseMapper.updateTrainingScore(lessonExaminationId,userId);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          //更新服务指标
 | 
	
		
			
				|  |  |          studentExtracurricularExercisesSituationService.updateLastSubmitTime(lessonExamination,studentLessonExamination);
 | 
	
		
			
				|  |  |      }
 |