ting.yin 5 년 전
부모
커밋
0e792fb923

+ 20 - 15
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/LibraryController.java

@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 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.RequestMethod;
 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.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.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;
 import cn.com.qmth.stmms.biz.lock.LockService;
@@ -53,6 +54,9 @@ public class LibraryController extends BaseExamController {
     @Autowired
     private MarkLibraryService libraryService;
 
+    @Autowired
+    private ExamStudentService studentService;
+
     @Autowired
     private MarkerService markerService;
 
@@ -166,24 +170,25 @@ public class LibraryController extends BaseExamController {
         return obj;
     }
 
-    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    @RequestMapping(value = "/getJson", method = RequestMethod.GET)
     @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);
-        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(
-                "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";
     }
 }

+ 2 - 3
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/jsonView.jsp

@@ -38,10 +38,9 @@ function initJsonPopover(url,questionNumbers){
         dataType:"json",  
         success:function(data){ 
         	//var data ='[{"mainNumber": 6,"subNumber": 1,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "audio","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/19/3_8_19_15748452552644264.mp3"}]}]},"studentAnswer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"},{"type": "image","value": "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582709869784&di=39683b1330bd09bebd93c95fe925ca70&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10108%2F170%2Fw600h370%2F20190222%2Fd6de-htknpmh2595255.jpg"}]}]}}]';
-         	//data = JSON.parse(data);
+        	//data = JSON.parse(data);
          	let questions = data || [];
-         	
-         	if(questionNumbers != undefined){
+         	if(questionNumbers != undefined && questionNumbers != ""){
                 var questionNumberArr = questionNumbers.split(",");
          		questions.forEach(question => {
                     //按题号过滤

+ 1 - 1
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/libraryList.jsp

@@ -122,7 +122,7 @@
 				<td>
 				    <c:if test="${result.status.value==1 || result.status.value==3 ||result.status.value==5}">
 				   		<c:if test="${examType=='MULTI_MEDIA'}">
-				    		<a class="json-link" href="${ctx}/admin/exam/library/${result.id}" target="_blank">原图</a> 
+				    		<a class="json-link" href="${ctx}/admin/exam/library/getJson?studentId=${result.studentId}&groupNumber=${result.groupNumber}" target="_blank">原图</a> 
 				    	</c:if>
 				    	<c:if test="${examType!='MULTI_MEDIA'}">
 	 				    	<a class="track-link" href="#" data-image-url="${ctx}/admin/exam/track/byLibrary?libraryId=${result.id}" data-title="${result.examNumber}">阅卷轨迹</a>

+ 1 - 1
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/scoreList.jsp

@@ -169,7 +169,7 @@
  						<a href="${ctx}/admin/exam/track/student/${student.id}" target="_blank">轨迹图</a>
 						</c:if>
 						<c:if test="${examType=='MULTI_MEDIA'}">
-						<a class="json-link" href="${ctx}/admin/exam/library/${result.id}" target="_blank">原图</a> 
+						<a class="json-link" href="${ctx}/admin/exam/library/getJson?studentId=${student.id}" target="_blank">原图</a> 
 						</c:if>
 					</c:if>
 					<c:if test="${student.packageUrlString!=null && student.packageUrlString!=''}">