wangliang 4 years ago
parent
commit
c39d9ae929

+ 3 - 10
themis-business/src/main/java/com/qmth/themis/business/bean/admin/OpenRecordAnswerBean.java

@@ -18,19 +18,12 @@ public class OpenRecordAnswerBean {
     private Integer subIndex;
 
     @ApiModelProperty("作答")
-    private List<String> answer;
+    private List<OpenRecordAnswerStructBean> answer;
 
     public OpenRecordAnswerBean() {
 
     }
 
-    public OpenRecordAnswerBean(Integer mainNumber, Integer subNumber, Integer subIndex, List<String> answer) {
-        this.mainNumber = mainNumber;
-        this.subNumber = subNumber;
-        this.subIndex = subIndex;
-        this.answer = answer;
-    }
-
     public OpenRecordAnswerBean(Integer mainNumber, Integer subNumber, Integer subIndex) {
         this.mainNumber = mainNumber;
         this.subNumber = subNumber;
@@ -61,11 +54,11 @@ public class OpenRecordAnswerBean {
         this.subIndex = subIndex;
     }
 
-    public List<String> getAnswer() {
+    public List<OpenRecordAnswerStructBean> getAnswer() {
         return answer;
     }
 
-    public void setAnswer(List<String> answer) {
+    public void setAnswer(List<OpenRecordAnswerStructBean> answer) {
         this.answer = answer;
     }
 }

+ 46 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/admin/OpenRecordAnswerBlocksBean.java

@@ -0,0 +1,46 @@
+package com.qmth.themis.business.bean.admin;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+@ApiModel("开放接口-待评卷考试记录答案内容")
+public class OpenRecordAnswerBlocksBean {
+
+    @ApiModelProperty("内容块")
+    private List<OpenRecordAnswerContentBean> blocks;
+
+    public List<OpenRecordAnswerContentBean> getBlocks() {
+        return blocks;
+    }
+
+    public void setBlocks(List<OpenRecordAnswerContentBean> blocks) {
+        this.blocks = blocks;
+    }
+
+    class OpenRecordAnswerContentBean {
+
+        @ApiModelProperty("类型")
+        private String type;
+
+        @ApiModelProperty("值")
+        private String value;
+
+        public String getType() {
+            return type;
+        }
+
+        public void setType(String type) {
+            this.type = type;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public void setValue(String value) {
+            this.value = value;
+        }
+    }
+}

+ 32 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/admin/OpenRecordAnswerStructBean.java

@@ -0,0 +1,32 @@
+package com.qmth.themis.business.bean.admin;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+@ApiModel("开放接口-待评卷考试记录答案章节结构")
+public class OpenRecordAnswerStructBean {
+
+    @ApiModelProperty("序号")
+    private String index;
+
+    @ApiModelProperty("章节")
+    private List<OpenRecordAnswerBlocksBean> sections;
+
+    public String getIndex() {
+        return index;
+    }
+
+    public void setIndex(String index) {
+        this.index = index;
+    }
+
+    public List<OpenRecordAnswerBlocksBean> getSections() {
+        return sections;
+    }
+
+    public void setSections(List<OpenRecordAnswerBlocksBean> sections) {
+        this.sections = sections;
+    }
+}

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/bean/admin/OpenRecordAnswerTempBean.java

@@ -3,7 +3,7 @@ package com.qmth.themis.business.bean.admin;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-@ApiModel("开放接口-待评卷考试记录答案")
+@ApiModel("开放接口-待评卷考试记录答案temp")
 public class OpenRecordAnswerTempBean {
 
 	@ApiModelProperty("大题号")

+ 5 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEOpenServiceImpl.java

@@ -24,7 +24,10 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @Service
@@ -227,10 +230,9 @@ public class TEOpenServiceImpl implements TEOpenService {
                     answersTemp.forEach(s -> {
                         OpenRecordAnswerBean openRecordAnswerBean = new OpenRecordAnswerBean(s.getMainNumber(), s.getSubNumber(), s.getSubIndex());
                         try {
-                            openRecordAnswerBean.setAnswer(JSONArray.parseArray(s.getAnswer()).toJavaList(String.class));
+                            openRecordAnswerBean.setAnswer(JSONArray.parseArray(s.getAnswer()).toJavaList(OpenRecordAnswerStructBean.class));
                         } catch (Exception e) {
                             log.error("错误答案:{}", s.getAnswer(), e);
-                            openRecordAnswerBean.setAnswer(Objects.nonNull(s.getAnswer()) ? Arrays.asList(s.getAnswer()) : null);
                         }
                         answers.add(openRecordAnswerBean);
                     });