Эх сурвалжийг харах

成绩导出标准版本加入缺考考生

wangliang 2 жил өмнө
parent
commit
d7d9907f0c

+ 15 - 1
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -204,11 +204,13 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
             Map<Long, Map<String, Integer>> paperObjectiveAnswerMap = new HashMap<>();
             LinkedMultiValueMap<Long, ExcelDto> dynamicExcelHead = new LinkedMultiValueMap<>();
             LinkedMultiValueMap<Long, MarkResultStandardExportDto> markResultStandardExportDtoLinkedMultiValueMap = new LinkedMultiValueMap<>();
-            if (Objects.nonNull(markResultStandardExportDtoList) && markResultStandardExportDtoList.size() > 0) {
+            if (!CollectionUtils.isEmpty(markResultStandardExportDtoList)) {
+                Long currentPaperId = null;
                 for (MarkResultStandardExportDto m : markResultStandardExportDtoList) {
                     excelDtoMap = new HashMap<>();
                     Map<String, Integer> objectiveAnswerCacheBeanMap = null;
                     if (Objects.nonNull(m.getPaperId())) {//处理试卷
+                        currentPaperId = m.getPaperId();
                         if (!paperObjectiveAnswerMap.containsKey(m.getPaperId())) {
                             objectiveAnswerCacheBeanMap = teExamPaperService.getPaperStructCacheBean(m.getPaperId());
                             paperObjectiveAnswerMap.put(m.getPaperId(), objectiveAnswerCacheBeanMap);
@@ -230,6 +232,18 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                             objectiveAnswerCacheBeanMap = paperObjectiveAnswerMap.get(m.getPaperId());
                         }
                     } else {
+                        if (Objects.nonNull(currentPaperId)) {//有答题数据的
+                            markResultStandardExportDtoLinkedMultiValueMap.add(currentPaperId, m);
+                            List<MarkResultStandardExportDto> markResultStandardExportDtos = markResultStandardExportDtoLinkedMultiValueMap.get(-1L);
+                            if (!CollectionUtils.isEmpty(markResultStandardExportDtos)) {
+                                for (MarkResultStandardExportDto markResultStandardExportDto : markResultStandardExportDtos) {
+                                    markResultStandardExportDtoLinkedMultiValueMap.add(currentPaperId, markResultStandardExportDto);
+                                }
+                                markResultStandardExportDtoLinkedMultiValueMap.remove(-1L);
+                            }
+                        } else {
+                            markResultStandardExportDtoLinkedMultiValueMap.add(-1L, m);
+                        }
                         continue;
                     }
                     if (Objects.nonNull(m.getRecordId())) {//处理考生答案