|
@@ -2,7 +2,6 @@ package cn.com.qmth.stmms.admin.exam;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
@@ -35,6 +34,7 @@ import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.InspectHistoryService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.InspectedService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.query.ExamSubjectSearchQuery;
|
|
|
import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
@@ -86,6 +86,9 @@ public class InspectedController extends BaseExamController {
|
|
|
@Autowired
|
|
|
private ExamSubjectService subjectService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InspectHistoryService inspectHistoryService;
|
|
|
+
|
|
|
@Value("${slice.split.config}")
|
|
|
private String splitConfig;
|
|
|
|
|
@@ -112,6 +115,7 @@ public class InspectedController extends BaseExamController {
|
|
|
questionScore, selectiveStatus);
|
|
|
for (ExamStudent e : list) {
|
|
|
e.setSubjectiveScoreList(e.getSubjectiveScoreList().replace(UN_SELECTIVE_SCORE, "/"));
|
|
|
+ e.setInspectHistoryList(inspectHistoryService.findByStudentIdLimit3(e.getId()));
|
|
|
}
|
|
|
Integer totalCount = inspectedService.countByQuery(query, null, mainNumber, mainStartScore, mainEndScore,
|
|
|
questionScore, selectiveStatus);
|
|
@@ -199,15 +203,9 @@ public class InspectedController extends BaseExamController {
|
|
|
@ResponseBody
|
|
|
public Object save(HttpServletRequest request, @RequestParam Integer studentId) {
|
|
|
WebUser wu = RequestUtils.getWebUser(request);
|
|
|
- ExamStudent student = studentService.findById(studentId);
|
|
|
JSONObject obj = new JSONObject();
|
|
|
try {
|
|
|
- if (lockService.trylock(LockType.STUDENT, student.getId())
|
|
|
- && inspectedService.hasApplied(student, wu.getId())
|
|
|
- && SubjectiveStatus.MARKED.equals(student.getSubjectiveStatus())) {
|
|
|
- studentService.updateSubjectiveStatusAndTimeAndInspectorId(studentId, SubjectiveStatus.INSPECTED,
|
|
|
- new Date(), wu.getUser().getId());
|
|
|
- inspectedService.releaseByStudent(student);
|
|
|
+ if (lockService.trylock(LockType.STUDENT, studentId) && inspectedService.inspect(studentId, wu.getId())) {
|
|
|
obj.accumulate("success", true);
|
|
|
} else {
|
|
|
obj.accumulate("success", false);
|
|
@@ -217,7 +215,7 @@ public class InspectedController extends BaseExamController {
|
|
|
obj.accumulate("success", false);
|
|
|
log.error("inspected save error", e);
|
|
|
} finally {
|
|
|
- lockService.unlock(LockType.STUDENT, student.getId());
|
|
|
+ lockService.unlock(LockType.STUDENT, studentId);
|
|
|
}
|
|
|
return obj;
|
|
|
}
|
|
@@ -249,31 +247,24 @@ public class InspectedController extends BaseExamController {
|
|
|
JSONObject obj = new JSONObject();
|
|
|
ExamStudent student = studentService.findById(studentId);
|
|
|
WebUser wu = RequestUtils.getWebUser(request);
|
|
|
- if (student != null && student.getSubjectiveStatus().equals(SubjectiveStatus.INSPECTED)) {
|
|
|
- if (subjectCheck(student.getSubjectCode(), wu)) {
|
|
|
- try {
|
|
|
- if (lockService.trylock(LockType.STUDENT, student.getId())) {
|
|
|
- studentService.updateSubjectiveStatusAndTimeAndInspectorId(student.getId(),
|
|
|
- SubjectiveStatus.MARKED, null, null);
|
|
|
- obj.accumulate("success", true);
|
|
|
- } else {
|
|
|
- obj.accumulate("success", false);
|
|
|
- obj.accumulate("message", "无法取消复核");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
+ if (student != null && subjectCheck(student.getSubjectCode(), wu)) {
|
|
|
+ try {
|
|
|
+ if (lockService.trylock(LockType.STUDENT, studentId) && inspectedService.cancel(studentId)) {
|
|
|
+ obj.accumulate("success", true);
|
|
|
+ } else {
|
|
|
obj.accumulate("success", false);
|
|
|
- obj.accumulate("message", "取消复核失败");
|
|
|
- log.error("back inspected error", e);
|
|
|
- } finally {
|
|
|
- lockService.unlock(LockType.STUDENT, student.getId());
|
|
|
+ obj.accumulate("message", "无法取消复核");
|
|
|
}
|
|
|
- } else {
|
|
|
+ } catch (Exception e) {
|
|
|
obj.accumulate("success", false);
|
|
|
- obj.accumulate("message", "没有操作该评卷任务的权限");
|
|
|
+ obj.accumulate("message", "取消复核失败");
|
|
|
+ log.error("back inspected error", e);
|
|
|
+ } finally {
|
|
|
+ lockService.unlock(LockType.STUDENT, studentId);
|
|
|
}
|
|
|
} else {
|
|
|
obj.accumulate("success", false);
|
|
|
- obj.accumulate("message", "无法取消复核");
|
|
|
+ obj.accumulate("message", "没有操作该评卷任务的权限");
|
|
|
}
|
|
|
return obj;
|
|
|
}
|
|
@@ -425,18 +416,14 @@ public class InspectedController extends BaseExamController {
|
|
|
WebUser wu = RequestUtils.getWebUser(request);
|
|
|
for (Integer id : ids) {
|
|
|
ExamStudent student = studentService.findById(id);
|
|
|
- if (student != null && student.getSubjectiveStatus().equals(SubjectiveStatus.INSPECTED)) {
|
|
|
- if (subjectCheck(student.getSubjectCode(), wu)) {
|
|
|
- try {
|
|
|
- if (lockService.trylock(LockType.STUDENT, student.getId())) {
|
|
|
- studentService.updateSubjectiveStatusAndTimeAndInspectorId(student.getId(),
|
|
|
- SubjectiveStatus.MARKED, null, null);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("back inspected error", e);
|
|
|
- } finally {
|
|
|
- lockService.unlock(LockType.STUDENT, student.getId());
|
|
|
+ if (student != null && subjectCheck(student.getSubjectCode(), wu)) {
|
|
|
+ try {
|
|
|
+ if (lockService.trylock(LockType.STUDENT, student.getId()) && inspectedService.cancel(id)) {
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("back inspected error", e);
|
|
|
+ } finally {
|
|
|
+ lockService.unlock(LockType.STUDENT, student.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|