|
@@ -10,10 +10,12 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.task.AsyncTaskExecutor;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -25,6 +27,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.boot.core.collection.PageResult;
|
|
|
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
|
|
|
+import com.qmth.boot.core.exception.ReentrantException;
|
|
|
import com.qmth.boot.core.exception.StatusException;
|
|
|
import com.qmth.boot.tools.excel.ExcelWriter;
|
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
@@ -33,20 +37,32 @@ import com.qmth.boot.tools.iterator.PageListIterator;
|
|
|
import com.qmth.boot.tools.iterator.SingletonIterator;
|
|
|
|
|
|
import cn.com.qmth.scancentral.bean.AbsentQueryDomain;
|
|
|
+import cn.com.qmth.scancentral.bean.AnswerQueryDomain;
|
|
|
import cn.com.qmth.scancentral.controller.BaseController;
|
|
|
+import cn.com.qmth.scancentral.entity.ExamEntity;
|
|
|
import cn.com.qmth.scancentral.entity.SubjectEntity;
|
|
|
import cn.com.qmth.scancentral.enums.ConditionType;
|
|
|
+import cn.com.qmth.scancentral.enums.ExamStatus;
|
|
|
+import cn.com.qmth.scancentral.enums.ExamStatusCheckMode;
|
|
|
import cn.com.qmth.scancentral.enums.GroupType;
|
|
|
+import cn.com.qmth.scancentral.enums.LockType;
|
|
|
+import cn.com.qmth.scancentral.exception.ParameterExceptions;
|
|
|
import cn.com.qmth.scancentral.model.ManualAbsentImportDTO;
|
|
|
+import cn.com.qmth.scancentral.service.ExamService;
|
|
|
import cn.com.qmth.scancentral.service.StudentService;
|
|
|
import cn.com.qmth.scancentral.service.SubjectService;
|
|
|
+import cn.com.qmth.scancentral.task.thread.ExamStatusImportThread;
|
|
|
+import cn.com.qmth.scancentral.task.thread.ExamStatusResetThread;
|
|
|
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.ExamStatusSaveVo;
|
|
|
import cn.com.qmth.scancentral.vo.OmrConditionsVo;
|
|
|
import cn.com.qmth.scancentral.vo.UpdateTimeVo;
|
|
|
+import cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
|
|
|
@RestController
|
|
|
@Api(tags = "缺考接口")
|
|
@@ -57,6 +73,15 @@ public class CheckController extends BaseController {
|
|
|
@Autowired
|
|
|
private StudentService studentService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ConcurrentService concurrentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamService examService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AsyncTaskExecutor taskExecutor;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SubjectService subjectService;
|
|
|
|
|
@@ -180,4 +205,90 @@ public class CheckController extends BaseController {
|
|
|
@RequestParam String examNumber) {
|
|
|
return studentService.absentSuspectUpdate(examId, subjectCode, examNumber, false);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验列表")
|
|
|
+ @RequestMapping(value = "exam-status/list", method = RequestMethod.POST)
|
|
|
+ public PageResult<AnswerQueryVo> examStatusList(@Validated AnswerQueryDomain query) {
|
|
|
+ return studentService.query(query);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验提交")
|
|
|
+ @RequestMapping(value = "exam-status/save", method = RequestMethod.POST)
|
|
|
+ public ExamStatusSaveVo examStatusSave(@RequestParam Long id, @RequestParam ExamStatus examStatus) {
|
|
|
+ studentService.updateExamStatus(id, examStatus);
|
|
|
+ return ExamStatusSaveVo.create(examStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验导入")
|
|
|
+ @RequestMapping(value = "exam-status/import", method = RequestMethod.POST)
|
|
|
+ public JSONObject examStatusImportFile(@RequestParam Long examId, @RequestParam ExamStatusCheckMode mode,
|
|
|
+ @RequestParam MultipartFile file) throws IOException {
|
|
|
+ ExamEntity exam = examService.getById(examId);
|
|
|
+ if (exam == null) {
|
|
|
+ throw ParameterExceptions.EXAM_NOT_FOUND;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!concurrentService.isLocked(LockType.EXAM_STATUS_RESET + "-" + examId)) {
|
|
|
+ taskExecutor.submit(
|
|
|
+ new ExamStatusImportThread(examId, mode, file.getInputStream(), studentService, concurrentService));
|
|
|
+ } else {
|
|
|
+ throw new ReentrantException("正在导入,请稍后再试");
|
|
|
+ }
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("updateTime", System.currentTimeMillis());
|
|
|
+ result.put("synching", true);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验导入状态")
|
|
|
+ @RequestMapping(value = "exam-status/import/status", method = RequestMethod.POST)
|
|
|
+ public Map<String, Object> examStatusImportStatus(@RequestParam Long examId) {
|
|
|
+ ExamEntity exam = examService.getById(examId);
|
|
|
+ if (exam == null) {
|
|
|
+ throw ParameterExceptions.EXAM_NOT_FOUND;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<String, Object>();
|
|
|
+ result.put("synching", concurrentService.isLocked(LockType.EXAM_STATUS_RESET + "-" + examId));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验重新生成")
|
|
|
+ @RequestMapping(value = "exam-status/reset", method = RequestMethod.POST)
|
|
|
+ public JSONObject examStatusReset(@RequestParam Long examId, @RequestParam Integer examNumberFillCount) {
|
|
|
+ ExamEntity exam = examService.getById(examId);
|
|
|
+ if (exam == null) {
|
|
|
+ throw ParameterExceptions.EXAM_NOT_FOUND;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!concurrentService.isLocked(LockType.EXAM_STATUS_RESET + "-" + examId)) {
|
|
|
+ taskExecutor
|
|
|
+ .submit(new ExamStatusResetThread(examId, examNumberFillCount, studentService, concurrentService));
|
|
|
+ } else {
|
|
|
+ throw new ReentrantException("正在重新生成,请稍后再试");
|
|
|
+ }
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("updateTime", System.currentTimeMillis());
|
|
|
+ result.put("synching", true);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验重新生成状态")
|
|
|
+ @RequestMapping(value = "exam-status/reset/status", method = RequestMethod.POST)
|
|
|
+ public Map<String, Object> examStatusResetStatus(@RequestParam Long examId) {
|
|
|
+ ExamEntity exam = examService.getById(examId);
|
|
|
+ if (exam == null) {
|
|
|
+ throw ParameterExceptions.EXAM_NOT_FOUND;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<String, Object>();
|
|
|
+ result.put("synching", concurrentService.isLocked(LockType.EXAM_STATUS_RESET + "-" + examId));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "缺考校验查询概要")
|
|
|
+ @RequestMapping(value = "exam-status/summary", method = RequestMethod.POST)
|
|
|
+ public List<String> examStatusSummary(@Validated AnswerQueryDomain query) {
|
|
|
+ return studentService.summary(query);
|
|
|
+ }
|
|
|
}
|