|
@@ -1189,17 +1189,28 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public boolean saveOrUpdateStudentApply(StudentApplyEntity studentApply) {
|
|
public boolean saveOrUpdateStudentApply(StudentApplyEntity studentApply) {
|
|
- // 缓存中查看考生是否已经预约
|
|
|
|
|
|
+ // 缓存中考生是否已经预约
|
|
ApplyRecordCacheBean studentApplyRecord = cacheService.getStudentApplyRecord(studentApply.getStudentId(), studentApply.getExamSiteId(),
|
|
ApplyRecordCacheBean studentApplyRecord = cacheService.getStudentApplyRecord(studentApply.getStudentId(), studentApply.getExamSiteId(),
|
|
studentApply.getTimePeriodId());
|
|
studentApply.getTimePeriodId());
|
|
- // 考生未预约
|
|
|
|
|
|
+ //数据库中考生是否已经预约
|
|
|
|
+ StudentApplyEntity existStudentApply = findStudentApply(studentApply);
|
|
|
|
+
|
|
|
|
+ // 缓存中考生未预约
|
|
if (studentApplyRecord == null) {
|
|
if (studentApplyRecord == null) {
|
|
- baseMapper.insert(studentApply);
|
|
|
|
|
|
+ // 数据库中不存在
|
|
|
|
+ if (existStudentApply == null) {
|
|
|
|
+ baseMapper.insert(studentApply);
|
|
|
|
+ } else if (existStudentApply.getCancel()) { //数据库中存在,但已取消
|
|
|
|
+ existStudentApply.setCancel(Boolean.FALSE);
|
|
|
|
+ baseMapper.updateById(existStudentApply);
|
|
|
|
+ } else { // 数据库中已存在预约信息
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
// 考生先预约,然后做了取消操作
|
|
// 考生先预约,然后做了取消操作
|
|
if (studentApplyRecord.getCancel()) {
|
|
if (studentApplyRecord.getCancel()) {
|
|
- StudentApplyEntity existStudentApply = findStudentApply(studentApply);
|
|
|
|
if (existStudentApply != null) {
|
|
if (existStudentApply != null) {
|
|
existStudentApply.setCancel(Boolean.FALSE);
|
|
existStudentApply.setCancel(Boolean.FALSE);
|
|
baseMapper.updateById(existStudentApply);
|
|
baseMapper.updateById(existStudentApply);
|