|
@@ -106,7 +106,7 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
dataList = baseMapper.queryPage(params);
|
|
|
if(queryInfo.getLessonExaminationId() != null){
|
|
|
- Map<Integer, StudentLessonExaminationDetail> examinationIdMap = new HashMap<>();
|
|
|
+ Map<Integer, List<StudentLessonExaminationDetail>> examinationIdMap = new HashMap<>();
|
|
|
LessonExamination lessonExamination = lessonExaminationService.getById(queryInfo.getLessonExaminationId());
|
|
|
if(queryInfo.getLessonExaminationId() != null && lessonExamination !=null){
|
|
|
List<StudentLessonExaminationDetail> list = studentLessonExaminationDetailService.lambdaQuery().
|
|
@@ -119,32 +119,37 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
|
|
|
musicScoreMap = musicScores.stream().collect(Collectors.toMap(SysMusicScore::getId, e -> e));
|
|
|
}
|
|
|
}
|
|
|
- examinationIdMap = list.stream().collect(Collectors.groupingBy(StudentLessonExaminationDetail::getUserId,
|
|
|
- Collectors.collectingAndThen(Collectors.toList(), e -> e.get(0))));
|
|
|
+ examinationIdMap = list.stream().collect(Collectors.groupingBy(StudentLessonExaminationDetail::getUserId, Collectors.toList()));
|
|
|
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 ) {
|
|
|
- String fileJson1 = detail.getFileJson();
|
|
|
- detail.setFileJson(null);
|
|
|
- StudentLessonExaminationDetailDto detailDto = JSON.parseObject(JSON.toJSONString(detail), StudentLessonExaminationDetailDto.class);
|
|
|
- detailDto.setFileJson(JSON.parseArray(fileJson1, CourseHomeworkWrapper.FileJson.class));
|
|
|
- if(detail.getMusicScoreId() != null && "MUSIC_SCORE".equals(detail.getHomeworkType())){
|
|
|
- SysMusicScore musicScore = musicScoreMap.get(detail.getMusicScoreId().intValue());
|
|
|
- if (musicScore != null){
|
|
|
- detailDto.setMusicScoreName(musicScore.getName());
|
|
|
+ List<StudentLessonExaminationDetail> detailList = examinationIdMap.get(dto.getUserId());
|
|
|
+ if (CollectionUtils.isNotEmpty(detailList)) {
|
|
|
+ List<StudentLessonExaminationDetailDto> studentLessonExaminationDetailList = new ArrayList<>();
|
|
|
+ for (StudentLessonExaminationDetail detail : detailList) {
|
|
|
+ dto.setMemo(detail.getMemo());
|
|
|
+ String fileJson1 = detail.getFileJson();
|
|
|
+ detail.setFileJson(null);
|
|
|
+ StudentLessonExaminationDetailDto detailDto = JSON.parseObject(JSON.toJSONString(detail), StudentLessonExaminationDetailDto.class);
|
|
|
+ if (detail.getMusicScoreId() != null && "MUSIC_SCORE".equals(detail.getHomeworkType())) {
|
|
|
+ SysMusicScore musicScore = musicScoreMap.get(detail.getMusicScoreId().intValue());
|
|
|
+ if (musicScore != null) {
|
|
|
+ detailDto.setMusicScoreName(musicScore.getName());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(detailDto.getFileJson())) {
|
|
|
- for (CourseHomeworkWrapper.FileJson fileJson : detailDto.getFileJson()) {
|
|
|
- fileJson.setExpireFlag(expireFlag);
|
|
|
+ if (StringUtils.isNotEmpty(fileJson1)) {
|
|
|
+ detailDto.setFileJson(JSON.parseArray(fileJson1, CourseHomeworkWrapper.FileJson.class));
|
|
|
+ if (CollectionUtils.isNotEmpty(detailDto.getFileJson())) {
|
|
|
+ for (CourseHomeworkWrapper.FileJson fileJson : detailDto.getFileJson()) {
|
|
|
+ fileJson.setExpireFlag(expireFlag);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ studentLessonExaminationDetailList.add(detailDto);
|
|
|
}
|
|
|
- dto.setStudentLessonExaminationDetail(detailDto);
|
|
|
- dto.setMemo(detailDto.getMemo());
|
|
|
+ dto.setStudentLessonExaminationDetailList(studentLessonExaminationDetailList);
|
|
|
}
|
|
|
}
|
|
|
}
|