浏览代码

后台bug修复

xiaof 4 年之前
父节点
当前提交
683e889022

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/TaskTypeEnum.java

@@ -21,7 +21,7 @@ public enum TaskTypeEnum {
 
     PRINT_PDF_DOWNLOAD("批量下载pdf"),
 
-    PAPER_AND_CARD_PDF_DOWNLOAD("差为管理试卷、空白题卡批量下载pdf"),
+    PAPER_AND_CARD_PDF_DOWNLOAD("卷库查询管理试卷、空白题卡批量下载pdf"),
 
     CREATE_PDF("生成pdf");
 

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java

@@ -88,5 +88,5 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
 
     List<ExamTask> listExamTaskAuditExpire(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
 
-    List<ExamTaskDetailDto> listTaskPaper(@Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("containsQuestionTeacher") boolean containsQuestionTeacher, @Param("id") Long id);
+    List<ExamTaskDetailDto> listTaskPaper(@Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("containsQuestionTeacher") boolean containsQuestionTeacher, @Param("userId") Long userId);
 }

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

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.business.templete.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -26,6 +27,7 @@ import com.qmth.distributed.print.common.util.HexUtils;
 import com.qmth.distributed.print.common.util.ResultUtil;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
@@ -946,6 +948,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Override
     public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) throws IOException {
         TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
+        String yyyyMMddHH24mmss = DateUtil.format(new Date(), "yyyyMMddHHmmss");
+        BasicSchool basicSchool = cacheService.schoolCache(tbTask.getSchoolId());
         LocalDateTime nowTime = LocalDateTime.now();
         StringJoiner zipJoiner = new StringJoiner("")
                 .add(SystemConstant.TEMP_FILES_DIR).add(File.separator);
@@ -954,7 +958,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 .add(String.valueOf(nowTime.getYear())).add(File.separator)
                 .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
                 .add(String.format("%02d", nowTime.getDayOfMonth()))
-                .add(File.separator).add(SystemConstant.getUuid()).add(SystemConstant.ZIP_PREFIX);
+                .add(File.separator)
+                .add(yyyyMMddHH24mmss).add("_").add(basicSchool.getName()).add("_").add("试卷导出文件").add(SystemConstant.ZIP_PREFIX);
         String dirNameTmp = dirName.toString().replaceAll("\\\\", "/");
 
         // 根文件路径
@@ -962,11 +967,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
         List<ExamTaskDetailDto> examTasks = (List<ExamTaskDetailDto>) map.get("examTasks");
         for (ExamTaskDetailDto examTask : examTasks) {
-            String courseCodeName = examTask.getCourseCode() + "(" + examTask.getCourseName() + ")";
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(Long.valueOf(examTask.getId()));
 
             // 试卷
-            String paperSavePath = zipLocalRootPath + File.separator + "试卷";
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             if (StringUtils.isNotBlank(paperAttachmentIds)) {
                 List<Map> paperInfo = JSONObject.parseArray(paperAttachmentIds, Map.class);
@@ -980,7 +983,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
                         if (Objects.nonNull(attachment)) {
                             JSONObject jsonObject = JSONObject.parseObject(attachment.getPath());
-                            String paperPath = paperSavePath + File.separator + courseCodeName + File.separator + examTask.getPaperNumber() + File.separator + attachment.getName() + attachment.getType();
+                            String paperPath = zipLocalRootPath + File.separator + examTask.getPaperNumber() + File.separator + "试卷" + "_" + examTask.getPaperNumber() + "_" + name + attachment.getType();
                             ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath);
                         }
                     }
@@ -988,7 +991,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             }
 
             // 题卡
-            String cardSavePath = zipLocalRootPath + File.separator + "题卡";
             // 处理题卡
             ExamCard examCard = examCardService.getById(examTaskDetail.getCardId());
             if (Objects.isNull(examCard)) {
@@ -996,9 +998,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             }
             MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
 
-            String cardPath = cardSavePath + File.separator + courseCodeName + File.separator + examTask.getPaperNumber();
-            String cardHtmlPath = cardPath + File.separator + examCard.getTitle() + SystemConstant.HTML_PREFIX;
-            String cardPdfPath = cardPath + File.separator + examCard.getTitle() + SystemConstant.PDF_PREFIX;
+            String cardPath = zipLocalRootPath + File.separator + examTask.getPaperNumber();
+            String cardHtmlPath = cardPath + File.separator + "题卡" + "_" + examTask.getPaperNumber() + SystemConstant.HTML_PREFIX;
+            String cardPdfPath = cardPath + File.separator + "题卡" + "_" + examTask.getPaperNumber() + SystemConstant.PDF_PREFIX;
             // 通用题卡
             ExamCardDetail examCardDetail = examCardDetailService.getByCardId(examCard.getId());
             String htmlContent;
@@ -1017,7 +1019,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             FileCopyUtils.copy(htmlContent.getBytes(), localFile);
             // 转pdf文件
             File file = new File(cardPdfPath);
-            if(!file.exists()){
+            if (!file.exists()) {
                 file.createNewFile();
             }
             HtmlToPdfUtil.convert(cardHtmlPath, cardPdfPath, PageSizeEnum.A3);
@@ -1027,7 +1029,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         if (!zipFile.getParentFile().exists()) {
             zipFile.getParentFile().mkdirs();
         }
-        if(!zipFile.exists()){
+        if (!zipFile.exists()) {
             zipFile.createNewFile();
         }