|
@@ -191,10 +191,11 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
boolean isAuditAllPass = auditAllPassProperty != null && StringUtil.isTrue(auditAllPassProperty.getValue());
|
|
|
|
|
|
//先更新考生的考试次数
|
|
|
- updateExamStudent(examStudentId);
|
|
|
+ ExamStudentEntity examStudent = updateExamStudent(examStudentId);
|
|
|
|
|
|
//同步考试记录,并返回真实的考试记录id
|
|
|
- Long realExamRecordDataId = syncExamRecordData(tempExamRecordData);
|
|
|
+ ExamRecordDataEntity realExamRecordData = syncExamRecordData(tempExamRecordData, examStudent);
|
|
|
+ Long realExamRecordDataId = realExamRecordData.getId();
|
|
|
|
|
|
//添加同步记录
|
|
|
addExamRecordDataSync(tempExamRecordDataId, realExamRecordDataId);
|
|
@@ -406,18 +407,19 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
* 更新考生相关信息
|
|
|
* 增加考试次数,修改考试状态为已完成
|
|
|
*/
|
|
|
- private void updateExamStudent(Long examStudentId) {
|
|
|
+ private ExamStudentEntity updateExamStudent(Long examStudentId) {
|
|
|
//更新数据库中的已考次数
|
|
|
ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examStudentId);
|
|
|
if (null == examStudentEntity) {
|
|
|
throw new StatusException("100101", "考生ID不正确!" + examStudentId);
|
|
|
}
|
|
|
|
|
|
- Integer usedTimes = examStudentEntity.getUsedNum() == null ? 0 : examStudentEntity.getUsedNum();
|
|
|
+ int usedTimes = examStudentEntity.getUsedNum() == null ? 0 : examStudentEntity.getUsedNum();
|
|
|
examStudentEntity.setUsedNum(usedTimes + 1);
|
|
|
examStudentEntity.setFinished(true);
|
|
|
|
|
|
examStudentRepo.saveAndFlush(examStudentEntity);
|
|
|
+ return examStudentEntity;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -441,14 +443,7 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
return examRecordDataSyncRepo.exists(example);
|
|
|
}
|
|
|
|
|
|
- private Long syncExamRecordData(ExamRecordDataBean examRecordData) {
|
|
|
- ExamRecordDataEntity examRecordDataEntity = copyExamRecordDataEntityFrom(examRecordData);
|
|
|
-
|
|
|
- ExamRecordDataEntity result = examRecordDataRepo.saveAndFlush(examRecordDataEntity);
|
|
|
- return result.getId();
|
|
|
- }
|
|
|
-
|
|
|
- private ExamRecordDataEntity copyExamRecordDataEntityFrom(ExamRecordDataBean examRecordData) {
|
|
|
+ private ExamRecordDataEntity syncExamRecordData(ExamRecordDataBean examRecordData, ExamStudentEntity examStudentEntity) {
|
|
|
ExamRecordDataEntity result = new ExamRecordDataEntity();
|
|
|
Long examId = examRecordData.getExamId();
|
|
|
result.setExamId(examId);
|
|
@@ -458,10 +453,6 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
result.setStudentId(studentId);
|
|
|
|
|
|
//部分数据从考生表中获取
|
|
|
- ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examRecordData.getExamStudentId());
|
|
|
- if (null == examStudentEntity) {
|
|
|
- throw new StatusException("100101", "考生ID不正确!" + examRecordData.getExamStudentId());
|
|
|
- }
|
|
|
result.setStudentCode(examStudentEntity.getStudentCode());
|
|
|
result.setStudentName(examStudentEntity.getStudentName());
|
|
|
result.setIdentityNumber(examStudentEntity.getIdentityNumber());
|
|
@@ -525,7 +516,7 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
result.setSwitchScreenCount(0);
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ return examRecordDataRepo.saveAndFlush(result);
|
|
|
}
|
|
|
|
|
|
/**
|