Browse Source

feat:服务指标预警,服务指标明细剔除未开始的课程

Joburgess 4 năm trước cách đây
mục cha
commit
0f22af9d9e

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentServeCourseDto.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
 
@@ -24,6 +25,8 @@ public class StudentServeCourseDto {
 
     private Long classGroupId;
 
+    private CourseStatusEnum status;
+
     private CourseSchedule.CourseScheduleType type;
 
     private Integer actualTeacherId;
@@ -82,6 +85,14 @@ public class StudentServeCourseDto {
         this.courseScheduleId = courseScheduleId;
     }
 
+    public CourseStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(CourseStatusEnum status) {
+        this.status = status;
+    }
+
     public GroupType getGroupType() {
         return groupType;
     }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentExtracurricularExercisesSituation.java

@@ -55,6 +55,10 @@ public class StudentExtracurricularExercisesSituation {
 
 	private String courseIds;
 
+	private String notOverCourseIds;
+
+	private Integer notOverCourseNum = 0;
+
 	public StudentExtracurricularExercisesSituation() {
 	}
 
@@ -205,6 +209,22 @@ public class StudentExtracurricularExercisesSituation {
 		return StringUtils.join(this.studentId, this.teacherId);
 	}
 
+	public String getNotOverCourseIds() {
+		return notOverCourseIds;
+	}
+
+	public void setNotOverCourseIds(String notOverCourseIds) {
+		this.notOverCourseIds = notOverCourseIds;
+	}
+
+	public Integer getNotOverCourseNum() {
+		return notOverCourseNum;
+	}
+
+	public void setNotOverCourseNum(Integer notOverCourseNum) {
+		this.notOverCourseNum = notOverCourseNum;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/StudentExtracurricularExercisesSituationService.java

@@ -47,8 +47,6 @@ public interface StudentExtracurricularExercisesSituationService extends BaseSer
      */
     PageInfo<TeacherServeDto> queryTeacherServeInfo(TeacherServeQueryInfo queryInfo);
 
-    List<Long> findTeacherRightServeIds(String monday, String sunday);
-
     /**
      * @describe 教师作业布置提醒
      * @author Joburgess

+ 24 - 26
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -369,17 +369,16 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
 			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance, null));
 
-//			Map<String, Object> params = new HashMap<>();
-//			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
-//			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-//			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
-//			params.put("organIds", organIds);
-//			params.put("monday",monDayDate.toString());
-//			params.put("sunday",sunDayDate.toString());
-//			params.put("unDone",1);
-//			params.put("rightServeIds", studentExtracurricularExercisesSituationService.findTeacherRightServeIds(monDayDate.toString(), sunDayDate.toString()));
-//			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
-//			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_SERVE_ERROR, IndexErrorType.TEACHER_SERVE_ERROR.getMsg(), serveErrTeacherNum, null));
+			Map<String, Object> params = new HashMap<>();
+			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
+			params.put("organIds", organIds);
+			params.put("monday",monDayDate.toString());
+			params.put("sunday",sunDayDate.toString());
+			params.put("unDone",1);
+			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
+			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_SERVE_ERROR, IndexErrorType.TEACHER_SERVE_ERROR.getMsg(), serveErrTeacherNum, null));
 
 			four.setNum(fourChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 			four.setResult(fourChild);
@@ -510,21 +509,20 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				flag4 = true;
 			}
 		}
-//		if(!flag4){
-//			Map<String, Object> params = new HashMap<>();
-//			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
-//			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-//			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
-//			params.put("organIds", organIds);
-//			params.put("monday",monDayDate.toString());
-//			params.put("sunday",sunDayDate.toString());
-//			params.put("unDone",1);
-//			params.put("rightServeIds", studentExtracurricularExercisesSituationService.findTeacherRightServeIds(monDayDate.toString(), sunDayDate.toString()));
-//			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
-//			if(serveErrTeacherNum > 0){
-//				flag4 = true;
-//			}
-//		}
+		if(!flag4){
+			Map<String, Object> params = new HashMap<>();
+			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
+			params.put("organIds", organIds);
+			params.put("monday",monDayDate.toString());
+			params.put("sunday",sunDayDate.toString());
+			params.put("unDone",1);
+			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
+			if(serveErrTeacherNum > 0){
+				flag4 = true;
+			}
+		}
 		resultMap.put("attendanceServe",flag4);
 
 //		SysUser sysUser = sysUserFeignService.queryUserInfo();

+ 0 - 47
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -185,10 +185,6 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 		PageInfo<TeacherServeDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
-		List<Long> rightServeIds = findTeacherRightServeIds(queryInfo.getMonday(), queryInfo.getSunday());
-		if(Objects.nonNull(queryInfo.getUnDone())){
-			params.put("rightServeIds", rightServeIds);
-		}
 
 		List<TeacherServeDto> dataList = null;
 		int count = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
@@ -210,11 +206,7 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			for (TeacherServeDto teacherServeDto : dataList) {
 				List<StudentExtracurricularExercisesSituation> tss = teacherServeMap.get(teacherServeDto.getTeacherId());
 				Set<Long> courseIds = new HashSet<>();
-				int done = 0;
 				for (StudentExtracurricularExercisesSituation ts : tss) {
-					if(!rightServeIds.contains(ts.getId())){
-						done = 1;
-					}
 					if(StringUtils.isBlank(ts.getCourseIds())){
 						continue;
 					}
@@ -222,7 +214,6 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 					courseIds.addAll(ids);
 				}
 				teacherServeDto.setHomeworkNum(courseIds.size());
-				teacherServeDto.setUnDone(done);
 				String mondayStr = DateUtil.dateToString(teacherServeDto.getMonday(), "yyyy-MM-dd");
 				if(!mondayTeacherRemindMap.containsKey(mondayStr)){
 					continue;
@@ -243,44 +234,6 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 		return pageInfo;
 	}
 
-	public List<Long> findTeacherRightServeIds(String monday, String sunday){
-		List<Long> serveIds = new ArrayList<>();
-		List<StudentExtracurricularExercisesSituation> teacherServeWithDate = studentExtracurricularExercisesSituationDao.findTeacherServeWithDate(monday, sunday, null, null);
-		if(CollectionUtils.isEmpty(teacherServeWithDate)){
-			return serveIds;
-		}
-		Set<Long> courseIds = new HashSet<>();
-		for (StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation : teacherServeWithDate) {
-			if(StringUtils.isBlank(studentExtracurricularExercisesSituation.getCourseIds())){
-				continue;
-			}
-			Set<Long> ids = Arrays.stream(studentExtracurricularExercisesSituation.getCourseIds().split(",")).map(s -> Long.valueOf(s)).collect(Collectors.toSet());
-			courseIds.addAll(ids);
-		}
-		List<CourseSchedule> courseSchedules = courseScheduleDao.findByCourseScheduleIds(new ArrayList<>(courseIds));
-		Set<Long> overCourseIds = courseSchedules.stream().filter(c->CourseStatusEnum.OVER.equals(c.getStatus())).map(CourseSchedule::getId).collect(Collectors.toSet());
-		for (StudentExtracurricularExercisesSituation sees : teacherServeWithDate) {
-			if(sees.getActualExercisesNum()>=sees.getExpectExercisesNum()){
-				serveIds.add(sees.getId());
-			}else{
-				if(StringUtils.isBlank(sees.getCourseIds())){
-					continue;
-				}
-				Set<Long> ids = Arrays.stream(sees.getCourseIds().split(",")).map(s -> Long.valueOf(s)).collect(Collectors.toSet());
-				int overCourseNum = 0;
-				for (Long courseId : ids) {
-					if(overCourseIds.contains(courseId)){
-						overCourseNum+=1;
-					}
-				}
-				if(sees.getActualExercisesNum()>=overCourseNum){
-					serveIds.add(sees.getId());
-				}
-			}
-		}
-		return serveIds;
-	}
-
 	@Override
 	public List<Map<String, Object>> findServiceStudentDetail(StudentServiceDetailQueryInfo queryInfo) {
 		PageInfo<StudentServiceDetailDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());

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

@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.TeachModeEnum;
-import com.ym.mec.biz.dal.enums.TeachTypeEnum;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.StudentServeService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.exception.BizException;
@@ -378,15 +375,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 = weekCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
+                    Map<Integer, Set<Long>> teacherNotOverCourseIds = new HashMap<>();
                     Map<Integer, Set<Long>> teacherServiceCourseIdMap = new HashMap<>();
                     for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
-                        if(musicGroupIds.contains(groupCourseInfoEntry.getKey()))
+                        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());
+
+                        if(!teacherNotOverCourseIds.containsKey(courseInfo.getActualTeacherId())){
+                            teacherNotOverCourseIds.put(courseInfo.getActualTeacherId(), new HashSet<>());
+                        }
+                        if(!CourseStatusEnum.OVER.equals(courseInfo.getStatus())){
+                            teacherNotOverCourseIds.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
+                        }
                     }
                     for (Map.Entry<Integer, Set<Long>> teacherServiceCourseIdMapEntry : teacherServiceCourseIdMap.entrySet()) {
                         StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
@@ -394,6 +400,8 @@ public class StudentServeServiceImpl implements StudentServeService {
                                 DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
                                 "HOMEWORK", StringUtils.join(teacherServiceCourseIdMapEntry.getValue(), ","));
                         studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherServiceCourseIdMapEntry.getValue().size());
+                        studentExtracurricularExercisesSituation.setNotOverCourseIds(StringUtils.join(teacherNotOverCourseIds.get(teacherServiceCourseIdMapEntry.getKey())));
+                        studentExtracurricularExercisesSituation.setNotOverCourseNum(teacherNotOverCourseIds.get(teacherServiceCourseIdMapEntry.getKey()).size());
                         results.add(studentExtracurricularExercisesSituation);
                     }
                 }
@@ -456,6 +464,10 @@ public class StudentServeServiceImpl implements StudentServeService {
                                     teacherCourseMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
                                     DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
                                     "HOMEWORK", String.valueOf(courseInfo.getCourseScheduleId()));
+                            if(!CourseStatusEnum.OVER.equals(courseInfo.getStatus())){
+                                studentExtracurricularExercisesSituation.setNotOverCourseIds(String.valueOf(courseInfo.getCourseScheduleId()));
+                                studentExtracurricularExercisesSituation.setNotOverCourseNum(1);
+                            }
                         }
                         results.add(studentExtracurricularExercisesSituation);
                     }
@@ -508,11 +520,19 @@ public class StudentServeServiceImpl implements StudentServeService {
                     }
                 }else{
                     Map<Integer, List<StudentServeCourseDto>> teacherCourseMap = weekCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getActualTeacherId));
+                    Map<Integer, Set<Long>> teacherNotOverCourseIds = new HashMap<>();
                     Map<Integer, Set<Long>> teacherServiceCourseIdMap = new HashMap<>();
                     for (Map.Entry<Integer, List<StudentServeCourseDto>> teacherCourseMapEntry : teacherCourseMap.entrySet()) {
                         StudentServeCourseDto courseInfo = teacherCourseMapEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
                         teacherServiceCourseIdMap.put(teacherCourseMapEntry.getKey(), new HashSet<>());
                         teacherServiceCourseIdMap.get(teacherCourseMapEntry.getKey()).add(courseInfo.getCourseScheduleId());
+
+                        if(!teacherNotOverCourseIds.containsKey(courseInfo.getActualTeacherId())){
+                            teacherNotOverCourseIds.put(courseInfo.getActualTeacherId(), new HashSet<>());
+                        }
+                        if(!CourseStatusEnum.OVER.equals(courseInfo.getStatus())){
+                            teacherNotOverCourseIds.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
+                        }
                     }
                     for (Map.Entry<Integer, Set<Long>> teacherServiceCourseIdMapEntry : teacherServiceCourseIdMap.entrySet()) {
                         StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
@@ -520,6 +540,8 @@ public class StudentServeServiceImpl implements StudentServeService {
                                 DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
                                 "HOMEWORK", StringUtils.join(teacherServiceCourseIdMapEntry.getValue(), ","));
                         studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherServiceCourseIdMapEntry.getValue().size());
+                        studentExtracurricularExercisesSituation.setNotOverCourseIds(StringUtils.join(teacherNotOverCourseIds.get(teacherServiceCourseIdMapEntry.getKey())));
+                        studentExtracurricularExercisesSituation.setNotOverCourseNum(teacherNotOverCourseIds.get(teacherServiceCourseIdMapEntry.getKey()).size());
                         results.add(studentExtracurricularExercisesSituation);
                     }
                 }

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

@@ -269,9 +269,9 @@
 					TRUNCATE(SUM(sees.exercises_message_num_)/SUM(sees.exercises_reply_num_)*100, 2) percent_
 				</when>
 				<otherwise>
-					SUM(sees.expect_exercises_num_) total_num_,
+					SUM(sees.expect_exercises_num_-sees.not_over_course_num_) total_num_,
 					SUM(sees.actual_exercises_num_) activate_num_,
-					TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
+					TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_-sees.not_over_course_num_)*100, 2) percent_
 				</otherwise>
 			</choose>
 		FROM student_extracurricular_exercises_situation_ sees

+ 37 - 23
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -23,6 +23,8 @@
 		<result column="last_submit_time_" property="lastSubmitTime"/>
 		<result column="serve_type_" property="serveType"/>
 		<result column="course_ids_" property="courseIds"/>
+		<result column="not_over_course_ids_" property="notOverCourseIds"/>
+		<result column="not_over_course_num_" property="notOverCourseNum"/>
 	</resultMap>
 
 	<resultMap id="StudentExercisesSituationDto" type="com.ym.mec.biz.dal.dto.StudentExercisesSituationDto" extends="StudentExtracurricularExercisesSituation">
@@ -52,21 +54,21 @@
 		INSERT INTO student_extracurricular_exercises_situation_ (id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
 		                                                          actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
 		                                                          exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
-		                                                          serve_type_,course_ids_)
+		                                                          serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_)
 		VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},
-		       #{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType},#{courseIds})
+		       #{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType},#{courseIds},#{notOverCourseIds},#{notOverCourseNum})
 	</insert>
 
 	<insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO student_extracurricular_exercises_situation_ (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
 		                                                          actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
 		                                                          exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
-		                                                          serve_type_,course_ids_)
+		                                                          serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_)
 		VALUES
 		<foreach collection="situations" item="situation" separator=",">
 			(#{situation.studentId},#{situation.weekOfYear},#{situation.monday},#{situation.sunday},#{situation.teacherId},#{situation.expectExercisesNum},
 			#{situation.actualExercisesNum},#{situation.exercisesReplyNum},#{situation.exercisesMessageNum},#{situation.exercisesMessageTimelyNum},
-			NOW(),NOW(),#{situation.lastSubmitTime},#{situation.serveType},#{situation.courseIds})
+			NOW(),NOW(),#{situation.lastSubmitTime},#{situation.serveType},#{situation.courseIds},#{situation.notOverCourseIds},#{nsituation.otOverCourseNum})
 		</foreach>
 	</insert>
 
@@ -119,6 +121,12 @@
 			<if test="courseIds!=null and courseIds!=''">
 				course_ids_=#{courseIds},
 			</if>
+			<if test="notOverCourseIds!=null and notOverCourseIds!=''">
+				not_over_course_ids_=#{notOverCourseIds},
+			</if>
+			<if test="notOverCourseNum!=null">
+				not_over_course_num_=#{notOverCourseNum},
+			</if>
 			update_time_ = #{updateTime}
 		</set> WHERE id_ = #{id}
 	</update>
@@ -166,6 +174,12 @@
 				<if test="situation.courseIds!=null">
 					course_ids_=#{situation.courseIds},
 				</if>
+				<if test="situation.notOverCourseIds!=null and situation.notOverCourseIds!=''">
+					not_over_course_ids_=#{situation.notOverCourseIds},
+				</if>
+				<if test="situation.notOverCourseNum!=null">
+					not_over_course_num_=#{situation.notOverCourseNum},
+				</if>
 				update_time_ = NOW()
 			</set> WHERE id_ = #{situation.id}
 		</foreach>
@@ -497,24 +511,6 @@
 			<if test="teacherId!=null">
 				AND sees.teacher_id_ = #{teacherId}
 			</if>
-			<if test="unDone!=null and unDone==1">
-				AND sees.expect_exercises_num_>sees.actual_exercises_num_
-				<if test="rightServeIds!=null and rightServeIds.size()>0">
-					AND sees.id_ NOT IN
-					<foreach collection="rightServeIds" item="rightServeId" open="(" close=")" separator=",">
-						#{rightServeId}
-					</foreach>
-				</if>
-			</if>
-			<if test="unDone!=null and unDone==0">
-				AND sees.expect_exercises_num_=sees.actual_exercises_num_
-				<if test="rightServeIds!=null and rightServeIds.size()>0">
-					AND sees.id_ IN
-					<foreach collection="rightServeIds" item="rightServeId" open="(" close=")" separator=",">
-						#{rightServeId}
-					</foreach>
-				</if>
-			</if>
 			<if test="reminded!=null and reminded==0">
 				AND NOT EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
 			</if>
@@ -536,7 +532,7 @@
 			su.real_name_ teacher_name_,
 			SUM(CASE sees.serve_type_ WHEN 'HOMEWORK' THEN sees.expect_exercises_num_ ELSE 0 END) homework_num_,
 			SUM(CASE sees.serve_type_ WHEN 'EXERCISE' THEN 1 ELSE 0 END) exercise_num_,
-			SUM(sees.expect_exercises_num_)>SUM(sees.actual_exercises_num_) un_done_
+			SUM( sees.expect_exercises_num_-sees.not_over_course_num_ )> SUM( sees.actual_exercises_num_ ) un_done_
 		FROM
 			student_extracurricular_exercises_situation_ sees
 			LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
@@ -544,6 +540,15 @@
 			LEFT JOIN sys_user su ON tea.id_=su.id_
 		<include refid="queryTeacherServeInfoCondition" />
 		GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_ ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
+		<if test="unDone!=null">
+			HAVING
+			<if test="unDone==1">
+				SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) &gt; SUM( sees.actual_exercises_num_ )
+			</if>
+			<if test="unDone==0">
+				SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) &lt;= SUM( sees.actual_exercises_num_ )
+			</if>
+		</if>
 		<include refid="global.limit"></include>
 	</select>
 
@@ -556,6 +561,15 @@
 				LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
 			<include refid="queryTeacherServeInfoCondition" />
 			GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_ ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
+			<if test="unDone!=null">
+				HAVING
+				<if test="unDone==1">
+					SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) &gt; SUM( sees.actual_exercises_num_ )
+				</if>
+				<if test="unDone==0">
+					SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) &lt;= SUM( sees.actual_exercises_num_ )
+				</if>
+			</if>
 		) e
 	</select>
 

+ 2 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -496,6 +496,7 @@
         <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="music_group_id_" property="musicGroupId"/>
         <result column="class_group_id_" property="classGroupId"/>
+        <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="actual_teacher_id_" property="actualTeacherId"/>
         <result column="course_start_time_" property="courseStartTime"/>
@@ -510,6 +511,7 @@
             cs.group_type_,
             cs.music_group_id_,
             cs.class_group_id_,
+            cs.status_,
             CASE cs.type_ WHEN 'TRAINING_SINGLE' THEN 'SINGLE' WHEN 'TRAINING_MIX' THEN 'MIX' ELSE cs.type_ END type_,
             cs.actual_teacher_id_,
             CONCAT(cs.class_date_, ' ', cs.start_class_time_) course_start_time_,