xiatian 8 månader sedan
förälder
incheckning
f1763fb2a6

+ 0 - 5
src/main/java/cn/com/qmth/scancentral/controller/admin/StudentImportController.java

@@ -23,7 +23,6 @@ import com.qmth.boot.tools.uuid.FastUUID;
 
 import cn.com.qmth.scancentral.controller.BaseController;
 import cn.com.qmth.scancentral.entity.ExamEntity;
-import cn.com.qmth.scancentral.service.ExamRoomService;
 import cn.com.qmth.scancentral.service.ExamService;
 import cn.com.qmth.scancentral.service.StudentImportService;
 import cn.com.qmth.scancentral.service.StudentService;
@@ -53,9 +52,6 @@ public class StudentImportController extends BaseController {
     @Autowired
     private ExamService examService;
 
-    @Autowired
-    private ExamRoomService examRoomService;
-
     @ApiOperation(value = "考生导入")
     @PostMapping("/import")
     public Map<String, Object> studentImport(@RequestParam Long examId,
@@ -115,7 +111,6 @@ public class StudentImportController extends BaseController {
     @PostMapping(value = "/clear")
     public ResultVo studentClean(@RequestParam Long examId, @RequestParam String subjectCode) {
         studentService.studentClean(examId, subjectCode);
-        examRoomService.clearByExamAndSubject(examId, subjectCode);
         return new ResultVo(System.currentTimeMillis());
     }
 

+ 3 - 2
src/main/java/cn/com/qmth/scancentral/service/BatchService.java

@@ -29,7 +29,7 @@ public interface BatchService extends IService<BatchEntity> {
 
     BatchCreateVo batchCreate(BatchCreateDomain domain, User user);
 
-    int getCountByExam(Long examId);
+    int getCountByExamAndSubject(Long examId, String subject);
 
     int getVerifyCount(Long examId);
 
@@ -97,7 +97,8 @@ public interface BatchService extends IService<BatchEntity> {
 
     int getCheckCountByExamId(Long examId, CheckStatus status, User user);
 
-    IPage<BatchEntity> findUnCheck(Long examId, int pageNumber, int pageSize, BatchStatus b, CheckStatus status, String order);
+    IPage<BatchEntity> findUnCheck(Long examId, int pageNumber, int pageSize, BatchStatus b, CheckStatus status,
+            String order);
 
     void batchVerifyCancel(User user, Long examId);
 

+ 2 - 1
src/main/java/cn/com/qmth/scancentral/service/impl/BatchServiceImpl.java

@@ -245,10 +245,11 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
     }
 
     @Override
-    public int getCountByExam(Long examId) {
+    public int getCountByExamAndSubject(Long examId, String subject) {
         QueryWrapper<BatchEntity> wrapper = new QueryWrapper<>();
         LambdaQueryWrapper<BatchEntity> lw = wrapper.lambda();
         lw.eq(BatchEntity::getExamId, examId);
+        lw.eq(BatchEntity::getSubjectCode, subject);
         return this.count(wrapper);
     }
 

+ 13 - 6
src/main/java/cn/com/qmth/scancentral/service/impl/StudentServiceImpl.java

@@ -208,6 +208,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
     @Autowired
     private MarkSiteService markSiteService;
 
+    @Autowired
+    private ExamRoomService examRoomService;
     static {
         int threadCount = 5;
         exec = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.SECONDS,
@@ -289,18 +291,22 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
             if (studentPaper.getPaperNumber() == 1) {
                 // 根据识别结果更新考生属性
                 PaperPageEntity page = paperPageService.findPaperIdAndIndex(paper.getId(), 1);
-                List<String> paperTypeBarcodeContents  = markSiteService.findPaperTypeBarcodeContentByExamAndSubjectCode(student.getExamId(), student.getSubjectCode());
+                List<String> paperTypeBarcodeContents = markSiteService
+                        .findPaperTypeBarcodeContentByExamAndSubjectCode(student.getExamId(), student.getSubjectCode());
                 if (paperTypeBarcodeContents == null || paperTypeBarcodeContents.isEmpty()) {
                     paperTypeBarcodeContents = exam.getPaperTypeBarcodeContent();
                 }
-                if(page.getPaperType() == null||page.getPaperType().getResult().length()==0 || page.getPaperType().getResult().equals("#")){
+                if (page.getPaperType() == null || page.getPaperType().getResult().length() == 0
+                        || page.getPaperType().getResult().equals("#")) {
                     student.setPaperType("#");
-                }else if (CollectionUtils.isNotEmpty(paperTypeBarcodeContents) && !paperTypeBarcodeContents.contains(page.getPaperType().getResult())) {
+                } else if (CollectionUtils.isNotEmpty(paperTypeBarcodeContents)
+                        && !paperTypeBarcodeContents.contains(page.getPaperType().getResult())) {
                     student.setPaperType("?");
-                }else{
+                } else {
                     student.setPaperType(page.getPaperType().getResult());
                 }
-//                student.setPaperType(page.getPaperType() != null ? page.getPaperType().getResult() : "#");
+                // student.setPaperType(page.getPaperType() != null ?
+                // page.getPaperType().getResult() : "#");
                 student.setOmrAbsent(page.getAbsent() == null ? false : page.getAbsent().getResult());
                 student.setDevice(batchService.findByPaperId(paper.getId()).getDevice());
             }
@@ -1030,7 +1036,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
             throw ParameterExceptions.EXAM_NOT_FOUND;
         }
 
-        if (batchService.getCountByExam(examId) > 0) {
+        if (batchService.getCountByExamAndSubject(examId, subjectCode) > 0) {
             throw new ParameterException("已开始扫描不能清空");
         }
 
@@ -1038,6 +1044,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         wrapper.eq(StudentEntity::getExamId, examId);
         wrapper.eq(StudentEntity::getSubjectCode, subjectCode);
         baseMapper.delete(wrapper);
+        examRoomService.clearByExamAndSubject(examId, subjectCode);
 
     }