Przeglądaj źródła

Merge remote-tracking branch 'origin/dev_v3.3.1' into dev_v3.3.1

wangliang 1 rok temu
rodzic
commit
508e2ec1b8
43 zmienionych plików z 918 dodań i 370 usunięć
  1. 11 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamCard.java
  2. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardService.java
  3. 9 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java
  4. 2 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TBTaskPdfService.java
  5. 17 22
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  6. 14 6
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java
  7. 27 13
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  8. 30 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java
  9. 9 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TBTaskPdfServiceImpl.java
  10. 1 14
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/create/AsyncCreateTaskTemplete.java
  11. 2 81
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncCreatePdfTempleteService.java
  12. 23 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncBasicExamStudentImportService.java
  13. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/PdfTaskLogicService.java
  14. 20 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java
  15. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  16. 12 0
      distributed-print-business/src/main/resources/db/log/update-yin.sql
  17. 15 0
      distributed-print-business/src/main/resources/db/log/脚本-caozx.sql
  18. 4 0
      distributed-print/install/mysql/upgrade/3.3.1.sql
  19. 7 3
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamStudentController.java
  20. 3 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java
  21. 7 29
      distributed-print/src/main/java/com/qmth/distributed/print/api/TBTaskPdfController.java
  22. 73 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkDocumentController.java
  23. BIN
      distributed-print/src/main/resources/temps/basicExamStudent.xlsx
  24. 12 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java
  25. 0 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/kit/TikuUtils.java
  26. 31 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/document/ArchivePaperQuery.java
  27. 46 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/document/ArchivePaperVo.java
  28. 31 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/document/MarkDocumantQuery.java
  29. 124 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkDocument.java
  30. 59 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/enums/DocumentType.java
  31. 7 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkDocumentMapper.java
  32. 8 3
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkPaperMapper.java
  33. 18 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkDocumentService.java
  34. 9 3
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkPaperService.java
  35. 30 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkDocumentServiceImpl.java
  36. 21 10
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkPaperServiceImpl.java
  37. 136 112
      teachcloud-mark/src/main/resources/mapper/MarkPaperMapper.xml
  38. 18 32
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/enums/JobEnum.java
  39. 29 0
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/CreatePdfTaskJob.java
  40. 1 1
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/SubjectCalculateJob.java
  41. 2 0
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/service/JobService.java
  42. 17 0
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/service/impl/JobServiceImpl.java
  43. 27 27
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/start/StartRunning.java

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamCard.java

