|
@@ -50,6 +50,8 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
@Autowired
|
|
|
private MusicGroupDao musicGroupDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentRegistrationDao studentRegistrationDao;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -1041,4 +1043,70 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
public void cleanStudentMember() {
|
|
|
studentDao.cleanStudentMember();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IndexBaseDto> musicGroupHomeworkStat(String musicGroupId, String startDayStr, String endDayStr) {
|
|
|
+ List<IndexBaseDto> result = new ArrayList<>();
|
|
|
+ List<StudentRegistration> musicGroupStu = studentRegistrationDao.getMusicGroupStu(musicGroupId);
|
|
|
+ List<Integer> studentIds = new ArrayList<>();
|
|
|
+ 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, null, studentIds);
|
|
|
+ d2 = studentExtracurricularExercisesSituationDao.getHomeworkData(startDayStr, endDayStr, "submit", studentIds);
|
|
|
+ d3 = studentExtracurricularExercisesSituationDao.getHomeworkData(startDayStr, endDayStr, "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.setIndexMonthData(typeDateMapEntry.getValue(), null);
|
|
|
+ result.add(indexBaseData);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<IndexBaseMonthData> musicGroupHomeworkDataDeal(List<IndexBaseMonthData> dataList, List<String> mondayDateStrs, IndexDataType dataType){
|
|
|
+ if(Objects.isNull(dataList)){
|
|
|
+ dataList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ Set<String> hasMondayDates = dataList.stream().map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ for (String mondayDate : mondayDateStrs) {
|
|
|
+ if(hasMondayDates.contains(mondayDate)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ IndexBaseMonthData indexBaseMonthData = new IndexBaseMonthData(DateUtil.stringToDate(mondayDate, "yyyy-MM-dd"), null);
|
|
|
+ indexBaseMonthData.setDataType(dataType);
|
|
|
+ indexBaseMonthData.setTotalNum(BigDecimal.ZERO);
|
|
|
+ indexBaseMonthData.setActivateNum(BigDecimal.ZERO);
|
|
|
+ indexBaseMonthData.setPercent(BigDecimal.ZERO);
|
|
|
+ indexBaseMonthData.setDataType(dataType);
|
|
|
+ dataList.add(indexBaseMonthData);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
}
|