Browse Source

3.3.0 fix

xiaofei 1 năm trước cách đây
mục cha
commit
e2a03c1e0d

+ 93 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/createPdf/PrintPathVo.java

@@ -0,0 +1,93 @@
+package com.qmth.distributed.print.business.bean.createPdf;
+
+import com.qmth.teachcloud.common.enums.ClassifyEnum;
+import com.qmth.teachcloud.common.enums.UploadFileEnum;
+
+public class PrintPathVo {
+    private int index;
+    private ClassifyEnum printType;
+    private UploadFileEnum uploadType;
+    private String type;
+    private String pdfPath;
+    private String  pdfMd5;
+    private String  htmlPath;
+    private String htmlMd5;
+
+    public PrintPathVo() {
+    }
+
+    public PrintPathVo(ClassifyEnum printType, UploadFileEnum uploadType, String type, String pdfPath, String pdfMd5, String htmlPath, String htmlMd5) {
+        this.index = printType.ordinal();
+        this.printType = printType;
+        this.uploadType = uploadType;
+        this.type = type;
+        this.pdfPath = pdfPath;
+        this.pdfMd5 = pdfMd5;
+        this.htmlPath = htmlPath;
+        this.htmlMd5 = htmlMd5;
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public void setIndex(int index) {
+        this.index = index;
+    }
+
+    public ClassifyEnum getPrintType() {
+        return printType;
+    }
+
+    public void setPrintType(ClassifyEnum printType) {
+        this.printType = printType;
+    }
+
+    public UploadFileEnum getUploadType() {
+        return uploadType;
+    }
+
+    public void setUploadType(UploadFileEnum uploadType) {
+        this.uploadType = uploadType;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getPdfPath() {
+        return pdfPath;
+    }
+
+    public void setPdfPath(String pdfPath) {
+        this.pdfPath = pdfPath;
+    }
+
+    public String getPdfMd5() {
+        return pdfMd5;
+    }
+
+    public void setPdfMd5(String pdfMd5) {
+        this.pdfMd5 = pdfMd5;
+    }
+
+    public String getHtmlPath() {
+        return htmlPath;
+    }
+
+    public void setHtmlPath(String htmlPath) {
+        this.htmlPath = htmlPath;
+    }
+
+    public String getHtmlMd5() {
+        return htmlMd5;
+    }
+
+    public void setHtmlMd5(String htmlMd5) {
+        this.htmlMd5 = htmlMd5;
+    }
+}

+ 3 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamDetailService.java

@@ -14,9 +14,11 @@ import com.qmth.distributed.print.business.entity.ExamDetailCourse;
 import com.qmth.distributed.print.business.entity.ExamPrintPlan;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.enums.ExamDataSourceEnum;
+import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.TBTask;
+import com.qmth.teachcloud.common.enums.CreatePdfTypeEnum;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
@@ -243,7 +245,7 @@ public interface ExamDetailService extends IService<ExamDetail> {
 
     void deleteExaminationDataByExamDetailIds(List<Long> examDetailIdList);
 
-    void resetExamDetail(Long entityId, boolean clearPaperType);
+    void resetExamDetail(Long entityId, CreatePdfTypeEnum type, ExamDetailStatusEnum reject, boolean clearPaperType);
 
     List<ExamDetailCourseInitMarkDto> listPrintFinishExamDetailCourse(String printStatus, long startTime, String markStatus);
 

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.itextpdf.text.DocumentException;
+import com.qmth.distributed.print.business.bean.createPdf.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
 import com.qmth.distributed.print.business.bean.dto.PdfPackageDto;
 import com.qmth.distributed.print.business.bean.dto.PdfSignDto;
@@ -266,4 +267,6 @@ public interface PrintCommonService {
     void saveAttachmentPackagePdf(PdfPackageDto pdfPackageDto, ExamDetail examDetail, List<PdfDto> variablePdfList, Integer printCount, List<File> fileTempList);
 
     JSONObject uploadPdfFile(File pdfFile, ClassifyEnum classifyEnum);
+
+    String parseAttachmentPath(String attachmentPath, PrintPathVo printPathVo);
 }

+ 33 - 24
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -1163,33 +1164,41 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
 
     @Transactional
     @Override
-    public void resetExamDetail(Long entityId, boolean clearPaperType) {
+    public void resetExamDetail(Long entityId, CreatePdfTypeEnum type, ExamDetailStatusEnum status, boolean clearPaperType) {
         // 清掉客户端产生的数据,包含缓存状态、校验状态
         ExamDetail examDetail = this.getById(entityId);
-        QueryWrapper<ClientStatus> clientStatusQueryWrapper = new QueryWrapper<>();
-        clientStatusQueryWrapper.lambda().eq(ClientStatus::getSchoolId, examDetail.getSchoolId())
-                .eq(ClientStatus::getExamDetailId, entityId);
-        List<ClientStatus> clientStatusList = clientStatusService.list(clientStatusQueryWrapper);
-        if (!CollectionUtils.isEmpty(clientStatusList)) {
-            for (ClientStatus clientStatus : clientStatusList) {
-                clientStatus.setPass(false);
-                clientStatus.setDownload(false);
+        if (CreatePdfTypeEnum.ALL.equals(type) || CreatePdfTypeEnum.PAPER.equals(type) || CreatePdfTypeEnum.CARD.equals(type)) {
+            QueryWrapper<ClientStatus> clientStatusQueryWrapper = new QueryWrapper<>();
+            clientStatusQueryWrapper.lambda().eq(ClientStatus::getSchoolId, examDetail.getSchoolId())
+                    .eq(ClientStatus::getExamDetailId, entityId);
+            List<ClientStatus> clientStatusList = clientStatusService.list(clientStatusQueryWrapper);
+            if (!CollectionUtils.isEmpty(clientStatusList)) {
+                for (ClientStatus clientStatus : clientStatusList) {
+                    clientStatus.setPass(false);
+                    clientStatus.setDownload(false);
+                }
+                clientStatusService.updateBatchById(clientStatusList);
+            }
+
+            // 清掉客户端产生的数据和考场文件,包含状态、校验状态,pdf文件路径,打印信息
+            UpdateWrapper<ExamDetail> examDetailUpdateWrapper = new UpdateWrapper<>();
+            LambdaUpdateWrapper<ExamDetail> lambdaUpdateWrapper = examDetailUpdateWrapper.lambda();
+            lambdaUpdateWrapper.set(ExamDetail::getStatus, status)
+                    .set(ExamDetail::getValidate, false).set(ExamDetail::getPrintProgress, null)
+                    .set(ExamDetail::getPrintStartTime, null)
+                    .set(ExamDetail::getPrintEndTime, null);
+            if (CreatePdfTypeEnum.ALL.equals(type) || CreatePdfTypeEnum.PAPER.equals(type)) {
+                lambdaUpdateWrapper.set(ExamDetail::getAttachmentId, null);
             }
-            clientStatusService.updateBatchById(clientStatusList);
-        }
-
-        // 清掉客户端产生的数据和考场文件,包含状态、校验状态,pdf文件路径,打印信息
-        UpdateWrapper<ExamDetail> examDetailUpdateWrapper = new UpdateWrapper<>();
-        examDetailUpdateWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.REJECT)
-                .set(ExamDetail::getValidate, false)
-                .set(ExamDetail::getAttachmentId, null)
-                .set(ExamDetail::getCardAttachmentId, null)
-                .set(ExamDetail::getAttachmentPath, null)
-                .set(ExamDetail::getPrintProgress, null)
-                .set(ExamDetail::getPrintStartTime, null)
-                .set(ExamDetail::getPrintEndTime, null)
-                .eq(ExamDetail::getId, entityId);
-        this.update(examDetailUpdateWrapper);
+            if (CreatePdfTypeEnum.ALL.equals(type) || CreatePdfTypeEnum.CARD.equals(type)) {
+                lambdaUpdateWrapper.set(ExamDetail::getCardAttachmentId, null);
+            }
+            if (CreatePdfTypeEnum.ALL.equals(type)) {
+                lambdaUpdateWrapper.set(ExamDetail::getAttachmentPath, null);
+            }
+            lambdaUpdateWrapper.eq(ExamDetail::getId, entityId);
+            this.update(examDetailUpdateWrapper);
+        }
 
         if (clearPaperType) {
             // 清掉考场-课程表中关联的试卷类型

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -503,7 +503,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             String key = stringJoiner.toString();
             CreatePdfCacheUtil.deletePaperType(key);
             for (ExamDetail examDetail : examDetailList) {
-                examDetailService.resetExamDetail(examDetail.getId(), true);
+                examDetailService.resetExamDetail(examDetail.getId(), CreatePdfTypeEnum.ALL, ExamDetailStatusEnum.REJECT, true);
             }
         }
 
@@ -676,7 +676,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             String key = stringJoiner.toString();
             CreatePdfCacheUtil.deletePaperType(key);
             for (ExamDetail examDetail : examDetailList) {
-                examDetailService.resetExamDetail(examDetail.getId(), true);
+                examDetailService.resetExamDetail(examDetail.getId(), CreatePdfTypeEnum.ALL, ExamDetailStatusEnum.REJECT, true);
             }
         }
 

+ 34 - 44
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.itextpdf.text.DocumentException;
 import com.itextpdf.text.pdf.PdfReader;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.distributed.print.business.bean.createPdf.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
 import com.qmth.distributed.print.business.bean.dto.PdfPackageDto;
 import com.qmth.distributed.print.business.bean.dto.PdfSignDto;
@@ -37,6 +38,7 @@ import com.qmth.teachcloud.common.mapper.BasicCourseMapper;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.*;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -44,7 +46,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -210,7 +211,6 @@ public class PrintCommonServiceImpl implements PrintCommonService {
             fileTempList.add(pdfFileTemp);
             HtmlToPdfUtil.convert(htmlFile.getPath(), pdfFileTemp.getPath(), PageSizeEnum.A4);
 
-//            File pdfFile = asposePdfUtil.documentToPdf(htmlFile.getPath(), destUrl, PaperSize.A4);
             String htmlFileMd5 = DigestUtils.md5Hex(new FileInputStream(htmlFile));
             String pdfFileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFileTemp));
             if (oss || (!oss && dictionaryConfig.fssPrivateDomain().getConfig().startsWith(SystemConstant.START_PARENT))) {
@@ -220,21 +220,8 @@ public class PrintCommonServiceImpl implements PrintCommonService {
             }
 
             PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
-            JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
-            attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;
-            JSONArray jsonArray = (JSONArray) attachmentPath.get(SystemConstant.PATH);
-            jsonArray = Objects.isNull(jsonArray) ? new JSONArray() : jsonArray;
-            JSONObject object = new JSONObject();
-            object.put("printType", classifyEnum.name());
-            object.put(SystemConstant.HTML_PATH, filePath);
-            object.put("htmlMd5", htmlFileMd5);
-            object.put("pdfMd5", pdfFileMd5);
-            object.put(SystemConstant.PDF_PATH, pdfDirName);
-            object.put(SystemConstant.TYPE, ossStr);
-            object.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.PDF);
-            jsonArray.add(object);
-            attachmentPath.put(SystemConstant.PATH, jsonArray);
-            examDetail.setAttachmentPath(attachmentPath.toJSONString());
+            PrintPathVo printPathVo = new PrintPathVo(classifyEnum, UploadFileEnum.PDF, ossStr, pdfDirName, pdfFileMd5, filePath, htmlFileMd5);
+            examDetail.setAttachmentPath(parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));
             basicAttachment.setPages(pdfDto.getActualPageCount());
             for (int i = 0; i < printCount; i++) {
                 pdfList.add(new PdfDto(pdfFileTemp.getPath(), PageSizeEnum.A4, pdfDto.getPageCount(), sequence));
@@ -292,20 +279,8 @@ public class PrintCommonServiceImpl implements PrintCommonService {
                 fileStoreUtil.localUpload(pdfDirName, new FileInputStream(pdfFileTemp), pdfFileMd5, LocalCatalogEnum.LOCAL_PDF);
             }
             PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
-
-            JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
-            attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;
-            JSONArray jsonArray = (JSONArray) attachmentPath.get(SystemConstant.PATH);
-            jsonArray = Objects.isNull(jsonArray) ? new JSONArray() : jsonArray;
-            JSONObject object = new JSONObject();
-            object.put("printType", ClassifyEnum.SIGN.name());
-            object.put("pdfMd5", pdfFileMd5);
-            object.put(SystemConstant.PDF_PATH, pdfDirName);
-            object.put(SystemConstant.TYPE, ossStr);
-            object.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.PDF);
-            jsonArray.add(object);
-            attachmentPath.put(SystemConstant.PATH, jsonArray);
-            examDetail.setAttachmentPath(attachmentPath.toJSONString());
+            PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.SIGN, UploadFileEnum.PDF, ossStr, pdfDirName, pdfFileMd5, null, null);
+            examDetail.setAttachmentPath(parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));
             for (int i = 0; i < printCount; i++) {
                 pdfList.add(new PdfDto(pdfFileTemp.getPath(), PageSizeEnum.A4, pdfDto.getPageCount(), 2));
             }
