deason 2 anni fa
parent
commit
a467998965

+ 30 - 5
src/main/java/cn/com/qmth/examcloud/tool/service/query_paper_struct/QueryPaperStructTask.java

@@ -10,6 +10,9 @@ import cn.com.qmth.examcloud.tool.utils.HttpHelper;
 import cn.com.qmth.examcloud.tool.utils.JsonMapper;
 import cn.com.qmth.examcloud.tool.utils.SignUtils;
 import cn.com.qmth.examcloud.tool.vo.Pager;
+import cn.com.qmth.examcloud.tool.vo.paper.DefaultQuestionGroup;
+import cn.com.qmth.examcloud.tool.vo.paper.DefaultQuestionStructureWrapper;
+import cn.com.qmth.examcloud.tool.vo.paper.DefaultQuestionUnitWrapper;
 import cn.com.qmth.examcloud.tool.vo.user.User;
 import com.fasterxml.jackson.core.type.TypeReference;
 import org.apache.commons.collections4.CollectionUtils;
@@ -57,7 +60,30 @@ public class QueryPaperStructTask {
                 for (ExamPaperVO examPaper : extractConfig.getExamPaperList()) {
                     String basePaperId = examPaper.getPaper().getId();
                     log.info("examId:{}, courseCode:{}, paperType:{}, basePaperId:{}", examId, course.getCourseCode(), examPaper.getGroupCode(), basePaperId);
-                    this.getPaperStruct(examId, course.getCourseCode(), examPaper.getGroupCode(), basePaperId);
+                    GetPaperStructResp resp = this.getPaperStruct(examId, course.getCourseCode(), examPaper.getGroupCode(), basePaperId);
+
+                    System.out.println("========== ========== ==========");
+                    System.out.println("试卷名称:" + resp.getDefaultPaper().getName());
+                    System.out.println("========== ========== ==========");
+                    List<DefaultQuestionGroup> questionGroupList = resp.getDefaultPaper().getQuestionGroupList();
+
+                    int index = 0;
+                    for (int i = 0; i < questionGroupList.size(); i++) {
+                        DefaultQuestionGroup questionGroup = questionGroupList.get(i);
+                        List<DefaultQuestionStructureWrapper> questionWrapperList = questionGroup.getQuestionWrapperList();
+
+                        for (int j = 0; j < questionWrapperList.size(); j++) {
+                            DefaultQuestionStructureWrapper questionStructure = questionWrapperList.get(j);
+                            List<DefaultQuestionUnitWrapper> questionUnitWrapperList = questionStructure.getQuestionUnitWrapperList();
+
+                            for (int k = 0; k < questionUnitWrapperList.size(); k++) {
+                                DefaultQuestionUnitWrapper questionUnit = questionUnitWrapperList.get(k);
+
+                                System.out.println(String.format("试题ID:%s %s%s-%s", questionStructure.getQuestionId(),
+                                        questionUnit.getQuestionType().getDesc(), i + 1, ++index));
+                            }
+                        }
+                    }
                 }
             }
         }
@@ -86,7 +112,7 @@ public class QueryPaperStructTask {
     /**
      * 获取某个考试课程原卷的试卷结构
      */
-    private void getPaperStruct(Long examId, String courseCode, String paperType, String basePaperId) {
+    private GetPaperStructResp getPaperStruct(Long examId, String courseCode, String paperType, String basePaperId) {
         long rootOrgId = sysProperty.getServerRootOrgId();
         String appId = sysProperty.getServerAppId();
         String secretKey = sysProperty.getServerSecretKey();
@@ -107,10 +133,9 @@ public class QueryPaperStructTask {
 
         String url = sysProperty.getServerUrl() + "/api/exchange/outer/question/getPaperStruct";
         String json = HttpHelper.post(url, headers, params);
+        // System.out.println(json);
 
-        GetPaperStructResp resp = new JsonMapper().parseJson(json, GetPaperStructResp.class);
-        System.out.println(json);
-
+        return new JsonMapper().parseJson(json, GetPaperStructResp.class);
     }
 
 }