@@ -105,6 +105,9 @@ public class ExamCard extends BaseEntity implements Serializable {
     @TableField(value = "blank_card_path", updateStrategy = FieldStrategy.IGNORED)
     private String blankCardPath;
 
+    @TableField(value = "paper_id")
+    private Long paperId;
+
     @TableField(exist = false)
     private List<SysOrg> orgs;
     @TableField(exist = false)
@@ -282,6 +285,14 @@ public class ExamCard extends BaseEntity implements Serializable {
         this.blankCardPath = blankCardPath;
     }
 
+    public Long getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(Long paperId) {
+        this.paperId = paperId;
+    }
+
     public List<String> getImageUrls() {
         return imageUrls;
     }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardService.java

@@ -9,6 +9,7 @@ import com.qmth.distributed.print.business.entity.ExamCard;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -20,7 +21,7 @@ import java.util.List;
  */
 public interface ExamCardService extends IService<ExamCard> {
 
-    String saveExamCard(ExamCardParams examCardParams) throws Exception;
+    Map<String, String> saveExamCard(ExamCardParams examCardParams) throws Exception;
 
     List<ExamCard> listSelectCard(String courseCode, Long cardRuleId, String paperNumber);
 

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

@@ -169,6 +169,15 @@ public interface PrintCommonService {
      */
     Map<String, Object> saveTask(MultipartFile file, TaskTypeEnum taskTypeEnum);
 
+    /**
+     * 保存任务
+     *
+     * @param file
+     * @param taskTypeEnum
+     * @return
+     */
+    Map<String, Object> saveTask(MultipartFile file,Long semesterId,Long examId, TaskTypeEnum taskTypeEnum);
+
     /**
      * 保存任务
      *

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TBTaskPdfService.java

@@ -34,4 +34,6 @@ public interface TBTaskPdfService extends IService<TBTaskPdf> {
     int countRunningByExamDetailIds(List<Long> examDetailIds);
 
     IPage<TaskPdfResult> pageData(Page<TaskPdfResult> page, Long examId, String printPlanId, String courseCode, String paperNumber, TaskStatusEnum status, TaskResultEnum result, String examPlace, String examRoom, Long examStartTime, Long examEndTime);
+
+    List<TBTaskPdf> listWaitingTask();
 }

+ 17 - 22
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.common.collect.Lists;
 import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
 import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
@@ -13,7 +12,6 @@ import com.qmth.distributed.print.business.entity.BasicTeachClazz;
 import com.qmth.distributed.print.business.mapper.BasicExamStudentMapper;
 import com.qmth.distributed.print.business.service.BasicExamStudentService;
 import com.qmth.distributed.print.business.service.BasicTeachClazzService;
-import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicCourse;
@@ -26,18 +24,17 @@ import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.LinkedMultiValueMap;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -191,13 +188,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         String examRoom = basicExamStudentParam.getExamRoom();
 
         // 校验1 学期、考试、课程为下拉框,姓名、学号、教学班为文本框,均必填;
-        if (SystemConstant.longNotNull(semesterId)) {
+        if (!SystemConstant.longNotNull(semesterId)) {
             errorMsgList.add("缺少学期id");
         }
-        if (SystemConstant.longNotNull(examId)) {
+        if (!SystemConstant.longNotNull(examId)) {
             errorMsgList.add("缺少考试id");
         }
-        if (SystemConstant.strNotNull(courseCode)) {
+        if (!SystemConstant.strNotNull(courseCode)) {
             errorMsgList.add("缺少课程编号");
         }
         BasicCourse basicCourse = basicCourseService.findByCourseCode(courseCode, schoolId);
@@ -205,13 +202,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             errorMsgList.add(String.format("缺少课程编号为[%s]", courseCode));
         }
 
-        if (SystemConstant.strNotNull(studentName)) {
+        if (!SystemConstant.strNotNull(studentName)) {
             errorMsgList.add("缺少学生姓名");
         }
-        if (SystemConstant.strNotNull(studentCode)) {
+        if (!SystemConstant.strNotNull(studentCode)) {
             errorMsgList.add("缺少学号");
         }
-        if (SystemConstant.strNotNull(teachClazz)) {
+        if (!SystemConstant.strNotNull(teachClazz)) {
             errorMsgList.add("缺少教学班名称");
         }
 
@@ -225,18 +222,15 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                 // 存在教师信息,根据工号查询,不存在报错(缺少机构信息没法直接创建教师),存在更新姓名
                 SysUser teacher = sysUserService.getOne(
                         new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId)
-                                .eq(SysUser::getCode, teacherCode).last(SystemConstant.LIMIT1));
+                                .eq(SysUser::getCode, teacherCode)
+                                .eq(SysUser::getRealName,teacherName)
+                                .last(SystemConstant.LIMIT1));
                 if (Objects.isNull(teacher)) {
-                    errorMsgList.add(String.format("工号为[%s]的教师不存在,请先创建", teacherCode));
+                    errorMsgList.add(String.format("工号为[%s],姓名为[%s]的教师不存在,请先创建", teacherCode,teacherName));
                 } else {
-                    String dbTeacherName = teacher.getRealName();
-                    if (!dbTeacherName.equals(teacherName)) {
-                        teacher.setRealName(teacherName);
-                        teacher.updateInfo(requestUserId);
-                        sysUserService.updateById(teacher);
-                    }
+                    teacherId = teacher.getId();
                 }
-                teacherId = teacher.getId();
+
             }
 
             if (!SystemConstant.longNotNull(examStartTime) || !SystemConstant.longNotNull(examEndTime)) {
@@ -286,6 +280,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             if (!studentCode.equals(dbBasicExamStudent.getStudentCode())) {
                 throw ExceptionResultEnum.ERROR.exception("编辑考生时,学号不可更改");
             }
+            basicExamStudent.setId(id);
             basicExamStudent.updateInfo(requestUserId);
         } else {
             // 新增 (学号在考试课程下唯一)

+ 14 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java

@@ -94,7 +94,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
 
     @Transactional
     @Override
-    public String saveExamCard(ExamCardParams examCardParams) {
+    public Map<String, String> saveExamCard(ExamCardParams examCardParams) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser user = (SysUser) ServletUtil.getRequestUser();
 
@@ -106,10 +106,12 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
         if (examCardParams.getId() == null) {
             validateCardData(examCardParams);
 
+            String title = examCardParams.getTitle()+SystemConstant.generateRandomNumber(4);
+
             QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
             queryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
                     .eq(ExamCard::getCourseCode, examCardParams.getCourseCode())
-                    .eq(ExamCard::getTitle, examCardParams.getTitle());
+                    .eq(ExamCard::getTitle, title);
             List<ExamCard> examCardList = this.list(queryWrapper);
             if (!examCardList.isEmpty()) {
                 throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
@@ -124,20 +126,22 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             }
             examCard.setCourseCode(examCardParams.getCourseCode());
             examCard.setCourseName(examCardParams.getCourseName());
-            examCard.setTitle(examCardParams.getTitle());
+            examCard.setTitle(title);
             examCard.setMakeMethod(examCardParams.getMakeMethod());
             examCard.setStatus(examCardParams.getStatus());
             examCard.setType(examCardParams.getType());
             examCard.setAttachmentId(examCardParams.getAttachmentId());
             examCard.setCardRuleId(examCardParams.getCardRuleId());
+            examCard.setPaperId(examCardParams.getPaperId());
             examCard.insertInfo(user.getId());
         }
         // 修改
         else {
+            String title = examCardParams.getTitle()+SystemConstant.generateRandomNumber(4);
             QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
             queryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
                     .eq(ExamCard::getCourseCode, examCardParams.getCourseCode())
-                    .eq(ExamCard::getTitle, examCardParams.getTitle())
+                    .eq(ExamCard::getTitle, title)
                     .ne(ExamCard::getId, examCardParams.getId());
             List<ExamCard> examCardList = this.list(queryWrapper);
             if (!examCardList.isEmpty()) {
@@ -145,7 +149,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             }
 
             examCard = this.getById(examCardParams.getId());
-            examCard.setTitle(examCardParams.getTitle());
+            examCard.setTitle(title);
             examCard.setStatus(examCardParams.getStatus());
             examCard.setUpdateId(user.getId());
             examCard.setUpdateTime(System.currentTimeMillis());
@@ -161,7 +165,11 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             examCard.setStageContent(examCardParams.getContent());
         }
         this.saveOrUpdate(examCard);
-        return String.valueOf(examCard.getId());
+
+        Map<String, String> map = new HashMap<>();
+        map.put("id", String.valueOf(examCard.getId()));
+        map.put("title", examCard.getTitle());
+        return map;
     }
 
     @Override

+ 27 - 13
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 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.Update;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -1257,16 +1258,24 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             examTaskDetail.setCreateTime(System.currentTimeMillis());
             examTaskDetailService.save(examTaskDetail);
 
-            // 将题卡更新为已绑定
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
-            List<String> cardIds = paperInfoVoList.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> m.getCardId()).collect(Collectors.toList());
-            for (String cardId : cardIds) {
-                UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
-                updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
-                examCardService.update(updateWrapper);
+            // 将题卡更新为已绑定
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                if (CardTypeEnum.CUSTOM.name().equals(paperInfoVo.getCardType())) {
+                    UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
+                    updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, paperInfoVo.getCardId());
+                    examCardService.update(updateWrapper);
+                }
+                // 删除临时题卡
+                if (paperInfoVo.getPaperId() != null) {
+                    QueryWrapper<ExamCard> deleteWrapper = new QueryWrapper<>();
+                    deleteWrapper.lambda().eq(ExamCard::getCreateId, sysUser.getId())
+                            .eq(ExamCard::getPaperId, paperInfoVo.getPaperId())
+                            .eq(ExamCard::getUsed, false);
+                    examCardService.remove(deleteWrapper);
+                }
             }
-
             // 更新题库试卷表
             for (PaperInfoVo paperInfoVo : paperInfoVoList) {
                 if (StringUtils.isNotBlank(paperInfoVo.getUuid())) {
@@ -1277,6 +1286,13 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                             .eq(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId())
                             .eq(ExamTaskPaperData::getUuid, paperInfoVo.getUuid());
                     examTaskPaperDataService.update(updateWrapper);
+
+                    // 删除临时数据
+                    QueryWrapper<ExamTaskPaperData> deleteWrapper = new QueryWrapper<>();
+                    deleteWrapper.lambda().eq(ExamTaskPaperData::getExamId, examTask.getExamId())
+                            .eq(ExamTaskPaperData::getPaperNumber, paperInfoVo.getUuid())
+                            .ne(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId());
+                    examTaskPaperDataService.remove(deleteWrapper);
                 }
             }
 
@@ -2156,12 +2172,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         try {
             File paperDataFile = tikuUtils.getTikuPaperData(schoolId, paperId);
             ExamTaskPaperData examTaskPaperData = saveTikuPaperData(examId, paperId, uuid, paperDataFile);
-            map.put("uuid", examTaskPaperData.getUuid());
-            map.put("answerJson", examTaskPaperData.getAnswerJson());
-            map.put("attachmentId", examTaskPaperData.getPaperPdfAttachmentId());
+            map.put("paperJson", examTaskPaperData.getPaperJson());
+            map.put("attachmentId", String.valueOf(examTaskPaperData.getPaperPdfAttachmentId()));
             return map;
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
         }
     }
 
@@ -2176,8 +2191,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             if (examTaskPaperData == null) {
                 examTaskPaperData = new ExamTaskPaperData();
                 examTaskPaperData.setExamId(examId);
-                // 系统自动生成唯一码,命题任务提交时,根据唯一码反向更新真实的试卷编号
-                uuid = SystemConstant.getNanoId();
+                // 唯一码,命题任务提交时,根据唯一码反向更新真实的试卷编号
                 examTaskPaperData.setPaperNumber(uuid);
                 examTaskPaperData.setUuid(uuid);
                 examTaskPaperData.setPaperId(paperId);

+ 30 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -1135,6 +1135,36 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> saveTask(MultipartFile file, Long semesterId, Long examId, TaskTypeEnum taskTypeEnum) {
+        BasicAttachment basicAttachment = null;
+        Map<String, Object> map = null;
+        try {
+            PrintCommonService printCommonService = SpringContextHolder.getBean(PrintCommonService.class);
+            basicAttachment = printCommonService.saveAttachment(file, ServletUtil.getRequestMd5(), UploadFileEnum.FILE);
+            if (Objects.isNull(basicAttachment)) {
+                throw ExceptionResultEnum.ATTACHMENT_ERROR.exception();
+            } else {
+                map = new HashMap<>();
+                TBTask tbTask = tbTaskService.saveTaskCommon(basicAttachment, taskTypeEnum, map, null);
+                tbTask.setSemesterId(semesterId);
+                tbTask.setExamId(examId);
+                tbTaskService.save(tbTask);
+            }
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+            if (Objects.nonNull(basicAttachment)) {
+                basicAttachmentService.deleteAttachment(basicAttachment);
+            }
+            if (e instanceof ApiException) {
+                ResultUtil.error((ApiException) e, e.getMessage());
+            } else {
+                ResultUtil.error(e.getMessage());
+            }
+        }
+        return map;
+    }
+
     @Override
     @Transactional
     public Map<String, Object> saveTask(Long printPlanId, MultipartFile file, TaskTypeEnum taskTypeEnum) {

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TBTaskPdfServiceImpl.java

@@ -92,4 +92,13 @@ public class TBTaskPdfServiceImpl extends ServiceImpl<TBTaskPdfMapper, TBTaskPdf
         }
         return this.baseMapper.pageData(page, examId, printPlanId, courseCode, paperNumber, status, result, examPlace, examRoom, examStartTime, examEndTime);
     }
+
+    @Override
+    public List<TBTaskPdf> listWaitingTask() {
+        QueryWrapper<TBTaskPdf> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TBTaskPdf::getStatus, TaskStatusEnum.INIT)
+                .orderByAsc(TBTaskPdf::getSchoolId)
+                .orderByAsc(TBTaskPdf::getId);
+        return this.list(queryWrapper);
+    }
 }

+ 1 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/create/AsyncCreateTaskTemplete.java

@@ -8,9 +8,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Async;
 
-import java.io.IOException;
-import java.util.Map;
-
 /**
  * @Description: 异步创建pdf模版
  * @Param:
@@ -25,19 +22,9 @@ public abstract class AsyncCreateTaskTemplete extends AsyncImportTaskTemplete {
 
     /**
      * 创建pdf
-     *
-     * @param map
-     * @param callbackCreatePdf
-     * @return
-     * @throws IOException
      */
     @Async("taskThreadPool")
-    public Result createPdf(Map<String, Object> map, CallbackCreatePdf callbackCreatePdf) throws IOException {
-        return null;
-    }
-
-    @Async("taskThreadPool")
-    public Result createPdf(TBTaskPdf tbTaskPdf, CallbackCreatePdf callbackCreatePdf) throws IOException {
+    public Result createPdf(TBTaskPdf tbTaskPdf, CallbackCreatePdf callbackCreatePdf) {
         return null;
     }
 }

+ 2 - 81
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncCreatePdfTempleteService.java

@@ -39,65 +39,6 @@ public class AsyncCreatePdfTempleteService extends AsyncCreateTaskTemplete {
 
     static final String OBJ_TITLE = "pdf数据";
 
-    /**
-     * 创建pdf
-     *
-     * @param map
-     * @param callbackCreatePdf
-     * @return
-     * @throws IOException
-     */
-    @Override
-    public Result createPdf(Map<String, Object> map, CallbackCreatePdf callbackCreatePdf) throws IOException {
-        TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
-        Boolean manual = (Boolean) map.get(SystemConstant.MANUAL);
-        StringJoiner stringJoinerSummary = new StringJoiner("\n").add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), BEGIN_TITLE, OBJ_TITLE));
-        TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
-        TBTask dbTask = tbTaskService.getById(tbTask.getId());
-        if (Objects.isNull(manual) && (Objects.nonNull(dbTask) && dbTask.getStatus() == TaskStatusEnum.FINISH && Objects.nonNull(dbTask.getResult()))) {//无需重新生成pdf
-            return ResultUtil.ok();
-        }
-        tbTask.setStatus(TaskStatusEnum.RUNNING);
-        tbTaskService.updateById(tbTask);
-        try {
-            TaskLogicService taskLogicService = SpringContextHolder.getBean(TaskLogicService.class);
-            taskLogicService.createPdfPrepose(map);
-            taskLogicService.executeCreatePdfLogic(map);
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, map.get("size"), FINISH_ERROR_SIZE));
-            tbTask.setResult(TaskResultEnum.SUCCESS);
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_TITLE, EXCEPTION_DATA, e.getMessage()));
-            tbTask.setResult(TaskResultEnum.ERROR);
-//            TBTask dbTask = tbTaskService.getById(tbTask.getId());
-//            if (tbTask.getVersion() == dbTask.getVersion()) {
-//                tbTask.setResetCount(new AtomicInteger(tbTask.getResetCount()).incrementAndGet());
-//            }
-            if (e instanceof ApiException) {
-                if (((ApiException) e).getCode() == ExceptionResultEnum.PAPER_ERROR.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.PAPER_TYPE_ERROR.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.ATTACHMENT_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_PRINT_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_RULE_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_DETAIL_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_CARD_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_TASK_IS_NULL.getCode()) {
-                    tbTask.setErrorMessage(e.getMessage());
-                }
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        } finally {//生成txt文件
-            tbTask.setSummary(stringJoinerSummary.toString());
-            super.createTxt(tbTask);
-            if (Objects.nonNull(callbackCreatePdf)) {
-                callbackCreatePdf.callback(map);
-            }
-        }
-        return ResultUtil.ok(map);
-    }
-
     /**
      * 创建pdf
      *
@@ -107,12 +48,9 @@ public class AsyncCreatePdfTempleteService extends AsyncCreateTaskTemplete {
      * @throws IOException
      */
     @Override
