|
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import cn.com.qmth.stmms.api.utils.AESUtil;
|
|
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.annotation.AuthValidate;
|
|
import cn.com.qmth.stmms.biz.api.auth.exception.ApiException;
|
|
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.model.Campus;
|
|
@@ -67,35 +68,44 @@ public class ExamStudentController extends BaseApiController {
|
|
private ExamStudentPaperService studentPaperService;
|
|
private ExamStudentPaperService studentPaperService;
|
|
|
|
|
|
@AuthValidate("adminUser")
|
|
@AuthValidate("adminUser")
|
|
- @RequestMapping(value = "/student/manualAbsent", method = RequestMethod.POST)
|
|
|
|
|
|
+ @RequestMapping(value = "/student/manualAbsent/{examId}", method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public boolean updateManualAbsent(HttpServletRequest request, @RequestParam Integer examId,
|
|
|
|
- @RequestParam String examNumber, @RequestParam Boolean manualAbsent) {
|
|
|
|
- boolean success = false;
|
|
|
|
|
|
+ public Object updateManualAbsent(HttpServletRequest request, @PathVariable Integer examId,
|
|
|
|
+ @RequestBody MenualAbsentDTO[] datas) {
|
|
User user = RequestUtils.getApiUser(request);
|
|
User user = RequestUtils.getApiUser(request);
|
|
Exam exam = examService.findById(examId);
|
|
Exam exam = examService.findById(examId);
|
|
if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
- ExamStudent student = examStudentService.findByExamIdAndExamNumber(examId, examNumber);
|
|
|
|
- if (student != null) {
|
|
|
|
- examStudentService.updateManualAbsent(student.getId(), manualAbsent);
|
|
|
|
- success = true;
|
|
|
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
|
+ for (MenualAbsentDTO dto : datas) {
|
|
|
|
+ ExamStudent student = examStudentService.findByExamIdAndSubjectCodeAndStudentCode(examId,
|
|
|
|
+ dto.getSubjectCode(), dto.getStudentCode());
|
|
|
|
+ if (student != null) {
|
|
|
|
+ if (student.isManualAbsent() != dto.isAbsent()) {
|
|
|
|
+ examStudentService.updateManualAbsent(student.getId(), dto.isAbsent());
|
|
|
|
+ }
|
|
|
|
+ array.add(student.getExamNumber());
|
|
|
|
+ } else {
|
|
|
|
+ array.add("");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ return array;
|
|
|
|
+ } else {
|
|
|
|
+ throw ApiException.EXAM_NOT_ACCESSIBLED;
|
|
}
|
|
}
|
|
- return success;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@AuthValidate("adminUser")
|
|
@AuthValidate("adminUser")
|
|
@RequestMapping(value = "/student/manualAbsent/clear", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/student/manualAbsent/clear", method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public boolean clearManualAbsent(HttpServletRequest request, @RequestParam Integer examId) {
|
|
|
|
- boolean success = false;
|
|
|
|
|
|
+ public Object clearManualAbsent(HttpServletRequest request, @RequestParam Integer examId) {
|
|
User user = RequestUtils.getApiUser(request);
|
|
User user = RequestUtils.getApiUser(request);
|
|
Exam exam = examService.findById(examId);
|
|
Exam exam = examService.findById(examId);
|
|
if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
if (exam != null && exam.getSchoolId().equals(user.getSchoolId())) {
|
|
examStudentService.clearManualAbsent(examId);
|
|
examStudentService.clearManualAbsent(examId);
|
|
- success = true;
|
|
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ throw ApiException.EXAM_NOT_ACCESSIBLED;
|
|
}
|
|
}
|
|
- return success;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@AuthValidate("adminUser")
|
|
@AuthValidate("adminUser")
|