Forráskód Böngészése

Merge remote-tracking branch 'origin/dev_200331_openapi' into dev_200331_openapi

luoshi 4 éve
szülő
commit
e7d89cc899

+ 2 - 0
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/PaperController.java

@@ -104,6 +104,8 @@ public class PaperController extends BaseExamController {
         model.addAttribute("categoryList", subjectService.listCategory(examId));
         model.addAttribute("fileServer", fileService.getFileServer());
         model.addAttribute("examLock", lockService.isLocked(LockType.SCORE_CALCULATE, examId));
+        Exam exam = examService.findById(examId);
+        model.addAttribute("examType", exam.getType());
         return "modules/exam/paperList";
     }
 

+ 1 - 1
stmms-web/src/main/java/cn/com/qmth/stmms/admin/thread/DataSyncThread.java

@@ -103,7 +103,7 @@ public class DataSyncThread implements Runnable {
             String subjectResult = subjectHttp.httpAction(null, datas.toString());
             JSONObject subjectJson = JSONObject.fromObject(subjectResult);
             // 考试返回错误,无法创建阅卷
-            if (ERROR_CODE.equals(subjectJson.getString("code"))) {
+            if (!subjectJson.getString("code").isEmpty()) {
                 log.error("data sync exception for cloud examId=" + dataSync.getCloudExamId(),
                         subjectJson.getString("desc"));
                 return;

+ 15 - 22
stmms-web/src/main/java/cn/com/qmth/stmms/admin/utils/HttpUtil.java

@@ -1,17 +1,12 @@
 package cn.com.qmth.stmms.admin.utils;
 
 import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.nio.charset.StandardCharsets;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 import java.util.Map;
@@ -24,11 +19,12 @@ import javax.net.ssl.X509TrustManager;
 
 import net.sf.json.JSONObject;
 
-import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class HttpUtil {
 
-    // private static Logger log = LoggerFactory.getLogger(HttpUtil.class);
+    private static Logger log = LoggerFactory.getLogger(HttpUtil.class);
 
     /** 默认的编码格式 */
     public static final String DEFAULT_CHARSET = "UTF-8";
@@ -151,13 +147,9 @@ public class HttpUtil {
             result = message.toString();
         } catch (Exception e) {
             // 操作失败
-            // log.error("Http connection error!", e);
+            log.error("Http connection error!", e);
             e.printStackTrace();
-            JSONObject message = JSONObject.fromObject(e.getMessage());
-            if (ERROR_CODE.equals(message.getString("code"))) {
-                return e.getMessage();
-            }
-            return null;
+            return e.getMessage();
         } finally {
             try {
                 if (os != null) {
@@ -169,7 +161,7 @@ public class HttpUtil {
                     is = null;
                 }
             } catch (IOException e) {
-                // log.error("Http connection error!", e);
+                log.error("Http connection error!", e);
             }
 
             if (conn != null) {
@@ -233,14 +225,14 @@ public class HttpUtil {
     public static void main(String[] args) throws IOException {
         JSONObject json = new JSONObject();
         json.accumulate("examId", 240);
-        json.accumulate("subjectCode", "CJFX17");
+        json.accumulate("subjectCode", "CJFX18");
         String test = "https://ecs-test.ea100.com.cn/api/exchange/outer/question/getSubjectivePaperStruct";
         // String dev =
         // "https://dev.ea100.com.cn/api/exchange/outer/question/getSubjectivePaperStruct";
         long start = System.currentTimeMillis();
         HttpUtil subjectHttp = new HttpUtil(test, "123456", "11", "17128");
         String subjectJson = subjectHttp.httpAction(null, json.toString());
-        System.out.println(subjectJson);
+        // System.out.println(subjectJson);
         // ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         // IOUtils.copy(new
         // ByteArrayInputStream(subjectJson.getBytes(StandardCharsets.UTF_8)),
@@ -262,12 +254,13 @@ public class HttpUtil {
         // String paper = paperHttp.httpAction(null, json.toString());
         // System.out.println(paper);
 
-        // HttpUtil studentHttp = new HttpUtil(
-        // "https://192.168.10.39:8007/api/exchange/outer/question/getSubjectiveQuestion",
-        // "123456", "11", "0");
-        // json.accumulate("startId", 0);
-        // json.accumulate("size", 10);
-        // String studentJson = studentHttp.httpAction(null, json.toString());
+        HttpUtil studentHttp = new HttpUtil(
+                "https://ecs-test.ea100.com.cn/api/exchange/outer/question/getSubjectiveQuestion", "123456", "11",
+                "17128");
+        json.accumulate("startId", 0);
+        json.accumulate("size", 1);
+        String studentJson = studentHttp.httpAction(null, json.toString());
+        System.out.println(studentJson);
         long end = System.currentTimeMillis();
         System.out.println(end - start);
     }

+ 56 - 55
stmms-web/src/main/webapp/WEB-INF/views/include/trialDetail.jsp

@@ -73,6 +73,7 @@
                     else if (data.fileServer != undefined && data.questionNumbers != undefined) {
                         var url = data.fileServer + data.urls;
                         var paperUrl = data.fileServer + data.paperUrl;
+                        var answerUrl = data.fileServer + data.urls;
                         var questionNumbers = data.questionNumbers.split(",");
                         let questionArr = {};
                         questionNumbers.forEach(questionNumber => {
@@ -92,69 +93,69 @@
                             url: answerUrl,
                             dataType: "json",
                             success: function (data) {
-                                let questions = JSON.parse(data) || [];
+                               	let questions = data || [];
                                 //var data = '[{"mainNumber": 6,"subNumber": 19,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"}]},{"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"},{"type": "text","value": "我是答案答案daan"}]}]}}]';
                                 //let questions = JSON.parse(data);
                                 for (var j in questions) {
-                                    var question = questions[j];
-                                    var paperQuestion = paperqQuestions[j];
-                                    // 按题号过滤
-                                    if (questionArr[question.mainNumber + "." + question.subNumber] === true) {
-                                        let numberTitle = {
-                                            "blocks": [{
-                                                "type": "text",
-                                                "param": {"bold": true},
-                                                "value": "题号:" + question.mainNumber + "-" + question.subNumber
-                                            }]
-                                        };
-                                        let bodyTitle = {
-                                            "blocks": [{
-                                                "type": "text",
-                                                "param": {"bold": true},
-                                                "value": "题干:"
-                                            }]
-                                        };
-                                        let answerTitle = {
-                                            "blocks": [{
-                                                "type": "text",
-                                                "param": {"bold": true},
-                                                "value": "考生答案:"
-                                            }, {
-                                                "type": "text",
-                                                "param": {
-                                                    "italic": true,
-                                                    "danger": true
-                                                },
-                                                "value": "(字数统计:" + textCount(question.answer) + ")"
-                                            }]
-                                        };
-                                        let standardTitle = {
-                                            "blocks": [{
-                                                "type": "text",
-                                                "param": {"bold": true},
-                                                "value": "标准答案:"
-                                            }]
-                                        };
-                                        this.holder = $('#trial-left-div');
-                                        $(renderSection(numberTitle)).appendTo(this.holder);
-                                        $(renderSection(bodyTitle)).appendTo(this.holder);
-                                        if (paperQuestion.parentBody != null && paperQuestion.parentBody != undefined) {
-                                            $(renderRichText(paperQuestion.parentBody)).appendTo(this.holder);
-                                        }
-                                        $(renderRichText(paperQuestion.body)).appendTo(this.holder);
-                                        $(renderSection(answerTitle)).appendTo(this.holder);
-                                        $(renderRichText(question.answer)).appendTo(this.holder);
-                                        $(renderSection(standardTitle)).appendTo(this.holder);
-                                        $(renderRichText(paperQuestion.answer)).appendTo(this.holder);
-                                        trialDetailModal.setContent($('#trial-detail-content'));
-                                    }
+                                	  var question = questions[j];
+                                      var paperQuestion = paperqQuestions[j];
+                                      // 按题号过滤
+                                      if (questionArr[question.mainNumber + "." + question.subNumber] === true) {
+                                          let numberTitle = {
+                                              "blocks": [{
+                                                  "type": "text",
+                                                  "param": {"bold": true},
+                                                  "value": "题号:" + question.mainNumber + "-" + question.subNumber
+                                              }]
+                                          };
+                                          let bodyTitle = {
+                                              "blocks": [{
+                                                  "type": "text",
+                                                  "param": {"bold": true},
+                                                  "value": "题干:"
+                                              }]
+                                          };
+                                          let answerTitle = {
+                                              "blocks": [{
+                                                  "type": "text",
+                                                  "param": {"bold": true},
+                                                  "value": "考生答案:"
+                                              }, {
+                                                  "type": "text",
+                                                  "param": {
+                                                      "italic": true,
+                                                      "danger": true
+                                                  },
+                                                  "value": "(字数统计:" + textCount(question.answer) + ")"
+                                              }]
+                                          };
+                                          let standardTitle = {
+                                              "blocks": [{
+                                                  "type": "text",
+                                                  "param": {"bold": true},
+                                                  "value": "标准答案:"
+                                              }]
+                                          };
+                                          this.holder = $('#trial-left-div');
+                                          $(renderSection(numberTitle)).appendTo(this.holder);
+                                          $(renderSection(bodyTitle)).appendTo(this.holder);
+                                          if (paperQuestion.parentBody != null && paperQuestion.parentBody != undefined) {
+                                              $(renderRichText(paperQuestion.parentBody)).appendTo(this.holder);
+                                          }
+                                          $(renderRichText(paperQuestion.body)).appendTo(this.holder);
+                                          $(renderSection(answerTitle)).appendTo(this.holder);
+                                          $(renderRichText(question.answer)).appendTo(this.holder);
+                                          $(renderSection(standardTitle)).appendTo(this.holder);
+                                          $(renderRichText(paperQuestion.answer)).appendTo(this.holder);
+                                          trialDetailModal.setContent($('#trial-detail-content'));
+                                      }
                                 }
+                         
                             }
                         }).error(function () {
                             trialDetailModal.setTitle('加载失败');
                         });
-                            
-                    }
+                    }   
             	} else {
                     trialDetailModal.setTitle('加载失败');
                 }

+ 10 - 10
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/inspectedList.jsp

@@ -23,14 +23,6 @@
             </c:forEach>
         </select>
         &nbsp;
-        <label>大题</label>
-        <select class="input-medium" id="question-select" name="mainNumber">
-            <option value="">请选择</option>
-            <c:forEach items="${questionList}" var="result">
-                <option value="${result.mainNumber}" <c:if test="${result.mainNumber==mainNumber}">selected</c:if>>${result.mainNumber}-${result.mainTitle}</option>
-            </c:forEach>
-        </select>
-        &nbsp;
         <label>状态</label>
         <select class="input-medium" name="status">
             <option value="">请选择</option>
@@ -38,12 +30,20 @@
                 <option value="${result}" <c:if test="${status==result}">selected</c:if>>${result.name}</option>
             </c:forEach>
         </select>
-        <br/><br/>
-		
+         &nbsp;
         <label>试卷总分:从</label>
         <input type="text" number="true" id="startScroe" name="startScore" value="${query.startScore}" class="input-mini"/>
         <label> 到&nbsp;&nbsp;&nbsp;</label>
         <input type="text" number="true" id="endScroe" name="endScore" value="${query.endScore}" class="input-mini"/>
+        
+        <br/><br/>
+		<label>大题</label>
+        <select class="input-medium" id="question-select" name="mainNumber">
+            <option value="">请选择</option>
+            <c:forEach items="${questionList}" var="result">
+                <option value="${result.mainNumber}" <c:if test="${result.mainNumber==mainNumber}">selected</c:if>>${result.mainNumber}-${result.mainTitle}</option>
+            </c:forEach>
+        </select>
         &nbsp;
         <label>大题得分:从</label>
         <input type="text" number="true" name="mainStartScore" id="mainStartScore" value="${mainStartScore }" class="input-mini"/>

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

@@ -129,12 +129,12 @@
             <td>${subject.level}</td>
             <td>${subject.category}</td>
             <td>
-                <c:if test="${subject.paperUrl != null}">
+                <c:if test="${subject.paperUrl != null && examType!='MULTI_MEDIA'}">
                     <a href="${fileServer}${subject.paperUrl}" target="_blank">已上传</a>
                 </c:if>
             </td>
             <td>
-                <c:if test="${subject.answerUrl != null}">
+                <c:if test="${subject.answerUrl != null && examType!='MULTI_MEDIA'}">
                     <a href="${fileServer}${subject.answerUrl}" target="_blank">已上传</a>
                 </c:if>
             </td>

+ 1 - 0
stmms-web/src/main/webapp/static/i18n/messages.properties

@@ -25,6 +25,7 @@ user.reset.password.length=\u5bc6\u7801\u7684\u957f\u5ea6\u81f3\u5c114\u4f4d\uff
 mark.control.assistant=\u5c0f\u52a9\u624b
 mark.control.mode.track=\u5207\u6362\u5230\u8f68\u8ff9\u6a21\u5f0f
 mark.control.mode.common=\u5207\u6362\u5230\u666e\u901a\u6a21\u5f0f
+mark.control.board=\u7ed9\u5206\u677f
 mark.control.function=\u8bc4\u5377\u529f\u80fd
 mark.control.logout=\u9000\u51fa
 mark.control.init.error=\u521d\u59cb\u5316\u5931\u8d25\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u65b0\u52a0\u8f7d

+ 1 - 0
stmms-web/src/main/webapp/static/i18n/messages_en.properties

@@ -25,6 +25,7 @@ user.reset.password.length=password must be at least 4 word,cannot exceed 8 word
 mark.control.assistant=Assistant
 mark.control.mode.track=Track Mode
 mark.control.mode.common=Common Mode
+mark.control.board=Mark Board
 mark.control.function=Marking function
 mark.control.logout=logout
 mark.control.init.error=Initialization failed, please refresh the page!

+ 1 - 0
stmms-web/src/main/webapp/static/i18n/messages_ja.properties

@@ -25,6 +25,7 @@ user.reset.password.length=4\u6587\u5b57\u4ee5\u4e0a\u30018\u6587\u5b57\u4ee5\u5
 mark.control.assistant=\u305d\u306e\u4ed6\u306e\u6a5f\u80fd
 mark.control.mode.track=\u90e8\u5206\u63a1\u70b9\u30e2\u30fc\u30c9\u306b\u5207\u308a\u66ff\u3048\u308b
 mark.control.mode.common=\u901a\u5e38\u63a1\u70b9\u30e2\u30fc\u30c9\u306b\u5207\u308a\u66ff\u3048\u308b
+mark.control.board=\u63a1\u70b9\u677f
 mark.control.function=\u63a1\u70b9\u6a5f\u80fd
 mark.control.logout=EXIT
 mark.control.init.error=\u30c7\u30fc\u30bf\u30fc\u66f4\u65b0\u304c\u5931\u6557\u3057\u305f\u306e\u3067\u3001\u518d\u5ea6\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044

+ 1 - 0
stmms-web/src/main/webapp/static/i18n/messages_zh.properties

@@ -25,6 +25,7 @@ user.reset.password.length=\u5bc6\u7801\u7684\u957f\u5ea6\u81f3\u5c114\u4f4d\uff
 mark.control.assistant=\u5c0f\u52a9\u624b
 mark.control.mode.track=\u5207\u6362\u5230\u8f68\u8ff9\u6a21\u5f0f
 mark.control.mode.common=\u5207\u6362\u5230\u666e\u901a\u6a21\u5f0f
+mark.control.board=\u7ed9\u5206\u677f
 mark.control.function=\u8bc4\u5377\u529f\u80fd
 mark.control.logout=\u9000\u51fa
 mark.control.init.error=\u521d\u59cb\u5316\u5931\u8d25\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u65b0\u52a0\u8f7d

+ 1 - 0
stmms-web/src/main/webapp/static/mark-new/js/mark-control.js

@@ -664,6 +664,7 @@ MarkControl.prototype.center_dom = '<div class="center-content span12"></div>';
 
 MarkControl.prototype.center_header_dom = '<div class="row-fluid"><div class="header"><p class="tips">\
 <em><a href="##" class="btn" id="switch-track-button" style="display:none" data-i18n-text="mark.control.mode.track">切换到轨迹模式</a>\
+<a href="##" class="btn" id="mark-board-button" data-i18n-text="mark.control.board">给分板</a>\
 <a href="javascript:void(0)" id="assistant-button" class="btn"><i class="icon-wrench"></i><span data-i18n-text="mark.control.assistant"> 小助手</span></a></em>\
 <a href="##" class="btn" id="switch-group-button" style="display:none" data-i18n-text="mark.control.group">切换分组</a>\
 <a class="useinfo" href="#"><i class="icon-user icon-white"></i><i id="mark-user-name"></i></a>\

+ 22 - 0
stmms-web/src/main/webapp/static/mark-new/js/modules/mark-board.js

@@ -13,6 +13,7 @@ function MarkBoard(option) {
     this.showScoreBoard = option.showScoreBoard === false ? false : true;
     this.enableSkip = option.enableSkip === true ? true : false;
     this.enablAllZero = option.enableAllZero === true ? true : false;
+    this.showBoard = true;
 
     this.init();
 
@@ -193,6 +194,14 @@ MarkBoard.prototype.init = function () {
     this.popover.title.css('line-height', '25px');
     //this.popover.width('100');
     //this.popover.title.width('100');
+    
+    this.markControl.container.header.find('#mark-board-button').click(this, function (event) {
+    	if(self.showBoard){
+    		event.data.toggleMarkBoard(false);
+    	}else{
+    		event.data.toggleMarkBoard(true);
+    	}
+    });
 }
 
 MarkBoard.prototype.initByTask = function (task) {
@@ -652,6 +661,19 @@ MarkBoard.prototype.onFocusChange = function () {
     this.currentStep = null;
 }
 
+MarkBoard.prototype.toggleMarkBoard = function (show) {
+    if (show) {
+        this.markControl.trigger('step.board.show');
+        this.stepBoard.show();
+        this.showBoard = true;
+    } else {
+    	this.markControl.trigger('step.board.hide');
+    	this.stepBoard.hide();
+    	this.scoreBoard.hide();
+    	this.showBoard = false;
+    }
+}
+
 MarkBoard.prototype.step_board_dom = '<div class="span2 mark-steps" style="display:none"><div class="step-board">\
 <a href="#" class="header" id="show-score-board-button" data-i18n-text="mark.board.mouse"><< 鼠标给分</a>\
 <div class="sublist"><p class="fraction"><span data-i18n-text="mark.board.total.score">总分</span> <i id="total-score">5</i></p><div>\

+ 1 - 0
stmms-web/src/main/webapp/static/mark-track/js/mark-control.js

@@ -657,6 +657,7 @@ MarkControl.prototype.center_dom = '<div class="center-content span12"></div>';
 
 MarkControl.prototype.center_header_dom = '<div class="row-fluid"><div class="header"><p class="tips">\
 <em><a href="##" class="btn" id="switch-common-button" style="display:none" data-i18n-text="mark.control.mode.common">切换到普通模式</a>\
+<a href="##" class="btn" id="mark-board-button" data-i18n-text="mark.control.board">给分板</a>\
 <a href="javascript:void(0)" id="assistant-button" class="btn"><i class="icon-wrench"></i><span data-i18n-text="mark.control.assistant"> 小助手</span></a></em>\
 <a href="##" class="btn" id="switch-group-button">切换分组</a>\
 <a class="useinfo" href="#"><i class="icon-user icon-white"></i><i id="mark-user-name"></i></a>\

+ 21 - 1
stmms-web/src/main/webapp/static/mark-track/js/modules/mark-board.js

@@ -12,6 +12,7 @@ function MarkBoard(option) {
     this.autoSubmit = option.autoSubmit === false ? false : true;
     this.enableSkip = option.enableSkip === true ? true : false;
     this.enablAllZero = option.enableAllZero === true ? true : false;
+    this.showBoard = true;
 
     this.init(this.markControl.option.forceSpecialTag);
     this.markControl.on('task.get.before', this, function (event, context, eventObject) {
@@ -166,7 +167,14 @@ MarkBoard.prototype.init = function (forceSpecialTag) {
             self.refreshTrack();
         }
     });
-
+    
+    this.markControl.container.header.find('#mark-board-button').click(this, function (event) {
+    	if(self.showBoard){
+    		event.data.toggleMarkBoard(false);
+    	}else{
+    		event.data.toggleMarkBoard(true);
+    	}
+    });
 }
 
 MarkBoard.prototype.initByTask = function (task) {
@@ -500,6 +508,18 @@ MarkBoard.prototype.onFocusChange = function () {
     this.currentStep = null;
 }
 
+MarkBoard.prototype.toggleMarkBoard = function (show) {
+    if (show) {
+        this.markControl.trigger('step.board.show');
+        this.stepBoard.show();
+        this.showBoard = true;
+    } else {
+    	this.markControl.trigger('step.board.hide');
+    	this.stepBoard.hide();
+    	this.showBoard = false;
+    }
+}
+
 MarkBoard.prototype.step_board_dom = '<div class="span3 mark-steps"><div class="step-board">\
     <div class="sublist"><p class="fraction"><span data-i18n-text="mark.board.total.score">总分</span> <i id="total-score">5</i></p></div>\
 <div class="button">\

+ 12 - 0
stmms-web/src/main/webapp/static/mark-track/js/modules/single-image-view.js

@@ -11,6 +11,18 @@ function SingleImageView(option) {
     this.markControl.on('center.width.change', this, function (event, context, eventObject) {
         //this.container.perfectScrollbar('update');
     });
+    this.markControl.on('step.board.show', this, function (event, context, eventObject) {
+        this.container.parent().removeClass('span12');
+        this.container.parent().addClass('span9');
+        this.reloadImage();
+        this.markControl.trigger('image.reload.event');
+    });
+    this.markControl.on('step.board.hide', this, function (event, context, eventObject) {
+        this.container.parent().removeClass('span9');
+        this.container.parent().addClass('span12');
+        this.reloadImage();
+        this.markControl.trigger('image.reload.event');
+    });
     this.markControl.on('task.get.before', this, function (event, context, eventObject) {
         this.task = undefined;
         this.image = undefined;