|
@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
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.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -21,10 +20,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
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;
|
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
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.ExamService;
|
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkerService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkerService;
|
|
import cn.com.qmth.stmms.biz.lock.LockService;
|
|
import cn.com.qmth.stmms.biz.lock.LockService;
|
|
@@ -53,6 +54,9 @@ public class LibraryController extends BaseExamController {
|
|
@Autowired
|
|
@Autowired
|
|
private MarkLibraryService libraryService;
|
|
private MarkLibraryService libraryService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamStudentService studentService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private MarkerService markerService;
|
|
private MarkerService markerService;
|
|
|
|
|
|
@@ -166,24 +170,25 @@ public class LibraryController extends BaseExamController {
|
|
return obj;
|
|
return obj;
|
|
}
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
|
|
|
|
|
+ @RequestMapping(value = "/getJson", method = RequestMethod.GET)
|
|
@RoleRequire({ Role.SCHOOL_ADMIN, Role.SUBJECT_HEADER })
|
|
@RoleRequire({ Role.SCHOOL_ADMIN, Role.SUBJECT_HEADER })
|
|
- public String list(Model model, HttpServletRequest request, @PathVariable Integer id) {
|
|
|
|
|
|
+ public String getJson(Model model, HttpServletRequest request, @RequestParam Integer studentId,
|
|
|
|
+ @RequestParam(required = false) Integer groupNumber) {
|
|
int examId = getSessionExamId(request);
|
|
int examId = getSessionExamId(request);
|
|
- MarkLibrary library = libraryService.findById(id);
|
|
|
|
- List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(examId,
|
|
|
|
- library.getSubjectCode(), false, library.getGroupNumber());
|
|
|
|
- List<String> strings = new ArrayList<String>();
|
|
|
|
- for (ExamQuestion examQuestion : questions) {
|
|
|
|
- strings.add(examQuestion.getQuestionNumber());
|
|
|
|
|
|
+ ExamStudent student = studentService.findById(studentId);
|
|
|
|
+ if (groupNumber != null) {
|
|
|
|
+ List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(examId,
|
|
|
|
+ student.getSubjectCode(), false, groupNumber);
|
|
|
|
+ List<String> strings = new ArrayList<String>();
|
|
|
|
+ for (ExamQuestion examQuestion : questions) {
|
|
|
|
+ strings.add(examQuestion.getQuestionNumber());
|
|
|
|
+ }
|
|
|
|
+ String questionNumbers = String.join(",", strings);
|
|
|
|
+ model.addAttribute("questionNumbers", questionNumbers);
|
|
}
|
|
}
|
|
- String questionNumbers = String.join(",", strings);
|
|
|
|
- model.addAttribute("questionNumbers", questionNumbers);
|
|
|
|
model.addAttribute("answerServer", answerServer);
|
|
model.addAttribute("answerServer", answerServer);
|
|
- model.addAttribute(
|
|
|
|
- "answerUrl",
|
|
|
|
- PictureUrlBuilder.getAnswerJson(library.getExamId(), library.getSubjectCode(), null,
|
|
|
|
- library.getExamNumber()));
|
|
|
|
|
|
+ model.addAttribute("answerUrl",
|
|
|
|
+ PictureUrlBuilder.getAnswerJson(examId, student.getSubjectCode(), null, student.getExamNumber()));
|
|
return "modules/exam/jsonView";
|
|
return "modules/exam/jsonView";
|
|
}
|
|
}
|
|
}
|
|
}
|