|
@@ -1,40 +1,13 @@
|
|
|
package cn.com.qmth.scancentral.controller.admin;
|
|
|
|
|
|
-import cn.com.qmth.scancentral.bean.AnswerQueryDomain;
|
|
|
-import cn.com.qmth.scancentral.bean.User;
|
|
|
-import cn.com.qmth.scancentral.controller.BaseController;
|
|
|
-import cn.com.qmth.scancentral.entity.ExamEntity;
|
|
|
-import cn.com.qmth.scancentral.enums.ExamStatusCheckMode;
|
|
|
-import cn.com.qmth.scancentral.enums.LockType;
|
|
|
-import cn.com.qmth.scancentral.exception.ParameterExceptions;
|
|
|
-import cn.com.qmth.scancentral.service.ExamService;
|
|
|
-import cn.com.qmth.scancentral.service.StudentService;
|
|
|
-import cn.com.qmth.scancentral.task.thread.ExamStatusImportThread;
|
|
|
-import cn.com.qmth.scancentral.task.thread.ExamStatusResetThread;
|
|
|
-import cn.com.qmth.scancentral.vo.ExamStatusSaveVo;
|
|
|
-import cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo;
|
|
|
-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 io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import net.sf.json.JSONObject;
|
|
|
-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.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import com.qmth.boot.api.annotation.Aac;
|
|
|
+import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+
|
|
|
+import cn.com.qmth.scancentral.controller.BaseController;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
|
@RestController
|
|
|
@Api(tags = "缺考校验接口")
|
|
@@ -42,106 +15,116 @@ import java.util.Map;
|
|
|
@Aac(strict = false, auth = true)
|
|
|
public class ExamStatusCheckController extends BaseController {
|
|
|
|
|
|
- @Autowired
|
|
|
- private StudentService studentService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private ConcurrentService concurrentService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamService examService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AsyncTaskExecutor taskExecutor;
|
|
|
-
|
|
|
- @ApiOperation(value = "列表")
|
|
|
- @RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
- public PageResult<AnswerQueryVo> list(@Validated AnswerQueryDomain query) {
|
|
|
- return studentService.query(query);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "提交")
|
|
|
- @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
- public ExamStatusSaveVo save(@RequestParam Long id, @RequestParam Boolean absent) {
|
|
|
- studentService.updateExamStatus(id, absent);
|
|
|
- return ExamStatusSaveVo.create(absent);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "导入")
|
|
|
- @RequestMapping(value = "/import", method = RequestMethod.POST)
|
|
|
- public JSONObject importFile(@RequestParam Long examId, @RequestParam ExamStatusCheckMode mode,
|
|
|
- @RequestParam MultipartFile file) throws IOException {
|
|
|
- User user = getAccessUser();
|
|
|
- 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 = "/import/status", method = RequestMethod.POST)
|
|
|
- public Map<String, Object> importStatus(@RequestParam Long examId) {
|
|
|
- User user = getAccessUser();
|
|
|
- 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 = "/reset", method = RequestMethod.POST)
|
|
|
- public JSONObject reset(@RequestParam Long examId, @RequestParam Integer examNumberFillCount) {
|
|
|
- User user = getAccessUser();
|
|
|
- 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 = "/reset/status", method = RequestMethod.POST)
|
|
|
- public Map<String, Object> resetStatus(@RequestParam Long examId) {
|
|
|
- User user = getAccessUser();
|
|
|
- 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 = "/summary", method = RequestMethod.POST)
|
|
|
- public List<String> summary(@Validated AnswerQueryDomain query) {
|
|
|
- return studentService.summary(query);
|
|
|
- }
|
|
|
+ // @Autowired
|
|
|
+ // private StudentService studentService;
|
|
|
+ //
|
|
|
+ // @Resource
|
|
|
+ // private ConcurrentService concurrentService;
|
|
|
+ //
|
|
|
+ // @Autowired
|
|
|
+ // private ExamService examService;
|
|
|
+ //
|
|
|
+ // @Autowired
|
|
|
+ // private AsyncTaskExecutor taskExecutor;
|
|
|
+ //
|
|
|
+ // @ApiOperation(value = "列表")
|
|
|
+ // @RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
+ // public PageResult<AnswerQueryVo> list(@Validated AnswerQueryDomain query)
|
|
|
+ // {
|
|
|
+ // return studentService.query(query);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // @ApiOperation(value = "提交")
|
|
|
+ // @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
+ // public ExamStatusSaveVo save(@RequestParam Long id, @RequestParam Boolean
|
|
|
+ // absent) {
|
|
|
+ // studentService.updateExamStatus(id, absent);
|
|
|
+ // return ExamStatusSaveVo.create(absent);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // @ApiOperation(value = "导入")
|
|
|
+ // @RequestMapping(value = "/import", method = RequestMethod.POST)
|
|
|
+ // public JSONObject importFile(@RequestParam Long examId, @RequestParam
|
|
|
+ // ExamStatusCheckMode mode,
|
|
|
+ // @RequestParam MultipartFile file) throws IOException {
|
|
|
+ // User user = getAccessUser();
|
|
|
+ // 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 = "/import/status", method = RequestMethod.POST)
|
|
|
+ // public Map<String, Object> importStatus(@RequestParam Long examId) {
|
|
|
+ // User user = getAccessUser();
|
|
|
+ // 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 = "/reset", method = RequestMethod.POST)
|
|
|
+ // public JSONObject reset(@RequestParam Long examId, @RequestParam Integer
|
|
|
+ // examNumberFillCount) {
|
|
|
+ // User user = getAccessUser();
|
|
|
+ // 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 = "/reset/status", method = RequestMethod.POST)
|
|
|
+ // public Map<String, Object> resetStatus(@RequestParam Long examId) {
|
|
|
+ // User user = getAccessUser();
|
|
|
+ // 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 = "/summary", method = RequestMethod.POST)
|
|
|
+ // public List<String> summary(@Validated AnswerQueryDomain query) {
|
|
|
+ // return studentService.summary(query);
|
|
|
+ // }
|
|
|
|
|
|
}
|