|
@@ -1,6 +1,7 @@
|
|
|
package cn.com.qmth.stmms.admin.exam;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -16,11 +17,14 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+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.ExamStudent;
|
|
|
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.Marker;
|
|
|
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.MarkGroupService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkerService;
|
|
@@ -32,6 +36,7 @@ import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
|
import cn.com.qmth.stmms.biz.mark.service.TrialService;
|
|
|
import cn.com.qmth.stmms.common.auth.annotation.RoleRequire;
|
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
|
+import cn.com.qmth.stmms.common.enums.ExamType;
|
|
|
import cn.com.qmth.stmms.common.enums.LibraryStatus;
|
|
|
import cn.com.qmth.stmms.common.enums.LockType;
|
|
|
import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
@@ -65,13 +70,19 @@ public class TrialController extends BaseExamController {
|
|
|
|
|
|
@Autowired
|
|
|
private LockService lockService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ExamQuestionService questionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamService examService;
|
|
|
+
|
|
|
@Value("${slice.image.server}")
|
|
|
private String sliceServer;
|
|
|
|
|
|
+ @Value("${json.server}")
|
|
|
+ private String jsonServer;
|
|
|
+
|
|
|
@RequestMapping
|
|
|
public String list(Model model, HttpServletRequest request, TrialLibrarySearchQuery query,
|
|
|
@RequestParam(required = false) LibraryStatus status) {
|
|
@@ -156,17 +167,37 @@ public class TrialController extends BaseExamController {
|
|
|
public JSONObject detail(HttpServletRequest request, @RequestParam Integer libraryId) {
|
|
|
JSONObject obj = new JSONObject();
|
|
|
TrialLibrary library = trialService.findLibrary(libraryId);
|
|
|
+ Exam exam = examService.findById(library.getExamId());
|
|
|
if (library != null) {
|
|
|
ExamStudent student = studentService.findById(library.getStudentId());
|
|
|
MarkGroup group = groupService.findOne(library.getExamId(), library.getSubjectCode(),
|
|
|
library.getGroupNumber());
|
|
|
if (group != null && student != null) {
|
|
|
obj.accumulate("success", true);
|
|
|
- // 裁切图配置
|
|
|
- obj.accumulate("imageServer", sliceServer);
|
|
|
- obj.accumulate("urls", PictureUrlBuilder.getSliceUrls(library.getExamId(), library.getCampusId(),
|
|
|
- library.getSubjectCode(), library.getExamNumber(), student.getSliceCount()));
|
|
|
- obj.accumulate("pictureConfig", group.getPictureConfigList());
|
|
|
+ if (ExamType.MULTI_MEDIA.equals(exam.getType())) {
|
|
|
+ // 多媒体配置
|
|
|
+ obj.accumulate("jsonServer", jsonServer);
|
|
|
+ obj.accumulate(
|
|
|
+ "urls",
|
|
|
+ PictureUrlBuilder.getAnswerJson(library.getExamId(), library.getSubjectCode(),
|
|
|
+ student.getPaperType(), library.getExamNumber()));
|
|
|
+ List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(
|
|
|
+ library.getExamId(), student.getSubjectCode(), false, group.getNumber());
|
|
|
+ List<String> strings = new ArrayList<String>();
|
|
|
+ for (ExamQuestion examQuestion : questions) {
|
|
|
+ strings.add(examQuestion.getQuestionNumber());
|
|
|
+ }
|
|
|
+ String questionNumbers = String.join(",", strings);
|
|
|
+ obj.accumulate("questionNumbers", questionNumbers);
|
|
|
+ } else {
|
|
|
+ // 裁切图配置
|
|
|
+ obj.accumulate("imageServer", sliceServer);
|
|
|
+ obj.accumulate(
|
|
|
+ "urls",
|
|
|
+ PictureUrlBuilder.getSliceUrls(library.getExamId(), library.getCampusId(),
|
|
|
+ library.getSubjectCode(), library.getExamNumber(), student.getSliceCount()));
|
|
|
+ obj.accumulate("pictureConfig", group.getPictureConfigList());
|
|
|
+ }
|
|
|
// 评卷记录集合
|
|
|
JSONArray array = new JSONArray();
|
|
|
List<TrialHistory> list = trialService.findHistory(libraryId);
|