|
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
|
|
|
import com.qmth.boot.core.exception.ParameterException;
|
|
|
import com.qmth.teachcloud.common.entity.BasicExam;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
@@ -31,6 +32,9 @@ import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
|
|
|
import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
|
|
|
import com.qmth.teachcloud.common.enums.scan.ConditionType;
|
|
|
import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
+import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
|
|
|
+import com.qmth.teachcloud.mark.bean.omredit.OmrEditDomain;
|
|
|
+import com.qmth.teachcloud.mark.bean.omredit.OmrEditPaper;
|
|
|
import com.qmth.teachcloud.mark.bean.scananswer.AnswerPageVo;
|
|
|
import com.qmth.teachcloud.mark.bean.scananswer.AnswerPaperVo;
|
|
|
import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryDomain;
|
|
@@ -55,6 +59,7 @@ import com.qmth.teachcloud.mark.entity.ScanPaper;
|
|
|
import com.qmth.teachcloud.mark.entity.ScanPaperPage;
|
|
|
import com.qmth.teachcloud.mark.entity.ScanStudentPaper;
|
|
|
import com.qmth.teachcloud.mark.enums.ExamStatus;
|
|
|
+import com.qmth.teachcloud.mark.enums.LockType;
|
|
|
import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
|
|
|
import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
|
|
|
import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
@@ -97,6 +102,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
private MarkQuestionService markQuestionService;
|
|
|
@Resource
|
|
|
private TeachcloudCommonService teachcloudCommonService;
|
|
|
+ @Autowired
|
|
|
+ private ConcurrentService concurrentService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<String> listClassByExamIdAndCourseCode(Long examId, String paperNumber) {
|
|
@@ -572,4 +580,52 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
// 不分页查询考生准考证号
|
|
|
return baseMapper.querySummary(query);
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public UpdateTimeVo omrEdit(Long userId,OmrEditDomain domain) {
|
|
|
+ MarkStudent student = findByExamIdAndStudentCode(domain.getExamId(), domain.getStudentCode());
|
|
|
+ if (student == null) {
|
|
|
+ throw new ParameterException("考生信息未找到");
|
|
|
+ }
|
|
|
+ concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().lock();
|
|
|
+ try {
|
|
|
+ for (OmrEditPaper paperEdit : domain.getPapers()) {
|
|
|
+ ScanStudentPaper sp = studentPaperService.findByStudentIdAndPaperNumber(student.getId(),
|
|
|
+ paperEdit.getNumber());
|
|
|
+ if (sp == null) {
|
|
|
+ throw new ParameterException("未找到绑定扫描结果");
|
|
|
+ }
|
|
|
+ ScanPaper paperEntity = scanPaperService.getById(sp.getPaperId());
|
|
|
+ if (paperEntity == null) {
|
|
|
+ throw new ParameterException("未找到paper信息结果");
|
|
|
+ }
|
|
|
+ paperEntity.setUpdaterId(userId);
|
|
|
+ paperEntity.setUpdateTime(System.currentTimeMillis());
|
|
|
+ List<ScanPaperPage> pages = scanPaperPageService.listByPaperId(paperEntity.getId());
|
|
|
+ for (ScanPaperPage pageEntity : pages) {
|
|
|
+ paperEdit.updatePage(pageEntity);
|
|
|
+ }
|
|
|
+ scanPaperService.savePaperAndPages(paperEntity, pages);
|
|
|
+ }
|
|
|
+ updateStudentByPaper(userId, student.getId(), false);
|
|
|
+ return UpdateTimeVo.create();
|
|
|
+ } finally {
|
|
|
+ concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().unlock();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public MarkStudent findByExamIdAndStudentCode(Long examId, String studentCode) {
|
|
|
+ if (examId == null) {
|
|
|
+ throw new ParameterException("examId 不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(studentCode)) {
|
|
|
+ throw new ParameterException("studentCode不能为空");
|
|
|
+ }
|
|
|
+ QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkStudent::getExamId, examId);
|
|
|
+ queryWrapper.lambda().eq(MarkStudent::getStudentCode, studentCode);
|
|
|
+ return baseMapper.selectOne(queryWrapper);
|
|
|
+ }
|
|
|
}
|