瀏覽代碼

feat:线下课考情调整

Joburgess 4 年之前
父節點
當前提交
fd19a405c1

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -93,6 +93,17 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
                                                        @Param("groupType") String groupType);
 
     /**
+     * @describe 获取教师在指定时间的前一节课程
+     * @author Joburgess
+     * @date 2020.10.21
+     * @param startClassTime:
+     * @param teacherId:
+     * @return com.ym.mec.biz.dal.entity.CourseSchedule
+     */
+    CourseSchedule getTeacherPrevCourseWithStartTime(@Param("startClassTime") Date startClassTime,
+                                                     @Param("teacherId") Integer teacherId);
+
+    /**
      * @param musicGroupId: 乐团编号
      * @param status:       状态
      * @param userId:       用户编号

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -76,6 +76,17 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @return com.ym.mec.biz.dal.enums.YesOrNoEnum
 	 */
 	YesOrNoEnum enableOnlyNormalAttendance(Date startClassTime,Long userId,boolean checkSchool,Integer schoolId);
+
+	/**
+	 * @describe 检测是否可以忽略正常签到时间限制
+	 * @author Joburgess
+	 * @date 2020.10.21
+	 * @param startClassTime: 当前课程开始时间
+	 * @param teacherId: 当前课程上课教师编号
+	 * @param schoolId:当前课程教学点编号
+	 * @return boolean
+	 */
+	boolean enableIgnoreAttendanceTime(Date startClassTime, Integer teacherId, Integer schoolId);
 	
 	/**
 	 * 给班级加课

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

@@ -267,11 +267,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             throw new BizException("课程不存在");
         }
         if(Objects.nonNull(currentCourseDetail.getSchoolId())){
-            YesOrNoEnum yesOrNoEnum = enableOnlyNormalAttendance(currentCourseDetail.getStartClassTime(),
-                    user.getId().longValue(),
-                    true,
+            boolean enableIgnoreAttendanceTime = enableIgnoreAttendanceTime(currentCourseDetail.getStartClassTime(),
+                    user.getId(),
                     currentCourseDetail.getSchoolId().intValue());
-            currentCourseDetail.setOnlyNormal(yesOrNoEnum);
+            currentCourseDetail.setOnlyNormal(enableIgnoreAttendanceTime?YesOrNoEnum.YES:YesOrNoEnum.NO);
         }else{
             currentCourseDetail.setOnlyNormal(YesOrNoEnum.NO);
         }
@@ -418,7 +417,28 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         }
     }
 
-    @Override
+	@Override
+	public boolean enableIgnoreAttendanceTime(Date startClassTime, Integer teacherId, Integer schoolId) {
+		CourseSchedule prevCourse = courseScheduleDao.getTeacherPrevCourseWithStartTime(startClassTime, teacherId);
+		if(Objects.isNull(prevCourse)){
+			return false;
+		}
+		TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(teacherId.longValue(), prevCourse.getId());
+		if(Objects.isNull(teacherAttendance)||Objects.isNull(teacherAttendance.getSignInStatus())){
+			return false;
+		}
+		if(!schoolId.equals(prevCourse.getSchoolId())){
+			return true;
+		}
+		int hoursBetween = DateUtil.hoursBetween(prevCourse.getStartClassTime(), startClassTime);
+		if(hoursBetween>1){
+			return false;
+		}else{
+			return true;
+		}
+	}
+
+	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public boolean batchAddCourseSchedule(Integer classGroupId, int coursesTimes, Date startDate, Date groupEndDate, Date groupStartDate, List<CourseTimeDto> teachingArrangementList,
 			TeachModeEnum teachMode, CourseScheduleType type, Integer schoolId, boolean isJumpHoliday) {

+ 11 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -111,6 +111,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		teacherAttendance.setClassGroupId(currentCourseDetail.getClassId());
 		teacherAttendance.setRemark(teacherSignOutDto.getTeacherAttendanceInfo().getRemark());
 		int advanceSignMinutes = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_IN_MINUTES));
+		int offlineSignInEarlyForwardTime = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME));
 
 		CourseSchedule courseSchedule = courseScheduleDao.get(teacherAttendance.getCourseScheduleId());
 		teacherAttendance.setGroupType(courseSchedule.getGroupType());
@@ -131,6 +132,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		Date classStartDateTime = DateUtil.stringToDate(classDate + " " + startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 		Date classEndDateTime = DateUtil.stringToDate(classDate + " " + endClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 		Date classEndDateAdd60Minutes = DateUtil.addMinutes(classEndDateTime, 180);
+		Date add60Minutes = DateUtil.addMinutes(classStartDateTime, offlineSignInEarlyForwardTime * -1);
 		Date add20Minutes = DateUtil.addMinutes(classStartDateTime, advanceSignMinutes * -1);
 		if(teacherAttendance.getSignInTime() == null && teacherSignOutDto.getTeacherAttendanceInfo().getStatus().equals(SignStatusEnum.SIGN_IN.getCode())){
 
@@ -165,24 +167,25 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 				throw new BizException("该课程已结束,不能进行签到!");
 			}
 
-			YesOrNoEnum yesOrNoEnum = YesOrNoEnum.NO;
+			boolean enableIgnoreAttendanceTime = false;
 			if(Objects.nonNull(courseSchedule.getSchoolId())){
-				yesOrNoEnum = courseScheduleService.enableOnlyNormalAttendance(currentCourseDetail.getStartClassTime(),
-						user.getId().longValue(),
-						true,
+				enableIgnoreAttendanceTime = courseScheduleService.enableIgnoreAttendanceTime(currentCourseDetail.getStartClassTime(),
+						user.getId(),
 						currentCourseDetail.getSchoolId().intValue());
 			}
 			teacherAttendance.setSignInTime(date);
 			teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
 			result.put("signInStatus",0);
-			if(yesOrNoEnum == YesOrNoEnum.YES){
-				//连堂课
-			}else if(DateUtil.minutesBetween(date,add20Minutes) >= 0){
+			if(!isInScore){
+				teacherAttendance.setSignInStatus(YesOrNoEnum.NO);
+			}else if(enableIgnoreAttendanceTime){
+				//连堂课,可忽略正常时间签到范围
+			}else if(date.compareTo(add20Minutes) <= 0&&date.compareTo(add60Minutes)>=0){
 				//正常签到范围(开始前60分钟  ~  开始之前20分钟)
 				if(!isInScore){
 					teacherAttendance.setSignInStatus(YesOrNoEnum.NO);
 				}
-			}else if(DateUtil.minutesBetween(add20Minutes,date) > 0){
+			}else if(date.compareTo(add20Minutes) > 0&&date.compareTo(add60Minutes) < 0){
 				if(StringUtils.isEmpty(teacherAttendance.getRemark())&&!teacherSignOutDto.isNotRturnErrorInfo()){
 					//当前为异常签到,请填写原因!
 					result.put("status",2);

+ 32 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -437,6 +437,8 @@
         ORDER BY cs.id_
     </select>
 
+
+
     <resultMap id="studentAttendanceViewUtilEntity" type="com.ym.mec.biz.dal.dto.StudentAttendanceViewDto">
         <result property="classGroupId" column="class_group_id_"/>
         <result property="studentId" column="student_id_"/>
@@ -3244,4 +3246,34 @@
         GROUP BY cgtm.class_group_id_
     </select>
 
+    <select id="getTeacherPrevCourseWithStartTime" resultMap="CourseSchedule">
+        SELECT  cs.id_,
+                cs.music_group_id_,
+                cs.group_type_,
+                cs.class_group_id_,
+                cs.status_,
+                cs.subsidy_,
+                cs.class_date_,
+                CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
+                CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
+                cs.teacher_id_,
+                cs.actual_teacher_id_,
+                cs.create_time_,
+                cs.update_time_,
+                cs.teach_mode_,
+                cs.type_,
+                cs.name_,
+                cs.student_num_,
+                cs.leave_student_num_,
+                cs.teaching_content_,
+                cs.note_,
+                cs.schoole_id_,
+                cs.organ_id_
+        FROM course_schedule cs LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_=cs.id_
+        WHERE csts.user_id_=#{teacherId}
+        AND cs.class_date_ = DATE_FORMAT(#{startClassTime},'%Y-%m-%d')
+        AND cs.start_class_time_ &lt; DATE_FORMAT(#{startClassTime},'%H:%i:%S')
+        ORDER BY class_start_time_ DESC LIMIT 1;
+    </select>
+
 </mapper>