@@ -319,6 +294,32 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         }
     }
 
+    @Override
+    public String parseAttachmentPath(String attachmentPath, PrintPathVo printPathVo) {
+        List<PrintPathVo> printPathVos = new ArrayList<>();
+        JSONObject jsonObject = new JSONObject();
+        if (StringUtils.isNotBlank(attachmentPath)) {
+            jsonObject = JSONObject.parseObject(attachmentPath);
+            String objectString = jsonObject.getString(SystemConstant.PATH);
+            if (StringUtils.isNotBlank(objectString)) {
+                printPathVos = JSON.parseArray(objectString, PrintPathVo.class);
+            }
+        }
+        List<PrintPathVo> finalList = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(printPathVos)) {
+            for (PrintPathVo pathVo : printPathVos) {
+                if (!pathVo.getPrintType().equals(printPathVo.getPrintType())) {
+                    finalList.add(pathVo);
+                }
+            }
+        }
+        finalList.add(printPathVo);
+        finalList.sort(Comparator.comparing(PrintPathVo::getIndex));
+
+        jsonObject.put(SystemConstant.PATH, finalList);
+        return jsonObject.toJSONString();
+    }
+
     /**
      * 保存html附件
      *
@@ -1248,20 +1249,9 @@ public class PrintCommonServiceImpl implements PrintCommonService {
             }
 
             PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
+            PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.PACKAGE, UploadFileEnum.PDF, ossStr, pdfDirName, pdfFileMd5, null, null);
+            examDetail.setAttachmentPath(parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));
 
-            JSONObject attachmentPath = JSON.parseObject(examDetail.getAttachmentPath());
-            attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;
-            JSONArray jsonArray = (JSONArray) attachmentPath.get(SystemConstant.PATH);
-            jsonArray = Objects.isNull(jsonArray) ? new JSONArray() : jsonArray;
-            JSONObject object = new JSONObject();
-            object.put("printType", ClassifyEnum.PACKAGE.name());
-            object.put("pdfMd5", pdfFileMd5);
-            object.put(SystemConstant.PDF_PATH, pdfDirName);
-            object.put(SystemConstant.TYPE, ossStr);
-            object.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.PDF);
-            jsonArray.add(object);
-            attachmentPath.put(SystemConstant.PATH, jsonArray);
-            examDetail.setAttachmentPath(attachmentPath.toJSONString());
             for (int i = 0; i < printCount; i++) {
                 pdfList.add(new PdfDto(pdfFileTemp.getPath(), PageSizeEnum.A4, pdfDto.getPageCount(), 2));
             }

+ 3 - 29
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.tools.models.ByteArray;
+import com.qmth.distributed.print.business.bean.createPdf.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.teachcloud.common.bean.vo.OriginalVo;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
@@ -116,35 +117,8 @@ public class CreatePdfUtil {
             String filePath = (String) jsonObject.get(SystemConstant.PATH);
             UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
 
-            JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
-            attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;
-            JSONArray jsonArray = (JSONArray) attachmentPath.get(SystemConstant.PATH);
-            jsonArray = Objects.isNull(jsonArray) ? new JSONArray() : jsonArray;
-
-            JSONObject object = new JSONObject();
-            object.put("printType", ClassifyEnum.CHECK_IN.name());
-            File localFile;
-//            if (SystemConstant.LOCAL.equals(jsonObject.get(SystemConstant.TYPE))) {
-//                localFile = new File(filePath);
-//                object.put(SystemConstant.PDF_PATH, localFile.getPath());
-//                object.put(SystemConstant.TYPE, SystemConstant.LOCAL);
-//            } else {
-//                localFile = fileStoreUtil.ossDownload(filePath, filePath, uploadFileEnum.getFssType());
-//                object.put(SystemConstant.PDF_PATH, localFile.getPath());
-//                object.put(SystemConstant.TYPE, SystemConstant.OSS);
-//            }
-            object.put(SystemConstant.PDF_PATH, filePath);
-            object.put(SystemConstant.TYPE, SystemConstant.LOCAL);
-            object.put(SystemConstant.UPLOAD_TYPE, uploadFileEnum);
-//            PdfDto pdfDto = PdfUtil.addPdfPage(localFile);
-
-//            byte[] data = ByteArray.fromFile(localFile).value();
-            String md5 = basicAttachment.getMd5();
-            object.put("pdfMd5", md5);
-
-            jsonArray.add(object);
-            attachmentPath.put(SystemConstant.PATH, jsonArray);
-            examDetail.setAttachmentPath(attachmentPath.toJSONString());
+            PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.CHECK_IN, uploadFileEnum, SystemConstant.LOCAL,filePath, basicAttachment.getMd5(), null, null);
+            examDetail.setAttachmentPath(printCommonService.parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));
 
             for (int i = 0; i < printCount; i++) {
                 ordinaryPdfList.add(new PdfDto(filePath, PageSizeEnum.A4, 0));

+ 3 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/TBTaskController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.result.EditResult;
+import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.service.ExamDetailService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.teachcloud.common.bean.dto.MqDto;
@@ -93,9 +94,9 @@ public class TBTaskController {
     @RequestMapping(value = "/reset_create_pdf", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "重新生成pdf", response = EditResult.class)})
     public Result resetCreatePdf(@ApiParam(value = "任务id", required = true) @RequestParam Long id,
-                                 @ApiParam(value = "pdf生成类型") @RequestParam(required = false) String type) {
+                                 @ApiParam(value = "pdf生成类型") @RequestParam(defaultValue = "ALL") CreatePdfTypeEnum type) {
         TBTask tbTask = tbTaskService.getById(id);
-        examDetailService.resetExamDetail(tbTask.getEntityId(), false);
+        examDetailService.resetExamDetail(tbTask.getEntityId(), type, ExamDetailStatusEnum.NEW,false);
         tbTaskService.resetCreatePdf(tbTask, type);
         return ResultUtil.ok(new EditResult());
     }

+ 2 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/TBTaskService.java

@@ -9,6 +9,7 @@ import com.qmth.teachcloud.common.bean.result.TbTaskDetailResult;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.TBTask;
+import com.qmth.teachcloud.common.enums.CreatePdfTypeEnum;
 import com.qmth.teachcloud.common.enums.TaskResultEnum;
 import com.qmth.teachcloud.common.enums.TaskStatusEnum;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
@@ -141,5 +142,5 @@ public interface TBTaskService extends IService<TBTask> {
 
     IPage<TaskListResult> queryResult(Page<Map> iPage, Long semesterId, Long examId, String courseCode, String paperNumber, TaskStatusEnum status, TaskTypeEnum type, TaskResultEnum result);
 
-    void resetCreatePdf(TBTask tbTask, String type);
+    void resetCreatePdf(TBTask tbTask, CreatePdfTypeEnum type);
 }

+ 2 - 5
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TBTaskServiceImpl.java

@@ -14,10 +14,7 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.TBTask;
-import com.qmth.teachcloud.common.enums.MqTagEnum;
-import com.qmth.teachcloud.common.enums.TaskResultEnum;
-import com.qmth.teachcloud.common.enums.TaskStatusEnum;
-import com.qmth.teachcloud.common.enums.TaskTypeEnum;
+import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.mapper.TBTaskMapper;
 import com.qmth.teachcloud.common.service.BasicRoleDataPermissionService;
 import com.qmth.teachcloud.common.service.TBTaskService;
@@ -282,7 +279,7 @@ public class TBTaskServiceImpl extends ServiceImpl<TBTaskMapper, TBTask> impleme
     }
 
     @Override
-    public void resetCreatePdf(TBTask tbTask, String type) {
+    public void resetCreatePdf(TBTask tbTask, CreatePdfTypeEnum type) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Map<String, Object> map = new HashMap<>();
         map.computeIfAbsent(SystemConstant.TASK, v -> tbTask);