|
@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
|
|
|
import com.ym.mec.biz.dal.wrapper.SchoolIndexStatWrapper;
|
|
|
import com.ym.mec.biz.service.SchoolIndexStatService;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -53,6 +54,12 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
Map<Integer, String> subjectMap = subjectDao.findBySubjectIds(subjectIdList).stream().collect(Collectors.toMap(Subject::getId, s -> s.getName(), (s1, s2) -> s1));
|
|
|
//年级分布
|
|
|
List<SchoolIndexStatWrapper.GradeDistribution> gradeDistributions = studentRegistrations.stream()
|
|
|
+ .map(e -> {
|
|
|
+ if (e.getCurrentGrade() == null) {
|
|
|
+ e.setCurrentGrade("一年级");
|
|
|
+ }
|
|
|
+ return e;
|
|
|
+ })
|
|
|
.collect(Collectors.groupingBy(
|
|
|
e -> e.getCurrentGrade(),
|
|
|
Collectors.collectingAndThen(
|
|
@@ -70,6 +77,7 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
.sorted(Comparator.comparing(SchoolIndexStatWrapper.GradeDistribution::getGrade))
|
|
|
.collect(Collectors.toList());
|
|
|
result.setGradeDistributions(gradeDistributions);
|
|
|
+
|
|
|
//声部分布
|
|
|
List<SchoolIndexStatWrapper.SubjectDistribution> subjectDistributions = studentRegistrations.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
@@ -160,6 +168,7 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
if(CollectionUtils.isEmpty(musicGroupIds)){
|
|
|
return new SchoolIndexStatWrapper.StudentAttendance();
|
|
|
}
|
|
|
+ this.setTime(queryDto);
|
|
|
//获取学员考勤数据
|
|
|
SchoolIndexStatWrapper.StudentAttendance studentAttendance = studentAttendanceDao.statCoopAttendance(musicGroupIds,queryDto);
|
|
|
if(Objects.nonNull(studentAttendance)){
|
|
@@ -182,6 +191,26 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
if(CollectionUtils.isEmpty(musicGroupIds)){
|
|
|
return new SchoolIndexStatWrapper.StudentLesson();
|
|
|
}
|
|
|
+ this.setTime(queryDto);
|
|
|
return lessonExaminationDao.schoolLessonStat(musicGroupIds,queryDto);
|
|
|
}
|
|
|
+
|
|
|
+ private void setTime(SchoolIndexStatWrapper.QueryDto queryDto){
|
|
|
+ if(StringUtils.isNotEmpty(queryDto.getPeriod())){
|
|
|
+ Date now = new Date();
|
|
|
+ if(queryDto.getPeriod().equals("week")){
|
|
|
+ queryDto.setStartTime(DateUtil.format(DateUtil.getWeekDayWithDate(now,Calendar.MONDAY),DateUtil.DEFAULT_PATTERN));
|
|
|
+ queryDto.setEndTime(DateUtil.format(DateUtil.getWeekDayWithDate(now,Calendar.SUNDAY),DateUtil.DEFAULT_PATTERN));
|
|
|
+ }
|
|
|
+ if(queryDto.getPeriod().equals("month")){
|
|
|
+ DateUtil.getFirstDayOfMonth(now);
|
|
|
+ queryDto.setStartTime(DateUtil.format(DateUtil.getFirstDayOfMonth(now),DateUtil.DEFAULT_PATTERN));
|
|
|
+ queryDto.setEndTime(DateUtil.format(DateUtil.getLastDayOfMonth(now),DateUtil.DEFAULT_PATTERN));
|
|
|
+ }
|
|
|
+ if(queryDto.getPeriod().equals("term")){
|
|
|
+ queryDto.setStartTime(DateUtil.getStartTerm(now));
|
|
|
+ queryDto.setEndTime(DateUtil.getEndTerm(now));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|