|
@@ -1111,4 +1111,51 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
return dataList;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IndexBaseDto> musicGroupHomeworkStatWithStu(String musicGroupId, Integer studentId, String startDayStr, String endDayStr) {
|
|
|
+ List<IndexBaseDto> result = new ArrayList<>();
|
|
|
+ List<StudentRegistration> musicGroupStu = studentRegistrationDao.getMusicGroupStu(musicGroupId);
|
|
|
+ List<Integer> studentIds = new ArrayList<>();
|
|
|
+ if(Objects.nonNull(studentId)){
|
|
|
+ studentIds.add(studentId);
|
|
|
+ }else if(!CollectionUtils.isEmpty(musicGroupStu)){
|
|
|
+ studentIds = musicGroupStu.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ LocalDate startDate = LocalDate.parse(startDayStr, DateUtil.dateFormatter);
|
|
|
+ LocalDate endDate = LocalDate.parse(endDayStr, DateUtil.dateFormatter);
|
|
|
+ List<String> mondayDateStrs = new ArrayList<>();
|
|
|
+ while (startDate.compareTo(endDate)<0){
|
|
|
+ LocalDate monDayDate = startDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
|
|
|
+ mondayDateStrs.add(monDayDate.toString());
|
|
|
+ startDate = startDate.plusDays(7);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = new HashMap<>();
|
|
|
+
|
|
|
+ List<IndexBaseMonthData> d1 = new ArrayList<>();
|
|
|
+ List<IndexBaseMonthData> d2 = new ArrayList<>();
|
|
|
+ List<IndexBaseMonthData> d3 = new ArrayList<>();
|
|
|
+ if(StringUtils.isNotBlank(musicGroupId) && !CollectionUtils.isEmpty(studentIds)){
|
|
|
+ d1 = studentExtracurricularExercisesSituationDao.getHomeworkData(startDayStr, endDayStr, musicGroupId,null, studentIds);
|
|
|
+ d2 = studentExtracurricularExercisesSituationDao.getHomeworkData(startDayStr, endDayStr, musicGroupId, "submit", studentIds);
|
|
|
+ d3 = studentExtracurricularExercisesSituationDao.getHomeworkData(startDayStr, endDayStr, musicGroupId, "comment", studentIds);
|
|
|
+ }
|
|
|
+ musicGroupHomeworkDataDeal(d1, mondayDateStrs, IndexDataType.HOMEWORK_CREATE_RATE);
|
|
|
+ typeDateMap.put(IndexDataType.HOMEWORK_CREATE_RATE, d1);
|
|
|
+
|
|
|
+ musicGroupHomeworkDataDeal(d2, mondayDateStrs, IndexDataType.HOMEWORK_SUBMIT_RATE);
|
|
|
+ typeDateMap.put(IndexDataType.HOMEWORK_SUBMIT_RATE, d2);
|
|
|
+
|
|
|
+ musicGroupHomeworkDataDeal(d3, mondayDateStrs, IndexDataType.HOMEWORK_COMMENT_RATE);
|
|
|
+ typeDateMap.put(IndexDataType.HOMEWORK_COMMENT_RATE, d3);
|
|
|
+
|
|
|
+ for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
|
|
|
+ IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
|
|
|
+ indexBaseData.setPercent(typeDateMapEntry.getValue().stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ result.add(indexBaseData);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|