Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

周箭河 4 éve
szülő
commit
ffc8df85b5

+ 26 - 45
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -370,52 +370,33 @@ public class StudentServeServiceImpl implements StudentServeService {
             Map<CourseSchedule.CourseScheduleType, List<StudentServeCourseDto>> typeCourseMap = studentCourseMapEntry.getValue().stream().collect(Collectors.groupingBy(StudentServeCourseDto::getType));
 
             if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.SINGLE)){
-
-//                List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
-//                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(),
-//                                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{
-//                    Map<String, List<StudentServeCourseDto>> groupCourseInfo = weekCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
-//                    Map<Integer, Set<Long>> teacherServiceCourseIdMap = new HashMap<>();
-//                    for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
-//                        StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
-//                        if(!teacherServiceCourseIdMap.containsKey(courseInfo.getActualTeacherId())){
-//                            teacherServiceCourseIdMap.put(courseInfo.getActualTeacherId(), new HashSet<>());
-//                        }
-//                        teacherServiceCourseIdMap.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
-//                    }
-//                    for (Map.Entry<Integer, Set<Long>> teacherServiceCourseIdMapEntry : teacherServiceCourseIdMap.entrySet()) {
-//                        StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
-//                                teacherServiceCourseIdMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
-//                                DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
-//                                "HOMEWORK", StringUtils.join(teacherServiceCourseIdMapEntry.getValue(), ","));
-//                        studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherServiceCourseIdMapEntry.getValue().size());
-//                        results.add(studentExtracurricularExercisesSituation);
-//                    }
-//                }
-
                 Set<String> musicGroupIds = noCourseStudentMusicIdsMap.get(studentCourseMapEntry.getKey());
+                if(Objects.isNull(musicGroupIds)){
+                    musicGroupIds = new HashSet<>();
+                }
+
+                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 = weekCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
+                    Map<Integer, Set<Long>> teacherServiceCourseIdMap = new HashMap<>();
+                    for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
+                        if(musicGroupIds.contains(groupCourseInfoEntry.getKey()))
+                            musicGroupIds.remove(groupCourseInfoEntry.getKey());
+                        StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
+                        if(!teacherServiceCourseIdMap.containsKey(courseInfo.getActualTeacherId())){
+                            teacherServiceCourseIdMap.put(courseInfo.getActualTeacherId(), new HashSet<>());
+                        }
+                        teacherServiceCourseIdMap.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
+                    }
+                    for (Map.Entry<Integer, Set<Long>> teacherServiceCourseIdMapEntry : teacherServiceCourseIdMap.entrySet()) {
+                        StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
+                                teacherServiceCourseIdMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
+                                DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
+                                "HOMEWORK", StringUtils.join(teacherServiceCourseIdMapEntry.getValue(), ","));
+                        studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherServiceCourseIdMapEntry.getValue().size());
+                        results.add(studentExtracurricularExercisesSituation);
+                    }
+                }
                 if(CollectionUtils.isEmpty(musicGroupIds)){
                     continue;
                 }

+ 7 - 5
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -155,6 +155,7 @@
 				 WHERE
 					 mg.status_ IN ( 'PREPARE', 'PROGRESS' )
 				   AND sr.music_group_status_ = 'NORMAL'
+				   AND DATE_FORMAT(sr.create_time_, '%Y-%m-%d')&lt;=#{dayStr}
 			 ) UNION
 			(
 			 SELECT DISTINCT
@@ -167,13 +168,13 @@
 			   AND ( cs.is_lock_ = 0 OR cs.is_lock_ IS NULL )
 			   AND ( cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_ )
 			   AND cs.organ_id_ IS NOT NULL
+			   AND DATE_FORMAT(cssp.create_time_, '%Y-%m-%d')&lt;=#{dayStr}
 			)) u
 			LEFT JOIN sys_user su ON u.user_id_ = su.id_
 		WHERE
 			del_flag_=0
 		  	AND organ_id_ IS NOT NULL
 			AND user_type_ LIKE '%STUDENT%'
-		  	AND DATE_FORMAT(create_time_, '%Y-%m-%d')&lt;=#{dayStr}
 		GROUP BY organ_id_
 		ORDER BY organ_id_;
 	</select>
@@ -357,7 +358,7 @@
 			AND m.group_type_ IN ('VIP', 'PRACTICE')
 			AND m.status_ = 'NOT_START'
 			<if test="dayStr!=null and dayStr!=''">
-				AND (DATE_FORMAT(m.create_time_, '%Y-%m-%d') &lt;= #{dayStr} OR YEAR(m.create_time_)=3000)
+				AND (DATE_FORMAT(s.create_time_, '%Y-%m-%d') &lt;= #{dayStr} OR YEAR(m.create_time_)=3000)
 			</if>
 		GROUP BY
 			su.organ_id_
@@ -564,12 +565,12 @@
 			LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND sa.user_id_ = cssp.user_id_
 			LEFT JOIN student_visit sv ON cssp.id_ = sv.object_id_
 		WHERE
-				cs.status_ = 'OVER' AND sv.id_ IS NULL
+				cs.status_ = 'OVER' AND sv.id_ IS NULL AND cs.del_flag_ = 0
 			<if test="type!=null and type=='LEAVE'">
 				AND sa.status_ = 'LEAVE'
 			</if>
 			<if test="type!=null and type=='TRUANT'">
-				AND (sa.status_ = 'TRUANT' OR sa.id_ IS NULL)
+				AND (sa.status_ = 'TRUANT' OR sa.id_ IS NULL) AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
 			</if>
 			<if test="firstDayOfMonth != null">
 				AND cs.class_date_ >= DATE_FORMAT(#{firstDayOfMonth},'%Y-%m-%d')
@@ -584,7 +585,7 @@
     <select id="getAttendanceError" resultType="java.lang.Long">
 		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
 		LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
-		WHERE (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0) AND cs.status_ = 'OVER'
+		WHERE (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0) AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
 		AND (ta.sign_in_time_ IS NOT NULL OR ta.sign_out_time_ IS NOT NULL) AND ta.dispose_content_ IS NULL
 		<if test="organIds != null and organIds != ''">
 			AND FIND_IN_SET(cs.organ_id_,#{organIds})
@@ -597,6 +598,7 @@
 		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
 		LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
 		WHERE ta.sign_in_time_ IS NULL AND cs.status_ = 'OVER' AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL
+		AND cs.del_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
 		<if test="organIds != null and organIds != ''">
 			AND FIND_IN_SET(cs.organ_id_,#{organIds})
 		</if>

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -387,7 +387,8 @@
 	<select id="queryNoPaymentTotalAmount" resultType="java.util.Map">
 		SELECT mgpcd.user_id_ 'key',SUM(mgpcd.expect_amount_) 'value' FROM music_group_payment_calender_detail mgpcd
 		LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
-		WHERE mgpc.batch_no_ IS NULL AND mgpcd.payment_status_ = 'NON_PAYMENT' AND mgpc.music_group_id_ = #{musicGroupId} AND mgpc.status_ IN ('OPEN','OVER','PAID')
+		WHERE mgpc.batch_no_ IS NOT NULL AND mgpcd.payment_status_ = 'NON_PAYMENT'
+		AND mgpc.music_group_id_ = #{musicGroupId} AND mgpc.status_ IN ('OPEN','OVER','PAID')
 		GROUP BY mgpcd.user_id_
 	</select>