xiaofei 1 سال پیش
والد
کامیت
a26fba55de

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailCourseServiceImpl.java

@@ -169,6 +169,7 @@ public class ExamDetailCourseServiceImpl extends ServiceImpl<ExamDetailCourseMap
         examStudent.setCoursePaperId(examDetailCourse.getCoursePaperId());
         examStudent.setPaperType(singleExamStudentAddParam.getPaperType());
         examStudent.setCollegeName(singleExamStudentAddParam.getCollege());
+        examStudent.setMajorName(singleExamStudentAddParam.getMajorName());
         examStudent.setClazzName(singleExamStudentAddParam.getClassName());
         examStudent.setCanDelete(true);
         examStudentService.save(examStudent);

+ 5 - 59
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -86,139 +86,91 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
     @Resource
     private ExamTaskTempService examTaskTempService;
-
-    @Resource
-    private BasicExamRuleService basicExamRuleService;
-
     @Resource
     private ExamTaskReviewLogService examTaskReviewLogService;
-
     @Resource
     private ExamTaskDetailService examTaskDetailService;
-
     @Resource
     private BasicAttachmentService basicAttachmentService;
-
     @Resource
     @Lazy
     private PrintCommonService printCommonService;
-
     @Resource
     ExamTaskMapper examTaskMapper;
-
     @Resource
     private BasicCourseService basicCourseService;
-
     @Resource
     private SysUserService sysUserService;
-
     @Resource
     private SysUserRoleService sysUserRoleService;
-
     @Resource
     private ExamCardService examCardService;
-
     @Resource
     private ExamDetailCourseService examDetailCourseService;
-
     @Resource
     private ExamDetailService examDetailService;
-
     @Resource
     TBTaskService tbTaskService;
-
     @Resource
     private ExamTaskPaperLogService examTaskPaperLogService;
-
-    @Resource
-    private SysConfigService sysConfigService;
-
-    @Resource
-    private BasicMessageService basicMessageService;
-
     @Resource
     AsyncPaperReviewPdfExportService asyncPaperReviewPdfExportService;
-
     @Resource
     TeachcloudCommonService teachcloudCommonService;
-
     @Resource
     ActivitiService activitiService;
-
     @Resource
     TFFlowApproveService tfFlowApproveService;
-
     @Resource
     TaskService taskService;
-
     @Resource
     BasicCardRuleService basicCardRuleService;
-
     @Resource
     ExamPrintPlanService examPrintPlanService;
-
     @Resource
     RedisUtil redisUtil;
-
     @Resource
     SysOrgService sysOrgService;
-
     @Resource
     FileStoreUtil fileStoreUtil;
-
     @Resource
     ExamTaskService examTaskService;
-
     @Resource
     ExamStudentService examStudentService;
-
     @Resource
     TFFlowJoinService tfFlowJoinService;
-
     @Resource
     CreatePdfUtil createPdfUtil;
-
     @Resource
     BasicPrintConfigService basicPrintConfigService;
-
     @Resource
     TFFlowLogService tfFlowLogService;
-
     @Resource
     CommonCacheService commonCacheService;
-
     @Resource
     TFCustomFlowService tfCustomFlowService;
-
     @Resource
     BasicExamService basicExamService;
-
     @Resource
     BasicSemesterService basicSemesterService;
-
     @Resource
     TeachStudentService teachStudentService;
-
     @Resource
     TeachClazzService teachClazzService;
-
     @Resource
     BasicStudentService basicStudentService;
-
     @Resource
     BasicClazzService basicClazzService;
-
     @Resource
     TeachCourseService teachCourseService;
-
     @Resource
     private BasicRoleDataPermissionService basicRoleDataPermissionService;
-
     @Resource
     private BasicOperationLogService basicOperationLogService;
-
     @Resource
     private RedisCounterUtil redisCounterUtil;
