|
@@ -280,8 +280,8 @@ public class CheckAbsentController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "缺考校验导入")
|
|
@ApiOperation(value = "缺考校验导入")
|
|
@RequestMapping(value = "exam-status/import", method = RequestMethod.POST)
|
|
@RequestMapping(value = "exam-status/import", method = RequestMethod.POST)
|
|
- public TaskIdVo examStatusImportFile(@RequestParam Long examId,@RequestParam String subjectCode, @RequestParam ExamStatusCheckMode mode,
|
|
|
|
- @RequestParam MultipartFile file) throws IOException {
|
|
|
|
|
|
+ public TaskIdVo examStatusImportFile(@RequestParam Long examId, @RequestParam String subjectCode,
|
|
|
|
+ @RequestParam ExamStatusCheckMode mode, @RequestParam MultipartFile file) throws IOException {
|
|
ExamEntity exam = examService.getById(examId);
|
|
ExamEntity exam = examService.getById(examId);
|
|
if (exam == null) {
|
|
if (exam == null) {
|
|
throw ParameterExceptions.EXAM_NOT_FOUND;
|
|
throw ParameterExceptions.EXAM_NOT_FOUND;
|
|
@@ -296,28 +296,24 @@ public class CheckAbsentController extends BaseController {
|
|
File temDir = new File("temp/" + taskId + "/");
|
|
File temDir = new File("temp/" + taskId + "/");
|
|
temDir.mkdirs();
|
|
temDir.mkdirs();
|
|
File txt = new File(temDir.getAbsolutePath() + "/data.txt");
|
|
File txt = new File(temDir.getAbsolutePath() + "/data.txt");
|
|
- try {
|
|
|
|
- file.transferTo(txt);
|
|
|
|
- List<String> list = FileUtils.readLines(txt, "utf-8");
|
|
|
|
- if (CollectionUtils.isEmpty(list) || list.size() <= 1) {
|
|
|
|
- throw new ParameterException("文件内容为空");
|
|
|
|
- }
|
|
|
|
- ExamStatusImportTaskVo vo = new ExamStatusImportTaskVo();
|
|
|
|
- vo.setTaskId(taskId);
|
|
|
|
- vo.setTotalCount(list.size() - 1);
|
|
|
|
- vo.setExamId(examId);
|
|
|
|
- vo.setSubjectCode(subjectCode);
|
|
|
|
- vo.setMode(mode);
|
|
|
|
- vo.setStatus(AsyncTaskStatus.RUNNING);
|
|
|
|
- vo.setProgress(0.0);
|
|
|
|
- vo.setTempDir(temDir);
|
|
|
|
- vo.setFile(txt);
|
|
|
|
- taskExecutor.submit(new ExamStatusImportThread(vo, studentService, concurrentService));
|
|
|
|
- asyncTaskService.addTask(vo);
|
|
|
|
- return TaskIdVo.create(vo.getTaskId());
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new ParameterException("系统错误", e);
|
|
|
|
|
|
+ file.transferTo(txt);
|
|
|
|
+ List<String> list = FileUtils.readLines(txt, "utf-8");
|
|
|
|
+ if (CollectionUtils.isEmpty(list) || list.size() <= 1) {
|
|
|
|
+ throw new ParameterException("文件内容为空");
|
|
}
|
|
}
|
|
|
|
+ ExamStatusImportTaskVo vo = new ExamStatusImportTaskVo();
|
|
|
|
+ vo.setTaskId(taskId);
|
|
|
|
+ vo.setTotalCount(list.size() - 1);
|
|
|
|
+ vo.setExamId(examId);
|
|
|
|
+ vo.setSubjectCode(subjectCode);
|
|
|
|
+ vo.setMode(mode);
|
|
|
|
+ vo.setStatus(AsyncTaskStatus.RUNNING);
|
|
|
|
+ vo.setProgress(0.0);
|
|
|
|
+ vo.setTempDir(temDir);
|
|
|
|
+ vo.setFile(txt);
|
|
|
|
+ taskExecutor.submit(new ExamStatusImportThread(vo, studentService, concurrentService));
|
|
|
|
+ asyncTaskService.addTask(vo);
|
|
|
|
+ return TaskIdVo.create(vo.getTaskId());
|
|
} else {
|
|
} else {
|
|
throw new ParameterException("正在导入,请稍后再试");
|
|
throw new ParameterException("正在导入,请稍后再试");
|
|
}
|
|
}
|