Browse Source

feat:1、服务指标

Joburgess 4 years ago
parent
commit
3f92da46cf

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -451,5 +451,6 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      */
     CourseSchedule getStudentHistoryLastCourse(@Param("studentId") Integer studentId,
                                                @Param("monday") String monday,
+                                               @Param("groupId") String groupId,
                                                @Param("courseType")CourseSchedule.CourseScheduleType courseType);
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1943,7 +1943,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                         if (CollectionUtils.isEmpty(backTeachingTeacherIdList)) {
                             IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId().longValue());
                             if (Objects.nonNull(integerAndIntegerListDto)) {
-								backTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
+//								backTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
                             }
                         }
 

+ 27 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -328,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{
@@ -387,16 +399,21 @@ 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.SINGLE);
+                Map<String, List<StudentServeCourseDto>> groupCourseInfo = futureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
+
+                for (String groupId : groupCourseInfo.keySet()) {
+                    CourseSchedule studentHistoryLastCourse = courseScheduleStudentPaymentDao.getStudentHistoryLastCourse(studentCourseMapEntry.getKey(), monDayDate.toString(), groupId, 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;
+                    }
+                    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());

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -679,6 +679,9 @@
 		SELECT cs.* FROM course_schedule_student_payment cssp
 		LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
 		WHERE cssp.user_id_=#{studentId}
+		  <if test="groupId!=null">
+			  AND cs.music_group_id_=#{groupId}
+		  </if>
 		  AND cs.class_date_&lt;#{monday}
 		  AND cs.type_=#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		  AND (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)