-    public Result createPdf(TBTaskPdf tbTaskPdf, CallbackCreatePdf callbackCreatePdf) throws IOException {
+    public Result createPdf(TBTaskPdf tbTaskPdf, CallbackCreatePdf callbackCreatePdf) {
         StringJoiner stringJoinerSummary = new StringJoiner("\n").add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), BEGIN_TITLE, OBJ_TITLE));
         TBTaskPdfService tbTaskPdfService = SpringContextHolder.getBean(TBTaskPdfService.class);
-//        if (Objects.isNull(manual) && (Objects.nonNull(dbTask) && dbTask.getStatus() == TaskStatusEnum.FINISH && Objects.nonNull(dbTask.getResult()))) {//无需重新生成pdf
-//            return ResultUtil.ok();
-//        }
         // 任务状态为进行中,直接结束
         if (TaskStatusEnum.RUNNING.equals(tbTaskPdf.getStatus())) {
             return ResultUtil.ok();
@@ -121,28 +59,11 @@ public class AsyncCreatePdfTempleteService extends AsyncCreateTaskTemplete {
         tbTaskPdfService.updateById(tbTaskPdf);
         try {
             PdfTaskLogicService pdfTaskLogicService = SpringContextHolder.getBean(PdfTaskLogicService.class);
-            pdfTaskLogicService.executeCreatePdfLogic(tbTaskPdf);
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, 0, FINISH_ERROR_SIZE));
+            pdfTaskLogicService.executeCreatePdfLogic(tbTaskPdf, stringJoinerSummary);
             tbTaskPdf.setResult(TaskResultEnum.SUCCESS);
         } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
             stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_TITLE, EXCEPTION_DATA, e.getMessage()));
             tbTaskPdf.setResult(TaskResultEnum.ERROR);
-            if (e instanceof ApiException) {
-                if (((ApiException) e).getCode() == ExceptionResultEnum.PAPER_ERROR.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.PAPER_TYPE_ERROR.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.ATTACHMENT_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_PRINT_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_RULE_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_DETAIL_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_CARD_IS_NULL.getCode()
-                        || ((ApiException) e).getCode() == ExceptionResultEnum.EXAM_TASK_IS_NULL.getCode()) {
-//                    tbTaskPdf.setErrorMessage(e.getMessage());
-                }
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
         } finally {
             tbTaskPdf.setStatus(TaskStatusEnum.FINISH);
             tbTaskPdf.setSummary(stringJoinerSummary.toString());

+ 23 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncBasicExamStudentImportService.java

@@ -7,6 +7,7 @@ import com.qmth.distributed.print.business.entity.BasicExamStudent;
 import com.qmth.distributed.print.business.service.BasicExamStudentService;
 import com.qmth.distributed.print.business.templete.importData.SyncImportTaskTemplate;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
+import com.qmth.teachcloud.common.annotation.ExcelNote;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
@@ -91,8 +92,7 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
                 List<BasicExamStudent> basicExamStudentList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.DATASOURCE)), BasicExamStudent.class);
                 basicExamStudentService.saveOrUpdateBatch(basicExamStudentList);
 
-            }
-            if (result.containsKey(SystemConstant.ERROR_DATA_LIST)) {
+            } else if (result.containsKey(SystemConstant.ERROR_DATA_LIST)) {
                 // 有异常数据
                 errorDataList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.ERROR_DATA_LIST)),
                         BasicExamStudentDto.class);
@@ -133,6 +133,7 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
             throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IOException {
 
         List<Field> fields = Arrays.asList(BasicExamStudentDto.class.getDeclaredFields());
+
         log.debug("导出Excel开始...");
         XSSFWorkbook wb = new XSSFWorkbook();
         XSSFSheet sheet = wb.createSheet("考生字典导入");
@@ -141,7 +142,7 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
         defaultFont.setFontHeightInPoints((short) 12);
         defaultFont.setFontName("宋体");
 
-        int cellCount = fields.size() + 1;
+        int cellCount = fields.size();
         // 说明
         XSSFCellStyle describeStyle = wb.createCellStyle();
         describeStyle.setAlignment(HorizontalAlignment.LEFT);
@@ -173,7 +174,20 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
         XSSFRow rowHead = sheet.createRow(1);
         for (int i = 0; i < fields.size(); i++) {
             XSSFCell cell = rowHead.createCell(i);
-            cell.setCellValue(fields.get(i).getName());
+            Field field = fields.get(i);
+            String title = "";
+            ExcelNote excelNote = field.getAnnotation(ExcelNote.class);
+
+            if (Objects.isNull(excelNote)) {
+                if (i == fields.size() - 1) {
+                    title = "异常信息";
+                } else {
+                    throw ExceptionResultEnum.ERROR.exception("未能获取dto属性注解");
+                }
+            } else {
+                title = excelNote.value();
+            }
+            cell.setCellValue(title);
             cell.setCellStyle(headerStyle);
         }
         XSSFCell lastCell = rowHead.createCell(cellCount - 1);
@@ -194,7 +208,11 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
                 String methodName = "get" + SystemConstant.initCap(head.getName());
                 Method getMethod = basicExamStudentDto.getClass().getDeclaredMethod(methodName);
                 String value = String.valueOf(getMethod.invoke(basicExamStudentDto));
-                cell.setCellValue(value);
+                if (SystemConstant.strNotNull(value)) {
+                    cell.setCellValue(value);
+                } else {
+                    cell.setCellValue("");
+                }
                 cell.setCellStyle(exampleStyle);
             }
         }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/PdfTaskLogicService.java

@@ -4,6 +4,7 @@ import com.qmth.distributed.print.business.entity.TBTaskPdf;
 
 import java.io.IOException;
 import java.util.Map;
+import java.util.StringJoiner;
 
 /**
  * @Description: 任务处理逻辑
@@ -22,5 +23,5 @@ public interface PdfTaskLogicService {
      * @return
      */
 
-    void executeCreatePdfLogic(TBTaskPdf tbTaskPdf);
+    void executeCreatePdfLogic(TBTaskPdf tbTaskPdf, StringJoiner stringJoinerSummary);
 }

+ 20 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.business.templete.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -41,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.io.File;
 import java.math.BigDecimal;
+import java.text.MessageFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
@@ -90,9 +92,11 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
     private FileUploadService fileUploadService;
 
     @Override
-    public void executeCreatePdfLogic(TBTaskPdf tbTaskPdf) {
+    public void executeCreatePdfLogic(TBTaskPdf tbTaskPdf, StringJoiner stringJoinerSummary) {
         CreatePdfDto createPdfDto = new CreatePdfDto();
         try {
+            long startTime = System.currentTimeMillis();
+            addSummary(stringJoinerSummary, "开始处理数据");
             // 更新状态(考场状态、印刷计划状态)
             updatePdfDataStatus(tbTaskPdf);
 
@@ -107,6 +111,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             updateAssignPaperType(tbTaskPdf, createPdfDto);
             // 查询生成pdf需要文件
             assemblePdfFile(tbTaskPdf, createPdfDto);
+            addSummary(stringJoinerSummary, "处理数据结束,准备生成pdf");
             // 生成pdf文件并合并
             //合并(试卷+备用试卷)
             String dirNamePaper = createPdfNewUtil.mergeA3Pdf(createPdfDto.getPaperPdfList());
@@ -116,8 +121,10 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             createPdfNewUtil.mergePdfSaveDb(dirNamePaper, dirNameCardA3, tbTaskPdf);
             // 生成A4文件
             createA4File(tbTaskPdf, examDetailCourseList);
+            long endTime = System.currentTimeMillis();
+            addSummary(stringJoinerSummary, "pdf文件生成成功,共处理" + examDetail.getTotalSubjects() + "科次。耗时:" + (endTime - startTime) / 1000 + "秒");
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
         } finally {
             if (CollectionUtils.isNotEmpty(createPdfDto.getFileTempList())) {
                 for (File file : createPdfDto.getFileTempList()) {
@@ -382,4 +389,15 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
         examDetailService.updateById(examDetail);
     }
 
+    /**
+     * 写入概要信息
+     *
+     * @param stringJoinerSummary
+     * @param message
+     */
+    private void addSummary(StringJoiner stringJoinerSummary, String message) {
+        // 时间:事件
+        stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), "->", message));
+    }
+
 }

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

@@ -2099,7 +2099,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
 
                     for (int i = 0; i < finalExcelList.size(); i++) {
-                        List<String> errorMsgList = new ArrayList<>();
                         LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
                         List<Object> basicExamStudentDtoList = excelMap.get(i);
                         // 无数据,跳过
@@ -2107,6 +2106,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             continue;
                         }
                         for (int y = 0; y < Objects.requireNonNull(basicExamStudentDtoList).size(); y++) {
+                            List<String> errorMsgList = new ArrayList<>();
                             // 行索引
                             BasicExamStudentDto basicExamStudentDto = (BasicExamStudentDto) basicExamStudentDtoList.get(
                                     y);
@@ -2184,7 +2184,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         }
                     }
 
