|
@@ -447,15 +447,15 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
List<StudentExtracurricularExercisesSituation> results=new ArrayList<StudentExtracurricularExercisesSituation>();
|
|
|
|
|
|
Map<Integer,Map<Integer,Set<Long>>> studentTeacherCourseMap = new HashMap<Integer, Map<Integer,Set<Long>>>();
|
|
|
- Map<Integer,Map<Integer,Set<Long>>> studentTeacherNotOverCourseMap = new HashMap<Integer, Map<Integer,Set<Long>>>();
|
|
|
- Map<Integer,Map<Integer,Integer>> studentTeacherCourseNumMap = new HashMap<Integer, Map<Integer,Integer>>();
|
|
|
+ //Map<Integer,Map<Integer,Set<Long>>> studentTeacherNotOverCourseMap = new HashMap<Integer, Map<Integer,Set<Long>>>();
|
|
|
+ //Map<Integer,Map<Integer,Integer>> studentTeacherCourseNumMap = new HashMap<Integer, Map<Integer,Integer>>();
|
|
|
|
|
|
- Map<Integer, Set<Long>> teacherCourseMap = null;
|
|
|
- Map<Integer, Set<Long>> teacherNotOverCourseMap = null;
|
|
|
+ //Map<Integer, Set<Long>> teacherCourseMap = null;
|
|
|
+ //Map<Integer, Set<Long>> teacherNotOverCourseMap = null;
|
|
|
Integer teacherId = null;
|
|
|
- Set<Long> courseIdList = null;
|
|
|
+ //Set<Long> courseIdList = null;
|
|
|
ClassGroupTypeEnum teacherType;
|
|
|
- Map<Integer,Integer> teacherCourseNumMap = null;
|
|
|
+ //Map<Integer,Integer> teacherCourseNumMap = null;
|
|
|
List<Integer> musicGroupStudentIdList = null;
|
|
|
|
|
|
//理论上一个学生一个乐团只布置一次作业
|
|
@@ -492,30 +492,30 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- teacherCourseNumMap = studentTeacherCourseNumMap.get(studentId);
|
|
|
+ /*teacherCourseNumMap = studentTeacherCourseNumMap.get(studentId);
|
|
|
if(teacherCourseNumMap == null){
|
|
|
teacherCourseNumMap = new HashMap<Integer, Integer>();
|
|
|
}
|
|
|
teacherCourseNumMap.put(teacherId, teacherCourseNumMap.get(teacherId) == null ? 1 : teacherCourseNumMap.get(teacherId) + 1);
|
|
|
- studentTeacherCourseNumMap.put(studentId, teacherCourseNumMap);
|
|
|
+ studentTeacherCourseNumMap.put(studentId, teacherCourseNumMap);*/
|
|
|
|
|
|
//本周没有课,布置课外训练
|
|
|
- studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(studentId, teacherId,
|
|
|
+ studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(musicGroupId, studentId, teacherId,
|
|
|
nowDate.get(DateUtil.weekFields.weekOfYear()), DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(
|
|
|
sunDayDate.toString(), "yyyy-MM-dd"), "EXERCISE", null);
|
|
|
|
|
|
-
|
|
|
- studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherCourseNumMap.get(teacherId));
|
|
|
+ studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
|
|
|
+ /*studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherCourseNumMap.get(teacherId));
|
|
|
if(results.contains(studentExtracurricularExercisesSituation)){
|
|
|
results.remove(studentExtracurricularExercisesSituation);
|
|
|
- }
|
|
|
+ }*/
|
|
|
results.add(studentExtracurricularExercisesSituation);
|
|
|
}else{//如果本周有课
|
|
|
|
|
|
studentServeCourseDto = userCourseMap.get(studentId);
|
|
|
teacherId = studentServeCourseDto.getActualTeacherId();
|
|
|
|
|
|
- teacherCourseMap = studentTeacherCourseMap.get(studentId);
|
|
|
+ /*teacherCourseMap = studentTeacherCourseMap.get(studentId);
|
|
|
if(teacherCourseMap == null){
|
|
|
teacherCourseMap = new HashMap<Integer, Set<Long>>();
|
|
|
}
|
|
@@ -525,29 +525,29 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
courseIdList.add(studentServeCourseDto.getCourseScheduleId());
|
|
|
teacherCourseMap.put(teacherId, courseIdList);
|
|
|
- studentTeacherCourseMap.put(studentId, teacherCourseMap);
|
|
|
+ studentTeacherCourseMap.put(studentId, teacherCourseMap);*/
|
|
|
|
|
|
- studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(studentId, teacherId,
|
|
|
+ studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(musicGroupId, studentId, teacherId,
|
|
|
nowDate.get(DateUtil.weekFields.weekOfYear()), DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(
|
|
|
- sunDayDate.toString(), "yyyy-MM-dd"), "HOMEWORK", StringUtils.join(courseIdList, ","));
|
|
|
- studentExtracurricularExercisesSituation.setExpectExercisesNum(courseIdList.size());
|
|
|
+ sunDayDate.toString(), "yyyy-MM-dd"), "HOMEWORK", studentServeCourseDto.getCourseScheduleId() + "");
|
|
|
+ studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
|
|
|
|
|
|
- teacherNotOverCourseMap = studentTeacherNotOverCourseMap.get(studentId);
|
|
|
+ /*teacherNotOverCourseMap = studentTeacherNotOverCourseMap.get(studentId);
|
|
|
if(teacherNotOverCourseMap == null){
|
|
|
teacherNotOverCourseMap = new HashMap<Integer, Set<Long>>();
|
|
|
}
|
|
|
courseIdList = teacherNotOverCourseMap.get(teacherId);
|
|
|
if(courseIdList == null){
|
|
|
courseIdList = new HashSet<Long>();
|
|
|
- }
|
|
|
+ }*/
|
|
|
if(studentServeCourseDto.getStatus() != CourseStatusEnum.OVER){
|
|
|
- courseIdList.add(studentServeCourseDto.getCourseScheduleId());
|
|
|
- teacherNotOverCourseMap.put(teacherId, courseIdList);
|
|
|
- studentTeacherNotOverCourseMap.put(studentId, teacherCourseMap);
|
|
|
+
|
|
|
+ studentExtracurricularExercisesSituation.setNotOverCourseIds(studentServeCourseDto.getCourseScheduleId() + "");
|
|
|
+ studentExtracurricularExercisesSituation.setNotOverCourseNum(1);
|
|
|
+ //teacherNotOverCourseMap.put(teacherId, courseIdList);
|
|
|
+ //studentTeacherNotOverCourseMap.put(studentId, teacherCourseMap);
|
|
|
}
|
|
|
|
|
|
- studentExtracurricularExercisesSituation.setNotOverCourseIds(StringUtils.join(courseIdList, ","));
|
|
|
- studentExtracurricularExercisesSituation.setNotOverCourseNum(courseIdList.size());
|
|
|
if(results.contains(studentExtracurricularExercisesSituation)){
|
|
|
results.remove(studentExtracurricularExercisesSituation);
|
|
|
}
|
|
@@ -633,7 +633,11 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
|
|
|
List<ExtracurricularExercisesReply> studentAllExercises = studentExercisesMap.get(weekServiceWithStudent.getStudentId());
|
|
|
if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
|
|
|
- List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
|
|
|
+ List<ExtracurricularExercisesReply> studentExercises = studentAllExercises
|
|
|
+ .stream()
|
|
|
+ .filter(s -> (weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())
|
|
|
+ && weekServiceWithStudent.getMusicGroupId().equals(s.getExtracurricularExercises().getMusicGroupId())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(studentExercises)){
|
|
|
weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
|
|
|
long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
|
|
@@ -690,10 +694,13 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateExercisesSituation(Date date,List<Integer> studentIds, Integer teacherId) {
|
|
|
+ public void updateExercisesSituation(String musicGroupId, Date date,List<Integer> studentIds, Integer teacherId) {
|
|
|
// if(true){
|
|
|
// return;
|
|
|
// }
|
|
|
+ if(StringUtils.isBlank(musicGroupId)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
LocalDate nowDate = LocalDateTime.ofInstant(date.toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
if(Objects.isNull(date)){
|
|
|
nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
|
|
@@ -743,6 +750,10 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
if(CollectionUtils.isEmpty(weekServiceWithStudents)){
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ weekServiceWithStudents = weekServiceWithStudents.stream().filter(s -> musicGroupId.equals(s.getMusicGroupId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<StudentExtracurricularExercisesSituation> batchUpdateList = new ArrayList<StudentExtracurricularExercisesSituation>();
|
|
|
|
|
|
for (StudentExtracurricularExercisesSituation weekServiceWithStudent : weekServiceWithStudents) {
|
|
|
List<StudentServeCourseHomeworkDto> studentAllHomeworks = studentHomeworkMap.get(weekServiceWithStudent.getStudentId());
|
|
@@ -775,12 +786,14 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
weekServiceWithStudent.setExercisesMessageNum(exercisesMessageNum>weekServiceWithStudent.getActualExercisesNum()?weekServiceWithStudent.getActualExercisesNum(): (int) exercisesMessageNum);
|
|
|
weekServiceWithStudent.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>weekServiceWithStudent.getActualExercisesNum()?weekServiceWithStudent.getActualExercisesNum(): (int) exercisesMessageTimelyNum);
|
|
|
+
|
|
|
+ batchUpdateList.add(weekServiceWithStudent);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<ExtracurricularExercisesReply> studentAllExercises = studentExercisesMap.get(weekServiceWithStudent.getStudentId());
|
|
|
if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
|
|
|
- List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
|
|
|
+ List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId()) && StringUtils.equals(s.getExtracurricularExercises().getMusicGroupId(), musicGroupId)).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(studentExercises)){
|
|
|
weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
|
|
|
long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
|
|
@@ -814,10 +827,13 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
if(weekServiceWithStudent.getExercisesMessageTimelyNum()<weekServiceWithStudent.getActualExercisesNum()){
|
|
|
weekServiceWithStudent.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>weekServiceWithStudent.getActualExercisesNum()?weekServiceWithStudent.getActualExercisesNum(): (int) exercisesMessageTimelyNum);
|
|
|
}
|
|
|
+ batchUpdateList.add(weekServiceWithStudent);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- studentExtracurricularExercisesSituationDao.batchUpdate(weekServiceWithStudents);
|
|
|
+ if(batchUpdateList.size() > 0){
|
|
|
+ studentExtracurricularExercisesSituationDao.batchUpdate(batchUpdateList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|