yin 9 месяцев назад
Родитель
Сommit
4b3a0364eb
33 измененных файлов с 715 добавлено и 1666 удалено
  1. 11 0
      src/main/java/cn/com/qmth/scancentral/bean/AnswerDeleteDomain.java
  2. 11 0
      src/main/java/cn/com/qmth/scancentral/bean/ImportCetAbsentDomain.java
  3. 11 0
      src/main/java/cn/com/qmth/scancentral/bean/PageDeleteDomain.java
  4. 13 1
      src/main/java/cn/com/qmth/scancentral/bean/answersave/AnswerDomain.java
  5. 13 1
      src/main/java/cn/com/qmth/scancentral/bean/omredit/OmrEditDomain.java
  6. 13 1
      src/main/java/cn/com/qmth/scancentral/bean/papermigrate/PaperMigrateDomain.java
  7. 13 1
      src/main/java/cn/com/qmth/scancentral/bean/refix/AnswerRefixDomain.java
  8. 0 5
      src/main/java/cn/com/qmth/scancentral/controller/admin/CardController.java
  9. 6 4
      src/main/java/cn/com/qmth/scancentral/controller/admin/CheckController.java
  10. 0 139
      src/main/java/cn/com/qmth/scancentral/controller/admin/StudentAnswerGroupController.java
  11. 0 104
      src/main/java/cn/com/qmth/scancentral/controller/scan/StudentAnswerTaskController.java
  12. 0 12
      src/main/java/cn/com/qmth/scancentral/dao/StudentAnswerGroupDao.java
  13. 0 16
      src/main/java/cn/com/qmth/scancentral/dao/StudentAnswerTaskDao.java
  14. 0 50
      src/main/java/cn/com/qmth/scancentral/entity/StudentAnswerGroupEntity.java
  15. 0 67
      src/main/java/cn/com/qmth/scancentral/entity/StudentAnswerTaskEntity.java
  16. 14 30
      src/main/java/cn/com/qmth/scancentral/entity/StudentEntity.java
  17. 0 38
      src/main/java/cn/com/qmth/scancentral/service/StudentAnswerGroupService.java
  18. 0 50
      src/main/java/cn/com/qmth/scancentral/service/StudentAnswerTaskService.java
  19. 39 14
      src/main/java/cn/com/qmth/scancentral/service/StudentService.java
  20. 24 19
      src/main/java/cn/com/qmth/scancentral/service/impl/AnswerCardServiceImpl.java
  21. 86 47
      src/main/java/cn/com/qmth/scancentral/service/impl/BatchServiceImpl.java
  22. 59 54
      src/main/java/cn/com/qmth/scancentral/service/impl/ExamServiceImpl.java
  23. 63 38
      src/main/java/cn/com/qmth/scancentral/service/impl/OmrTaskServiceImpl.java
  24. 7 6
      src/main/java/cn/com/qmth/scancentral/service/impl/PaperServiceImpl.java
  25. 0 185
      src/main/java/cn/com/qmth/scancentral/service/impl/StudentAnswerGroupServiceImpl.java
  26. 0 345
      src/main/java/cn/com/qmth/scancentral/service/impl/StudentAnswerTaskServiceImpl.java
  27. 331 265
      src/main/java/cn/com/qmth/scancentral/service/impl/StudentServiceImpl.java
  28. 0 49
      src/main/java/cn/com/qmth/scancentral/task/thread/StudentAnswerGroupBuildThread.java
  29. 0 47
      src/main/java/cn/com/qmth/scancentral/task/thread/StudentAnswerGroupDeleteThread.java
  30. 0 47
      src/main/java/cn/com/qmth/scancentral/task/thread/StudentAnswerGroupResetThread.java
  31. 1 1
      src/main/java/cn/com/qmth/scancentral/vo/student/StudentVo.java
  32. 0 16
      src/main/resources/mapper/StudentAnswerGroupMapper.xml
  33. 0 14
      src/main/resources/mapper/StudentAnswerTaskMapper.xml

+ 11 - 0
src/main/java/cn/com/qmth/scancentral/bean/AnswerDeleteDomain.java

