|
@@ -4,7 +4,9 @@ package com.keao.edu.user.service.impl;
|
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
|
import com.keao.edu.user.api.entity.StudentAttendance;
|
|
|
+import com.keao.edu.user.api.enums.StudentExamResultApiDto;
|
|
|
import com.keao.edu.user.dao.StudentAttendanceDao;
|
|
|
+import com.keao.edu.user.dao.StudentExamResultDao;
|
|
|
import com.keao.edu.user.service.StudentAttendanceService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -18,6 +20,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
|
|
|
@Autowired
|
|
|
private StudentAttendanceDao studentAttendanceDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentExamResultDao studentExamResultDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentAttendance> getDAO() {
|
|
@@ -27,7 +31,16 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
|
|
|
public void upsetAttendance(Long examRegistrationId, Integer signFlag) {
|
|
|
+ StudentExamResultApiDto studentExamResultApiDto = studentExamResultDao.getStudentExamResultApiDto(examRegistrationId);
|
|
|
+ Integer isFinishedExam = studentExamResultApiDto.getIsFinishedExam();
|
|
|
StudentAttendance studentAttendance = studentAttendanceDao.findByRegistrationId(examRegistrationId);
|
|
|
+ if(isFinishedExam == 3){
|
|
|
+ if(studentAttendance != null){
|
|
|
+ studentAttendanceDao.delete(studentAttendance.getId());
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
Date date = new Date();
|
|
|
if(studentAttendance == null){
|
|
|
studentAttendance = new StudentAttendance();
|