Bläddra i källkod

fix:批量下载 只下题卡异常

caozixuan 3 år sedan
förälder
incheckning
cb6f4d0fac

+ 17 - 12
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -1693,18 +1693,20 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         if (examTaskPaperFileDtoList.size() == 0){
             throw ExceptionResultEnum.ERROR.exception("没有找到任何试卷信息");
         }
-        switch (paperFileDownloadExposureStatus) {
-            case EXPOSED_PAPER: // 曝光的
-                excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
-                examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(ExamTaskPaperFileDto::getExposureStatus).collect(Collectors.toList());
-                break;
-            case UNEXPOSED_PAPER: // 未曝光的
-                excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
-                examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(e -> !e.getExposureStatus()).collect(Collectors.toList());
-                break;
-            case ALL_PAPER: // 全部试卷
-                excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
-                break;
+        if (Objects.nonNull(paperFileDownloadExposureStatus)){
+            switch (paperFileDownloadExposureStatus) {
+                case EXPOSED_PAPER: // 曝光的
+                    excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
+                    examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(ExamTaskPaperFileDto::getExposureStatus).collect(Collectors.toList());
+                    break;
+                case UNEXPOSED_PAPER: // 未曝光的
+                    excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
+                    examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(e -> !e.getExposureStatus()).collect(Collectors.toList());
+                    break;
+                case ALL_PAPER: // 全部试卷
+                    excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
+                    break;
+            }
         }
         String excelLocalPath = zipLocalRootPath + File.separator + excelName + "." + SystemConstant.XLSX;
         convertUtil.saveLocal(in,excelLocalPath);
@@ -1755,6 +1757,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 String cardLocalHtmlPath = filePath + cardName + SystemConstant.HTML_PREFIX;
                 String cardLocalPdfPath = filePath + cardName + SystemConstant.PDF_PREFIX;
 
+                if (Objects.isNull(paperFileDownloadContent)){
+                    continue;
+                }
                 switch (paperFileDownloadContent) {
                     case ONLY_CARD: // 只下载题卡
                         File localFile = new File(cardLocalHtmlPath);