xiatian 4 лет назад
Родитель
Сommit
9199885a42

+ 10 - 6
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -246,10 +246,14 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         }
     }
 
-    private boolean checkSingleChoice(String answer, JSONArray ar) {
-        int a = Integer.parseInt(answer);
+    private boolean checkSingleChoice(String answerArray, JSONArray ar) {
+    	JSONArray an=JSONArray.parseArray(answerArray);
+        int a = an.getIntValue(0);
+        return checkSingleChoice(a, ar);
+    }
+    private boolean checkSingleChoice(int answer, JSONArray ar) {
         for (int i = 0; i < ar.size(); i++) {
-            if (a == ar.getIntValue(i)) {
+            if (answer == ar.getIntValue(i)) {
                 return true;
             }
         }
@@ -264,9 +268,9 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
     private int checkMultipleChoice(String answer, JSONArray ar) {
         int yes = 0;
         int no = 0;
-        String[] ss = answer.split(",");
-        for (String an : ss) {
-            if (checkSingleChoice(an, ar)) {
+        JSONArray an=JSONArray.parseArray(answer);
+        for(int i=0;i<an.size();i++) {
+            if (checkSingleChoice(an.getIntValue(i), ar)) {
                 yes++;
                 continue;
             } else {