wangliang 1 year ago
parent
commit
06c32249ce

+ 24 - 25
distributed-print/src/main/java/com/qmth/distributed/print/api/TCPaperStructController.java

@@ -156,34 +156,33 @@ public class TCPaperStructController {
         } else {
             if (Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
                 trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
-                paperStructDimensionResultList = new ArrayList<>();
-
-                if (Objects.nonNull(tcPaperStruct.getPaperStruct())) {
-                    List<PaperStructDto> paperStructDtoList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructDto>>() {
-                    }.getType());
-                    paperStructDimensionResultList = new ArrayList<>(paperStructDtoList.size());
-                    for (PaperStructDto paperStructDto : paperStructDtoList) {
-                        paperStructDimensionResultList.add(new PaperStructDimensionResult(paperStructDto.getMainNumber(), paperStructDto.getSubNumber(), paperStructDto.getScore()));
-                    }
-                } else {
-                    return this.finalScorePaperStructQuery(examId, courseCode, paperNumber);
-                }
+                paperStructDimensionResultList = this.getPaperStructDimensionResult(tcPaperStruct, paperStructDimensionResultList);
             } else {
-                if (Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
-                    paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
-                    }.getType());
-                } else if (Objects.nonNull(tcPaperStruct.getPaperStruct())) {
-                    List<PaperStructDto> paperStructDtoList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructDto>>() {
-                    }.getType());
-                    paperStructDimensionResultList = new ArrayList<>(paperStructDtoList.size());
-                    for (PaperStructDto paperStructDto : paperStructDtoList) {
-                        paperStructDimensionResultList.add(new PaperStructDimensionResult(paperStructDto.getMainNumber(), paperStructDto.getSubNumber(), paperStructDto.getScore()));
-                    }
-                } else {
-                    return this.finalScorePaperStructQuery(examId, courseCode, paperNumber);
-                }
+                paperStructDimensionResultList = this.getPaperStructDimensionResult(tcPaperStruct, paperStructDimensionResultList);
             }
         }
         return ResultUtil.ok(paperStructDimensionResultList);
     }
+
+    /**
+     * 获取试卷结构蓝图数据
+     *
+     * @param tcPaperStruct
+     * @param paperStructDimensionResultList
+     * @return
+     */
+    protected List<PaperStructDimensionResult> getPaperStructDimensionResult(TCPaperStruct tcPaperStruct, List<PaperStructDimensionResult> paperStructDimensionResultList) {
+        if (Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
+            paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
+            }.getType());
+        } else if (Objects.nonNull(tcPaperStruct.getPaperStruct())) {
+            List<PaperStructDto> paperStructDtoList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructDto>>() {
+            }.getType());
+            paperStructDimensionResultList = new ArrayList<>(paperStructDtoList.size());
+            for (PaperStructDto paperStructDto : paperStructDtoList) {
+                paperStructDimensionResultList.add(new PaperStructDimensionResult(paperStructDto.getMainNumber(), paperStructDto.getSubNumber(), paperStructDto.getScore()));
+            }
+        }
+        return paperStructDimensionResultList;
+    }
 }