|
@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
@@ -25,17 +27,25 @@ 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.ExamStudentService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
|
|
+import cn.com.qmth.stmms.biz.lock.LockService;
|
|
|
|
+import cn.com.qmth.stmms.biz.mark.model.MarkLibrary;
|
|
import cn.com.qmth.stmms.biz.mark.model.ProblemHistory;
|
|
import cn.com.qmth.stmms.biz.mark.model.ProblemHistory;
|
|
import cn.com.qmth.stmms.biz.mark.model.ProblemType;
|
|
import cn.com.qmth.stmms.biz.mark.model.ProblemType;
|
|
import cn.com.qmth.stmms.biz.mark.query.ProblemHistorySearchQuery;
|
|
import cn.com.qmth.stmms.biz.mark.query.ProblemHistorySearchQuery;
|
|
|
|
+import cn.com.qmth.stmms.biz.mark.service.MarkLibraryService;
|
|
|
|
+import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
import cn.com.qmth.stmms.biz.mark.service.ProblemHistoryService;
|
|
import cn.com.qmth.stmms.biz.mark.service.ProblemHistoryService;
|
|
import cn.com.qmth.stmms.biz.mark.service.ProblemTypeService;
|
|
import cn.com.qmth.stmms.biz.mark.service.ProblemTypeService;
|
|
import cn.com.qmth.stmms.biz.user.service.UserService;
|
|
import cn.com.qmth.stmms.biz.user.service.UserService;
|
|
import cn.com.qmth.stmms.common.annotation.Logging;
|
|
import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
|
+import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
import cn.com.qmth.stmms.common.enums.HistoryStatus;
|
|
import cn.com.qmth.stmms.common.enums.HistoryStatus;
|
|
|
|
+import cn.com.qmth.stmms.common.enums.LibraryStatus;
|
|
|
|
+import cn.com.qmth.stmms.common.enums.LockType;
|
|
import cn.com.qmth.stmms.common.enums.LogType;
|
|
import cn.com.qmth.stmms.common.enums.LogType;
|
|
import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
|
|
+import cn.com.qmth.stmms.common.enums.Role;
|
|
import cn.com.qmth.stmms.common.utils.DateUtils;
|
|
import cn.com.qmth.stmms.common.utils.DateUtils;
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
|
|
|
@@ -69,6 +79,15 @@ public class ProblemHistoryController extends BaseExamController {
|
|
@Autowired
|
|
@Autowired
|
|
private UserService userService;
|
|
private UserService userService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private MarkLibraryService libraryService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private LockService lockService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private MarkService markService;
|
|
|
|
+
|
|
@Logging(menu = "问题卷查询", type = LogType.QUERY)
|
|
@Logging(menu = "问题卷查询", type = LogType.QUERY)
|
|
@RequestMapping
|
|
@RequestMapping
|
|
public String list(HttpServletRequest request, Model model, ProblemHistorySearchQuery query) {
|
|
public String list(HttpServletRequest request, Model model, ProblemHistorySearchQuery query) {
|
|
@@ -130,4 +149,31 @@ public class ProblemHistoryController extends BaseExamController {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Logging(menu = "任务批量重置", type = LogType.QUERY)
|
|
|
|
+ @RequestMapping("/restBatch")
|
|
|
|
+ @RoleRequire({ Role.SCHOOL_ADMIN, Role.SUBJECT_HEADER })
|
|
|
|
+ public String restBatch(HttpServletRequest request, Model model, RedirectAttributes redirectAttributes,
|
|
|
|
+ @RequestParam Integer[] libraryIds) {
|
|
|
|
+ WebUser wu = RequestUtils.getWebUser(request);
|
|
|
|
+ for (Integer libraryId : libraryIds) {
|
|
|
|
+ MarkLibrary library = libraryService.findById(libraryId);
|
|
|
|
+ if (library != null && subjectCheck(library.getSubjectCode(), RequestUtils.getWebUser(request))) {
|
|
|
|
+ try {
|
|
|
|
+ lockService.watch(LockType.EXAM_SUBJECT, library.getExamId(), library.getSubjectCode());
|
|
|
|
+ lockService.watch(LockType.GROUP, library.getExamId(), library.getSubjectCode(),
|
|
|
|
+ library.getGroupNumber());
|
|
|
|
+ if (library.getStatus().equals(LibraryStatus.PROBLEM)) {
|
|
|
|
+ markService.rejectLibrary(library, wu.getId(), true);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("back library error", e);
|
|
|
|
+ } finally {
|
|
|
|
+ lockService.unwatch(LockType.GROUP, library.getExamId(), library.getSubjectCode(),
|
|
|
|
+ library.getGroupNumber());
|
|
|
|
+ lockService.unwatch(LockType.EXAM_SUBJECT, library.getExamId(), library.getSubjectCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "redirect:/admin/exam/problem/history";
|
|
|
|
+ }
|
|
}
|
|
}
|