wangliang 4 anos atrás
pai
commit
63a7b5e8b2

+ 9 - 10
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -92,23 +92,22 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
             List<MarkResultStandardExportDto> markResultStandardExportDtoList = gson.fromJson(gson.toJson(markResultSimpleExportDtoList), new TypeToken<List<MarkResultStandardExportDto>>() {
             }.getType());
             Map<Long, List<ExcelDto>> excelDtoMap = null;
-            Map<Long, Map<String, ObjectiveAnswerCacheBean>> paperObjectiveAnswerMap = new HashMap<>();
+            Map<Long, Map<String, Integer>> paperObjectiveAnswerMap = new HashMap<>();
             List<ExcelDto> dynamicExcelHead = new ArrayList<>();
             if (Objects.nonNull(markResultStandardExportDtoList) && markResultStandardExportDtoList.size() > 0) {
                 for (MarkResultStandardExportDto m : markResultStandardExportDtoList) {
                     excelDtoMap = new HashMap<>();
-                    Map<String, ObjectiveAnswerCacheBean> objectiveAnswerCacheBeanMap = null;
+                    Map<String, Integer> objectiveAnswerCacheBeanMap = null;
                     if (Objects.nonNull(m.getPaperId())) {//处理试卷
                         if (!paperObjectiveAnswerMap.containsKey(m.getPaperId())) {
-                            objectiveAnswerCacheBeanMap = teExamPaperService.getObjectiveAnswerCacheBean(m.getPaperId());
+                            objectiveAnswerCacheBeanMap = teExamPaperService.getPaperStructCacheBean(m.getPaperId());
                             paperObjectiveAnswerMap.put(m.getPaperId(), objectiveAnswerCacheBeanMap);
                         } else {
                             objectiveAnswerCacheBeanMap = paperObjectiveAnswerMap.get(m.getPaperId());
                         }
                         if (dynamicExcelHead.size() == 0) {
                             objectiveAnswerCacheBeanMap.forEach((k, v) -> {
-                                ObjectiveAnswerCacheBean objectiveAnswerCacheBean = v;
-                                String title = QuestionTypeEnum.convertToTitle(objectiveAnswerCacheBean.getStructType()) + k;
+                                String title = QuestionTypeEnum.convertToTitle(v) + k;
                                 ExcelDto excelAnswerDto = new ExcelDto(title + "作答");
                                 ExcelDto excelScoreDto = new ExcelDto(title + "得分");
                                 dynamicExcelHead.add(excelAnswerDto);
@@ -127,11 +126,11 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                             questionsTitle = Objects.nonNull(s.getSubNumber()) ? questionsTitle + "_" + s.getSubNumber() : questionsTitle;
                             questionsTitle = Objects.nonNull(s.getSubIndex()) ? questionsTitle + "_" + s.getSubIndex() : questionsTitle;
                             if (Objects.nonNull(s.getAnswer())) {
-                                ObjectiveAnswerCacheBean objectiveAnswerCacheBean = objectiveAnswerCacheBeanMap.get(questionsTitle);
-                                if (Objects.nonNull(objectiveAnswerCacheBean)) {
-                                    String title = QuestionTypeEnum.convertToTitle(objectiveAnswerCacheBean.getStructType()) + questionsTitle;
+                                Integer structType = objectiveAnswerCacheBeanMap.get(questionsTitle);
+                                if (Objects.nonNull(structType)) {
+                                    String title = QuestionTypeEnum.convertToTitle(structType) + questionsTitle;
                                     String answer = "无";
-                                    if (objectiveAnswerCacheBean.getStructType().intValue() == 1 || objectiveAnswerCacheBean.getStructType().intValue() == 2) {
+                                    if (structType.intValue() == 1 || structType.intValue() == 2) {
                                         String string = s.getAnswer().replace("[", "").replace("]", "").replaceAll(" ", "").replaceAll("\n", "");
                                         if (Objects.nonNull(string) && !Objects.equals(string, "")) {
                                             List<String> list = Arrays.asList(string.split(","));
@@ -141,7 +140,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                                             }
                                             answer = answerList.toString();
                                         }
-                                    } else if (objectiveAnswerCacheBean.getStructType().intValue() == 3) {
+                                    } else if (structType.intValue() == 3) {
                                         answer = AnswerTypeEnum.convertToTitle(s.getAnswer().replaceAll("\n", "").toUpperCase());
                                     }
                                     ExcelDto excelAnswerDto = new ExcelDto(title + "作答", answer);