@@ -8,6 +8,9 @@ public class AnswerDeleteDomain {
     @NotNull(message = "考试Id不能为空")
     private Long examId;
 
+    @NotBlank(message = "subjectCode不能为空")
+    private String subjectCode;
+
     @NotBlank(message = "准考证号不能为空")
     private String examNumber;
 
@@ -26,4 +29,12 @@ public class AnswerDeleteDomain {
     public void setExamNumber(String examNumber) {
         this.examNumber = examNumber;
     }
+
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
 }

+ 11 - 0
src/main/java/cn/com/qmth/scancentral/bean/ImportCetAbsentDomain.java

@@ -3,7 +3,11 @@ package cn.com.qmth.scancentral.bean;
 public class ImportCetAbsentDomain {
 
     private Long examId;
+
+    private String subjectCode;
+
     private String examNumber;
+
     private String breachCode;
 
     public Long getExamId() {
@@ -30,5 +34,12 @@ public class ImportCetAbsentDomain {
         this.breachCode = breachCode;
     }
 
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
 
 }

+ 11 - 0
src/main/java/cn/com/qmth/scancentral/bean/PageDeleteDomain.java

@@ -9,6 +9,9 @@ public class PageDeleteDomain {
     @NotNull(message = "考试Id不能为空")
     private Long examId;
 
+    @NotBlank(message = "科目代码不能为空")
+    private String subjectCode;
+
     @NotBlank(message = "准考证号不能为空")
     private String examNumber;
 
@@ -40,4 +43,12 @@ public class PageDeleteDomain {
         this.paperNumber = paperNumber;
     }
 
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
+
 }

+ 13 - 1
src/main/java/cn/com/qmth/scancentral/bean/answersave/AnswerDomain.java

@@ -1,17 +1,21 @@
 package cn.com.qmth.scancentral.bean.answersave;
 
+import java.util.List;
+
 import javax.validation.Valid;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
-import java.util.List;
 
 public class AnswerDomain {
 
     @NotNull(message = "batchId不能为空")
     private Long batchId;
 
+    @NotBlank(message = "subjectCode不能为空")
+    private String subjectCode;
+
     @NotBlank(message = "examNumber不能为空")
     private String examNumber;
 
@@ -56,4 +60,12 @@ public class AnswerDomain {
         this.papers = papers;
     }
 
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
+
 }

+ 13 - 1
src/main/java/cn/com/qmth/scancentral/bean/omredit/OmrEditDomain.java

@@ -1,16 +1,20 @@
 package cn.com.qmth.scancentral.bean.omredit;
 
+import java.util.List;
+
 import javax.validation.Valid;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
-import java.util.List;
 
 public class OmrEditDomain {
 
     @NotNull(message = "考试ID不能为空")
     private Long examId;
 
+    @NotBlank(message = "subjectCode不能为空")
+    private String subjectCode;
+
     @NotBlank(message = "准考证号不能为空")
     private String examNumber;
 
@@ -43,4 +47,12 @@ public class OmrEditDomain {
         this.papers = papers;
     }
 
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
+
 }

+ 13 - 1
src/main/java/cn/com/qmth/scancentral/bean/papermigrate/PaperMigrateDomain.java

@@ -1,8 +1,9 @@
 package cn.com.qmth.scancentral.bean.papermigrate;
 
+import java.util.List;
+
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
-import java.util.List;
 
 public class PaperMigrateDomain {
 
@@ -12,6 +13,9 @@ public class PaperMigrateDomain {
     @NotNull(message = "考试ID不能为空")
     private Long examId;
 
+    @NotBlank(message = "科目代码不能为空")
+    private String subjectCode;
+
     @NotBlank(message = "准考证号不能为空")
     private String examNumber;
 
@@ -71,4 +75,12 @@ public class PaperMigrateDomain {
         this.pages = pages;
     }
 
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
+
 }

+ 13 - 1
src/main/java/cn/com/qmth/scancentral/bean/refix/AnswerRefixDomain.java

@@ -1,17 +1,21 @@
 package cn.com.qmth.scancentral.bean.refix;
 
+import java.util.List;
+
 import javax.validation.Valid;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
-import java.util.List;
 
 public class AnswerRefixDomain {
 
     @NotNull(message = "考试Id不能为空")
     private Long examId;
 
+    @NotBlank(message = "subjectCode不能为空")
+    private String subjectCode;
+
     @NotBlank(message = "准考证号不能为空")
     private String examNumber;
 
@@ -56,6 +60,14 @@ public class AnswerRefixDomain {
         this.papers = papers;
     }
 
+    public String getSubjectCode() {
+        return subjectCode;
+    }
+
+    public void setSubjectCode(String subjectCode) {
+        this.subjectCode = subjectCode;
+    }
+
     public PaperRefixDomain findPaperDomain(Integer paperNumber, Long paperId) {
         for (PaperRefixDomain domain : papers) {
             if (domain.getId().equals(paperId) && domain.getNumber().equals(paperNumber)) {

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

@@ -10,7 +10,6 @@ import javax.servlet.http.HttpServletRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.task.AsyncTaskExecutor;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -54,10 +53,6 @@ public class CardController extends BaseController {
     @Autowired
     private ExamService examService;
 
-    // @Qualifier("task-executor")
-    @Autowired
-    private AsyncTaskExecutor taskExecutor;
-
     @ApiOperation(value = "卡格式详情")
     @RequestMapping(value = "/info", method = RequestMethod.POST)
     public Map<String, Object> info(@RequestParam Long examId) {

+ 6 - 4
src/main/java/cn/com/qmth/scancentral/controller/admin/CheckController.java

@@ -169,13 +169,15 @@ public class CheckController extends BaseController {
 
     @ApiOperation(value = "更新为指定缺考")
     @PostMapping("absent/manual/update")
-    public UpdateTimeVo absentManualUpdate(@RequestParam Long examId, @RequestParam String examNumber) {
-        return studentService.absentManualUpdate(examId, examNumber);
+    public UpdateTimeVo absentManualUpdate(@RequestParam Long examId, @RequestParam String subjectCode,
+            @RequestParam String examNumber) {
+        return studentService.absentManualUpdate(examId, subjectCode, examNumber);
     }
 
     @ApiOperation(value = "取消缺考标记嫌疑")
     @PostMapping("absent/suspect/remove")
-    public UpdateTimeVo absentSuspectRemove(@RequestParam Long examId, @RequestParam String examNumber) {
-        return studentService.absentSuspectUpdate(examId, examNumber, false);
+    public UpdateTimeVo absentSuspectRemove(@RequestParam Long examId, @RequestParam String subjectCode,
+            @RequestParam String examNumber) {
+        return studentService.absentSuspectUpdate(examId, subjectCode, examNumber, false);
     }
 }

+ 0 - 139
src/main/java/cn/com/qmth/scancentral/controller/admin/StudentAnswerGroupController.java

@@ -1,139 +0,0 @@
-package cn.com.qmth.scancentral.controller.admin;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.task.AsyncTaskExecutor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.qmth.boot.api.annotation.Aac;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.boot.core.concurrent.model.Semaphore;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.ParameterException;
-import com.qmth.boot.core.exception.ReentrantException;
-
-import cn.com.qmth.scancentral.bean.answergroup.StudentAnswerGroupCondition;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupCountVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupIdVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupMarkedVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryQuery;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupVo;
-import cn.com.qmth.scancentral.controller.BaseController;
-import cn.com.qmth.scancentral.entity.StudentAnswerGroupEntity;
-import cn.com.qmth.scancentral.enums.LockType;
-import cn.com.qmth.scancentral.service.StudentAnswerGroupService;
-import cn.com.qmth.scancentral.task.thread.StudentAnswerGroupBuildThread;
-import cn.com.qmth.scancentral.task.thread.StudentAnswerGroupDeleteThread;
-import cn.com.qmth.scancentral.task.thread.StudentAnswerGroupResetThread;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import net.sf.json.JSONObject;
-
-@RestController
-@Api(tags = "数据检查任务组接口")
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/admin/check/student/answer/group")
-@Aac(strict = false, auth = true)
-public class StudentAnswerGroupController extends BaseController {
-
-    @Autowired
-    private StudentAnswerGroupService groupService;
-
-    @Autowired
-    private ConcurrentService concurrentService;
-
-    @Autowired
-    private AsyncTaskExecutor taskExecutor;
-
-    @ApiOperation(value = "抽查任务列表")
-    @PostMapping("list")
-    public StudnetAnswerGroupVo list(@RequestParam Long examId) {
-        return groupService.listByExamId(examId);
-    }
-    
-    @ApiOperation(value = "抽查任务查询计数")
-    @PostMapping("count")
-    public StudnetAnswerGroupCountVo count(StudentAnswerGroupCondition domain) {
-        return groupService.countByCondition(domain);
-    }
-    
-    @ApiOperation(value = "抽查任务创建")
-    @PostMapping("save")
-    public StudnetAnswerGroupIdVo save(StudentAnswerGroupCondition domain) {
-        return groupService.saveByCondition(domain);
-    }
-
-
-    @ApiOperation(value = "抽查任务组生成任务")
-    @RequestMapping(value = "build", method = RequestMethod.POST)
-    public JSONObject build(@RequestParam Long id) {
-        StudentAnswerGroupEntity group = groupService.getById(id);
-        if (group == null) {
-            throw new ParameterException("分组不存在");
-        }
-        Semaphore semaphore = concurrentService.getSemaphore(LockType.STUDENT_ANSWER_GROUP_BUILD + "-" + id);
-        if (semaphore.tryAcquire()) {
-            taskExecutor.submit(new StudentAnswerGroupBuildThread(id, groupService, concurrentService, semaphore));
-        } else {
-            throw new ReentrantException("该分组数据操作繁忙,请稍后重试");
-        }
-        JSONObject result = new JSONObject();
-        result.accumulate("id", id);
-        result.accumulate("building", !semaphore.isAvailable());
-        result.accumulate("updateTime", System.currentTimeMillis());
-        return result;
-    }
-
-    @ApiOperation(value = "重置抽查任务组")
-    @RequestMapping(value = "reset", method = RequestMethod.POST)
-    public JSONObject reset(@RequestParam Long id) {
-        StudentAnswerGroupEntity group = groupService.getById(id);
-        if (group == null) {
-            throw new ParameterException("分组不存在");
-        }
-        Semaphore semaphore = concurrentService.getSemaphore(LockType.STUDENT_ANSWER_GROUP_RESET + "-" + id);
-        if (semaphore.tryAcquire()) {
-            taskExecutor.submit(new StudentAnswerGroupResetThread(id, groupService, concurrentService, semaphore));
-        } else {
-            throw new ReentrantException("该分组数据操作繁忙,请稍后重试");
-        }
-        JSONObject result = new JSONObject();
-        result.accumulate("id", id);
-        return result;
-    }
-
-    @ApiOperation(value = "删除抽查任务组")
-    @RequestMapping(value = "delete", method = RequestMethod.POST)
-    public JSONObject delete(@RequestParam Long id) {
-        StudentAnswerGroupEntity group = groupService.getById(id);
-        if (group == null) {
-            throw new ParameterException("分组不存在");
-        }
-        Semaphore semaphore = concurrentService.getSemaphore(LockType.STUDENT_ANSWER_GROUP_DELETE + "-" + id);
-        if (semaphore.tryAcquire()) {
-            taskExecutor.submit(new StudentAnswerGroupDeleteThread(id, groupService, concurrentService, semaphore));
-        } else {
-            throw new ReentrantException("该分组数据操作繁忙,请稍后重试");
-        }
-        JSONObject result = new JSONObject();
-        result.accumulate("success", true);
-        return result;
-    }
-    
-    @ApiOperation(value = "获取异常题卡概要")
-    @PostMapping("summary")
-    public StudnetAnswerGroupSummaryVo summary(StudnetAnswerGroupSummaryQuery query) {
-        return groupService.summary(query);
-    }
-    
-    @ApiOperation(value = "获取标记异常考生列表")
-    @PostMapping("marked")
-    public List<StudnetAnswerGroupMarkedVo> marked(@RequestParam Long examId) {
-        return groupService.marked(examId);
-    }
-}

+ 0 - 104
src/main/java/cn/com/qmth/scancentral/controller/scan/StudentAnswerTaskController.java

@@ -1,104 +0,0 @@
-package cn.com.qmth.scancentral.controller.scan;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.qmth.boot.api.annotation.Aac;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.ParameterException;
-
-import cn.com.qmth.scancentral.bean.User;
-import cn.com.qmth.scancentral.bean.answertask.ReleaseVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskSaveDomain;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskSaveVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskStatusVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskVo;
-import cn.com.qmth.scancentral.controller.BaseController;
-import cn.com.qmth.scancentral.entity.StudentAnswerTaskEntity;
-import cn.com.qmth.scancentral.enums.LockType;
-import cn.com.qmth.scancentral.enums.StudentAnswerTaskStatus;
-import cn.com.qmth.scancentral.service.StudentAnswerTaskService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-@RestController
-@Api(tags = "扫描功能-数据抽查接口")
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/scan/task/student/answer")
-@Aac(strict = false, auth = true)
-public class StudentAnswerTaskController extends BaseController {
-
-    @Autowired
-    private StudentAnswerTaskService studentAnswerTaskService;
-
-    @Autowired
-    private ConcurrentService concurrentService;
-
-    @ApiOperation(value = "任务获取")
-    @PostMapping("get")
-    public StudentAnswerTaskVo get(@RequestParam Long examId) {
-        User user = getAccessUser();
-        return studentAnswerTaskService.getTask(examId, user.getAccount());
-    }
-
-    @ApiOperation(value = "抽查任务提交")
-    @PostMapping("save")
-    public StudentAnswerTaskSaveVo save(@RequestBody StudentAnswerTaskSaveDomain domain) {
-        User user = getAccessUser();
-        if (domain.getId() == null) {
-            throw new ParameterException("id不能为空");
-        }
-        if (domain.getTag() == null) {
-            throw new ParameterException("tag不能为空");
-        }
-        StudentAnswerTaskEntity task = studentAnswerTaskService.getById(domain.getId());
-        if (task == null) {
-            throw new ParameterException("任务不存在");
-        }
-        // if (StudentAnswerTaskStatus.PROCESSED.equals(task.getStatus())) {
-        // throw new ParameterException("任务已处理");
-        // }
-        if (StudentAnswerTaskStatus.WAITING.equals(task.getStatus())
-                && !studentAnswerTaskService.hasApplied(task, user.getAccount())) {
-            throw new ParameterException("任务非本人领取");
-        }
-        concurrentService.getReadWriteLock(LockType.STUDENT_ANSWER_GROUP + "-" + task.getGroupId()).readLock().lock();
-        concurrentService.getReadWriteLock(LockType.STUDENT + "-" + task.getStudentId()).writeLock().lock();
-        try {
-            return studentAnswerTaskService.submitTask(domain, user);
-        } finally {
-            concurrentService.getReadWriteLock(LockType.STUDENT + "-" + task.getStudentId()).writeLock().unlock();
-            concurrentService.getReadWriteLock(LockType.STUDENT_ANSWER_GROUP + "-" + task.getGroupId()).readLock()
-                    .unlock();
-        }
-    }
-
-    @ApiOperation(value = "抽查任务状态")
-    @PostMapping("status")
-    public StudentAnswerTaskStatusVo getStatus(@RequestParam Long examId) {
-        User user = getAccessUser();
-        return studentAnswerTaskService.getStatus(examId, user);
-    }
-
-    @ApiOperation(value = "抽查任务释放")
-    @PostMapping("release")
-    public ReleaseVo release(@RequestParam Long examId) {
-        User user = getAccessUser();
-        ReleaseVo vo = new ReleaseVo();
-        studentAnswerTaskService.releaseByUser(examId, user.getAccount());
-        vo.setSuccess(true);
-        return vo;
-    }
-
-    @ApiOperation(value = "抽查任务历史")
-    @RequestMapping(value = "history", method = RequestMethod.POST)
-    public StudentAnswerTaskVo history(@RequestParam Long examId, @RequestParam(required = false) Long id,@RequestParam(required = false) Boolean next) {
-        User user = getAccessUser();
-        return studentAnswerTaskService.history(examId, id, user.getAccount(),next);
-    }
-}

+ 0 - 12
src/main/java/cn/com/qmth/scancentral/dao/StudentAnswerGroupDao.java

@@ -1,12 +0,0 @@
-package cn.com.qmth.scancentral.dao;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import cn.com.qmth.scancentral.entity.StudentAnswerGroupEntity;
-
-public interface StudentAnswerGroupDao extends BaseMapper<StudentAnswerGroupEntity> {
-
-    void updateTotalCount(@Param(value = "id")Long id);
-}

+ 0 - 16
src/main/java/cn/com/qmth/scancentral/dao/StudentAnswerTaskDao.java

@@ -1,16 +0,0 @@
-package cn.com.qmth.scancentral.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import cn.com.qmth.scancentral.entity.StudentAnswerTaskEntity;
-import cn.com.qmth.scancentral.enums.StudentAnswerTaskStatus;
-
-public interface StudentAnswerTaskDao extends BaseMapper<StudentAnswerTaskEntity> {
-
-        List<StudentAnswerTaskEntity> findUnMarked(@Param(value = "examId") Long examId, @Param(value = "startNumber") int startNumber,
-            @Param(value = "pageSize") int pageSize, @Param(value = "status") StudentAnswerTaskStatus status);
-}

+ 0 - 50
src/main/java/cn/com/qmth/scancentral/entity/StudentAnswerGroupEntity.java

@@ -1,50 +0,0 @@
-package cn.com.qmth.scancentral.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
-
-import cn.com.qmth.scancentral.bean.answergroup.StudentAnswerGroupCondition;
-import cn.com.qmth.scancentral.entity.base.AuditingEntity;
-
-// 数据抽查任务分组
-@TableName(value = "sc_student_answer_group", autoResultMap = true)
-public class StudentAnswerGroupEntity extends AuditingEntity {
-
-    /**
-     * 
-     */
-    private static final long serialVersionUID = -949594321840840607L;
-
-    private Long examId;
-
-    @TableField(value = "conditions", typeHandler = JacksonTypeHandler.class)
-    private StudentAnswerGroupCondition conditions;
-
-    private Integer totalCount;
-
-    public Long getExamId() {
-        return examId;
-    }
-
-    public void setExamId(Long examId) {
-        this.examId = examId;
-    }
-
-    public StudentAnswerGroupCondition getConditions() {
-        return conditions;
-    }
-
-    public void setConditions(StudentAnswerGroupCondition conditions) {
-        this.conditions = conditions;
-    }
-
-    public Integer getTotalCount() {
-        return totalCount;
-    }
-
-    public void setTotalCount(Integer totalCount) {
-        this.totalCount = totalCount;
-    }
-
-}

+ 0 - 67
src/main/java/cn/com/qmth/scancentral/entity/StudentAnswerTaskEntity.java

@@ -1,67 +0,0 @@
-package cn.com.qmth.scancentral.entity;
-
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import cn.com.qmth.scancentral.entity.base.AuditingEntity;
-import cn.com.qmth.scancentral.enums.StudentAnswerTaskStatus;
-
-// 数据抽查任务
-@TableName(value = "sc_student_answer_task", autoResultMap = true)
-public class StudentAnswerTaskEntity extends AuditingEntity {
-
-    private static final long serialVersionUID = -6781868544296671511L;
-
-    private Long examId;
-
-    private Long groupId;
-
-    private Long studentId;
-
-    private StudentAnswerTaskStatus status;
-
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private String device;
-    
-    public Long getExamId() {
-        return examId;
-    }
-
-    public void setExamId(Long examId) {
-        this.examId = examId;
-    }
-
-    public Long getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(Long groupId) {
-        this.groupId = groupId;
-    }
-
-    public Long getStudentId() {
-        return studentId;
-    }
-
-    public void setStudentId(Long studentId) {
-        this.studentId = studentId;
-    }
-
-    public StudentAnswerTaskStatus getStatus() {
-        return status;
-    }
-
-    public void setStatus(StudentAnswerTaskStatus status) {
-        this.status = status;
-    }
-
-    public String getDevice() {
-        return device;
-    }
-
-    public void setDevice(String device) {
-        this.device = device;
-    }
-
-}

+ 14 - 30
src/main/java/cn/com/qmth/scancentral/entity/StudentEntity.java

@@ -1,10 +1,11 @@
 package cn.com.qmth.scancentral.entity;
 
+import com.baomidou.mybatisplus.annotation.*;
+
 import cn.com.qmth.scancentral.entity.base.AuditingWithoutIdEntity;
 import cn.com.qmth.scancentral.enums.ExamStatus;
 import cn.com.qmth.scancentral.enums.ScanStatus;
 import cn.com.qmth.scancentral.enums.UploadStatus;
-import com.baomidou.mybatisplus.annotation.*;
 
 // 考生
 @TableName("sc_student")
@@ -22,8 +23,6 @@ public class StudentEntity extends AuditingWithoutIdEntity {
 
     private String examNumber;
 
-    private String studentCode;
-
     private String name;
 
     private String subjectCode;
@@ -45,14 +44,16 @@ public class StudentEntity extends AuditingWithoutIdEntity {
     private String device;
 
     private ScanStatus status;
-    //识别缺考
+
+    // 识别缺考
     private Boolean omrAbsent;
-    //是否有填涂
+
+    // 是否有填涂
     private Boolean questionFilled;
 
     private Boolean subjectiveFilled;
 
-    //是否人工绑定
+    // 是否人工绑定
     private Boolean assigned;
 
     // 是否标记异常
@@ -61,10 +62,11 @@ public class StudentEntity extends AuditingWithoutIdEntity {
     // 是否有缺页
     private Boolean incomplete;
 
-    //考试状态
+    // 考试状态
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private ExamStatus examStatus;
-    //违纪码
+
+    // 违纪码
     private String breachCode;
 
     @TableField(updateStrategy = FieldStrategy.IGNORED)
@@ -77,12 +79,13 @@ public class StudentEntity extends AuditingWithoutIdEntity {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String paperType;
 
-    //数据检查标记
+    // 数据检查标记
     private Boolean checkMark;
 
-    //人工绑定确认次数
+    // 人工绑定确认次数
     private Integer assignedCheckCount;
-    //人工绑定异常标记
+
+    // 人工绑定异常标记
     private Boolean assignedSuspect;
 
     public Long getId() {
@@ -109,14 +112,6 @@ public class StudentEntity extends AuditingWithoutIdEntity {
         this.examNumber = examNumber;
     }
 
-    public String getStudentCode() {
-        return studentCode;
-    }
-
-    public void setStudentCode(String studentCode) {
-        this.studentCode = studentCode;
-    }
-
     public String getName() {
         return name;
     }
@@ -253,7 +248,6 @@ public class StudentEntity extends AuditingWithoutIdEntity {
         this.paperType = paperType;
     }
 
-
     public String getDevice() {
         return device;
     }
@@ -262,52 +256,42 @@ public class StudentEntity extends AuditingWithoutIdEntity {
         this.device = device;
     }
 
-
     public ExamStatus getExamStatus() {
         return examStatus;
     }
 
-
     public void setExamStatus(ExamStatus examStatus) {
         this.examStatus = examStatus;
     }
 
-
     public String getExamSiteName() {
         return examSiteName;
     }
 
-
     public void setExamSiteName(String examSiteName) {
         this.examSiteName = examSiteName;
     }
 
-
     public String getCampusCode() {
         return campusCode;
     }
 
-
     public void setCampusCode(String campusCode) {
         this.campusCode = campusCode;
     }
 
-
     public String getBreachCode() {
         return breachCode;
     }
 
-
     public void setBreachCode(String breachCode) {
         this.breachCode = breachCode;
     }
 
-
     public Boolean getCheckMark() {
         return checkMark;
     }
 
-
     public void setCheckMark(Boolean checkMark) {
         this.checkMark = checkMark;
     }

+ 0 - 38
src/main/java/cn/com/qmth/scancentral/service/StudentAnswerGroupService.java

@@ -1,38 +0,0 @@
-package cn.com.qmth.scancentral.service;
-
-import java.util.List;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import cn.com.qmth.scancentral.bean.answergroup.StudentAnswerGroupCondition;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupCountVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupIdVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupMarkedVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryQuery;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupVo;
-import cn.com.qmth.scancentral.entity.StudentAnswerGroupEntity;
-
-public interface StudentAnswerGroupService extends IService<StudentAnswerGroupEntity> {
-
-    void deleteById(Long id);
-
-    void resetById(Long id);
-
-    void updateTotalCount(Long id);
-
-    void updateTotalCountByExamId(Long examId);
-
-    StudnetAnswerGroupVo listByExamId(Long examId);
-
-    StudnetAnswerGroupCountVo countByCondition(StudentAnswerGroupCondition domain);
-
-    StudnetAnswerGroupIdVo saveByCondition(StudentAnswerGroupCondition domain);
-
-    void buildTaskById(Long groupId);
-
-    StudnetAnswerGroupSummaryVo summary(StudnetAnswerGroupSummaryQuery query);
-
-    List<StudnetAnswerGroupMarkedVo> marked(Long examId);
-
-}

+ 0 - 50
src/main/java/cn/com/qmth/scancentral/service/StudentAnswerTaskService.java

@@ -1,50 +0,0 @@
-package cn.com.qmth.scancentral.service;
-
-import java.util.List;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import cn.com.qmth.scancentral.bean.User;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskSaveDomain;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskSaveVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskStatusVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskVo;
-import cn.com.qmth.scancentral.entity.StudentAnswerGroupEntity;
-import cn.com.qmth.scancentral.entity.StudentAnswerTaskEntity;
-import cn.com.qmth.scancentral.enums.StudentAnswerTaskStatus;
-
-public interface StudentAnswerTaskService extends IService<StudentAnswerTaskEntity> {
-
-    int getCountByExam(Long examId);
-
-    int getCountByExamAndStatus(Long examId, StudentAnswerTaskStatus status);
-
-    void deleteByGroupId(Long groupId);
-
-    void resetByGroup(StudentAnswerGroupEntity group);
-
-    StudentAnswerTaskVo getTask(Long examId, String account);
-
-    StudentAnswerTaskSaveVo submitTask(StudentAnswerTaskSaveDomain domain, User user);
-
-    void releaseByUser(Long examId, String account);
-
-    boolean hasApplied(StudentAnswerTaskEntity t, String account);
-
-    List<StudentAnswerTaskEntity> findUnMarked(Long examId, int pageNumber, int pageSize, StudentAnswerTaskStatus status);
-
-    void deleteByStudentId(Long examId, Long studentId);
-
-    StudentAnswerTaskVo history(Long examId, Long taskId, String account, Boolean next);
-
-    void releaseByTask(StudentAnswerTaskEntity t);
-
-    StudentAnswerTaskStatusVo getStatus(Long examId, User user);
-
-    int getCountByExamAndStatusAndDevice(Long examId, String device, StudentAnswerTaskStatus status);
-
-    int getCountByExamAndGroupAndStatus(Long examId, Long groupId, StudentAnswerTaskStatus status);
-
-    void saveTask(StudentAnswerGroupEntity group, List<Long> studentIds);
-
-}

+ 39 - 14
src/main/java/cn/com/qmth/scancentral/service/StudentService.java

@@ -1,6 +1,23 @@
 package cn.com.qmth.scancentral.service;
 
-import cn.com.qmth.scancentral.bean.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.List;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.boot.core.collection.PageResult;
+
+import cn.com.qmth.scancentral.bean.AbsentQueryDomain;
+import cn.com.qmth.scancentral.bean.AnswerDeleteDomain;
+import cn.com.qmth.scancentral.bean.AnswerQueryDomain;
+import cn.com.qmth.scancentral.bean.AssignedQueryDomain;
+import cn.com.qmth.scancentral.bean.ImportCetAbsentDomain;
+import cn.com.qmth.scancentral.bean.ImportStudentDomain;
+import cn.com.qmth.scancentral.bean.PageDeleteDomain;
+import cn.com.qmth.scancentral.bean.User;
 import cn.com.qmth.scancentral.bean.answergroup.StudentAnswerGroupCondition;
 import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupMarkedVo;
 import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryQuery;
@@ -12,7 +29,24 @@ import cn.com.qmth.scancentral.enums.ExamStatusCheckMode;
 import cn.com.qmth.scancentral.enums.GroupType;
 import cn.com.qmth.scancentral.enums.ScanStatus;
 import cn.com.qmth.scancentral.enums.UploadStatus;
-import cn.com.qmth.scancentral.vo.*;
+import cn.com.qmth.scancentral.vo.AbsentInfoVo;
+import cn.com.qmth.scancentral.vo.AbsentManualImportVo;
+import cn.com.qmth.scancentral.vo.AbsentQueryVo;
+import cn.com.qmth.scancentral.vo.AnswerDeleteVo;
+import cn.com.qmth.scancentral.vo.AnswerExportK12Vo;
+import cn.com.qmth.scancentral.vo.AnswerExportVo;
+import cn.com.qmth.scancentral.vo.AnswerRefixVo;
+import cn.com.qmth.scancentral.vo.CampusVo;
+import cn.com.qmth.scancentral.vo.ExamSiteVo;
+import cn.com.qmth.scancentral.vo.ExportCetMarkingQueryVo;
+import cn.com.qmth.scancentral.vo.ExportCetVo;
+import cn.com.qmth.scancentral.vo.ImportResult;
+import cn.com.qmth.scancentral.vo.ImportStudentQueryVo;
+import cn.com.qmth.scancentral.vo.ImportStudentVo;
+import cn.com.qmth.scancentral.vo.PaperDeleteVo;
+import cn.com.qmth.scancentral.vo.ScanAnswerInfoVo;
+import cn.com.qmth.scancentral.vo.StudentUploadVo;
+import cn.com.qmth.scancentral.vo.UpdateTimeVo;
 import cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo;
 import cn.com.qmth.scancentral.vo.assginedcheck.AssginedTaskResult;
 import cn.com.qmth.scancentral.vo.assginedcheck.AssignedCheckExport;
@@ -20,16 +54,9 @@ import cn.com.qmth.scancentral.vo.assginedcheck.AssignedTaskSaveVo;
 import cn.com.qmth.scancentral.vo.student.StudentQuery;
 import cn.com.qmth.scancentral.vo.student.StudentVo;
 import cn.com.qmth.scancentral.vo.task.TaskStatusVo;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.boot.core.collection.PageResult;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
 
 public interface StudentService extends IService<StudentEntity> {
+
     void pictureCopy(StudentUploadVo vo);
 
     void updateStudentByPaper(User user, Long id, boolean updateOmrTask);
@@ -54,8 +81,6 @@ public interface StudentService extends IService<StudentEntity> {
 
     List<StudentVo> packageList(StudentQuery query);
 
-    StudentEntity findByExamIdAndExamNumber(Long examId, String examNumber);
-
     List<StudentEntity> findByExamAndPackage(Long examId, String packageCode, String subjectCode);
 
     int getAssignedCountByExam(Long examId);
@@ -72,9 +97,9 @@ public interface StudentService extends IService<StudentEntity> {
 
     AbsentManualImportVo absentManualImport(Long examId, MultipartFile file);
 
-    UpdateTimeVo absentManualUpdate(Long examId, String examNumber);
+    UpdateTimeVo absentManualUpdate(Long examId, String subjectCode, String examNumber);
 
-    UpdateTimeVo absentSuspectUpdate(Long examId, String examNumber, boolean enable);
+    UpdateTimeVo absentSuspectUpdate(Long examId, String subjectCode, String examNumber, boolean enable);
 
     ScanAnswerInfoVo scanAnswerInfo(Long examId);
 

+ 24 - 19
src/main/java/cn/com/qmth/scancentral/service/impl/AnswerCardServiceImpl.java

@@ -21,15 +21,26 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
 import com.qmth.boot.core.exception.ParameterException;
-import com.qmth.boot.core.fss.store.FileStore;
 
 import cn.com.qmth.scancentral.bean.User;
 import cn.com.qmth.scancentral.bean.card.CardFile;
 import cn.com.qmth.scancentral.dao.AnswerCardDao;
-import cn.com.qmth.scancentral.entity.*;
+import cn.com.qmth.scancentral.entity.AnswerCardEntity;
+import cn.com.qmth.scancentral.entity.AnswerCardSubjectEntity;
+import cn.com.qmth.scancentral.entity.ExamEntity;
+import cn.com.qmth.scancentral.entity.ScannerCardEntity;
+import cn.com.qmth.scancentral.entity.SubjectEntity;
 import cn.com.qmth.scancentral.enums.CardSource;
 import cn.com.qmth.scancentral.enums.ExamMode;
-import cn.com.qmth.scancentral.service.*;
+import cn.com.qmth.scancentral.service.AdapteFileService;
+import cn.com.qmth.scancentral.service.AnswerCardService;
+import cn.com.qmth.scancentral.service.AnswerCardSubjectService;
+import cn.com.qmth.scancentral.service.ExamService;
+import cn.com.qmth.scancentral.service.FileService;
+import cn.com.qmth.scancentral.service.PaperService;
+import cn.com.qmth.scancentral.service.PaperStructureService;
+import cn.com.qmth.scancentral.service.ScannerCardService;
+import cn.com.qmth.scancentral.service.SubjectService;
 import cn.com.qmth.scancentral.vo.AnswerCardVo;
 
 @Service
@@ -47,18 +58,12 @@ public class AnswerCardServiceImpl extends MppServiceImpl<AnswerCardDao, AnswerC
     @Autowired
     private FileService fileService;
 
-    @Autowired
-    private FileStore fileStore;
-
     @Autowired
     private SubjectService subjectService;
 
     @Autowired
     private ScannerCardService scannerCardService;
 
-    @Autowired
-    private SessionService sessionService;
-
     @Autowired
     private PaperService paperService;
 
@@ -97,8 +102,8 @@ public class AnswerCardServiceImpl extends MppServiceImpl<AnswerCardDao, AnswerC
                 throw new ParameterException("卡格式已被使用,无法修改");
             }
             entity = this.findByExamAndNumber(examId, number);
-            if (StringUtils.isNotBlank(subjectCode) && !answerCardSubjectService
-                    .checkSubject(examId, number, subjectCode)) {
+            if (StringUtils.isNotBlank(subjectCode)
+                    && !answerCardSubjectService.checkSubject(examId, number, subjectCode)) {
                 throw new ParameterException("卡格式与该科目无关联,无法修改");
             }
         }
@@ -109,7 +114,7 @@ public class AnswerCardServiceImpl extends MppServiceImpl<AnswerCardDao, AnswerC
         List<String> sliceName = null;
         try {
             fileData = file.getBytes();
-            //解析卡格式文件
+            // 解析卡格式文件
             cardFile = parseCardFile(fileData);
             if (singlePage && paperCount != cardFile.getPages().size()) {
                 throw new ParameterException("卡格式数量不一致");
@@ -117,7 +122,7 @@ public class AnswerCardServiceImpl extends MppServiceImpl<AnswerCardDao, AnswerC
             if (!singlePage && paperCount * 2 != cardFile.getPages().size()) {
                 throw new ParameterException("卡格式数量不一致");
             }
-            //提取裁切坐标
+            // 提取裁切坐标
             sliceConfig = cardFile.getSliceConfig().toString();
             if (ExamMode.CET.equals(exam.getMode())) {
                 sliceName = cardFile.getSliceName();
@@ -125,11 +130,11 @@ public class AnswerCardServiceImpl extends MppServiceImpl<AnswerCardDao, AnswerC
         } catch (IOException e) {
             throw new ParameterException("文件解析失败", e);
         }
-            if (number != null) {
-                entity = this.findByExamAndNumber(examId, number);
-            } else {
-                number = findMaxCardNumberByExamId(examId) + 1;
-            }
+        if (number != null) {
+            entity = this.findByExamAndNumber(examId, number);
+        } else {
+            number = findMaxCardNumberByExamId(examId) + 1;
+        }
         String filePath;
         try {
             filePath = fileService.uploadAnswerCard(file.getInputStream(), md5, examId, number);
@@ -161,7 +166,7 @@ public class AnswerCardServiceImpl extends MppServiceImpl<AnswerCardDao, AnswerC
         entity.setNeedAdapte(false);
         entity.setSliceName(sliceName);
         this.saveOrUpdateByMultiId(entity);
-        //提取客观题结构
+        // 提取客观题结构
         paperStructureService.updateByAnswerCard(cardFile, examId, number);
         return entity;
     }

+ 86 - 47
src/main/java/cn/com/qmth/scancentral/service/impl/BatchServiceImpl.java

@@ -1,5 +1,31 @@
 package cn.com.qmth.scancentral.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.math.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.collection.PageResult;
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
+import com.qmth.boot.core.exception.ParameterException;
+import com.qmth.boot.core.exception.StatusException;
+
 import cn.com.qmth.scancentral.bean.BatchCreateDomain;
 import cn.com.qmth.scancentral.bean.BatchQueryDomain;
 import cn.com.qmth.scancentral.bean.User;
@@ -7,15 +33,43 @@ import cn.com.qmth.scancentral.bean.WorkloadDomain;
 import cn.com.qmth.scancentral.bean.answersave.AnswerDomain;
 import cn.com.qmth.scancentral.bean.answersave.AnswerPaper;
 import cn.com.qmth.scancentral.dao.BatchDao;
-import cn.com.qmth.scancentral.entity.*;
-import cn.com.qmth.scancentral.enums.*;
+import cn.com.qmth.scancentral.entity.AnswerCardEntity;
+import cn.com.qmth.scancentral.entity.BatchEntity;
+import cn.com.qmth.scancentral.entity.BatchPaperEntity;
+import cn.com.qmth.scancentral.entity.ExamEntity;
+import cn.com.qmth.scancentral.entity.PaperEntity;
+import cn.com.qmth.scancentral.entity.PaperPageEntity;
+import cn.com.qmth.scancentral.entity.StudentEntity;
+import cn.com.qmth.scancentral.entity.StudentPaperEntity;
+import cn.com.qmth.scancentral.entity.SubjectEntity;
+import cn.com.qmth.scancentral.enums.BatchStatus;
+import cn.com.qmth.scancentral.enums.CheckStatus;
+import cn.com.qmth.scancentral.enums.LockType;
+import cn.com.qmth.scancentral.enums.Role;
+import cn.com.qmth.scancentral.enums.VerifyStatus;
 import cn.com.qmth.scancentral.exception.NotFoundExceptions;
 import cn.com.qmth.scancentral.exception.ParameterExceptions;
-import cn.com.qmth.scancentral.service.*;
+import cn.com.qmth.scancentral.service.AnswerCardService;
+import cn.com.qmth.scancentral.service.AnswerCardSubjectService;
+import cn.com.qmth.scancentral.service.AssignedCheckHistoryService;
+import cn.com.qmth.scancentral.service.BatchPaperService;
+import cn.com.qmth.scancentral.service.BatchService;
+import cn.com.qmth.scancentral.service.ExamService;
+import cn.com.qmth.scancentral.service.FilePropertyService;
+import cn.com.qmth.scancentral.service.FileService;
+import cn.com.qmth.scancentral.service.PaperPageService;
+import cn.com.qmth.scancentral.service.PaperService;
+import cn.com.qmth.scancentral.service.StudentService;
+import cn.com.qmth.scancentral.service.SubjectService;
 import cn.com.qmth.scancentral.support.TaskLock;
 import cn.com.qmth.scancentral.support.TaskLockUtil;
 import cn.com.qmth.scancentral.util.PageUtil;
-import cn.com.qmth.scancentral.vo.*;
+import cn.com.qmth.scancentral.vo.BatchFinishVo;
+import cn.com.qmth.scancentral.vo.BatchQueryVo;
+import cn.com.qmth.scancentral.vo.BatchVerifyVo;
+import cn.com.qmth.scancentral.vo.ScannerWorkloadVo;
+import cn.com.qmth.scancentral.vo.SheetUploadVo;
+import cn.com.qmth.scancentral.vo.SliceUploadVo;
 import cn.com.qmth.scancentral.vo.batch.AnswerSaveVo;
 import cn.com.qmth.scancentral.vo.batch.BatchCreateVo;
 import cn.com.qmth.scancentral.vo.batch.Paper;
@@ -28,24 +82,6 @@ import cn.com.qmth.scancentral.vo.paper.PaperVo;
 import cn.com.qmth.scancentral.vo.task.TaskStatusVo;
 import cn.com.qmth.scancentral.vo.verify.VerifyStudentVo;
 import cn.com.qmth.scancentral.vo.verify.VerifyTaskVo;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-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.collection.PageResult;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.ParameterException;
-import com.qmth.boot.core.exception.StatusException;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang.math.RandomUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.*;
 
 @Service
 public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> implements BatchService {
@@ -113,7 +149,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
         List<Rescan> rescan = new ArrayList<>();
         String packageCode = null;
         for (String examNumber : domain.getExamNumbers()) {
-            StudentEntity student = studentService.findByExamIdAndExamNumber(domain.getExamId(), examNumber);
+            StudentEntity student = studentService.findByExamAndSubjectCodeAndStudentCode(domain.getExamId(),
+                    domain.getSubjectCode(), examNumber);
             if (student == null) {
                 throw new ParameterException("未找到考生信息:" + examNumber);
             }
@@ -138,7 +175,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
             if (StringUtils.isBlank(domain.getSubjectCode())) {
                 throw new ParameterException("整袋模式下科目代码不能为空");
             }
-            List<StudentEntity> ss = studentService.findByExamAndPackage(domain.getExamId(), packageCode, domain.getSubjectCode());
+            List<StudentEntity> ss = studentService.findByExamAndPackage(domain.getExamId(), packageCode,
+                    domain.getSubjectCode());
             if (CollectionUtils.isEmpty(ss) || ss.size() != domain.getExamNumbers().size()) {
                 throw new ParameterException("该批次考生数量与卷袋考生数量不一致");
             }
@@ -226,12 +264,11 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
     @Transactional
     @Override
     public SheetUploadVo sheetUpload(Long batchId, String examNumber, Integer paperNumber, Integer pageIndex,
-                                     MultipartFile multipartFile, String md5) {
+            MultipartFile multipartFile, String md5) {
         BatchEntity batch = checkBatchStatus(getById(batchId));
         try {
-            String path = fileService
-                    .uploadSheet(multipartFile.getInputStream(), md5, batch.getExamId(), batchId, examNumber,
-                            paperNumber, pageIndex);
+            String path = fileService.uploadSheet(multipartFile.getInputStream(), md5, batch.getExamId(), batchId,
+                    examNumber, paperNumber, pageIndex);
             filePropertyService.save(batch.getExamId(), path, md5, multipartFile.getSize());
             return SheetUploadVo.create(path);
         } catch (Exception e) {
@@ -244,12 +281,11 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
     @Transactional
     @Override
     public SliceUploadVo sliceUpload(Long batchId, String examNumber, Integer paperNumber, Integer pageIndex,
-                                     Integer index, MultipartFile multipartFile, String md5) {
+            Integer index, MultipartFile multipartFile, String md5) {
         BatchEntity batch = checkBatchStatus(getById(batchId));
         try {
-            String path = fileService
-                    .uploadSlice(multipartFile.getInputStream(), md5, batch.getExamId(), batchId, examNumber,
-                            paperNumber, pageIndex, index);
+            String path = fileService.uploadSlice(multipartFile.getInputStream(), md5, batch.getExamId(), batchId,
+                    examNumber, paperNumber, pageIndex, index);
             filePropertyService.save(batch.getExamId(), path, md5, multipartFile.getSize());
             return SliceUploadVo.create(path);
         } catch (Exception e) {
@@ -268,7 +304,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
             throw ParameterExceptions.EXAM_NOT_FOUND;
         }
         String examNumber = domain.getExamNumber();
-        StudentEntity student = studentService.findByExamIdAndExamNumber(batch.getExamId(), examNumber);
+        StudentEntity student = studentService.findByExamAndSubjectCodeAndStudentCode(batch.getExamId(),
+                domain.getSubjectCode(), examNumber);
         if (student == null) {
             throw new ParameterException("考生信息未找到");
         }
@@ -283,7 +320,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
             }
         }
         // 验证卡格式所属科目
-        boolean allowSubject = answerCardSubjectService.checkSubject(answerCard.getExamId(), answerCard.getNumber(), student.getSubjectCode());
+        boolean allowSubject = answerCardSubjectService.checkSubject(answerCard.getExamId(), answerCard.getNumber(),
+                student.getSubjectCode());
         if (!allowSubject) {
             throw new ParameterException("卡格式与考生科目不一致");
         }
@@ -322,10 +360,11 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
             studentAssigned = studentAssigned || paper.getAssigned();
         }
         // 更新批次统计数量,改到finish的时候更新
-//        updateAssignedCount(batch.getId());
-//        updateScanCount(batch.getId());
+        // updateAssignedCount(batch.getId());
+        // updateScanCount(batch.getId());
         // 不开启实时审核,或者没有人工绑定的情况下,或者当前批次无需审核,直接更新考生扫描状态
-        if (VerifyStatus.CANCEL.equals(batch.getVerifyStatus()) || exam.getEnableSyncVerify() == null || !exam.getEnableSyncVerify() || !studentAssigned) {
+        if (VerifyStatus.CANCEL.equals(batch.getVerifyStatus()) || exam.getEnableSyncVerify() == null
+                || !exam.getEnableSyncVerify() || !studentAssigned) {
             concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().lock();
             try {
                 studentService.updateStudentAndPaper(user, student.getId(), studentPaperList);
@@ -340,8 +379,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
     private PaperEntity findOrCreatePaper(BatchEntity batch, StudentEntity student, Integer paperNumber, User user) {
         PaperEntity paper = null;
         // 尝试重用已有paper对象
-        BatchPaperEntity batchPaper = batchPaperService
-                .findByBatchIdAndStudentIdAndPaperNumber(batch.getId(), student.getId(), paperNumber);
+        BatchPaperEntity batchPaper = batchPaperService.findByBatchIdAndStudentIdAndPaperNumber(batch.getId(),
+                student.getId(), paperNumber);
         if (batchPaper != null) {
             paper = paperService.getById(batchPaper.getPaperId());
         }
@@ -358,9 +397,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
         List<BatchPaperEntity> batchPaperList = batchPaperService.findByBatchId(batchId);
         Map<Long, List<StudentPaperEntity>> studentMap = new HashMap<>();
         for (BatchPaperEntity batchPaper : batchPaperList) {
-            studentMap.computeIfAbsent(batchPaper.getStudentId(), key -> new ArrayList<>())
-                    .add(new StudentPaperEntity(batchPaper.getStudentId(), batchPaper.getPaperNumber(),
-                            batchPaper.getPaperId()));
+            studentMap.computeIfAbsent(batchPaper.getStudentId(), key -> new ArrayList<>()).add(new StudentPaperEntity(
+                    batchPaper.getStudentId(), batchPaper.getPaperNumber(), batchPaper.getPaperId()));
         }
         for (Map.Entry<Long, List<StudentPaperEntity>> entry : studentMap.entrySet()) {
             concurrentService.getReadWriteLock(LockType.STUDENT + "-" + entry.getKey()).writeLock().lock();
@@ -470,7 +508,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
 
     private void checkStudentCount(BatchEntity entity) {
         List<BatchPaperEntity> papers = batchPaperService.findByBatchId(entity.getId());
-        List<StudentEntity> students = studentService.findByExamAndPackage(entity.getExamId(), entity.getPackageCode(), entity.getSubjectCode());
+        List<StudentEntity> students = studentService.findByExamAndPackage(entity.getExamId(), entity.getPackageCode(),
+                entity.getSubjectCode());
         if (CollectionUtils.isEmpty(papers) && CollectionUtils.isEmpty(students)) {
             return;
         }
@@ -509,8 +548,8 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
 
     @Override
     public PageResult<BatchQueryVo> batchQuery(BatchQueryDomain query) {
-        IPage<BatchQueryVo> iPage = baseMapper
-                .batchQueryPage(new Page<>(query.getPageNumber(), query.getPageSize()), query);
+        IPage<BatchQueryVo> iPage = baseMapper.batchQueryPage(new Page<>(query.getPageNumber(), query.getPageSize()),
+                query);
         // TODO 需要后续补充incomplete逻辑
         return PageUtil.of(iPage);
     }
@@ -755,7 +794,7 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
         lw.eq(BatchEntity::getExamId, examId);
         lw.eq(BatchEntity::getCheckStatus, status);
         lw.eq(BatchEntity::getStatus, BatchStatus.FINISH);
-        //审核员只统计自身已完成的数量
+        // 审核员只统计自身已完成的数量
         if (status == CheckStatus.FINISH && user.getRole() == Role.AUDITOR) {
             lw.eq(BatchEntity::getCheckImageUserId, user.getId());
         }
@@ -770,7 +809,7 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
 
     @Override
     public IPage<BatchEntity> findUnCheck(Long examId, int pageNumber, int pageSize, BatchStatus batchStatus,
-                                          CheckStatus checkStatus) {
+            CheckStatus checkStatus) {
         return this.baseMapper.findUnCheck(new Page<>(pageNumber, pageSize), examId, batchStatus, checkStatus);
     }
 

+ 59 - 54
src/main/java/cn/com/qmth/scancentral/service/impl/ExamServiceImpl.java

@@ -22,9 +22,26 @@ import cn.com.qmth.scancentral.dao.ExamDao;
 import cn.com.qmth.scancentral.entity.ExamEntity;
 import cn.com.qmth.scancentral.entity.ExamSummaryEntity;
 import cn.com.qmth.scancentral.entity.SystemConfigEntity;
-import cn.com.qmth.scancentral.enums.*;
+import cn.com.qmth.scancentral.enums.CheckStatus;
+import cn.com.qmth.scancentral.enums.ImageTransferMode;
+import cn.com.qmth.scancentral.enums.LockType;
+import cn.com.qmth.scancentral.enums.Role;
+import cn.com.qmth.scancentral.enums.SystemMode;
+import cn.com.qmth.scancentral.enums.TaskStatus;
 import cn.com.qmth.scancentral.exception.ParameterExceptions;
-import cn.com.qmth.scancentral.service.*;
+import cn.com.qmth.scancentral.service.AnswerCardService;
+import cn.com.qmth.scancentral.service.BatchService;
+import cn.com.qmth.scancentral.service.ExamService;
+import cn.com.qmth.scancentral.service.ExamSummaryService;
+import cn.com.qmth.scancentral.service.OmrGroupService;
+import cn.com.qmth.scancentral.service.OmrTaskService;
+import cn.com.qmth.scancentral.service.PackageCardService;
+import cn.com.qmth.scancentral.service.PackageTaskService;
+import cn.com.qmth.scancentral.service.SessionService;
+import cn.com.qmth.scancentral.service.StudentService;
+import cn.com.qmth.scancentral.service.SubjectService;
+import cn.com.qmth.scancentral.service.SystemConfigService;
+import cn.com.qmth.scancentral.service.UserService;
 import cn.com.qmth.scancentral.util.PageUtil;
 import cn.com.qmth.scancentral.vo.ExamConfigVo;
 import cn.com.qmth.scancentral.vo.ExamVo;
@@ -74,22 +91,16 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
     @Autowired
     private UserService userService;
 
-    @Autowired
-    private QuestionService questionService;
-
     @Autowired
     private ExamSummaryService examSummaryService;
 
-    @Autowired
-    private StudentAnswerTaskService studentAnswerTaskService;
-
     @Override
     public PageResult<ExamVo> pageQuery(ExamQuery query, User user) {
         if (query.getEnable() == null) {
             throw new ParameterException("是否启用不能为空");
         }
-        IPage<ExamVo> iPage = this.baseMapper
-                .pageExam(new Page<>(query.getPageNumber(), query.getPageSize()), query, user.getSchoolId());
+        IPage<ExamVo> iPage = this.baseMapper.pageExam(new Page<>(query.getPageNumber(), query.getPageSize()), query,
+                user.getSchoolId());
         return PageUtil.of(iPage);
     }
 
@@ -107,7 +118,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
         if (!exam.getSchoolId().equals(accessUser.getSchoolId())) {
             throw ParameterExceptions.EXAM_NOT_FOUND;
         }
-        //ScanAnswerInfoVo info = studentService.scanAnswerInfo(examId);
+        // ScanAnswerInfoVo info = studentService.scanAnswerInfo(examId);
         ExamInfoVo vo = new ExamInfoVo();
         ExamSummaryEntity es = examSummaryService.find(examId);
         vo.setId(examId);
@@ -179,9 +190,6 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
         vo.getAuditor().setOnlineCount(sessionService.getOnlineAuditorCount());
         vo.getAuditor().setUserCount(userService.countByRole(accessUser.getSchoolId(), Role.AUDITOR));
 
-        vo.getStudentAnswerTask().setTodoCount(studentAnswerTaskService.getCountByExamAndStatus(examId, StudentAnswerTaskStatus.WAITING));
-        vo.getStudentAnswerTask().setTotalCount(studentAnswerTaskService.getCountByExam(examId));
-
         vo.getExamStatusCheck().setExamNumberFillCount(exam.getExamNumberFillCount());
 
         if (accessUser.getRole().equals(Role.AUDITOR)) {
@@ -230,9 +238,6 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
 
         vo.setSubjectConfig(subjectService.listConfigByExamId(id));
 
-        vo.getStudentAnswerTask().setTodoCount(studentAnswerTaskService.getCountByExamAndStatus(id, StudentAnswerTaskStatus.WAITING));
-        vo.getStudentAnswerTask().setFinishCount(studentAnswerTaskService.getCountByExamAndStatus(id, StudentAnswerTaskStatus.PROCESSED));
-
         return vo;
     }
 
@@ -256,48 +261,48 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
         if (!exam.getSchoolId().equals(user.getSchoolId())) {
             throw ParameterExceptions.EXAM_NOT_FOUND;
         }
-            if (domain.getAllowUnexistPaper() != null) {
-                exam.setAllowUnexistPaper(domain.getAllowUnexistPaper());
-            }
-            if (domain.getEnableSinglePageAnswer() != null) {
-                exam.setEnableSinglePageAnswer(domain.getEnableSinglePageAnswer());
-            }
-            if (domain.getEnableSyncVerify() != null) {
-                exam.setEnableSyncVerify(domain.getEnableSyncVerify());
-            }
-            if (domain.getScanByPackage() != null) {
-                exam.setScanByPackage(domain.getScanByPackage());
-            }
-            if (domain.getAbsentBarcodeContent() != null) {
-                exam.setAbsentBarcodeContent(domain.getAbsentBarcodeContent());
-            }
-            if (domain.getAnswerFrontCardType() != null) {
-                exam.setAnswerFrontCardType(domain.getAnswerFrontCardType());
-            }
-            if (domain.getImageTransferMode() != null) {
-                exam.setImageTransferMode(domain.getImageTransferMode());
-            }
-            if (domain.getMode() != null) {
-                exam.setMode(domain.getMode());
-            }
-            if (domain.getPaperTypeBarcodeContent() != null) {
-                exam.setPaperTypeBarcodeContent(domain.getPaperTypeBarcodeContent());
-            }
-            exam.setId(domain.getId());
-            exam.setAbsentBarcodeContent(domain.getAbsentBarcodeContent());
+        if (domain.getAllowUnexistPaper() != null) {
             exam.setAllowUnexistPaper(domain.getAllowUnexistPaper());
+        }
+        if (domain.getEnableSinglePageAnswer() != null) {
+            exam.setEnableSinglePageAnswer(domain.getEnableSinglePageAnswer());
+        }
+        if (domain.getEnableSyncVerify() != null) {
+            exam.setEnableSyncVerify(domain.getEnableSyncVerify());
+        }
+        if (domain.getScanByPackage() != null) {
+            exam.setScanByPackage(domain.getScanByPackage());
+        }
+        if (domain.getAbsentBarcodeContent() != null) {
+            exam.setAbsentBarcodeContent(domain.getAbsentBarcodeContent());
+        }
+        if (domain.getAnswerFrontCardType() != null) {
             exam.setAnswerFrontCardType(domain.getAnswerFrontCardType());
+        }
+        if (domain.getImageTransferMode() != null) {
             exam.setImageTransferMode(domain.getImageTransferMode());
-            exam.setEnableSyncVerify(domain.getEnableSyncVerify());
-            exam.setEnableSinglePageAnswer(domain.getEnableSinglePageAnswer());
+        }
+        if (domain.getMode() != null) {
             exam.setMode(domain.getMode());
+        }
+        if (domain.getPaperTypeBarcodeContent() != null) {
             exam.setPaperTypeBarcodeContent(domain.getPaperTypeBarcodeContent());
-            exam.setScanByPackage(domain.getScanByPackage());
-            if (exam.getEnableSyncVerify() == false) {
-                batchService.batchVerifyCancel(user, exam.getId());
-            }
-            this.saveOrUpdate(exam);
-            return new ExamConfigVo(exam);
+        }
+        exam.setId(domain.getId());
+        exam.setAbsentBarcodeContent(domain.getAbsentBarcodeContent());
+        exam.setAllowUnexistPaper(domain.getAllowUnexistPaper());
+        exam.setAnswerFrontCardType(domain.getAnswerFrontCardType());
+        exam.setImageTransferMode(domain.getImageTransferMode());
+        exam.setEnableSyncVerify(domain.getEnableSyncVerify());
+        exam.setEnableSinglePageAnswer(domain.getEnableSinglePageAnswer());
+        exam.setMode(domain.getMode());
+        exam.setPaperTypeBarcodeContent(domain.getPaperTypeBarcodeContent());
+        exam.setScanByPackage(domain.getScanByPackage());
+        if (exam.getEnableSyncVerify() == false) {
+            batchService.batchVerifyCancel(user, exam.getId());
+        }
+        this.saveOrUpdate(exam);
+        return new ExamConfigVo(exam);
     }
 
     @Transactional

+ 63 - 38
src/main/java/cn/com/qmth/scancentral/service/impl/OmrTaskServiceImpl.java

@@ -1,37 +1,63 @@
 package cn.com.qmth.scancentral.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.validation.constraints.NotNull;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
+import com.qmth.boot.core.exception.ParameterException;
+
 import cn.com.qmth.scancentral.bean.OmrTaskDto;
 import cn.com.qmth.scancentral.bean.OmrTaskPageDto;
 import cn.com.qmth.scancentral.bean.User;
 import cn.com.qmth.scancentral.dao.OmrTaskDao;
-import cn.com.qmth.scancentral.entity.*;
-import cn.com.qmth.scancentral.enums.*;
+import cn.com.qmth.scancentral.entity.OmrGroupEntity;
+import cn.com.qmth.scancentral.entity.OmrTaskEntity;
+import cn.com.qmth.scancentral.entity.PaperEntity;
+import cn.com.qmth.scancentral.entity.PaperPageEntity;
+import cn.com.qmth.scancentral.entity.StudentEntity;
+import cn.com.qmth.scancentral.entity.StudentPaperEntity;
+import cn.com.qmth.scancentral.entity.SubjectEntity;
+import cn.com.qmth.scancentral.enums.ConditionType;
+import cn.com.qmth.scancentral.enums.LockType;
+import cn.com.qmth.scancentral.enums.OmrField;
+import cn.com.qmth.scancentral.enums.ScanStatus;
+import cn.com.qmth.scancentral.enums.Stage;
+import cn.com.qmth.scancentral.enums.TaskStatus;
 import cn.com.qmth.scancentral.exception.NotFoundExceptions;
 import cn.com.qmth.scancentral.model.OmrCondition;
 import cn.com.qmth.scancentral.model.OmrTaskItem;
 import cn.com.qmth.scancentral.model.OmrTaskPage;
-import cn.com.qmth.scancentral.service.*;
+import cn.com.qmth.scancentral.service.OmrGroupService;
+import cn.com.qmth.scancentral.service.OmrTaskService;
+import cn.com.qmth.scancentral.service.PaperPageService;
+import cn.com.qmth.scancentral.service.PaperService;
+import cn.com.qmth.scancentral.service.PaperStructureService;
+import cn.com.qmth.scancentral.service.StudentPaperService;
+import cn.com.qmth.scancentral.service.StudentService;
+import cn.com.qmth.scancentral.service.SubjectService;
 import cn.com.qmth.scancentral.support.TaskLock;
 import cn.com.qmth.scancentral.support.TaskLockUtil;
 import cn.com.qmth.scancentral.vo.paperstructureinfo.PaperStructure;
-import cn.com.qmth.scancentral.vo.task.*;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.ParameterException;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.validation.constraints.NotNull;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import cn.com.qmth.scancentral.vo.task.TaskPageVo;
+import cn.com.qmth.scancentral.vo.task.TaskResultPageVo;
+import cn.com.qmth.scancentral.vo.task.TaskResultVo;
+import cn.com.qmth.scancentral.vo.task.TaskSaveVo;
+import cn.com.qmth.scancentral.vo.task.TaskStatusVo;
+import cn.com.qmth.scancentral.vo.task.TaskVo;
 
 @Service
 public class OmrTaskServiceImpl extends ServiceImpl<OmrTaskDao, OmrTaskEntity> implements OmrTaskService {
@@ -321,7 +347,7 @@ public class OmrTaskServiceImpl extends ServiceImpl<OmrTaskDao, OmrTaskEntity> i
                         if ((!pageEntity.getPaperType().getResult().contains(OMR_SUSPECT)
                                 && pageEntity.getPaperType().getResult().length() > 2)
                                 || (pageEntity.getPaperType().getResult().contains(OMR_SUSPECT)
-                                && pageEntity.getPaperType().getResult().length() > 1)) {
+                                        && pageEntity.getPaperType().getResult().length() > 1)) {
                             OmrTaskItem item = new OmrTaskItem();
                             item.setField(OmrField.PAPER_TYPE);
                             item.setOmrResult(pageEntity.getPaperType().getResult());
@@ -481,7 +507,6 @@ public class OmrTaskServiceImpl extends ServiceImpl<OmrTaskDao, OmrTaskEntity> i
         TaskVo vo = new TaskVo();
         StudentEntity student = studentService.getById(task.getStudentId());
         vo.setCardNumber(task.getCardNumber());
-        vo.setExamNumber(student.getExamNumber());
         vo.setId(task.getId());
         vo.setName(student.getName());
         vo.setPaperId(task.getPaperId());
@@ -609,21 +634,21 @@ public class OmrTaskServiceImpl extends ServiceImpl<OmrTaskDao, OmrTaskEntity> i
                 for (OmrTaskItem item : page.getItems()) {
                     Object content = null;
                     switch (item.getField()) {
-                        case ABSENT:
-                            content = pageVo.getAbsent();
-                            break;
-                        case BREACH:
-                            content = pageVo.getBreach();
-                            break;
-                        case PAPER_TYPE:
-                            content = pageVo.getPaperType();
-                            break;
-                        case QUESTION:
-                            content = pageVo.getQuestion() != null ? pageVo.getQuestion().get(item.getIndex()) : null;
-                            break;
-                        case SELECTIVE:
-                            content = pageVo.getSelective() != null ? pageVo.getSelective().get(item.getIndex()) : null;
-                            break;
+                    case ABSENT:
+                        content = pageVo.getAbsent();
+                        break;
+                    case BREACH:
+                        content = pageVo.getBreach();
+                        break;
+                    case PAPER_TYPE:
+                        content = pageVo.getPaperType();
+                        break;
+                    case QUESTION:
+                        content = pageVo.getQuestion() != null ? pageVo.getQuestion().get(item.getIndex()) : null;
+                        break;
+                    case SELECTIVE:
+                        content = pageVo.getSelective() != null ? pageVo.getSelective().get(item.getIndex()) : null;
+                        break;
                     }
                     if (content != null) {
                         item.setArbitrateResult(content.toString());

+ 7 - 6
src/main/java/cn/com/qmth/scancentral/service/impl/PaperServiceImpl.java

@@ -282,8 +282,14 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
         if (paper == null) {
             throw new ParameterException("题卡信息未找到, paperId=" + domain.getPaperId());
         }
+        // 校验卡格式
+        AnswerCardEntity answerCard = answerCardService.findByExamAndNumber(domain.getExamId(), domain.getCardNumber());
+        if (answerCard == null) {
+            throw new ParameterException("卡格式信息未找到");
+        }
         // 查找目标考生
-        StudentEntity student = studentService.findByExamIdAndExamNumber(domain.getExamId(), domain.getExamNumber());
+        StudentEntity student = studentService.findByExamAndSubjectCodeAndStudentCode(domain.getExamId(),
+                domain.getSubjectCode(), domain.getExamNumber());
         if (student == null) {
             throw new ParameterException("考生信息未找到, 准考证号=" + domain.getExamNumber());
         }
@@ -291,11 +297,6 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
         if (student.getCardNumber() != null && !student.getCardNumber().equals(domain.getCardNumber())) {
             throw new ParameterException("卡格式与目标考生不一致");
         }
-        // 校验卡格式
-        AnswerCardEntity answerCard = answerCardService.findByExamAndNumber(domain.getExamId(), domain.getCardNumber());
-        if (answerCard == null) {
-            throw new ParameterException("卡格式信息未找到");
-        }
         // 验证卡格式所属科目
         boolean allowSubject = answerCardSubjectService.checkSubject(answerCard.getExamId(), answerCard.getNumber(),
                 student.getSubjectCode());

+ 0 - 185
src/main/java/cn/com/qmth/scancentral/service/impl/StudentAnswerGroupServiceImpl.java

@@ -1,185 +0,0 @@
-package cn.com.qmth.scancentral.service.impl;
-
-import java.util.List;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.ParameterException;
-
-import cn.com.qmth.scancentral.bean.answergroup.StudentAnswerGroupCondition;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupCountVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupIdVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupMarkedVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryQuery;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupSummaryVo;
-import cn.com.qmth.scancentral.bean.answergroup.StudnetAnswerGroupVo;
-import cn.com.qmth.scancentral.dao.StudentAnswerGroupDao;
-import cn.com.qmth.scancentral.entity.StudentAnswerGroupEntity;
-import cn.com.qmth.scancentral.enums.LockType;
-import cn.com.qmth.scancentral.enums.StudentAnswerTaskStatus;
-import cn.com.qmth.scancentral.exception.NotFoundExceptions;
-import cn.com.qmth.scancentral.service.PaperService;
-import cn.com.qmth.scancentral.service.StudentAnswerGroupService;
-import cn.com.qmth.scancentral.service.StudentAnswerTaskService;
-import cn.com.qmth.scancentral.service.StudentService;
-import cn.com.qmth.scancentral.util.BatchSetDataUtil;
-
-@Service
-public class StudentAnswerGroupServiceImpl extends ServiceImpl<StudentAnswerGroupDao, StudentAnswerGroupEntity>
-        implements StudentAnswerGroupService {
-    @Autowired
-    private ConcurrentService concurrentService;
-    @Autowired
-    private StudentAnswerTaskService taskService;
-    
-    @Autowired
-    private PaperService paperService;
-    
-    @Autowired
-    private StudentService studentService;
-
-    @Transactional
-    @Override
-    public void deleteById(Long id) {
-        taskService.deleteByGroupId(id);
-        this.removeById(id);
-    }
-
-    @Transactional
-    @Override
-    public void resetById(Long id) {
-        StudentAnswerGroupEntity group = this.getById(id);
-        if (group == null) {
-            throw new ParameterException("分组不存在");
-        }
-        taskService.resetByGroup(group);
-    }
-
-    @Transactional
-    @Override
-    public void buildTaskById(Long groupId) {
-        StudentAnswerGroupEntity group = this.getById(groupId);
-        List<Long> studentIds = studentService.findStudentAnswerTask(group.getConditions());
-        if(CollectionUtils.isEmpty(studentIds)) {
-            return; 
-        }
-        new BatchSetDataUtil<Long>() {
-            @Override
-            protected void setData(List<Long> dataList) {
-                taskService.saveTask(group, dataList);
-            }
-        }.setDataForBatch(studentIds, 1000);
-        
-    }
-
-    @Override
-    public StudnetAnswerGroupVo listByExamId(Long examId) {
-        StudnetAnswerGroupVo vo = new StudnetAnswerGroupVo();
-        QueryWrapper<StudentAnswerGroupEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerGroupEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerGroupEntity::getExamId, examId);
-        wrapper.last("LIMIT 1");
-        StudentAnswerGroupEntity group = this.baseMapper.selectOne(wrapper);
-        if(group==null) {
-            throw NotFoundExceptions.NO_STUDENT_ANSWER_GROUP;
-        }
-        vo.setId(group.getId());
-        vo.setBuilding(!concurrentService.getSemaphore(LockType.STUDENT_ANSWER_GROUP_BUILD + "-" + group.getId()).isAvailable());
-        vo.setDeleting(!concurrentService.getSemaphore(LockType.STUDENT_ANSWER_GROUP_DELETE + "-" + group.getId()).isAvailable());
-        vo.setReseting(!concurrentService.getSemaphore(LockType.STUDENT_ANSWER_GROUP_RESET + "-" + group.getId()).isAvailable());
-        vo.setConditions(group.getConditions());
-        vo.setTotalCount(group.getTotalCount());
-        vo.setTodoCount(
-                taskService.getCountByExamAndGroupAndStatus(examId, group.getId(), StudentAnswerTaskStatus.WAITING));
-        return vo;
-    }
-
-
-    private List<StudentAnswerGroupEntity> findByExamId(Long examId) {
-        QueryWrapper<StudentAnswerGroupEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerGroupEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerGroupEntity::getExamId, examId);
-        return baseMapper.selectList(wrapper);
-    }
-
-    @Transactional
-    @Override
-    public void updateTotalCount(Long id) {
-        if (id == null) {
-            throw new ParameterException("Id不能为空");
-        }
-        baseMapper.updateTotalCount(id);
-    }
-
-
-    @Transactional
-    @Override
-    public void updateTotalCountByExamId(Long examId) {
-        List<StudentAnswerGroupEntity> list = this.findByExamId(examId);
-        for (StudentAnswerGroupEntity groupEntity : list) {
-            this.updateTotalCount(groupEntity.getId());
-        }
-    }
-
-    @Override
-    public StudnetAnswerGroupCountVo countByCondition(StudentAnswerGroupCondition domain) {
-        if (domain.getExamId() == null) {
-            throw new ParameterException("examId不能为空");
-        }
-        StudnetAnswerGroupCountVo vo = new StudnetAnswerGroupCountVo();
-        if(domain.getAssigned() ==null ||domain.getAssigned()==false ) {
-            domain.setStartTime(null);
-            domain.setEndTime(null);
-        }
-        vo.setTotalCount(studentService.queryStudentAnswerGroupCount(domain));
-        return vo;
-    }
-
-    @Transactional
-    @Override
-    public StudnetAnswerGroupIdVo saveByCondition(StudentAnswerGroupCondition domain) {
-        if (domain.getExamId() == null) {
-            throw new ParameterException("examId不能为空");
-        }
-        QueryWrapper<StudentAnswerGroupEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerGroupEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerGroupEntity::getExamId, domain.getExamId());
-        wrapper.last("LIMIT 1");
-        StudentAnswerGroupEntity oldgroup = this.baseMapper.selectOne(wrapper);
-        if (oldgroup != null) {
-            throw new ParameterException("已存在任务组");
-        }
-        StudentAnswerGroupEntity group = new StudentAnswerGroupEntity();
-        group.setExamId(domain.getExamId());
-        group.setTotalCount(0);
-        if(domain.getAssigned() ==null ||domain.getAssigned()==false ) {
-            domain.setStartTime(null);
-            domain.setEndTime(null);
-        }
-        group.setConditions(domain);
-        this.save(group);
-        StudnetAnswerGroupIdVo vo=new StudnetAnswerGroupIdVo();
-        vo.setId(group.getId());
-        return vo;
-    }
-
-    @Override
-    public StudnetAnswerGroupSummaryVo summary(StudnetAnswerGroupSummaryQuery query) {
-        StudnetAnswerGroupSummaryVo vo=new StudnetAnswerGroupSummaryVo();
-        vo.setSystem(paperService.getMismatchCountByExam(query.getExamId()));
-        vo.setMark(studentService.getStudentAnswerCount(query)); 
-        return vo;
-    }
-
-    @Override
-    public List<StudnetAnswerGroupMarkedVo> marked(Long examId) {
-        return studentService.getStudentAnswerMarkedList(examId);
-    }
-}

+ 0 - 345
src/main/java/cn/com/qmth/scancentral/service/impl/StudentAnswerTaskServiceImpl.java

@@ -1,345 +0,0 @@
-package cn.com.qmth.scancentral.service.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-import cn.com.qmth.scancentral.bean.User;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskPageVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskPaperVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskSaveDomain;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskSaveVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskStatusVo;
-import cn.com.qmth.scancentral.bean.answertask.StudentAnswerTaskVo;
-import cn.com.qmth.scancentral.dao.StudentAnswerTaskDao;
-import cn.com.qmth.scancentral.entity.PaperEntity;
-import cn.com.qmth.scancentral.entity.PaperPageEntity;
-import cn.com.qmth.scancentral.entity.StudentAnswerGroupEntity;
-import cn.com.qmth.scancentral.entity.StudentAnswerTaskEntity;
-import cn.com.qmth.scancentral.entity.StudentEntity;
-import cn.com.qmth.scancentral.entity.StudentPaperEntity;
-import cn.com.qmth.scancentral.entity.SubjectEntity;
-import cn.com.qmth.scancentral.enums.PaperTypeStatus;
-import cn.com.qmth.scancentral.enums.StudentAnswerTaskStatus;
-import cn.com.qmth.scancentral.enums.TaskStatus;
-import cn.com.qmth.scancentral.exception.NotFoundExceptions;
-import cn.com.qmth.scancentral.service.PaperPageService;
-import cn.com.qmth.scancentral.service.PaperService;
-import cn.com.qmth.scancentral.service.StudentAnswerGroupService;
-import cn.com.qmth.scancentral.service.StudentAnswerTaskService;
-import cn.com.qmth.scancentral.service.StudentPaperService;
-import cn.com.qmth.scancentral.service.StudentService;
-import cn.com.qmth.scancentral.service.SubjectService;
-import cn.com.qmth.scancentral.support.TaskLock;
-import cn.com.qmth.scancentral.support.TaskLockUtil;
-
-@Service
-public class StudentAnswerTaskServiceImpl extends ServiceImpl<StudentAnswerTaskDao, StudentAnswerTaskEntity>
-        implements StudentAnswerTaskService {
-
-    @Autowired
-    private PaperService paperService;
-
-    @Autowired
-    private StudentAnswerGroupService groupService;
-
-    @Autowired
-    private PaperPageService pageService;
-
-    @Autowired
-    private StudentService studentService;
-
-    @Autowired
-    private SubjectService subjectService;
-
-    @Autowired
-    private StudentPaperService studentPaperService;
-
-    @Override
-    public int getCountByExamAndStatus(Long examId, StudentAnswerTaskStatus status) {
-        QueryWrapper<StudentAnswerTaskEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getStatus, status);
-        lw.eq(StudentAnswerTaskEntity::getExamId, examId);
-        return this.count(wrapper);
-    }
-
-    @Override
-    public int getCountByExamAndStatusAndDevice(Long examId, String device, StudentAnswerTaskStatus status) {
-        QueryWrapper<StudentAnswerTaskEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getStatus, status);
-        lw.eq(StudentAnswerTaskEntity::getDevice, device);
-        lw.eq(StudentAnswerTaskEntity::getExamId, examId);
-        return this.count(wrapper);
-    }
-
-    @Override
-    public int getCountByExamAndGroupAndStatus(Long examId, Long groupId, StudentAnswerTaskStatus status) {
-        QueryWrapper<StudentAnswerTaskEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getStatus, status);
-        lw.eq(StudentAnswerTaskEntity::getExamId, examId);
-        lw.eq(StudentAnswerTaskEntity::getGroupId, groupId);
-        return this.count(wrapper);
-    }
-
-    @Transactional
-    @Override
-    public void deleteByGroupId(Long groupId) {
-        UpdateWrapper<StudentAnswerTaskEntity> wrapper = new UpdateWrapper<>();
-        LambdaUpdateWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getGroupId, groupId);
-        this.baseMapper.delete(wrapper);
-    }
-
-    @Transactional
-    @Override
-    public void resetByGroup(StudentAnswerGroupEntity group) {
-        UpdateWrapper<StudentAnswerTaskEntity> wrapper = new UpdateWrapper<>();
-        LambdaUpdateWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.set(StudentAnswerTaskEntity::getStatus, TaskStatus.WAITING);
-        lw.set(StudentAnswerTaskEntity::getDevice, null);
-        lw.eq(StudentAnswerTaskEntity::getGroupId, group.getId());
-        this.update(wrapper);
-    }
-
-    @Transactional
-    @Override
-    public void saveTask(StudentAnswerGroupEntity group, List<Long> studentIds) {
-        List<StudentAnswerTaskEntity> list = new ArrayList<>();
-        for (Long studentId : studentIds) {
-            StudentAnswerTaskEntity task = new StudentAnswerTaskEntity();
-            task.setExamId(group.getExamId());
-            task.setGroupId(group.getId());
-            task.setStatus(StudentAnswerTaskStatus.WAITING);
-            task.setStudentId(studentId);
-            list.add(task);
-        }
-        this.saveBatch(list);
-        groupService.updateTotalCount(group.getId());
-    }
-
-    @Override
-    public StudentAnswerTaskVo getTask(Long examId, String account) {
-        return findWaitingTask(examId, account);
-    }
-
-    private StudentAnswerTaskVo findWaitingTask(Long examId, String account) {
-        int retry = 0;
-        StudentAnswerTaskVo task = null;
-        while (task == null) {
-            List<StudentAnswerTaskEntity> list = this.findUnMarked(examId, retry * 20, 20,
-                    StudentAnswerTaskStatus.WAITING);
-            if (list.isEmpty()) {
-                break;
-            }
-            for (StudentAnswerTaskEntity t : list) {
-                if (this.apply(t, account)) {
-                    task = toTaskVo(t);
-                    break;
-                }
-            }
-            if (task == null) {
-                retry++;
-            }
-        }
-        if (task == null) {
-            throw NotFoundExceptions.NO_STUDENT_ANSWER_TASK;
-        }
-        return task;
-    }
-
-    private StudentAnswerTaskVo toTaskVo(StudentAnswerTaskEntity task) {
-        StudentAnswerTaskVo vo = new StudentAnswerTaskVo();
-        StudentEntity student = studentService.getById(task.getStudentId());
-        vo.setCardNumber(student.getCardNumber());
-        vo.setExamNumber(student.getExamNumber());
-        vo.setId(task.getId());
-        vo.setName(student.getName());
-        vo.setSubjectCode(student.getSubjectCode());
-        vo.setOmrAbsent(student.getOmrAbsent());
-        vo.setAssigned(student.getAssigned());
-        vo.setCheckMark(student.getCheckMark());
-        SubjectEntity subject = subjectService.findByExamIdAndCode(student.getExamId(), student.getSubjectCode());
-        vo.setSubjectName(subject.getName());
-        List<StudentAnswerTaskPaperVo> papers = new ArrayList<>();
-        vo.setPapers(papers);
-        List<StudentPaperEntity> spapers = studentPaperService.findByStudentId(student.getId());
-        StudentAnswerGroupEntity group = groupService.getById(task.getGroupId());
-        for (StudentPaperEntity sp : spapers) {
-            PaperEntity paper = paperService.getById(sp.getPaperId());
-            if (group.getConditions().getAssigned() != null && group.getConditions().getAssigned()
-                    && paper.getAssigned() != null && !paper.getAssigned()) {
-                continue;
-            }
-            boolean paperTypeSuccss = true;
-            StudentAnswerTaskPaperVo paperVo = new StudentAnswerTaskPaperVo();
-            paperVo.setNumber(paper.getNumber());
-            paperVo.setAssigned(paper.getAssigned());
-            List<PaperPageEntity> pages = pageService.listByPaperId(sp.getPaperId());
-            if (group.getConditions().getPaperTypeStatus() != null) {
-                paperTypeSuccss = paperTypeSuccss(pages.get(0), group.getConditions().getPaperTypeStatus());
-            }
-            for (PaperPageEntity page : pages) {
-                StudentAnswerTaskPageVo pageVo = new StudentAnswerTaskPageVo();
-                pageVo.setIndex(page.getPageIndex());
-                pageVo.setSheetUri(page.getSheetPath());
-                pageVo.setSliceUri(page.getSlicePath());
-                paperVo.addPage(pageVo);
-            }
-            if (paperTypeSuccss) {
-                papers.add(paperVo);
-            }
-        }
-        return vo;
-    }
-
-    private boolean paperTypeSuccss(PaperPageEntity page, PaperTypeStatus paperTypeStatus) {
-        if (PaperTypeStatus.OK.equals(paperTypeStatus)) {
-            if (page.getPaperType() == null || page.getPaperType().getResult() == null
-                    || "#".equals(page.getPaperType().getResult()) || "?".equals(page.getPaperType().getResult())) {
-                return false;
-            } else {
-                return true;
-            }
-        } else if (PaperTypeStatus.ERROR.equals(paperTypeStatus)) {
-            if (page.getPaperType() != null && page.getPaperType().getResult() != null
-                    && "?".equals(page.getPaperType().getResult())) {
-                return true;
-            } else {
-                return false;
-            }
-        } else if (PaperTypeStatus.BLANK.equals(paperTypeStatus)) {
-            if (page.getPaperType() != null && page.getPaperType().getResult() != null
-                    && "#".equals(page.getPaperType().getResult())) {
-                return true;
-            } else {
-                return false;
-            }
-        }
-        return false;
-    }
-
-    @Transactional
-    @Override
-    public StudentAnswerTaskSaveVo submitTask(StudentAnswerTaskSaveDomain domain, User user) {
-        StudentAnswerTaskEntity task = this.getById(domain.getId());
-        task.setStatus(StudentAnswerTaskStatus.PROCESSED);
-        task.setDevice(user.getAccount());
-        studentService.updateCheckMark(task.getStudentId(), domain.getTag());
-        this.saveOrUpdate(task);
-        this.releaseByTask(task);
-        StudentAnswerTaskSaveVo vo = new StudentAnswerTaskSaveVo();
-        vo.setId(domain.getId());
-        vo.setStatus(getStatus(task.getExamId(), user));
-        return vo;
-    }
-
-    @Override
-    public StudentAnswerTaskStatusVo getStatus(Long examId, User user) {
-        StudentAnswerTaskStatusVo vo = new StudentAnswerTaskStatusVo();
-        vo.setFinishCount(
-                this.getCountByExamAndStatusAndDevice(examId, user.getAccount(), StudentAnswerTaskStatus.PROCESSED));
-        vo.setTodoCount(this.getCountByExamAndStatus(examId, StudentAnswerTaskStatus.WAITING));
-        return vo;
-    }
-
-    private boolean apply(StudentAnswerTaskEntity t, String account) {
-        TaskLock taskLock = TaskLockUtil.getStudentAnswerTask(t.getExamId().toString());
-        boolean lock = taskLock.add(t.getId(), account);
-        // 上锁失败直接返回
-        if (!lock) {
-            return false;
-        }
-        // 重复校验任务状态
-        if (t.getStatus().equals(StudentAnswerTaskStatus.WAITING)) {
-            return true;
-        } else {
-            taskLock.remove(t.getId());
-            return false;
-        }
-    }
-
-    @Override
-    public void releaseByUser(Long examId, String account) {
-        TaskLock taskLock = TaskLockUtil.getStudentAnswerTask(examId.toString());
-        taskLock.clear(account);
-    }
-
-    @Override
-    public void releaseByTask(StudentAnswerTaskEntity t) {
-        TaskLock taskLock = TaskLockUtil.getStudentAnswerTask(t.getExamId().toString());
-        taskLock.remove(t.getId());
-    }
-
-    @Override
-    public boolean hasApplied(StudentAnswerTaskEntity t, String account) {
-        TaskLock taskLock = TaskLockUtil.getStudentAnswerTask(t.getExamId().toString());
-        return taskLock.exist(t.getId(), account);
-    }
-
-    @Override
-    public List<StudentAnswerTaskEntity> findUnMarked(Long examId, int pageNumber, int pageSize,
-            StudentAnswerTaskStatus status) {
-        return this.baseMapper.findUnMarked(examId, pageNumber, pageSize, status);
-    }
-
-    @Override
-    public int getCountByExam(Long examId) {
-        QueryWrapper<StudentAnswerTaskEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getExamId, examId);
-        return this.count(wrapper);
-    }
-
-    @Transactional
-    @Override
-    public void deleteByStudentId(Long examId, Long studentId) {
-        QueryWrapper<StudentAnswerTaskEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getExamId, examId);
-        lw.eq(StudentAnswerTaskEntity::getStudentId, studentId);
-        this.baseMapper.delete(wrapper);
-        groupService.updateTotalCountByExamId(examId);
-    }
-
-    @Override
-    public StudentAnswerTaskVo history(Long examId, Long taskId, String account,Boolean next) {
-        StudentAnswerTaskEntity cur = null;
-        if (taskId != null) {
-            cur = this.getById(taskId);
-        }
-        QueryWrapper<StudentAnswerTaskEntity> wrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<StudentAnswerTaskEntity> lw = wrapper.lambda();
-        lw.eq(StudentAnswerTaskEntity::getExamId, examId);
-        lw.eq(StudentAnswerTaskEntity::getDevice, account);
-        lw.eq(StudentAnswerTaskEntity::getStatus, TaskStatus.PROCESSED);
-        if(next!=null && next) {
-            if (taskId != null) {
-                lw.gt(StudentAnswerTaskEntity::getId, cur.getId());
-            }
-            lw.orderByAsc(StudentAnswerTaskEntity::getId);
-        }else {
-            if (taskId != null) {
-                lw.lt(StudentAnswerTaskEntity::getId, cur.getId());
-            }
-            lw.orderByDesc(StudentAnswerTaskEntity::getId);
-        }
-        wrapper.last("LIMIT 1");
-        StudentAnswerTaskEntity task = this.baseMapper.selectOne(wrapper);
-        if (task == null) {
-            throw NotFoundExceptions.NO_STUDENT_ANSWER_TASK;
-        }
-        return toTaskVo(task);
-    }
-}

Разница между файлами не показана из-за своего большого размера
+ 331 - 265
src/main/java/cn/com/qmth/scancentral/service/impl/StudentServiceImpl.java


+ 0 - 49
src/main/java/cn/com/qmth/scancentral/task/thread/StudentAnswerGroupBuildThread.java

@@ -1,49 +0,0 @@
-package cn.com.qmth.scancentral.task.thread;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.qmth.boot.core.concurrent.model.Semaphore;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-import com.qmth.boot.core.exception.StatusException;
-
-import cn.com.qmth.scancentral.enums.LockType;
-import cn.com.qmth.scancentral.service.StudentAnswerGroupService;
-
-public class StudentAnswerGroupBuildThread implements Runnable {
-
-    protected static Logger log = LoggerFactory.getLogger(StudentAnswerGroupBuildThread.class);
-
-    private Long groupId;
-
-    private StudentAnswerGroupService groupService;
-
-    private ConcurrentService concurrentService;
-
-    private Semaphore semaphore;
-
-    public StudentAnswerGroupBuildThread(Long groupId, StudentAnswerGroupService groupService, ConcurrentService concurrentService,
-            Semaphore semaphore) {
-        this.groupId = groupId;
-        this.groupService = groupService;
-        this.concurrentService = concurrentService;
-        this.semaphore = semaphore;
-    }
-
-    @Override
-    public void run() {
-        try {
-            log.info("StudentAnswerGroup[" + groupId + "] build task start");
-            concurrentService.getReadWriteLock(LockType.STUDENT_ANSWER_GROUP + "-" + groupId).readLock().lock();
-            groupService.buildTaskById(groupId);
-            log.info("StudentAnswerGroup[" + groupId + "] build task finish");
-        } catch (Exception e) {
-            log.error("StudentAnswerGroup[" + groupId + "] build task error", e);
-            throw new StatusException("抽查分组生成任务失败");
-        } finally {
-            concurrentService.getReadWriteLock(LockType.STUDENT_ANSWER_GROUP + "-" + groupId).readLock().unlock();
-            semaphore.release();
-        }
-    }
-
-}

+ 0 - 47
src/main/java/cn/com/qmth/scancentral/task/thread/StudentAnswerGroupDeleteThread.java

@@ -1,47 +0,0 @@
-package cn.com.qmth.scancentral.task.thread;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.qmth.boot.core.concurrent.model.Semaphore;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-
-import cn.com.qmth.scancentral.enums.LockType;
-import cn.com.qmth.scancentral.service.StudentAnswerGroupService;
-
-public class StudentAnswerGroupDeleteThread implements Runnable {
-
-    protected static Logger log = LoggerFactory.getLogger(StudentAnswerGroupDeleteThread.class);
-
-    private Long groupId;
-
-    private StudentAnswerGroupService groupService;
-
-    private ConcurrentService concurrentService;
-
-    private Semaphore semaphore;
-
-    public StudentAnswerGroupDeleteThread(Long groupId, StudentAnswerGroupService groupService,
-            ConcurrentService concurrentService, Semaphore semaphore) {
-        this.groupId = groupId;
-        this.groupService = groupService;
-        this.concurrentService = concurrentService;
-        this.semaphore = semaphore;
-    }
-
-    @Override
-    public void run() {
-        try {
-            log.info("StudentAnswerGroup[" + groupId + "] delete start");
-            concurrentService.getLock(LockType.STUDENT_ANSWER_GROUP + "-" + groupId).lock();
-            groupService.deleteById(groupId);
-            log.info("StudentAnswerGroup[" + groupId + "] delete finish");
-        } catch (Exception e) {
-            log.error("StudentAnswerGroup[" + groupId + "] delete error", e);
-        } finally {
-            concurrentService.getLock(LockType.STUDENT_ANSWER_GROUP + "-" + groupId).unlock();
-            semaphore.release();
-        }
-    }
-
-}

+ 0 - 47
src/main/java/cn/com/qmth/scancentral/task/thread/StudentAnswerGroupResetThread.java

@@ -1,47 +0,0 @@
-package cn.com.qmth.scancentral.task.thread;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.qmth.boot.core.concurrent.model.Semaphore;
-import com.qmth.boot.core.concurrent.service.ConcurrentService;
-
-import cn.com.qmth.scancentral.enums.LockType;
-import cn.com.qmth.scancentral.service.StudentAnswerGroupService;
-
-public class StudentAnswerGroupResetThread implements Runnable {
-
-    protected static Logger log = LoggerFactory.getLogger(StudentAnswerGroupResetThread.class);
-
-    private Long groupId;
-
-    private StudentAnswerGroupService groupService;
-
-    private ConcurrentService concurrentService;
-
-    private Semaphore semaphore;
-
-    public StudentAnswerGroupResetThread(Long groupId, StudentAnswerGroupService groupService, ConcurrentService concurrentService,
-            Semaphore semaphore) {
-        this.groupId = groupId;
-        this.groupService = groupService;
-        this.concurrentService = concurrentService;
-        this.semaphore = semaphore;
-    }
-
-    @Override
-    public void run() {
-        try {
-            log.info("StudentAnswerGroup[" + groupId + "] reset start");
-            concurrentService.getReadWriteLock(LockType.STUDENT_ANSWER_GROUP + "-" + groupId).readLock().lock();
-            groupService.resetById(groupId);
-            log.info("StudentAnswerGroup[" + groupId + "] reset finish");
-        } catch (Exception e) {
-            log.error("StudentAnswerGroup[" + groupId + "] reset error", e);
-        } finally {
-            concurrentService.getReadWriteLock(LockType.STUDENT_ANSWER_GROUP + "-" + groupId).readLock().unlock();
-            semaphore.release();
-        }
-    }
-
-}

+ 1 - 1
src/main/java/cn/com/qmth/scancentral/vo/student/StudentVo.java

@@ -41,7 +41,7 @@ public class StudentVo {
         vo.setId(e.getId());
         vo.setExamNumber(e.getExamNumber());
         vo.setName(e.getName());
-        vo.setStudentCode(e.getStudentCode());
+        vo.setStudentCode(e.getExamNumber());
         vo.setSubjectCode(e.getSubjectCode());
         vo.setPackageCode(e.getPackageCode());
         vo.setCampusName(e.getCampusName());

+ 0 - 16
src/main/resources/mapper/StudentAnswerGroupMapper.xml

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.qmth.scancentral.dao.StudentAnswerGroupDao">
-    <update id="updateTotalCount">
-        UPDATE sc_student_answer_group
-		SET total_count = (
-			SELECT
-				count(1)
-			FROM
-				sc_student_answer_task
-			WHERE
-				group_id =#{id}
-		)
-		WHERE id =#{id}
-    </update>
-</mapper>

+ 0 - 14
src/main/resources/mapper/StudentAnswerTaskMapper.xml

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.qmth.scancentral.dao.StudentAnswerTaskDao">
-	<select id="findUnMarked" resultType="cn.com.qmth.scancentral.entity.StudentAnswerTaskEntity">
-		select *
-		from sc_student_answer_task t
-		where t.exam_id=#{examId}
-		and
-		t.status=#{status}
-		order by t.id
-		limit
-		#{startNumber},#{pageSize}
-	</select>
-</mapper>

Некоторые файлы не были показаны из-за большого количества измененных файлов