|
@@ -20,6 +20,8 @@ import com.qmth.paper.library.common.entity.BasicField;
|
|
|
import com.qmth.paper.library.common.entity.ExamStudent;
|
|
|
import com.qmth.paper.library.common.entity.SysUser;
|
|
|
import com.qmth.paper.library.common.enums.*;
|
|
|
+import com.qmth.paper.library.common.lock.LockService;
|
|
|
+import com.qmth.paper.library.common.lock.LockType;
|
|
|
import com.qmth.paper.library.common.service.BasicFieldService;
|
|
|
import com.qmth.paper.library.common.service.CommonCacheService;
|
|
|
import com.qmth.paper.library.common.util.ServletUtil;
|
|
@@ -68,6 +70,8 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
private AsyncExamStudentImportService asyncExamStudentImportService;
|
|
|
@Resource
|
|
|
private FileUploadService fileUploadService;
|
|
|
+ @Resource
|
|
|
+ private LockService lockService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<ExamStudent> findStudentPage(Long examId, String courseCode, String collegeName, String majorName, String clazzName, String queryParams, int pageNumber, int pageSize) {
|
|
@@ -152,10 +156,10 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
if (Objects.isNull(existStudent)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("找不到考生,id:%s", examStudent.getId()));
|
|
|
}
|
|
|
- if(StoreTypeEnum.ROOM.equals(storeType) && !StringUtils.deleteWhitespace(examStudent.getExamRoom()).equals(existStudent.getExamRoom())) {
|
|
|
+ if (StoreTypeEnum.ROOM.equals(storeType) && !StringUtils.deleteWhitespace(examStudent.getExamRoom()).equals(existStudent.getExamRoom())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("不能更改考场");
|
|
|
}
|
|
|
- if(StoreTypeEnum.CLASS.equals(storeType) && !StringUtils.deleteWhitespace(examStudent.getClassName()).equals(existStudent.getClassName())) {
|
|
|
+ if (StoreTypeEnum.CLASS.equals(storeType) && !StringUtils.deleteWhitespace(examStudent.getClassName()).equals(existStudent.getClassName())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("不能更改班级");
|
|
|
}
|
|
|
|
|
@@ -252,10 +256,15 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
|
|
|
@Override
|
|
|
public void updateBindCount(Long studentId) {
|
|
|
- UpdateWrapper<ExamStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(ExamStudent::getBindCount, paperLibraryService.countByStudentId(studentId))
|
|
|
- .eq(ExamStudent::getId, studentId);
|
|
|
- this.update(updateWrapper);
|
|
|
+ try {
|
|
|
+ lockService.waitlock(LockType.UPDATE_STUDENT_PICTURE_COUNT, studentId);
|
|
|
+ UpdateWrapper<ExamStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().set(ExamStudent::getBindCount, paperLibraryService.countByStudentId(studentId))
|
|
|
+ .eq(ExamStudent::getId, studentId);
|
|
|
+ this.update(updateWrapper);
|
|
|
+ } finally {
|
|
|
+ lockService.unlock(LockType.UPDATE_STUDENT_PICTURE_COUNT, studentId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|