+    @Resource
+    private FileUploadService fileUploadService;
 
     @Override
     public IPage<ExamTaskDto> list(Long semesterId, Long examId, Boolean enable, String status, Long cardRuleId, String courseCode, String paperNumber, Long startTime, Long endTime, String userName, String createName, Integer pageNumber, Integer pageSize) {
@@ -945,7 +897,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         String rootPath = null;
         try {
             // 本地保存目录
-            tempFile = SystemConstant.getFileTempDirVar(String.valueOf(System.currentTimeMillis()) + File.separator + SystemConstant.getNanoId(), SystemConstant.TEMP_PREFIX);
+            tempFile = SystemConstant.getFileTempDirVar(System.currentTimeMillis() + File.separator + SystemConstant.getNanoId(), SystemConstant.TEMP_PREFIX);
             rootPath = tempFile.getParent();
             StringJoiner dirPath = new StringJoiner("");
             dirPath = dirPath.add(rootPath).add(File.separator)
@@ -964,14 +916,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 if (Objects.nonNull(attachmentId)) {
                     BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
                     Optional.ofNullable(attachment).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("附件数据异常"));
-                    StringJoiner paperPath = new StringJoiner("");
-                    paperPath = paperPath.add(rootPath).add(File.separator)
-                            .add(examTaskDetailPdfDownloadDto.getSemesterName()).add(File.separator)
-                            .add(examTaskDetailPdfDownloadDto.getExamName()).add(File.separator)
-                            .add(examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "")).add(File.separator)
-                            .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(File.separator);
-                    String fileName = examTaskDetailPdfDownloadDto.getCourseNameCode() + SystemConstant.HYPHEN + examTaskDetailPdfDownloadDto.getPaperNumber() + SystemConstant.HYPHEN + "试卷" + SystemConstant.HYPHEN + name + attachment.getType();
-                    File file = teachcloudCommonService.copyFile(paperPath.toString(), fileName, attachment);
+                    String fileName = dirPath + "试卷" + SystemConstant.HYPHEN + name + attachment.getType();
+                    File file = fileUploadService.downloadFile(attachment, fileName);
                     if (Objects.nonNull(file)) {
                         fileList.add(file);
                     }

+ 41 - 76
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 com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -9,6 +10,7 @@ import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import com.itextpdf.text.DocumentException;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.distributed.print.business.bean.createPdf.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
 import com.qmth.distributed.print.business.bean.examRule.FieldsDto;
@@ -75,99 +77,66 @@ import java.util.stream.Collectors;
 public class TaskLogicServiceImpl implements TaskLogicService {
     private final static Logger log = LoggerFactory.getLogger(TaskLogicServiceImpl.class);
 
-    @Resource
-    RedisCounterUtil redisCounterUtil;
-
     @Resource
     ExamPrintPlanService examPrintPlanService;
-
     @Resource
     ExamTaskService examTaskService;
-
     @Resource
     ExamTaskDetailService examTaskDetailService;
-
     @Resource
     ExamCardService examCardService;
 
     @Resource
     ExamStudentService examStudentService;
-
     @Resource
     BasicAttachmentService basicAttachmentService;
-
     @Resource
     ExamDetailService examDetailService;
-
     @Resource
     CommonCacheService commonCacheService;
-
     @Resource
     BasicCourseService basicCourseService;
-
     @Resource
     CreatePdfUtil createPdfUtil;
-
-    @Resource
-    RedisTemplate<String, Object> redisTemplate;
-
     @Resource
     TBTaskService tbTaskService;
-
     @Resource
     BasicCardRuleService basicCardRuleService;
-
-    @Resource
-    ConvertUtil convertUtil;
-
     @Autowired
     ExamDetailCourseService examDetailCourseService;
-
     @Autowired
     BasicStudentService basicStudentService;
-
     @Autowired
     ExamTaskPrintService examTaskPrintService;
-
     @Resource
     SysUserService sysUserService;
-
     @Resource
     FileStoreUtil fileStoreUtil;
-
     @Resource
     BasicClazzService basicClazzService;
-
     @Resource
     SysOrgService sysOrgService;
-
     @Resource
     TCStatisticsService tcStatisticsService;
-
     @Resource
     TCStatisticsTempService tcStatisticsTempService;
-
     @Resource
     TSyncExamStudentScoreService tSyncExamStudentScoreService;
-
     @Resource
     @Lazy
     PrintCommonService printCommonService;
-
     @Resource
     private DownloadService downloadService;
-
     @Resource
     private TeachClazzService teachClazzService;
-
     @Resource
     DictionaryConfig dictionaryConfig;
-
     @Resource
     BasicPrintConfigService basicPrintConfigService;
-
     @Resource
     ExamDetailCoursePaperTypeService examDetailCoursePaperTypeService;
+    @Resource
+    FileUploadService fileUploadService;
 
     /**
      * 创建pdf前置条件
@@ -971,12 +940,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
      *
      * @param map
      * @return
-     * @throws IOException
      */
     @Override
     @Transactional
-    public Map<String, Object> executeDownloadPdfLogic(Map<String, Object> map) throws Exception {
-        List<File> sourceFileList = null;
+    public Map<String, Object> executeDownloadPdfLogic(Map<String, Object> map) {
+        List<File> sourceFileList = new ArrayList<>();
         File zipFile = null;
         String zipLocalRootPath = null;
         try {
@@ -984,25 +952,16 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             JSONArray jsonArray = JSONArray.parseArray(tbTask.getRemark());
             ArraysParams arraysParams = new ArraysParams(jsonArray.toArray(new Long[jsonArray.size()]));
             if (Objects.isNull(arraysParams) || arraysParams.getIds().length == 0) {
-                throw ExceptionResultEnum.ERROR.exception("数组id为空");
+                throw ExceptionResultEnum.ERROR.exception("请选择要下载的数据");
             }
 
             List<ExamDetailPdfDownloadDto> examDetailList = examDetailService.findPdfDownload(Arrays.asList(arraysParams.getIds()));
-            if (!CollectionUtils.isEmpty(examDetailList)) {
+            if (CollectionUtils.isNotEmpty(examDetailList)) {
                 Long time = System.currentTimeMillis();
-                boolean oss = dictionaryConfig.sysDomain().isOss();
-                StringJoiner stringJoiner = new StringJoiner("");
-                if (!oss && Objects.nonNull(dictionaryConfig.fssPublicDomain()) && !StringUtils.isBlank(dictionaryConfig.fssPublicDomain().getConfig()) && !dictionaryConfig.fssPublicDomain().getConfig().startsWith(SystemConstant.START_PARENT)) {
-                    stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig()).add(File.separator);
-                }
-                stringJoiner = SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
-                stringJoiner.add("印刷任务管理_批量下载PDF_" + time).add(SystemConstant.ZIP_PREFIX);
 
-                String zipDirName = FileUtil.replaceSplit(stringJoiner.toString());
                 zipFile = SystemConstant.getFileTempDirVar(SystemConstant.ZIP_PREFIX);
                 zipLocalRootPath = zipFile.getParent() + File.separator + time;
 
-                sourceFileList = new ArrayList<>(examDetailList.size() * 5);
                 for (ExamDetailPdfDownloadDto e : examDetailList) {
                     StringJoiner dirPath = new StringJoiner("")
                             .add(zipLocalRootPath).add(File.separator)
@@ -1015,44 +974,49 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     //试卷合并文件
                     if (Objects.nonNull(e.getAttachmentId())) {
                         BasicAttachment attachment = basicAttachmentService.getById(e.getAttachmentId());
-                        File paperFile = getAttachmentFile(attachment, dirPath.toString() + PdfTypeEnum.PAPER.getTitle() + SystemConstant.PDF_PREFIX);
-                        if (Objects.nonNull(paperFile)) {
-                            sourceFileList.add(paperFile);
+                        if (attachment != null) {
+                            String fileName = dirPath + PdfTypeEnum.PAPER.getTitle() + SystemConstant.PDF_PREFIX;
+                            File paperFile = fileUploadService.downloadFile(attachment, fileName);
+                            if (Objects.nonNull(paperFile)) {
+                                sourceFileList.add(paperFile);
+                            }
                         }
                     }
 
                     //题卡合并文件
                     if (Objects.nonNull(e.getCardAttachmentId())) {
                         BasicAttachment cardAttachment = basicAttachmentService.getById(e.getCardAttachmentId());
-                        File cardFile = getAttachmentFile(cardAttachment, dirPath.toString() + PdfTypeEnum.CARD_A3.getTitle() + SystemConstant.PDF_PREFIX);
-                        if (Objects.nonNull(cardFile)) {
-                            sourceFileList.add(cardFile);
+                        if (cardAttachment != null) {
+                            String fileName = dirPath + PdfTypeEnum.CARD_A3.getTitle() + SystemConstant.PDF_PREFIX;
+                            File cardFile = fileUploadService.downloadFile(cardAttachment, fileName);
+                            if (Objects.nonNull(cardFile)) {
+                                sourceFileList.add(cardFile);
+                            }
                         }
                     }
 
                     //卷袋贴/签到表/登记表文件
-                    if (Objects.nonNull(e.getCardAttachmentId())) {
+                    if (Objects.nonNull(e.getAttachmentPath())) {
                         JSONObject js = JSONObject.parseObject(e.getAttachmentPath());
-                        JSONArray jsonArrayTemp = js.getJSONArray(SystemConstant.PATH);
-                        for (int i = 0; i < jsonArrayTemp.size(); i++) {
-                            JSONObject object = jsonArrayTemp.getJSONObject(i);
-                            PdfTypeEnum pdfTypeEnum = PdfTypeEnum.valueOf((String) object.get("printType"));
-                            switch (pdfTypeEnum) {
-                                case PACKAGE:
-                                case SIGN:
-                                case CHECK_IN:
-                                    File file = getJsonFile(object, dirPath.toString() + pdfTypeEnum.getTitle() + SystemConstant.PDF_PREFIX);
-                                    if (Objects.nonNull(file)) {
-                                        sourceFileList.add(file);
-                                    }
-                                    break;
-                                default:
-                                    break;
+                        List<PrintPathVo> printPathVoList = JSON.parseArray(js.getString(SystemConstant.PATH), PrintPathVo.class);
+                        for (PrintPathVo pathVo : printPathVoList) {
+                            String fileName = dirPath + pathVo.getPrintType().getName() + SystemConstant.PDF_PREFIX;
+                            File cardFile = fileUploadService.downloadFile(pathVo.getType(), pathVo.getUploadType(), pathVo.getPdfPath(), fileName);
+                            if (Objects.nonNull(cardFile)) {
+                                sourceFileList.add(cardFile);
                             }
                         }
                     }
                 }
                 if (!CollectionUtils.isEmpty(sourceFileList)) {
+                    boolean oss = dictionaryConfig.sysDomain().isOss();
+                    StringJoiner stringJoiner = new StringJoiner("");
+                    if (!oss && Objects.nonNull(dictionaryConfig.fssPublicDomain()) && !StringUtils.isBlank(dictionaryConfig.fssPublicDomain().getConfig()) && !dictionaryConfig.fssPublicDomain().getConfig().startsWith(SystemConstant.START_PARENT)) {
+                        stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig()).add(File.separator);
+                    }
+                    stringJoiner = SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
+                    stringJoiner.add("印刷任务管理_批量下载PDF_" + time).add(SystemConstant.ZIP_PREFIX);
+                    String zipDirName = FileUtil.replaceSplit(stringJoiner.toString());
                     JSONObject jsonObject = SystemConstant.createZip(zipFile, zipLocalRootPath, zipDirName);
                     tbTask.setResultFilePath(jsonObject.toJSONString());
                 }
@@ -1286,7 +1250,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     }
 
     @Override
-    public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) throws Exception {
+    public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) {
         String zipLocalRootPath = null;
         File zipFile = null;
         List<File> sourceFileList = null;
@@ -1332,7 +1296,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         if (Objects.nonNull(attachmentId)) {
                             BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
                             if (Objects.nonNull(attachment)) {
-                                File paperFile = getAttachmentFile(attachment, dirPath.toString() + "试卷" + SystemConstant.HYPHEN + name + attachment.getType());
+                                String fileName = dirPath + "试卷" + SystemConstant.HYPHEN + name + attachment.getType();
+                                File paperFile = fileUploadService.downloadFile(attachment, fileName);
                                 sourceFileList.add(paperFile);
                             }
                         }
@@ -1532,13 +1497,13 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         checkDtoMap.put(loginName, sysUserImportDto);
                     }
 
-                    if (Objects.nonNull(loginName) && !loginName.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE)) {
+                    if (StringUtils.isNotBlank(loginName) && !loginName.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE)) {
                         errorStringJoiner.add("用户名/工号[" + loginName + "]不符合规范");
                     }
-                    if (Objects.nonNull(phoneNumber) && !phoneNumber.matches(SystemConstant.REGULAR_EXPRESSION_OF_PHONE)) {
+                    if (StringUtils.isNotBlank(phoneNumber) && !phoneNumber.matches(SystemConstant.REGULAR_EXPRESSION_OF_PHONE)) {
                         errorStringJoiner.add("手机号[" + phoneNumber + "]不符合输入规范");
                     }
-                    if (Objects.nonNull(phoneNumber)) {
+                    if (StringUtils.isNotBlank(phoneNumber)) {
                         if (phoneNumberMap.containsKey(phoneNumber)) {
                             errorStringJoiner.add("手机号[" + phoneNumber + "]在文件中重复");
                         } else {

+ 4 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -8,6 +8,7 @@ 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.FilePathVo;
 import com.qmth.teachcloud.common.bean.vo.OriginalVo;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
@@ -108,13 +109,11 @@ public class CreatePdfUtil {
         Optional.ofNullable(basicAttachment).orElseThrow(() -> ExceptionResultEnum.ATTACHMENT_IS_NULL.exception());
 
         String type = basicAttachment.getType();
-        JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
+        FilePathVo filePathVo = JSON.parseObject(basicAttachment.getPath(), FilePathVo.class);
 
         if (Objects.nonNull(type) && Objects.equals(type, SystemConstant.PDF_PREFIX)) {
-            String filePath = (String) jsonObject.get(SystemConstant.PATH);
-            UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
-
-            PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.CHECK_IN, uploadFileEnum, SystemConstant.LOCAL, filePath, basicAttachment.getMd5(), null, null);
+            String filePath = filePathVo.getPath();
+            PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.CHECK_IN, filePathVo.getUploadType(), filePathVo.getType(), filePath, basicAttachment.getMd5(), null, null);
             examDetail.setAttachmentPath(printCommonService.parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));
 
             for (int i = 0; i < printCount; i++) {

+ 6 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/FileUploadService.java

@@ -1,6 +1,7 @@
 package com.qmth.teachcloud.common.service;
 
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
+import com.qmth.teachcloud.common.entity.BasicAttachment;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 
 import java.io.File;
@@ -9,6 +10,11 @@ public interface FileUploadService {
 
     FilePathVo uploadFile(File pdfFile, UploadFileEnum uploadFileEnum, String fileName);
 
+    File downloadFile(String path, String pathName) throws Exception;
+    File downloadFile(String type, UploadFileEnum uploadFileEnum, String path, String pathName) throws Exception;
+    File downloadFile(Long attachmentId, String pathName) throws Exception;
+    File downloadFile(BasicAttachment attachment, String pathName) throws Exception;
+
     String filePreview(String path);
 
     String filePreview(Long attachmentId);

+ 114 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/FileUploadServiceImpl.java

@@ -2,7 +2,6 @@ package com.qmth.teachcloud.common.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.qmth.boot.api.exception.ApiException;
-import com.qmth.teachcloud.common.service.FileUploadService;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
@@ -13,10 +12,12 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.LocalCatalogEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
+import com.qmth.teachcloud.common.service.FileUploadService;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.FileUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -79,6 +80,113 @@ public class FileUploadServiceImpl implements FileUploadService {
         return null;
     }
 
+    /**
+     * 获取附件文件
+     *
+     * @param path     文件路径json
+     * @param pathName 文件名
+     * @return string
+     * @throws Exception
+     */
+    @Override
+    public File downloadFile(String path, String pathName) throws Exception {
+        if (StringUtils.isBlank(path)) {
+            return null;
+        }
+        File file = new File(pathName);
+        if (!file.exists()) {
+            file.getParentFile().mkdirs();
+            file.createNewFile();
+        }
+        FilePathVo filePathVo = JSON.parseObject(path, FilePathVo.class);
+        if (filePathVo == null) {
+            return null;
+        }
+        UploadFileEnum uploadFileEnum = filePathVo.getUploadType();
+        if (StringUtils.isNotBlank(filePathVo.getType()) && Objects.equals(filePathVo.getType(), SystemConstant.OSS)) {
+            file = fileStoreUtil.ossDownload(filePathVo.getPath(), file, uploadFileEnum.getFssType());
+        } else {
+            File sourceFile;
+            String config = findFssConfig(isOssUpload(Objects.equals(filePathVo.getType(), SystemConstant.OSS), uploadFileEnum), uploadFileEnum);
+            if (config.startsWith(SystemConstant.START_PARENT)) {
+                sourceFile = new File(config, filePathVo.getPath());
+            } else {
+                sourceFile = new File(filePathVo.getPath());
+            }
+            FileUtils.copyFile(sourceFile, file);
+        }
+        return file;
+    }
+
+    /**
+     * 获取附件文件
+     *
+     * @param path     文件路径json
+     * @param pathName 文件名
+     * @return string
+     * @throws Exception
+     */
+    @Override
+    public File downloadFile(String type, UploadFileEnum uploadFileEnum, String path, String pathName) throws Exception {
+        if (StringUtils.isBlank(path)) {
+            return null;
+        }
+        File file = new File(pathName);
+        if (!file.exists()) {
+            file.getParentFile().mkdirs();
+            file.createNewFile();
+        }
+        if (StringUtils.isNotBlank(type) && Objects.equals(type, SystemConstant.OSS)) {
+            file = fileStoreUtil.ossDownload(path, file, uploadFileEnum.getFssType());
+        } else {
+            File sourceFile;
+            String config = findFssConfig(isOssUpload(Objects.equals(type, SystemConstant.OSS), uploadFileEnum), uploadFileEnum);
+            if (config.startsWith(SystemConstant.START_PARENT)) {
+                sourceFile = new File(config, path);
+            } else {
+                sourceFile = new File(path);
+            }
+            FileUtils.copyFile(sourceFile, file);
+        }
+        return file;
+    }
+
+    /**
+     * 获取附件文件
+     *
+     * @param attachmentId 附件ID
+     * @param pathName     保存路径
+     * @return String
+     * @throws Exception
+     */
+    @Override
+    public File downloadFile(Long attachmentId, String pathName) throws Exception {
+        if (attachmentId == null) {
+            return null;
+        }
+        BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
+        if (basicAttachment == null || StringUtils.isBlank(basicAttachment.getPath())) {
+            return null;
+        }
+        return downloadFile(basicAttachment.getPath(), pathName);
+    }
+
+    /**
+     * 获取附件文件
+     *
+     * @param attachment 附件
+     * @param pathName   保存路径
+     * @return String
+     * @throws Exception
+     */
+    @Override
+    public File downloadFile(BasicAttachment attachment, String pathName) throws Exception {
+        if (attachment == null || StringUtils.isBlank(attachment.getPath())) {
+            return null;
+        }
+        return downloadFile(attachment.getPath(), pathName);
+    }
+
     /**
      * 预览文件
      *
@@ -109,6 +217,11 @@ public class FileUploadServiceImpl implements FileUploadService {
         return FileUtil.replaceSplit(url);
     }
 
+    /**
+     * 预览文件
+     *
+     * @param attachmentId 附件ID
+     */
     @Override
     public String filePreview(Long attachmentId) {
         if (attachmentId == null) {

+ 2 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -343,6 +343,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             student.setUpload(true);
             student.setIncomplete(paperCount != answerCard.getPaperCount());
             student.setScanStatus(ScanStatus.SCANNED);
+            student.setAbsent(false);
+            student.setManualAbsent(false);
             // 更新图片数量和图片地址
             updateStudentSheetInfo(student, studentPaperList);
         } else {

+ 6 - 0
teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml

@@ -452,6 +452,12 @@
             <if test="markStudent.courseCode != null and markStudent.courseCode != ''">
                 and ms.course_code = #{markStudent.courseCode}
             </if>
+            <if test="markStudent.paperNumber != null and markStudent.paperNumber != ''">
+                and ms.paper_number = #{markStudent.paperNumber}
+            </if>
+            <if test="markStudent.paperType != null and markStudent.paperType != ''">
+                and ms.paper_type = #{markStudent.paperType}
+            </if>
             <if test="markStudent.coursePaperId != null and markStudent.coursePaperId != ''">
                 and ms.course_paper_id = #{markStudent.coursePaperId}
             </if>