| | |
| | | try{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
| | | //上课时间 |
| | | String s1 = "9:00:00"; |
| | | String classTime = "9:00:00"; |
| | | //当前时间 |
| | | String s2 = sdf.format(new Date()); |
| | | String currentTime = sdf.format(new Date()); |
| | | String hqlTwo = "from Subject where name = ?"; |
| | | List<Object> argsTwo = CollectionUtils.newList(subjectName); |
| | | Subject subject = findUnique(hqlTwo,argsTwo,Subject.class); |
| | |
| | | stuStudent.setSubjectId(subject.getSubjectId()); |
| | | } |
| | | //如果上课时间(9点)>当前时间 |
| | | int compareTo = s1.compareTo(s2); |
| | | int compareTo = classTime.compareTo(currentTime); |
| | | if(compareTo>0) |
| | | { |
| | | s="签到时间已过,本节课按照旷课处理"; |
| | | stuStudent.setAttendanceStatus("旷课"); |
| | | stuStudent.setAttendanceStatus(stuStudent.STATUS_TRUANCY); |
| | | } |
| | | else |
| | | { |
| | | String s3 = "8:50:00"; |
| | | compareTo = s2.compareTo(s3); |
| | | //打卡时间 |
| | | String clockTime = "8:50:00"; |
| | | compareTo = currentTime.compareTo(clockTime); |
| | | if(compareTo<0) |
| | | { |
| | | s="未到签到时间,请与上课时间前10分钟签到"; |
| | | stuStudent.setAttendanceStatus("未打卡"); |
| | | stuStudent.setAttendanceStatus(stuStudent.STATUS_NO_CLOCKING); |
| | | } |
| | | else |
| | | { |
| | | if(stuStudent!=null && subjectId!=null){ |
| | | stuStudent.setAttendanceStatus("已打卡"); |
| | | stuStudent.setAttendanceStatus(stuStudent.STATUS_PUNCHE); |
| | | s = "成功签到"; |
| | | } |
| | | } |