|
@@ -294,6 +294,11 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
public void exercisesSituationStatistics2(String monday, List<Integer> studentIds) {
|
|
|
LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
|
|
|
|
|
|
+ int lastWeekTodayUpdateNum = studentExtracurricularExercisesSituationDao.findLastWeekTodayUpdateNum(nowDate.plusDays(-nowDate.getDayOfWeek().getValue()).toString());
|
|
|
+ if(lastWeekTodayUpdateNum<=0){
|
|
|
+ nowDate = nowDate.plusDays(-nowDate.getDayOfWeek().getValue());
|
|
|
+ }
|
|
|
+
|
|
|
if(StringUtils.isNotBlank(monday)){
|
|
|
nowDate=LocalDate.parse(monday, DateUtil.dateFormatter);
|
|
|
}
|
|
@@ -323,12 +328,24 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
|
if(CollectionUtils.isEmpty(weekCourseInfo)){
|
|
|
Map<String, List<StudentServeCourseDto>> groupCourseInfo = futureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
|
|
|
+
|
|
|
+ Map<Integer, Integer> teacherNumMap = new HashMap<>();
|
|
|
for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
|
|
|
StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
|
|
|
+
|
|
|
+ if(!teacherNumMap.containsKey(courseInfo.getActualTeacherId())){
|
|
|
+ teacherNumMap.put(courseInfo.getActualTeacherId(), 1);
|
|
|
+ }else{
|
|
|
+ teacherNumMap.put(courseInfo.getActualTeacherId(), teacherNumMap.get(courseInfo.getActualTeacherId())+1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
|
|
|
StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
- courseInfo.getActualTeacherId(),nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
+ teacherNumMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
"EXERCISE", null);
|
|
|
+ studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
|
|
|
results.add(studentExtracurricularExercisesSituation);
|
|
|
}
|
|
|
}else{
|
|
@@ -382,16 +399,41 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
}
|
|
|
}else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.MIX)){
|
|
|
- CourseSchedule studentHistoryLastCourse = courseScheduleStudentPaymentDao.getStudentHistoryLastCourse(studentCourseMapEntry.getKey(), monDayDate.toString(), CourseSchedule.CourseScheduleType.SINGLE);
|
|
|
- StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
- Objects.isNull(studentHistoryLastCourse)?studentCourseMapEntry.getValue().get(0).getLeadTeacherId():studentHistoryLastCourse.getActualTeacherId(),
|
|
|
- nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
- DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
- "EXERCISE", null);
|
|
|
- if(Objects.isNull(studentExtracurricularExercisesSituation.getTeacherId())){
|
|
|
- continue;
|
|
|
+ List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
|
|
|
+ List<StudentServeCourseDto> weekCourseInfo = futureCourseInfo.stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
|
+ List<StudentServeCourseDto> serveCourseInfo;
|
|
|
+ if(CollectionUtils.isEmpty(weekCourseInfo)){
|
|
|
+ serveCourseInfo = futureCourseInfo;
|
|
|
+ }else{
|
|
|
+ serveCourseInfo = weekCourseInfo;
|
|
|
+ }
|
|
|
+ Map<String, List<StudentServeCourseDto>> groupCourseInfo = serveCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
|
|
|
+
|
|
|
+ Map<Integer, Integer> teacherNumMap = new HashMap<>();
|
|
|
+ for (String groupId : groupCourseInfo.keySet()) {
|
|
|
+ CourseSchedule studentHistoryLastCourse = courseScheduleStudentPaymentDao.getStudentHistoryLastCourse(studentCourseMapEntry.getKey(), monDayDate.toString(), groupId, CourseSchedule.CourseScheduleType.SINGLE);
|
|
|
+ Integer teacherId = Objects.isNull(studentHistoryLastCourse)?studentCourseMapEntry.getValue().get(0).getLeadTeacherId():studentHistoryLastCourse.getActualTeacherId();
|
|
|
+ if(Objects.isNull(teacherId)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!teacherNumMap.containsKey(teacherId)){
|
|
|
+ teacherNumMap.put(teacherId, 1);
|
|
|
+ }else{
|
|
|
+ teacherNumMap.put(teacherId, teacherNumMap.get(teacherId)+1);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
|
|
|
+ StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
+ teacherNumMapEntry.getKey(),
|
|
|
+ nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
+ DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
+ "EXERCISE", null);
|
|
|
+ studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
|
|
|
+ results.add(studentExtracurricularExercisesSituation);
|
|
|
}
|
|
|
- results.add(studentExtracurricularExercisesSituation);
|
|
|
}else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.PRACTICE)){
|
|
|
List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE);
|
|
|
List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
@@ -476,7 +518,7 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
Set<String> courseIds = Arrays.stream(weekServiceWithStudent.getCourseIds().split(",")).collect(Collectors.toSet());
|
|
|
List<StudentServeCourseHomeworkDto> studentHomeworks = studentAllHomeworks.stream().filter(s -> courseIds.contains(s.getCourseScheduleId().toString())).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(studentHomeworks)){
|
|
|
- weekServiceWithStudent.setActualExercisesNum(1);
|
|
|
+ weekServiceWithStudent.setActualExercisesNum(studentHomeworks.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentHomeworks.size());
|
|
|
long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
|
|
|
weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
|
|
|
long haveSubmitTimes = studentHomeworks.stream().filter(e -> Objects.nonNull(e.getSubmitTime())).count();
|
|
@@ -507,7 +549,7 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
|
|
|
List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(studentExercises)){
|
|
|
- weekServiceWithStudent.setActualExercisesNum(1);
|
|
|
+ weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
|
|
|
long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
|
|
|
if(weekServiceWithStudent.getExercisesReplyNum()<=0){
|
|
|
weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
|
|
@@ -608,9 +650,9 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
|
|
|
@Override
|
|
|
public void updateExercisesSituation(Date date,List<Integer> studentIds, Integer teacherId) {
|
|
|
- if(true){
|
|
|
- return;
|
|
|
- }
|
|
|
+// if(true){
|
|
|
+// return;
|
|
|
+// }
|
|
|
LocalDate nowDate = LocalDateTime.ofInstant(date.toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
if(Objects.isNull(date)){
|
|
|
nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
|
|
@@ -668,7 +710,7 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
Set<String> courseIds = Arrays.stream(weekServiceWithStudent.getCourseIds().split(",")).collect(Collectors.toSet());
|
|
|
List<StudentServeCourseHomeworkDto> studentHomeworks = studentAllHomeworks.stream().filter(s -> courseIds.contains(s.getCourseScheduleId())).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(studentHomeworks)){
|
|
|
- weekServiceWithStudent.setActualExercisesNum(1);
|
|
|
+ weekServiceWithStudent.setActualExercisesNum(studentHomeworks.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentHomeworks.size());
|
|
|
long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
|
|
|
weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
|
|
|
long haveSubmitTimes = studentHomeworks.stream().filter(e -> Objects.nonNull(e.getSubmitTime())).count();
|
|
@@ -699,7 +741,7 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
|
|
|
List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(studentExercises)){
|
|
|
- weekServiceWithStudent.setActualExercisesNum(1);
|
|
|
+ weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
|
|
|
long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
|
|
|
if(weekServiceWithStudent.getExercisesReplyNum()<=0){
|
|
|
weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
|