|
@@ -22,7 +22,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import cn.com.qmth.stmms.api.utils.AESUtil;
|
|
|
+import cn.com.qmth.stmms.api.utils.MenualAbsentDTO;
|
|
|
import cn.com.qmth.stmms.biz.api.auth.annotation.AuthValidate;
|
|
|
+import cn.com.qmth.stmms.biz.api.auth.exception.ApiException;
|
|
|
import cn.com.qmth.stmms.biz.campus.model.Campus;
|
|
|
import cn.com.qmth.stmms.biz.campus.service.CampusService;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
@@ -59,6 +61,37 @@ public class ExamStudentController extends BaseApiController {
|
|
|
|
|
|
@Autowired
|
|
|
private ExamQuestionService questionService;
|
|
|
+
|
|
|
+ @AuthValidate("adminUser")
|
|
|
+ @RequestMapping(value = "/student/manualAbsent/{examId}", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Object updateManualAbsent(HttpServletRequest request, @PathVariable Integer examId,
|
|
|
+ @RequestBody MenualAbsentDTO[] datas) {
|
|
|
+ User user = RequestUtils.getApiUser(request);
|
|
|
+ Exam exam = examService.findById(examId);
|
|
|
+ if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
|
+ for (MenualAbsentDTO dto : datas) {
|
|
|
+ examStudentService.updateManualAbsent(examId, dto.getExamNumber(), dto.isAbsent());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw ApiException.EXAM_NOT_ACCESSIBLED;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @AuthValidate("adminUser")
|
|
|
+ @RequestMapping(value = "/student/manualAbsent/clear", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Object clearManualAbsent(HttpServletRequest request, @RequestParam Integer examId) {
|
|
|
+ User user = RequestUtils.getApiUser(request);
|
|
|
+ Exam exam = examService.findById(examId);
|
|
|
+ if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
|
+ examStudentService.clearManualAbsent(examId);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw ApiException.EXAM_NOT_ACCESSIBLED;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@AuthValidate({ "adminUser", "scanner" })
|
|
|
@RequestMapping(value = "/exam/students/{examId}", method = RequestMethod.GET)
|