-                    if (!errorDataList.isEmpty()) {
+                    if (errorDataList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
                         map.put(SystemConstant.ERROR_DATA_LIST, errorDataList);
                     } else {
                         List<BasicExamStudent> basicExamStudentList = new ArrayList<>(studentCodeObjMap.values());

+ 12 - 0
distributed-print-business/src/main/resources/db/log/update-yin.sql

@@ -0,0 +1,12 @@
+CREATE TABLE IF NOT EXISTS `mark_document` (
+    `id` bigint NOT NULL,
+    `exam_id` bigint NOT NULL COMMENT '考试ID',
+    `course_code` varchar(32) NOT NULL COMMENT '课程代码',
+    `course_name` varchar(100) NOT NULL COMMENT '科目名称',
+    `paper_number` varchar(64) DEFAULT NULL COMMENT '试卷编号',
+    `type` varchar(64) NOT NULL COMMENT '类型',
+    `name` varchar(64) DEFAULT NULL COMMENT '名称',
+    `file_count` int DEFAULT NULL COMMENT '文件数量',
+    `file_path` mediumtext COMMENT '文件地址',
+    PRIMARY KEY (`id`) USING BTREE
+    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='归档文档表';

+ 15 - 0
distributed-print-business/src/main/resources/db/log/脚本-caozx.sql

@@ -0,0 +1,15 @@
+-- 考生字典管理权限设置
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1101', '分页查询', '/api/admin/basic/exam_student/page', 'URL', '1100', '1', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1102', '新增/编辑', '/api/admin/basic/exam_student/save', 'URL', '1100', '2', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1103', '导入', '/api/admin/basic/exam_student/import', 'URL', '1100', '3', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1104', '导出', '/api/admin/basic/exam_student/export', 'URL', '1100', '4', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1105', '批量删除', '/api/admin/basic/exam_student/delete', 'URL', '1100', '5', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1106', '查询', 'Select', 'BUTTON', '1100', '1', 'AUTH', '1101', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1107', '查询条件', 'Condition', 'CONDITION', '1100', '3', 'AUTH', '1101', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1108', '列表', 'List', 'LIST', '1100', '2', 'AUTH', '1101', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1109', '新增', 'Add', 'BUTTON', '1100', '4', 'AUTH', '1102', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1110', '编辑', 'Edit', 'LINK', '1100', '5', 'AUTH', '1102', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1111', '导入学生', 'Import', 'BUTTON', '1100', '6', 'AUTH', '1103', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1112', '导出学生', 'Export', 'BUTTON', '1100', '7', 'AUTH', '1104', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1113', '删除', 'Delete', 'LINK', '1100', '8', 'AUTH', '1105', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1114', '批量删除', 'DeleteBatch', 'BUTTON', '1100', '9', 'AUTH', '1105', '1', '0', '1');

+ 4 - 0
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -478,3 +478,7 @@ CREATE TABLE `exam_task_paper_data` (
            `uuid` VARCHAR(200) NULL COMMENT '唯一标识',
            PRIMARY KEY (`exam_id`, `paper_number`, `paper_id`))
     COMMENT = '命题任务选择题库试卷相关文件表';
+
+-- 2024/03/04
+ALTER TABLE `exam_card`
+    ADD COLUMN `paper_id` BIGINT(20) NULL COMMENT '题库试卷ID' AFTER `blank_card_path`;

+ 7 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamStudentController.java

@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
  * @author CaoZixuan
  * @since 2024-02-22
  */
-@Api(tags = "专业管理controller")
+@Api(tags = "考生字典管理controller")
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_BASIC + "/exam_student")
 public class BasicExamStudentController {
@@ -85,8 +85,12 @@ public class BasicExamStudentController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @ApiResponses({ @ApiResponse(code = 200, message = "返回信息", response = Result.class) })
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
-    public Result basicExamStudentImportSync(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) throws Exception {
-        Map<String, Object> map = printCommonService.saveTask(file, TaskTypeEnum.STUDENT_IMPORT);
+    public Result basicExamStudentImportSync(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
+            @ApiParam(value = "学期id", required = true) @RequestParam String semesterId, @ApiParam(value = "考试id", required = true) @RequestParam String examId) throws Exception {
+        Map<String, Object> map = printCommonService.saveTask(file, SystemConstant.convertIdToLong(semesterId),
+                SystemConstant.convertIdToLong(examId), TaskTypeEnum.STUDENT_IMPORT);
+        map.put("semesterId",SystemConstant.convertIdToLong(semesterId));
+        map.put("examId",SystemConstant.convertIdToLong(examId));
         return syncBasicExamStudentImportService.importTask(map);
     }
 

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

@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -109,8 +110,8 @@ public class ExamCardController {
     @ApiOperation(value = "新建")
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     public Result save(@RequestBody ExamCardParams examCardParams) throws Exception {
-        String cardId = examCardService.saveExamCard(examCardParams);
-        return ResultUtil.ok(cardId, "");
+        Map<String, String > map = examCardService.saveExamCard(examCardParams);
+        return ResultUtil.ok(map);
     }
 
     /**

+ 7 - 29
distributed-print/src/main/java/com/qmth/distributed/print/api/TBTaskPdfController.java

@@ -5,32 +5,29 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.result.EditResult;
-import com.qmth.distributed.print.business.entity.TBTaskPdf;
 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.distributed.print.business.service.TBTaskPdfService;
-import com.qmth.distributed.print.business.templete.execute.AsyncCreatePdfTempleteService;
 import com.qmth.teachcloud.common.bean.result.TaskListResult;
 import com.qmth.teachcloud.common.bean.result.TaskPdfResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.enums.*;
-import com.qmth.teachcloud.common.service.TBTaskService;
+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.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
 import io.swagger.annotations.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
 
 /**
  * <p>
@@ -50,25 +47,6 @@ public class TBTaskPdfController {
     @Resource
     ExamDetailService examDetailService;
 
-    @Resource
-    AsyncCreatePdfTempleteService asyncCreatePdfTempleteService;
-
-    @Aac(auth = false)
-    @ApiOperation(value = "test")
-    @RequestMapping(value = "/{id}/{type}", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "重新生成pdf", response = EditResult.class)})
-    public Result test(@PathVariable Long id,
-                       @PathVariable CreatePdfTypeEnum type) {
-        TBTaskPdf tbTaskPdf = tbTaskPdfService.getById(id);
-        try {
-            asyncCreatePdfTempleteService.createPdf(tbTaskPdf, null);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        return ResultUtil.ok(new EditResult());
-    }
-
-
     @Aac(auth = false)
     @ApiOperation(value = "PDF生成管理查询接口")
     @RequestMapping(value = "/page_pdf_create", method = RequestMethod.POST)

+ 73 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkDocumentController.java

@@ -0,0 +1,73 @@
+package com.qmth.distributed.print.api.mark;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.alibaba.fastjson.JSONObject;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.util.Result;
+import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
+import com.qmth.teachcloud.mark.bean.document.MarkDocumantQuery;
+import com.qmth.teachcloud.mark.service.MarkDocumentService;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * <p>
+ * 归档管理 前端控制器
+ * </p>
+ */
+@Api(tags = "归档管理")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_MARK + "/archive/document")
+public class MarkDocumentController {
+
+    @Autowired
+    private MarkPaperService markPaperService;
+    @Resource
+    private MarkDocumentService markDocumentService;
+
+    @ApiOperation(value = "文档管理列表")
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    public Result list(@Validated ArchivePaperQuery query) {
+        return ResultUtil.ok(markPaperService.documentList(query));
+    }
+
+    @ApiOperation(value = "文档详情")
+    @RequestMapping(value = "/detail", method = RequestMethod.POST)
+    public Result detail(@Validated MarkDocumantQuery query) {
+        return ResultUtil.ok(markDocumentService.listByExamIdAndPaperNumber(query.getExamId(),query.getPaperNumber()));
+    }
+
+    @ApiOperation(value = "文档下载")
+    @RequestMapping(value = "/export", method = RequestMethod.POST)
+    public void export(@Validated MarkDocumantQuery query, HttpServletResponse response) {
+
+    }
+
+    @ApiOperation(value = "文档上传")
+    @RequestMapping(value = "/import", method = RequestMethod.POST)
+    public void importFile(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
+    }
+
+    @ApiOperation(value = "文档新建")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public void save(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
+    }
+
+    @ApiOperation(value = "文档删除")
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public void delete(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
+    }
+}

BIN
distributed-print/src/main/resources/temps/basicExamStudent.xlsx


+ 12 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -1213,6 +1213,18 @@ public class SystemConstant {
         }
     }
 
+    public static String generateRandomNumber(int n) {
+        StringBuilder sb = new StringBuilder();
+        Random rand = new Random();
+
+        for (int i = 0; i < n; i++) {
+            char digit = (char)(rand.nextInt('9' - '0') + '0');
+            sb.append(digit);
+        }
+
+        return sb.toString();
+    }
+
 //    /**
 //     * 获取版本号
 //     *

+ 0 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/kit/TikuUtils.java

@@ -72,7 +72,6 @@ public class TikuUtils {
             map.put("pageSize", validParam(pageSize, 10, false, "分页参数"));
 
             String result = HttpUtil.post(postUrl, map, createSign(schoolId, timestamp, url), timestamp);
-            System.out.println(result);
             JSONObject jsonObject = JSONObject.parseObject(result);
             if (jsonObject.containsKey("content")) {
                 Page<TikuPaperInfo> page = new Page(pageNumber, pageSize);

+ 31 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/document/ArchivePaperQuery.java

@@ -0,0 +1,31 @@
+package com.qmth.teachcloud.mark.bean.document;
+
+import javax.validation.constraints.NotNull;
+
+import com.qmth.teachcloud.mark.utils.PagerQuery;
+
+public class ArchivePaperQuery extends PagerQuery {
+	@NotNull(message = "考试Id不能为空")
+	private Long examId;
+	
+	private String courseCode;
+
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+
+}

+ 46 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/document/ArchivePaperVo.java

@@ -0,0 +1,46 @@
+package com.qmth.teachcloud.mark.bean.document;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
+public class ArchivePaperVo {
+
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long examId;
+	private String courseCode;
+	private String courseName;
+	private String paperNumber;
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public String getCourseName() {
+		return courseName;
+	}
+
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
+
+	public String getPaperNumber() {
+		return paperNumber;
+	}
+
+	public void setPaperNumber(String paperNumber) {
+		this.paperNumber = paperNumber;
+	}
+
+}

+ 31 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/document/MarkDocumantQuery.java

@@ -0,0 +1,31 @@
+package com.qmth.teachcloud.mark.bean.document;
+
+import javax.validation.constraints.NotNull;
+
+import com.qmth.teachcloud.mark.utils.PagerQuery;
+
+public class MarkDocumantQuery extends PagerQuery {
+	@NotNull(message = "考试Id不能为空")
+	private Long examId;
+	@NotNull(message = "paperNumber")
+	private String paperNumber;
+
+	public String getPaperNumber() {
+		return paperNumber;
+	}
+
+	public void setPaperNumber(String paperNumber) {
+		this.paperNumber = paperNumber;
+	}
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+
+
+}

+ 124 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkDocument.java

@@ -0,0 +1,124 @@
+package com.qmth.teachcloud.mark.entity;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.mark.enums.DocumentType;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * <p>
+ * 归档文档表
+ * </p>
+ */
+@TableName("mark_document")
+@ApiModel(value = "MarkDocument对象", description = "归档文档表")
+public class MarkDocument implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "ID")
+    @TableId(value = "id")
+    private Long id;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "考试ID")
+    private Long examId;
+
+    @ApiModelProperty(value = "课程代码")
+    private String courseCode;
+
+    @ApiModelProperty(value = "科目名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "试卷编号(显示)")
+    private String paperNumber;
+    @ApiModelProperty(value = "材料类型")
+    private DocumentType type;
+    @ApiModelProperty(value = "材料名称")
+    private String name;
+    @ApiModelProperty(value = "文件数量")
+    private Integer fileCount;
+    @ApiModelProperty(value = "文件地址")
+    private String filePath;
+    public MarkDocument() {
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public DocumentType getType() {
+        return type;
+    }
+
+    public void setType(DocumentType type) {
+        this.type = type;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getFileCount() {
+        return fileCount;
+    }
+
+    public void setFileCount(Integer fileCount) {
+        this.fileCount = fileCount;
+    }
+
+    public String getFilePath() {
+        return filePath;
+    }
+
+    public void setFilePath(String filePath) {
+        this.filePath = filePath;
+    }
+}

+ 59 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/enums/DocumentType.java

@@ -0,0 +1,59 @@
+package com.qmth.teachcloud.mark.enums;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public enum DocumentType {
+    SYLLABUS("课程教学大纲", 1),
+    PROCESS_SCORE("过程考核成绩", 2),
+    PAPER("试卷样卷", 3),
+    ANSWER("试卷评阅标准", 4),
+    PAPER_REPORT("试卷分析报告", 5),
+    APPROVE_RECORD("试卷审批记录", 6),
+    SCORE("学生期末考试成绩单", 7),
+    SCORE_REPORT("学生期末考试成绩分析", 8),
+    SHEET("学生答卷原图", 9),
+    TRACK("学生答卷轨迹图", 10),
+    SIGN("期末考试签到表", 11),
+    CHECK_IN("期考考试考场记录单", 12),
+    CUSTOM("自定义", 13),
+    ;
+
+    private String name;
+
+    private int value;
+
+    private static List<DocumentType> options;
+
+    private DocumentType(String name, int value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public static DocumentType findByValue(int value) {
+        for (DocumentType c : DocumentType.values()) {
+            if (c.getValue() == value) {
+                return c;
+            }
+        }
+        return null;
+    }
+
+    public static List<DocumentType> getOptionList() {
+        if (options == null) {
+            options = new LinkedList<>();
+            for (DocumentType status : DocumentType.values()) {
+                options.add(status);
+            }
+        }
+        return options;
+    }
+}

+ 7 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkDocumentMapper.java

@@ -0,0 +1,7 @@
+package com.qmth.teachcloud.mark.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.teachcloud.mark.entity.MarkDocument;
+
+public interface MarkDocumentMapper extends BaseMapper<MarkDocument> {
+}

+ 8 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkPaperMapper.java

@@ -1,5 +1,9 @@
 package com.qmth.teachcloud.mark.mapper;
 
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -7,12 +11,11 @@ import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreQuery;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
 import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
 import com.qmth.teachcloud.mark.dto.mark.score.MarkPaperPackageDto;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
 
 /**
  * <p>
@@ -40,4 +43,6 @@ public interface MarkPaperMapper extends BaseMapper<MarkPaper> {
     int getPaperNumberCount(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("coursePaperId") String coursePaperId, @Param("status") String status, @Param("dpr") DataPermissionRule dpr);
 
     List<MarkPaper> listByExamId(@Param("examId") Long examId, @Param("status") String status, @Param("dpr") DataPermissionRule dpr);
+
+    IPage<ArchivePaperVo> documentList(Page<ArchiveScoreVo> page, @Param("req") ArchivePaperQuery query, @Param("dpr")DataPermissionRule dpr);
 }

+ 18 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkDocumentService.java

@@ -0,0 +1,18 @@
+package com.qmth.teachcloud.mark.service;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.teachcloud.mark.entity.MarkDocument;
+
+/**
+ * <p>
+ * 考试科目表 服务类
+ * </p>
+ *
+ * @author xf
+ * @since 2023-09-22
+ */
+public interface MarkDocumentService extends IService<MarkDocument> {
+    List<MarkDocument> listByExamIdAndPaperNumber(Long examId, String paperNumber);
+}

+ 9 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkPaperService.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto;
 import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreQuery;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
 import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
@@ -27,6 +29,7 @@ public interface MarkPaperService extends IService<MarkPaper> {
     IPage<MarkSettingDto> listPaperSetting(Long examId, String courseCode, String paperNumber, Boolean groupStatus, Integer pageNumber, Integer pageSize);
 
     MarkPaper getByExamIdAndPaperNumber(Long examId, String paperNumber);
+
     MarkPaper getByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType);
 
     void savePaperSetting(MarkPaper markPaper);
@@ -36,6 +39,7 @@ public interface MarkPaperService extends IService<MarkPaper> {
     List<MarkPaper> listQualityMarkPaperByStatus(MarkPaperStatus formal, int uploadCount);
 
     int getCourseCount(Long id, String courseCode, String coursePaperId, MarkPaperStatus status, DataPermissionRule dpr);
+
     int getPaperNumberCount(Long id, String courseCode, String coursePaperId, MarkPaperStatus status, DataPermissionRule dpr);
 
     IPage<CheckScoreListDto> listStudentScoreList(Long examId, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);
@@ -46,9 +50,9 @@ public interface MarkPaperService extends IService<MarkPaper> {
 
     IPage<MarkPaperPackageDto> listPackage(Long examId, String paperNumber, String packageCode, Integer pageNumber, Integer pageSize);
 
-	MarkPaper getByExamIdAndCoursePaperId(Long examId, String coursePaperId);
+    MarkPaper getByExamIdAndCoursePaperId(Long examId, String coursePaperId);
 
-	List<MarkPaper> listByExamId(Long examId, MarkPaperStatus status, DataPermissionRule dpr);
+    List<MarkPaper> listByExamId(Long examId, MarkPaperStatus status, DataPermissionRule dpr);
 
     void updateGroupStatusByExamIdAndPaperNumber(boolean groupStatus, Long examId, String paperNumber);
 
@@ -58,9 +62,11 @@ public interface MarkPaperService extends IService<MarkPaper> {
 
     SettingDto getSetting(Long examId, String paperNumber);
 
-	IPage<ArchiveScoreVo> scoreList(ArchiveScoreQuery query);
+    IPage<ArchiveScoreVo> scoreList(ArchiveScoreQuery query);
 
     void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
 
     void updateAbsentCount(Long examId, String paperNumber, int absentCount);
+
+    IPage<ArchivePaperVo> documentList(ArchivePaperQuery query);
 }

+ 30 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkDocumentServiceImpl.java

@@ -0,0 +1,30 @@
+package com.qmth.teachcloud.mark.service.impl;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.mark.entity.MarkDocument;
+import com.qmth.teachcloud.mark.mapper.MarkDocumentMapper;
+import com.qmth.teachcloud.mark.service.MarkDocumentService;
+
+/**
+ * <p>
+ * 考试科目表 服务实现类
+ * </p>
+ *
+ * @author xf
+ * @since 2023-09-22
+ */
+@Service
+public class MarkDocumentServiceImpl extends ServiceImpl<MarkDocumentMapper, MarkDocument> implements MarkDocumentService {
+    @Override
+    public List<MarkDocument> listByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        QueryWrapper<MarkDocument> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkDocument::getExamId, examId)
+                .eq(MarkDocument::getPaperNumber, paperNumber);
+        return this.list(queryWrapper);
+    }
+}

+ 21 - 10
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkPaperServiceImpl.java

@@ -1,5 +1,16 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -18,6 +29,8 @@ import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreQuery;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
+import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
 import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
 import com.qmth.teachcloud.mark.dto.mark.score.MarkPaperPackageDto;
 import com.qmth.teachcloud.mark.dto.mark.score.SettingDto;
@@ -27,15 +40,6 @@ import com.qmth.teachcloud.mark.entity.ScanPackage;
 import com.qmth.teachcloud.mark.mapper.MarkPaperMapper;
 import com.qmth.teachcloud.mark.service.*;
 import com.qmth.teachcloud.mark.utils.Calculator;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -331,5 +335,12 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
                 .eq(MarkPaper::getPaperNumber, paperNumber);
         this.update(updateWrapper);
     }
-
+    @Override
+    public IPage<ArchivePaperVo> documentList(ArchivePaperQuery query) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        Page<ArchiveScoreVo> page = new Page<>(query.getPageNumber(), query.getPageSize());
+        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
+        IPage<ArchivePaperVo> ret = this.baseMapper.documentList(page, query, dpr);
+        return ret;
+    }
 }

+ 136 - 112
teachcloud-mark/src/main/resources/mapper/MarkPaperMapper.xml

@@ -4,43 +4,43 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.qmth.teachcloud.mark.entity.MarkPaper">
-        <result column="exam_id" property="examId" />
-        <result column="course_code" property="courseCode" />
-        <result column="course_name" property="courseName" />
-        <result column="paper_number" property="paperNumber" />
-        <result column="objective_score" property="objectiveScore" />
-        <result column="subjective_score" property="subjectiveScore" />
-        <result column="total_score" property="totalScore" />
-        <result column="upload_count" property="uploadCount" />
-        <result column="remark" property="remark" />
-        <result column="sheet_config" property="sheetConfig" />
-        <result column="pass_score" property="passScore" />
-        <result column="excellent_score" property="excellentScore" />
-        <result column="card_type" property="cardType" />
-        <result column="paper_file_path" property="paperFilePath" />
-        <result column="answer_file_path" property="answerFilePath" />
-        <result column="auto_scroll" property="autoScroll" />
-        <result column="mark_mode" property="markMode" />
-        <result column="mark_start_time" property="markStartTime" />
-        <result column="mark_end_time" property="markEndTime" />
-        <result column="sheet_view" property="sheetView" />
-        <result column="show_object_score" property="showObjectScore" />
-        <result column="open_mark_class" property="openMarkClass" />
-        <result column="status" property="status" />
+        <result column="exam_id" property="examId"/>
+        <result column="course_code" property="courseCode"/>
+        <result column="course_name" property="courseName"/>
+        <result column="paper_number" property="paperNumber"/>
+        <result column="objective_score" property="objectiveScore"/>
+        <result column="subjective_score" property="subjectiveScore"/>
+        <result column="total_score" property="totalScore"/>
+        <result column="upload_count" property="uploadCount"/>
+        <result column="remark" property="remark"/>
+        <result column="sheet_config" property="sheetConfig"/>
+        <result column="pass_score" property="passScore"/>
+        <result column="excellent_score" property="excellentScore"/>
+        <result column="card_type" property="cardType"/>
+        <result column="paper_file_path" property="paperFilePath"/>
+        <result column="answer_file_path" property="answerFilePath"/>
+        <result column="auto_scroll" property="autoScroll"/>
+        <result column="mark_mode" property="markMode"/>
+        <result column="mark_start_time" property="markStartTime"/>
+        <result column="mark_end_time" property="markEndTime"/>
+        <result column="sheet_view" property="sheetView"/>
+        <result column="show_object_score" property="showObjectScore"/>
+        <result column="open_mark_class" property="openMarkClass"/>
+        <result column="status" property="status"/>
     </resultMap>
     <select id="listPaperSetting" resultType="com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto">
         SELECT
-            mp.exam_id examId,
-            mp.course_code courseCode,
-            mp.course_name courseName,
-            mp.paper_number paperNumber,
-            mp.mark_mode markMode,
-            mp.group_status groupStatus,
-            mp.paper_type paperType
+        mp.exam_id examId,
+        mp.course_code courseCode,
+        mp.course_name courseName,
+        mp.paper_number paperNumber,
+        mp.mark_mode markMode,
+        mp.group_status groupStatus,
+        mp.paper_type paperType
         FROM
-            mark_paper mp
-                LEFT JOIN
-            sys_user su ON mp.user_id = su.id
+        mark_paper mp
+        LEFT JOIN
+        sys_user su ON mp.user_id = su.id
         <where>
             <if test="schoolId != null">
                 and su.school_id = #{schoolId}
@@ -69,65 +69,61 @@
                 </if>
             </if>
         </where>
-            order by mp.id desc
+        order by mp.id desc
     </select>
     <select id="listQualityMarkPaperByStatus" resultType="com.qmth.teachcloud.mark.entity.MarkPaper">
-        SELECT
-            exam_id examId,
-            paper_number paperNumber
-        FROM
-            mark_paper mp
-        WHERE
-            mp.status = #{status} AND upload_count > #{uploadCount}
-          AND EXISTS( SELECT
-                          1
-                      FROM
-                          basic_exam be
-                      WHERE
-                          be.enable = 1 AND mp.exam_id = be.id)
+        SELECT exam_id      examId,
+               paper_number paperNumber
+        FROM mark_paper mp
+        WHERE mp.status = #{status}
+          AND upload_count > #{uploadCount}
+          AND EXISTS(SELECT 1
+                     FROM basic_exam be
+                     WHERE be.enable = 1
+                       AND mp.exam_id = be.id)
     </select>
     <select id="listStudentScoreList" resultType="com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto">
         SELECT
-            mp.exam_id examId,
-            mp.course_code courseCode,
-            mp.course_name courseName,
-            mp.paper_number paperNumber,
-            mp.student_count studentCount,
-            mp.upload_count uploadCount
+        mp.exam_id examId,
+        mp.course_code courseCode,
+        mp.course_name courseName,
+        mp.paper_number paperNumber,
+        mp.student_count studentCount,
+        mp.upload_count uploadCount
         FROM
-            mark_paper mp
-                LEFT JOIN sys_user su ON mp.user_id = su.id
+        mark_paper mp
+        LEFT JOIN sys_user su ON mp.user_id = su.id
         where mp.exam_id = #{examId}
-            <if test="courseCode != null and courseCode != ''">
-                AND mp.course_code = #{courseCode}
+        <if test="courseCode != null and courseCode != ''">
+            AND mp.course_code = #{courseCode}
+        </if>
+        <if test="paperNumber != null and paperNumber != ''">
+            AND mp.paper_number = #{paperNumber}
+        </if>
+        <if test="dpr != null">
+            <if test="dpr.requestUserId != null">
+                AND mp.user_id = #{dpr.requestUserId}
             </if>
-            <if test="paperNumber != null and paperNumber != ''">
-                AND mp.paper_number = #{paperNumber}
+            <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
+                AND su.org_id IN
+                <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
             </if>
-            <if test="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND mp.user_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND su.org_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </if>
-            order by mp.id desc
+        </if>
+        order by mp.id desc
     </select>
     <select id="listPackage" resultType="com.qmth.teachcloud.mark.dto.mark.score.MarkPaperPackageDto">
         SELECT distinct
-            sp.package_code packageCode
+        sp.package_code packageCode
         FROM
-            scan_package sp
+        scan_package sp
         WHERE
-            sp.exam_id = #{examId}
-            AND sp.course_paper_id = #{coursePaperId}
-            <if test="packageCode != null and packageCode != ''">
-                AND sp.package_code = #{packageCode}
-            </if>
+        sp.exam_id = #{examId}
+        AND sp.course_paper_id = #{coursePaperId}
+        <if test="packageCode != null and packageCode != ''">
+            AND sp.package_code = #{packageCode}
+        </if>
         ORDER BY sp.package_code
     </select>
     <select id="scoreList" resultType="com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo">
@@ -137,30 +133,32 @@
         avg(case when s.is_absent !=1 then s.objective_score+s.subjective_score else null end) avgScore,
         max(case when s.is_absent !=1 then s.objective_score+s.subjective_score else null end) maxScore,
         min(case when s.is_absent !=1 then s.objective_score+s.subjective_score else null end) minScore,
-        sum(case when s.objective_score+s.subjective_score >=t.total_score * t.pass_score/100 then 1 else 0 end) passCount,
-        sum(case when s.objective_score+s.subjective_score >=t.total_score * t.excellent_score/100 then 1 else 0 end) excellentCount
+        sum(case when s.objective_score+s.subjective_score >=t.total_score * t.pass_score/100 then 1 else 0 end)
+        passCount,
+        sum(case when s.objective_score+s.subjective_score >=t.total_score * t.excellent_score/100 then 1 else 0 end)
+        excellentCount
 
         FROM
-            mark_paper t 
-            left join mark_student s on t.exam_id=s.exam_id and t.course_paper_id=s.course_paper_id
-            left join sys_user su on t.user_id = su.id
+        mark_paper t
+        left join mark_student s on t.exam_id=s.exam_id and t.course_paper_id=s.course_paper_id
+        left join sys_user su on t.user_id = su.id
         WHERE
-            t.exam_id = #{req.examId}
-            <if test="req.courseCode != null and req.courseCode != ''">
-                AND t.course_code = #{req.courseCode}
+        t.exam_id = #{req.examId}
+        <if test="req.courseCode != null and req.courseCode != ''">
+            AND t.course_code = #{req.courseCode}
+        </if>
+        AND t.status = 'FINISH'
+        <if test="dpr != null">
+            <if test="dpr.requestUserId != null">
+                AND t.user_id = #{dpr.requestUserId}
             </if>
-            AND t.status = 'FINISH'
-            <if test="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND t.user_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND su.org_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
+            <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
+                AND su.org_id IN
+                <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
             </if>
+        </if>
         group by t.id,t.exam_id,t.course_code,t.course_name,t.paper_number
         ORDER BY t.id desc
     </select>
@@ -212,22 +210,48 @@
     </select>
     <select id="listByExamId" resultType="com.qmth.teachcloud.mark.entity.MarkPaper">
         select mp.*
-            from mark_paper mp
-                left join sys_user su on mp.user_id = su.id
-            <where>
-                mp.exam_id = #{examId} AND mp.status = #{status}
-                <if test="dpr != null">
-                    <if test="dpr.requestUserId != null">
-                        AND mp.user_id = #{dpr.requestUserId}
-                    </if>
-                    <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                        AND su.org_id IN
-                        <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                            #{item}
-                        </foreach>
-                    </if>
+        from mark_paper mp
+        left join sys_user su on mp.user_id = su.id
+        <where>
+            mp.exam_id = #{examId} AND mp.status = #{status}
+            <if test="dpr != null">
+                <if test="dpr.requestUserId != null">
+                    AND mp.user_id = #{dpr.requestUserId}
                 </if>
-            </where>
+                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
+                    AND su.org_id IN
+                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+            </if>
+        </where>
     </select>
 
+    <select id="documentList" resultType="com.qmth.teachcloud.mark.bean.document.ArchivePaperVo">
+        SELECT t.id,t.exam_id,t.course_code,t.course_name,t.paper_number
+        FROM
+        mark_paper t
+        left join mark_student s on t.exam_id=s.exam_id and t.course_paper_id=s.course_paper_id
+        left join sys_user su on t.user_id = su.id
+        WHERE
+        t.exam_id = #{req.examId}
+        <if test="req.courseCode != null and req.courseCode != ''">
+            AND t.course_code = #{req.courseCode}
+        </if>
+        AND t.status = 'FINISH'
+        <if test="dpr != null">
+            <if test="dpr.requestUserId != null">
+                AND t.user_id = #{dpr.requestUserId}
+            </if>
+            <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
+                AND su.org_id IN
+                <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </if>
+        group by t.id,t.exam_id,t.course_code,t.course_name,t.paper_number
+        ORDER BY t.id desc
+    </select>
 </mapper>

+ 18 - 32
teachcloud-task/src/main/java/com/qmth/teachcloud/task/enums/JobEnum.java

@@ -11,44 +11,30 @@ import java.util.Objects;
  */
 public enum JobEnum {
 
-    RESET_CREATE_PDF_JOB("重新生成pdf定时任务"),
-
-    RESET_CREATE_PDF_JOB_GROUP("重新生成pdfjob组"),
-
-    SMS_NOTICE_TASK_EXPIRE_JOB("任务到期提醒定时任务"),
-
-    SMS_NOTICE_TASK_EXPIRE_JOB_GROUP("任务到期提醒定时任务job组"),
-
-    SMS_NOTICE_TASK_OVERDUE_JOB("任务逾期提醒定时任务"),
-
-    SMS_NOTICE_TASK_OVERDUE_JOB_GROUP("任务逾期提醒定时任务job组"),
-
-    SMS_NOTICE_TASK_RESEND_JOB("短信发送失败重发定时任务"),
-
-    SMS_NOTICE_TASK_RESEND_JOB_GROUP("短信发送失败重发定时任务job组"),
-
-    SYNC_REUNIFY_JOB("自动统分定时任务"),
-
-    SYNC_REUNIFY_JOB_GROUP("自动统分定时任务job组"),
-
-    REDIS_MQ_JOB("学校信息同步定时任务"),
-
-    REDIS_MQ_JOB_GROUP("学校信息同步定时任务组"),
-    UPDATE_MARKER_QUALITY("更新评卷员质量监控指标"),
-    UPDATE_MARKER_QUALITY_GROUP("更新评卷员质量监控指标任务组"),
-    BUILD_MARK_TASK("创建评卷任务"),
-    BUILD_MARK_TASK_GROUP("创建评卷任务任务组"),
-    INIT_MARK_DATA("初始化阅卷数据"),
-    INIT_MARK_DATA_GROUP("初始化阅卷数据任务组"),
-    CLEAR_TIMEOUT_TASK("清空过期任务"),
-    CLEAR_TIMEOUT_TASK_GROUP("清空过期任务任务组");
+    CREATE_PDF_JOB("CREATE_PDF_JOB_GROUP", "重新生成pdf定时任务"),
+    SMS_NOTICE_TASK_EXPIRE_JOB("SMS_NOTICE_TASK_EXPIRE_JOB_GROUP", "任务到期提醒定时任务"),
+    SMS_NOTICE_TASK_OVERDUE_JOB("SMS_NOTICE_TASK_OVERDUE_JOB_GROUP", "任务逾期提醒定时任务"),
+    SMS_NOTICE_TASK_RESEND_JOB("SMS_NOTICE_TASK_RESEND_JOB_GROUP", "短信发送失败重发定时任务"),
+    SYNC_REUNIFY_JOB("SYNC_REUNIFY_JOB_GROUP", "自动统分定时任务"),
+    REDIS_MQ_JOB("REDIS_MQ_JOB_GROUP", "学校信息同步定时任务"),
+    UPDATE_MARKER_QUALITY("UPDATE_MARKER_QUALITY_GROUP", "更新评卷员质量监控指标"),
+    BUILD_MARK_TASK("BUILD_MARK_TASK_GROUP", "创建评卷任务"),
+    INIT_MARK_DATA("INIT_MARK_DATA_GROUP", "初始化阅卷数据"),
+    CLEAR_TIMEOUT_TASK("CLEAR_TIMEOUT_TASK_GROUP", "清空过期任务");
+
+    private String groupName;
 
     private String title;
 
-    private JobEnum(String title) {
+    private JobEnum(String groupName, String title) {
+        this.groupName = groupName;
         this.title = title;
     }
 
+    public String getGroupName() {
+        return groupName;
+    }
+
     public String getTitle() {
         return title;
     }

+ 29 - 0
teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/CreatePdfTaskJob.java

@@ -0,0 +1,29 @@
+package com.qmth.teachcloud.task.job;
+
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.task.job.service.JobService;
+import org.quartz.JobExecutionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+import javax.annotation.Resource;
+
+/**
+ * pdf自动生成任务
+ */
+public class CreatePdfTaskJob extends QuartzJobBean {
+    private final static Logger log = LoggerFactory.getLogger(CreatePdfTaskJob.class);
+
+    @Resource
+    JobService jobService;
+
+    @Override
+    protected void executeInternal(JobExecutionContext jobExecutionContext) {
+        try {
+            jobService.createPdfTask();
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+        }
+    }
+}

+ 1 - 1
teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/SubjectCalculateJob.java

@@ -21,7 +21,7 @@ public class SubjectCalculateJob extends QuartzJobBean {
     @Override
     protected void executeInternal(JobExecutionContext jobExecutionContext) {
         try {
-//            jobService.updateMarkerQuality();
+            jobService.updateMarkerQuality();
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
         }

+ 2 - 0
teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/service/JobService.java

@@ -58,4 +58,6 @@ public interface JobService {
     void initMarkData();
 
     void clearTimeoutTask();
+
+    void createPdfTask();
 }

+ 17 - 0
teachcloud-task/src/main/java/com/qmth/teachcloud/task/job/service/impl/JobServiceImpl.java

@@ -2,9 +2,12 @@ package com.qmth.teachcloud.task.job.service.impl;
 
 import com.qmth.boot.redis.uid.RedisMachineService;
 import com.qmth.distributed.print.business.bean.dto.initMarkData.ExamDetailCourseInitMarkDto;
+import com.qmth.distributed.print.business.bean.result.EditResult;
 import com.qmth.distributed.print.business.entity.TBSyncTask;
+import com.qmth.distributed.print.business.entity.TBTaskPdf;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.service.*;
+import com.qmth.distributed.print.business.templete.execute.AsyncCreatePdfTempleteService;
 import com.qmth.teachcloud.common.bean.dto.MqDto;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.enums.PushTypeEnum;
@@ -13,6 +16,7 @@ import com.qmth.teachcloud.common.enums.TaskStatusEnum;
 import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
 import com.qmth.teachcloud.common.util.DateDisposeUtils;
 import com.qmth.teachcloud.common.util.RedisUtil;
+import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.mark.entity.MarkGroup;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkUserGroup;
@@ -69,6 +73,10 @@ public class JobServiceImpl implements JobService {
     RedisMachineService redisMachineService;
     @Resource
     TBSyncTaskService tbSyncTaskService;
+    @Resource
+    TBTaskPdfService tbTaskPdfService;
+    @Resource
+    AsyncCreatePdfTempleteService asyncCreatePdfTempleteService;
 
     /**
      * 重新生成pdf失败任务
@@ -179,6 +187,15 @@ public class JobServiceImpl implements JobService {
         }
     }
 
+    @Override
+    public void createPdfTask() {
+        List<TBTaskPdf> tbTaskPdfList = tbTaskPdfService.listWaitingTask();
+        for (TBTaskPdf tbTaskPdf : tbTaskPdfList) {
+            asyncCreatePdfTempleteService.createPdf(tbTaskPdf, null);
+        }
+
+    }
+
     /**
      * 组装job
      *

+ 27 - 27
teachcloud-task/src/main/java/com/qmth/teachcloud/task/start/StartRunning.java

@@ -40,84 +40,84 @@ public class StartRunning implements CommandLineRunner {
         jobService.machineHeart();
         printCommonService.updateStatus();
 
-//        log.info("增加重新生成pdf定时任务 start");
-//        Map taskJobMap = new HashMap();
-//        schoolJobMap.computeIfAbsent("name", v -> ResetCreatePdfJob.class.getName());
-//        quartzService.deleteJob(JobEnum.RESET_CREATE_PDF_JOB.name(), JobEnum.RESET_CREATE_PDF_JOB_GROUP.name());
-//         //每天0点定时任务
-//        quartzService.addJob(ResetCreatePdfJob.class, JobEnum.RESET_CREATE_PDF_JOB.name(), JobEnum.RESET_CREATE_PDF_JOB_GROUP.name(), "0 0/1 * * * ?", taskJobMap);
-//        log.info("增加重新生成pdf定时任务 end");
-
         log.info("增加任务到期提醒定时任务 start");
         Map expireJobMap = new HashMap();
         expireJobMap.computeIfAbsent("name", v -> SendSmsExpireJob.class.getName());
-        quartzService.deleteJob(JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB.name(), JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB_GROUP.name());
+        quartzService.deleteJob(JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB.name(), JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB.getGroupName());
         // 每天15点定时任务
-        quartzService.addJob(SendSmsExpireJob.class, JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB.name(), JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB_GROUP.name(), "0 0 15 * * ?", expireJobMap);
+        quartzService.addJob(SendSmsExpireJob.class, JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB.name(), JobEnum.SMS_NOTICE_TASK_EXPIRE_JOB.getGroupName(), "0 0 15 * * ?", expireJobMap);
         log.info("增加任务到期提醒定时任务 end");
 
         log.info("增加任务逾期提醒定时任务 start");
         Map orverdueJobMap = new HashMap();
         orverdueJobMap.computeIfAbsent("name", v -> SendSmsOverdueJob.class.getName());
-        quartzService.deleteJob(JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB.name(), JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB_GROUP.name());
+        quartzService.deleteJob(JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB.name(), JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB.getGroupName());
         // 每天9点定时任务
-        quartzService.addJob(SendSmsOverdueJob.class, JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB.name(), JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB_GROUP.name(), "0 0 9 * * ?", orverdueJobMap);
+        quartzService.addJob(SendSmsOverdueJob.class, JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB.name(), JobEnum.SMS_NOTICE_TASK_OVERDUE_JOB.getGroupName(), "0 0 9 * * ?", orverdueJobMap);
         log.info("增加任务逾期提醒定时任务 end");
 
         log.info("增加短信发送失败重发定时任务 start");
         Map rensendJobMap = new HashMap();
         rensendJobMap.computeIfAbsent("name", v -> ResendSmsJob.class.getName());
-        quartzService.deleteJob(JobEnum.SMS_NOTICE_TASK_RESEND_JOB.name(), JobEnum.SMS_NOTICE_TASK_RESEND_JOB_GROUP.name());
+        quartzService.deleteJob(JobEnum.SMS_NOTICE_TASK_RESEND_JOB.name(), JobEnum.SMS_NOTICE_TASK_RESEND_JOB.getGroupName());
         // 每隔1小时定时任务
-        quartzService.addJob(ResendSmsJob.class, JobEnum.SMS_NOTICE_TASK_RESEND_JOB.name(), JobEnum.SMS_NOTICE_TASK_RESEND_JOB_GROUP.name(), "0 0/30 * * * ?", rensendJobMap);
+        quartzService.addJob(ResendSmsJob.class, JobEnum.SMS_NOTICE_TASK_RESEND_JOB.name(), JobEnum.SMS_NOTICE_TASK_RESEND_JOB.getGroupName(), "0 0/30 * * * ?", rensendJobMap);
         log.info("增加短信发送失败重发定时任务 end");
 
         log.info("增加mq信息同步定时任务 start");
         Map redisMqJobMap = new HashMap();
         redisMqJobMap.computeIfAbsent("name", v -> RedisMqSyncJob.class.getName());
-        quartzService.deleteJob(JobEnum.REDIS_MQ_JOB.name(), JobEnum.REDIS_MQ_JOB_GROUP.name());
+        quartzService.deleteJob(JobEnum.REDIS_MQ_JOB.name(), JobEnum.REDIS_MQ_JOB.getGroupName());
         // 每分钟定时任务
-        quartzService.addJob(RedisMqSyncJob.class, JobEnum.REDIS_MQ_JOB.name(), JobEnum.REDIS_MQ_JOB_GROUP.name(), "0 0/1 * * * ?", redisMqJobMap);
+        quartzService.addJob(RedisMqSyncJob.class, JobEnum.REDIS_MQ_JOB.name(), JobEnum.REDIS_MQ_JOB.getGroupName(), "0 0/1 * * * ?", redisMqJobMap);
         log.info("增加mq信息同步定时任务 end");
 
         // 每天0点开始,每2小时一次
         log.info("增加自动统分定时任务 start");
         Map reunifyJobMap = new HashMap();
         reunifyJobMap.computeIfAbsent("name", v -> SubjectCalculateJob.class.getName());
-        quartzService.deleteJob(JobEnum.SYNC_REUNIFY_JOB.name(), JobEnum.SYNC_REUNIFY_JOB_GROUP.name());
-//        quartzService.addJob(SubjectCalculateJob.class, JobEnum.SYNC_REUNIFY_JOB.name(), JobEnum.SYNC_REUNIFY_JOB_GROUP.name(), "0 0 0/2 * * ?", reunifyJobMap);
+        quartzService.deleteJob(JobEnum.SYNC_REUNIFY_JOB.name(), JobEnum.SYNC_REUNIFY_JOB.getGroupName());
+        quartzService.addJob(SubjectCalculateJob.class, JobEnum.SYNC_REUNIFY_JOB.name(), JobEnum.SYNC_REUNIFY_JOB.getGroupName(), "0 0 0/2 * * ?", reunifyJobMap);
         log.info("增加自动统分定时任务 end");
 
         // 每1分钟一次
         log.info("增加更新评卷员质量监控指标定时任务 start");
         Map qualityJobMap = new HashMap();
         qualityJobMap.computeIfAbsent("name", v -> UpdateMarkerQualityJob.class.getName());
-        quartzService.deleteJob(JobEnum.UPDATE_MARKER_QUALITY.name(), JobEnum.UPDATE_MARKER_QUALITY_GROUP.name());
-        quartzService.addJob(UpdateMarkerQualityJob.class, JobEnum.UPDATE_MARKER_QUALITY.name(), JobEnum.UPDATE_MARKER_QUALITY_GROUP.name(), "0 */1 * * * ?", qualityJobMap);
+        quartzService.deleteJob(JobEnum.UPDATE_MARKER_QUALITY.name(), JobEnum.UPDATE_MARKER_QUALITY.getGroupName());
+        quartzService.addJob(UpdateMarkerQualityJob.class, JobEnum.UPDATE_MARKER_QUALITY.name(), JobEnum.UPDATE_MARKER_QUALITY.getGroupName(), "0 */1 * * * ?", qualityJobMap);
         log.info("增加更新评卷员质量监控指标定时任务 end");
 
-//        // 每1分钟一次
+        // 每1分钟一次
         log.info("增加评卷任务生成定时任务 start");
         Map buildMarkTaskJobMap = new HashMap();
         buildMarkTaskJobMap.computeIfAbsent("name", v -> BuildMarkTaskJob.class.getName());
-        quartzService.deleteJob(JobEnum.BUILD_MARK_TASK.name(), JobEnum.BUILD_MARK_TASK_GROUP.name());
-        quartzService.addJob(BuildMarkTaskJob.class, JobEnum.BUILD_MARK_TASK.name(), JobEnum.BUILD_MARK_TASK_GROUP.name(), "0 */1 * * * ?", buildMarkTaskJobMap);
+        quartzService.deleteJob(JobEnum.BUILD_MARK_TASK.name(), JobEnum.BUILD_MARK_TASK.getGroupName());
+        quartzService.addJob(BuildMarkTaskJob.class, JobEnum.BUILD_MARK_TASK.name(), JobEnum.BUILD_MARK_TASK.getGroupName(), "0 */1 * * * ?", buildMarkTaskJobMap);
         log.info("增加评卷任务生成定时任务 end");
 
         // 每5分钟一次
         log.info("增加初始化阅卷数据定时任务 start");
         Map initMarkDataJobMap = new HashMap();
         initMarkDataJobMap.computeIfAbsent("name", v -> InitMarkDataJob.class.getName());
-        quartzService.deleteJob(JobEnum.INIT_MARK_DATA.name(), JobEnum.INIT_MARK_DATA_GROUP.name());
-        quartzService.addJob(InitMarkDataJob.class, JobEnum.INIT_MARK_DATA.name(), JobEnum.INIT_MARK_DATA_GROUP.name(), "0 */5 * * * ?", initMarkDataJobMap);
+        quartzService.deleteJob(JobEnum.INIT_MARK_DATA.name(), JobEnum.INIT_MARK_DATA.getGroupName());
+        quartzService.addJob(InitMarkDataJob.class, JobEnum.INIT_MARK_DATA.name(), JobEnum.INIT_MARK_DATA.getGroupName(), "0 */5 * * * ?", initMarkDataJobMap);
         log.info("增加初始化阅卷数据定时任务 end");
 
         // 每10分钟一次
         log.info("增加清空过期任务定时任务 start");
         Map clearTimeoutTaskJobMap = new HashMap();
         clearTimeoutTaskJobMap.computeIfAbsent("name", v -> ClearTimeoutTaskJob.class.getName());
-        quartzService.deleteJob(JobEnum.CLEAR_TIMEOUT_TASK.name(), JobEnum.CLEAR_TIMEOUT_TASK_GROUP.name());
-        quartzService.addJob(ClearTimeoutTaskJob.class, JobEnum.CLEAR_TIMEOUT_TASK.name(), JobEnum.CLEAR_TIMEOUT_TASK_GROUP.name(), "0 0/10 6-23 * * ?", clearTimeoutTaskJobMap);
+        quartzService.deleteJob(JobEnum.CLEAR_TIMEOUT_TASK.name(), JobEnum.CLEAR_TIMEOUT_TASK.getGroupName());
+        quartzService.addJob(ClearTimeoutTaskJob.class, JobEnum.CLEAR_TIMEOUT_TASK.name(), JobEnum.CLEAR_TIMEOUT_TASK.getGroupName(), "0 0/10 6-23 * * ?", clearTimeoutTaskJobMap);
+        log.info("增加清空过期任务定时任务 end");
+
+        // 每10分钟一次
+        log.info("增加PDF生成定时任务 start");
+        Map createPdfJobMap = new HashMap();
+        createPdfJobMap.computeIfAbsent("name", v -> CreatePdfTaskJob.class.getName());
+        quartzService.deleteJob(JobEnum.CREATE_PDF_JOB.name(), JobEnum.CREATE_PDF_JOB.getGroupName());
+        quartzService.addJob(CreatePdfTaskJob.class, JobEnum.CREATE_PDF_JOB.name(), JobEnum.CREATE_PDF_JOB.getGroupName(), "0 0/10 * * * ?", createPdfJobMap);
         log.info("增加清空过期任务定时任务 end");
 
         log.info("服务器启动时执行 end");