| | |
| | | @Override |
| | | public String attendanceUpAndAdd(String studentId, String subjectId) { |
| | | String s=""; |
| | | |
| | | StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false"); |
| | | |
| | | List<Object> args = CollectionUtils.newList(studentId); |
| | | |
| | | StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class); |
| | | |
| | | try{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
| | | //上课时间 |
| | |
| | | if(compareTo>0) |
| | | { |
| | | s="签到时间已过,本节课按照旷课处理"; |
| | | StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false"); |
| | | |
| | | List<Object> args = CollectionUtils.newList(studentId); |
| | | |
| | | StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class); |
| | | |
| | | if(stuStudent!=null && subjectId!=null){ |
| | | stuStudent.setSubjectId(subjectId); |
| | | save(stuStudent); |
| | | s = "成功完成签到"; |
| | | } |
| | | stuStudent.setAttendanceStatus("旷课"); |
| | | } |
| | | else |
| | | { |
| | |
| | | if(compareTo<0) |
| | | { |
| | | s="未到签到时间,请与上课时间前10分钟签到"; |
| | | stuStudent.setAttendanceStatus("未打卡"); |
| | | } |
| | | else |
| | | { |
| | | StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false"); |
| | | |
| | | List<Object> args = CollectionUtils.newList(studentId); |
| | | |
| | | StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class); |
| | | |
| | | if(stuStudent!=null && subjectId!=null){ |
| | | stuStudent.setSubjectId(subjectId); |
| | | save(stuStudent); |
| | | return "成功完成签到"; |
| | | stuStudent.setAttendanceStatus("已打卡"); |
| | | s = "成功完成签到"; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | save(stuStudent); |
| | | return s; |
| | | } |
| | | } |