|
@@ -4,10 +4,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
-import com.ym.mec.biz.dal.entity.ClassGroup;
|
|
|
|
-import com.ym.mec.biz.dal.entity.CourseHomework;
|
|
|
|
-import com.ym.mec.biz.dal.entity.StudentCourseHomework;
|
|
|
|
-import com.ym.mec.biz.dal.entity.TeacherAttendance;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.dal.page.TeacherCloseQueryInfo;
|
|
import com.ym.mec.biz.dal.page.TeacherCloseQueryInfo;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.biz.service.*;
|
|
@@ -45,6 +42,8 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
@Autowired
|
|
@Autowired
|
|
private SysConfigDao sysConfigDao;
|
|
private SysConfigDao sysConfigDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
+ @Autowired
|
|
private SysMessageService sysMessageService;
|
|
private SysMessageService sysMessageService;
|
|
@Autowired
|
|
@Autowired
|
|
private ClassGroupDao classGroupDao;
|
|
private ClassGroupDao classGroupDao;
|
|
@@ -66,6 +65,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
throw new BizException("请选择课程!");
|
|
throw new BizException("请选择课程!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ SysConfig byParamName = sysConfigService.findByParamName(SysConfigService.ADVANCE_SIGN_IN_MINUTES);
|
|
|
|
+ Integer advanceSignInMinutes=Integer.parseInt(byParamName.getParanValue());
|
|
|
|
+
|
|
Map<String,Object> result=new HashMap<>();
|
|
Map<String,Object> result=new HashMap<>();
|
|
|
|
|
|
TeacherAttendance teacherAttendance=teacherAttendanceDao.findByTeacherAttendanceInfo(user.getId().longValue(),teacherSignOutDto.getTeacherAttendanceInfo().getCourseScheduleId());
|
|
TeacherAttendance teacherAttendance=teacherAttendanceDao.findByTeacherAttendanceInfo(user.getId().longValue(),teacherSignOutDto.getTeacherAttendanceInfo().getCourseScheduleId());
|
|
@@ -93,14 +95,14 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
throw new BizException("该课程已结束,不能进行签到!");
|
|
throw new BizException("该课程已结束,不能进行签到!");
|
|
}
|
|
}
|
|
|
|
|
|
- YesOrNoEnum yesOrNoEnum = courseScheduleService.enableOnlyNormalAttendance(currentCourseDetail, user.getId().longValue());
|
|
|
|
|
|
+ YesOrNoEnum yesOrNoEnum = courseScheduleService.enableOnlyNormalAttendance(currentCourseDetail, user.getId().longValue(),true);
|
|
|
|
|
|
if(yesOrNoEnum==YesOrNoEnum.YES){
|
|
if(yesOrNoEnum==YesOrNoEnum.YES){
|
|
teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
|
|
teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
|
|
result.put("signInStatus",YesOrNoEnum.YES.getCode());
|
|
result.put("signInStatus",YesOrNoEnum.YES.getCode());
|
|
}else{
|
|
}else{
|
|
Long timeGap=(date.getTime()-currentCourseDetail.getStartClassTime().getTime())/1000/60;
|
|
Long timeGap=(date.getTime()-currentCourseDetail.getStartClassTime().getTime())/1000/60;
|
|
- if(timeGap<= ParamEnum.TEACHER_ATTENDANCE_TIME_GAP.getCode()){
|
|
|
|
|
|
+ if(timeGap<= advanceSignInMinutes){
|
|
teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
|
|
teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
|
|
result.put("signInStatus",YesOrNoEnum.YES.getCode());
|
|
result.put("signInStatus",YesOrNoEnum.YES.getCode());
|
|
}else{
|
|
}else{
|
|
@@ -159,9 +161,13 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
public void addTeacherAttendanceRecord(Integer courseScheduleId, Integer userId, SignStatusEnum signStatus, boolean updateCourseScheduleStatus) {
|
|
public void addTeacherAttendanceRecord(Integer courseScheduleId, Integer userId, SignStatusEnum signStatus, boolean updateCourseScheduleStatus) {
|
|
TeacherAttendance teacherAttendance=teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(),courseScheduleId.longValue());
|
|
TeacherAttendance teacherAttendance=teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(),courseScheduleId.longValue());
|
|
ClassGroup classGroup = classGroupDao.findByCourseSchedule(courseScheduleId);
|
|
ClassGroup classGroup = classGroupDao.findByCourseSchedule(courseScheduleId);
|
|
|
|
+ CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId.longValue());
|
|
boolean isAttendance=false;
|
|
boolean isAttendance=false;
|
|
Date now=new Date();
|
|
Date now=new Date();
|
|
|
|
|
|
|
|
+ SysConfig byParamName = sysConfigService.findByParamName(SysConfigService.ADVANCE_SIGN_IN_MINUTES);
|
|
|
|
+ Integer advanceSignInMinutes=Integer.parseInt(byParamName.getParanValue());
|
|
|
|
+
|
|
if(Objects.isNull(teacherAttendance)){
|
|
if(Objects.isNull(teacherAttendance)){
|
|
teacherAttendance=new TeacherAttendance();
|
|
teacherAttendance=new TeacherAttendance();
|
|
teacherAttendance.setTeacherId(userId);
|
|
teacherAttendance.setTeacherId(userId);
|
|
@@ -171,10 +177,17 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
}else{
|
|
}else{
|
|
isAttendance=true;
|
|
isAttendance=true;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ int timeGap = DateUtil.minutesBetween(now, courseSchedule.getStartClassTime());
|
|
|
|
+
|
|
switch (signStatus){
|
|
switch (signStatus){
|
|
case SIGN_IN:
|
|
case SIGN_IN:
|
|
teacherAttendance.setSignInTime(now);
|
|
teacherAttendance.setSignInTime(now);
|
|
- teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
|
|
|
|
|
|
+ if(advanceSignInMinutes<=timeGap&&timeGap<=60){
|
|
|
|
+ teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
|
|
|
|
+ }else{
|
|
|
|
+ teacherAttendance.setSignInStatus(YesOrNoEnum.NO);
|
|
|
|
+ }
|
|
int currentClassTimes = teacherAttendanceDao.countClassTime(classGroup.getId().longValue());
|
|
int currentClassTimes = teacherAttendanceDao.countClassTime(classGroup.getId().longValue());
|
|
classGroup.setCurrentClassTimes(currentClassTimes);
|
|
classGroup.setCurrentClassTimes(currentClassTimes);
|
|
if(updateCourseScheduleStatus){
|
|
if(updateCourseScheduleStatus){
|