派生自 projectDept/qhighschool

11
yn147
2022-11-21 e2f63040ba839fb0045360b4971ebbb06a79d55d
src/main/java/com/qxueyou/scc/admin/attendance/impl/AttendanceServiceImpl.java
@@ -19,6 +19,13 @@
    @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");
            //上课时间
@@ -29,17 +36,7 @@
            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
            {
@@ -48,19 +45,14 @@
                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 = "成功完成签到";
                    }
                }
            }
@@ -69,6 +61,7 @@
        {
            e.printStackTrace();
        }
        save(stuStudent);
        return s;
    }
}