Forráskód Böngészése

Merge branch 'dev' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev

xiaof 4 éve
szülő
commit
878f18b49d

+ 34 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/PdfDto.java

@@ -18,12 +18,18 @@ public class PdfDto {
     @ApiModelProperty(name = "页数")
     Integer pageCount = 0;
 
+    @ApiModelProperty(name = "实际页数")
+    Integer actualPageCount = 0;
+
     @ApiModelProperty(name = "页面大小")
     PageSizeEnum pageSize;
 
     @ApiModelProperty(name = "序号")
     Integer sequence = 0;
 
+    @ApiModelProperty(name = "tag")
+    boolean tag = true;
+
     public PdfDto() {
 
     }
@@ -46,6 +52,34 @@ public class PdfDto {
         this.sequence = sequence;
     }
 
+    public PdfDto(PageSizeEnum pageSize, Integer pageCount, boolean tag) {
+        this.pageSize = pageSize;
+        this.pageCount = pageCount;
+        this.tag = tag;
+    }
+
+    public PdfDto(PageSizeEnum pageSize, Integer pageCount, Integer actualPageCount) {
+        this.pageSize = pageSize;
+        this.pageCount = pageCount;
+        this.actualPageCount = actualPageCount;
+    }
+
+    public Integer getActualPageCount() {
+        return actualPageCount;
+    }
+
+    public void setActualPageCount(Integer actualPageCount) {
+        this.actualPageCount = actualPageCount;
+    }
+
+    public boolean isTag() {
+        return tag;
+    }
+
+    public void setTag(boolean tag) {
+        this.tag = tag;
+    }
+
     public Integer getSequence() {
         return sequence;
     }

+ 8 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicAttachmentServiceImpl.java

@@ -103,6 +103,7 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
     @Transactional
     public BasicAttachment saveAttachmentHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList) throws IOException {
         BasicAttachment basicAttachment = null;
+        PdfDto pdfDto = null;
         try {
             byte[] bytes = htmlContent.getBytes();
             int size = bytes.length;
@@ -131,8 +132,8 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
                 String destUrl = SystemConstant.PDF_TEMP_FILES_DIR + File.separator + pdfDirName;
                 HtmlToPdfUtil.convert(localHtmlFile.getPath(), destUrl, PageSizeEnum.A3);
                 File pdfFile = new File(destUrl);
-                int pageCount = PdfUtil.addPdfPage(pdfFile);
-                localFileList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A3, pageCount));
+                pdfDto = PdfUtil.addPdfPage(pdfFile);
+                localFileList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
                 fileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
                 ossUtil.ossUpload(pdfDirName, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(fileMd5)));
                 localHtmlFile.delete();
@@ -155,6 +156,7 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
                     UploadFileEnum.HTML, UploadFileEnum.PDF
             });
             basicAttachment = new BasicAttachment(jsonObject.toJSONString(), fileName, SystemConstant.HTML_PREFIX, new BigDecimal(size), fileMd5, userId);
+            basicAttachment.setPages(pdfDto.getActualPageCount());
             save(basicAttachment);
         } catch (Exception e) {
             log.error("请求出错", e);
@@ -266,9 +268,9 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
             HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A4);
             File pdfFile = new File(destUrl);
             String fileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
-            int pageCount = 0;
+            PdfDto pdfDto = null;
             if (oss) {//上传至oss
-                pageCount = PdfUtil.addPdfPage(pdfFile);
+                pdfDto = PdfUtil.addPdfPage(pdfFile);
                 ossUtil.ossUpload(pdfDirName, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(fileMd5)));
                 jsonObject.put(SystemConstant.PDF_PATH, pdfDirName);
                 if (Objects.nonNull(type) && Objects.equals(type, SystemConstant.FTL_PREFIX)) {
@@ -286,8 +288,9 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
                 }
             }
             basicAttachment.setPath(jsonObject.toJSONString());
+            basicAttachment.setPages(pdfDto.getActualPageCount());
             for (int i = 0; i < printCount; i++) {
-                pdfList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A4, pageCount, sequence));
+                pdfList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount(), sequence));
             }
             this.updateById(basicAttachment);
         } catch (Exception e) {

+ 20 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -15,6 +15,7 @@ import com.qmth.distributed.print.business.bean.result.ExaminationResult;
 import com.qmth.distributed.print.business.bean.result.SummarizedDataResult;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
+import com.qmth.distributed.print.business.enums.ExaminationDBFieldsEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.enums.TaskTypeEnum;
 import com.qmth.distributed.print.business.mapper.ExamDetailMapper;
@@ -438,6 +439,24 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             String courseCode = String.valueOf(map.get("courseCode"));
             String courseName = String.valueOf(map.get("courseName"));
             String paperNumber = String.valueOf(map.get("paperNumber"));
+
+            // 获取该科目下的考生人数
+            List<Map<String,Object>> sameCourseList = dataList.stream().filter(e -> Long.valueOf(String.valueOf(e.get("schoolId"))).equals(schoolId) &&
+                    Long.valueOf(String.valueOf(e.get("printPlanId"))).equals(printPlanId) &&
+                    String.valueOf(e.get("examPlace")).equals(examPlace) &&
+                    String.valueOf(e.get("examRoom")).equals(examRoom) &&
+                    Long.valueOf(String.valueOf(e.get("examStartTime"))).equals(examStartTime) &&
+                    Long.valueOf(String.valueOf(e.get("examEndTime"))).equals(examEndTime) &&
+                    String.valueOf(e.get("courseCode")).equals(courseCode) &&
+                    String.valueOf(e.get("courseName")).equals(courseName) &&
+                    String.valueOf(e.get("paperNumber")).equals(paperNumber)).collect(Collectors.toList());
+
+            System.out.println(JSON.toJSONString(sameCourseList));
+
+            int totalSubjects = sameCourseList.size();
+
+
+
             List<ExamDetail> examDetailList = this.list(new QueryWrapper<ExamDetail>().lambda()
                     .eq(ExamDetail::getPrintPlanId, printPlanId)
                     .eq(ExamDetail::getExamPlace, examPlace)
@@ -455,6 +474,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             examDetailCourse.setCourseCode(courseCode);
             examDetailCourse.setCourseName(courseName);
             examDetailCourse.setPaperNumber(paperNumber);
+            examDetailCourse.setTotalSubjects(totalSubjects);
             examDetailCourse.setCreateId(userId);
             examDetailCourse.setUpdateId(userId);
             examDetailCourseList.add(examDetailCourse);

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

@@ -75,7 +75,7 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         List<PrintPlanResult> list = page.getRecords();
         for (PrintPlanResult printPlanResult : list) {
             List<Map> variableContent = JSONObject.parseArray(printPlanResult.getVariableContentTemp(), Map.class);
-            List<Map> ordinaryContent = JSONObject.parseArray(printPlanResult.getOrdinaryContentTemp(),Map.class);
+            List<Map> ordinaryContent = JSONObject.parseArray(printPlanResult.getOrdinaryContentTemp(), Map.class);
             printPlanResult.setVariableContent(variableContent);
             printPlanResult.setOrdinaryContent(ordinaryContent);
 
@@ -142,7 +142,7 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         for (ClassifyEnum value : ClassifyEnum.values()) {
             Map<String, Object> variableMap = new HashMap<>();
             List<TemplatePrintInfoResult> sourceList = variableList.stream().filter(e -> value.equals(e.getTemplateClassify())).collect(Collectors.toList());
-            List<Map<String,Object>> templateList = new ArrayList<>();
+            List<Map<String, Object>> templateList = new ArrayList<>();
             for (TemplatePrintInfoResult templatePrintInfoResult : sourceList) {
                 Map<String, Object> printMap = new HashMap<>();
                 printMap.put("id", String.valueOf(templatePrintInfoResult.getTemplateId()));
@@ -150,9 +150,9 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
                 printMap.put("attachmentId", templatePrintInfoResult.getAttachmentId().toString());
                 templateList.add(printMap);
             }
-            if (templateList.size() > 0){
-                variableMap.put("type",value);
-                variableMap.put("template",templateList);
+            if (templateList.size() > 0) {
+                variableMap.put("type", value);
+                variableMap.put("template", templateList);
                 variable.add(variableMap);
             }
         }
@@ -165,7 +165,7 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         Map<String, Object> ordinaryMap = new HashMap<>();
         for (ClassifyEnum value : ClassifyEnum.values()) {
             List<TemplatePrintInfoResult> sourceList = ordinaryList.stream().filter(e -> value.equals(e.getTemplateClassify())).collect(Collectors.toList());
-            List<Map<String,Object>> templateList = new ArrayList<>();
+            List<Map<String, Object>> templateList = new ArrayList<>();
             for (TemplatePrintInfoResult templatePrintInfoResult : sourceList) {
                 Map<String, Object> printMap = new HashMap<>();
                 printMap.put("id", String.valueOf(templatePrintInfoResult.getTemplateId()));
@@ -173,9 +173,9 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
                 printMap.put("attachmentId", templatePrintInfoResult.getAttachmentId().toString());
                 templateList.add(printMap);
             }
-            if (templateList.size() > 0){
-                ordinaryMap.put("type",value);
-                ordinaryMap.put("template",templateList);
+            if (templateList.size() > 0) {
+                ordinaryMap.put("type", value);
+                ordinaryMap.put("template", templateList);
                 ordinary.add(ordinaryMap);
             }
         }
@@ -193,17 +193,17 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Long id = printPlanParams.getId();
         Long schoolId = printPlanParams.getSchoolId();
-        if (basicSchoolService.list(new QueryWrapper<BasicSchool>().lambda().eq(BasicSchool::getId,schoolId).eq(BasicSchool::getEnable,true)).size() != 1) {
+        if (basicSchoolService.list(new QueryWrapper<BasicSchool>().lambda().eq(BasicSchool::getId, schoolId).eq(BasicSchool::getEnable, true)).size() != 1) {
             throw ExceptionResultEnum.ERROR.exception("输入的学校id不满足条件 schoolId = " + schoolId);
         }
 
         // 校验是否印试卷和题卡
         List<String> printContentList = printPlanParams.getPrintContent();
         BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(schoolId);
-        if (Objects.isNull(basicExamRule)){
+        if (Objects.isNull(basicExamRule)) {
             throw ExceptionResultEnum.ERROR.exception("未找到学校的通用规则! schoolId : " + schoolId);
         }
-        if (basicExamRule.getIncludePaper() && !printContentList.contains("PAPER")){
+        if (basicExamRule.getIncludePaper() && !printContentList.contains("PAPER")) {
             throw ExceptionResultEnum.ERROR.exception("学校通用规则设置了强制包含试卷的必须选择试卷印品! schoolId : " + schoolId);
         }
         if (printContentList.contains("PAPER") && !printContentList.contains("CARD")) {
@@ -224,7 +224,7 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         } else {
             // 包含印刷计划id -> 编辑印刷计划
             ExamPrintPlan tmp = this.getById(id);
-            if (tmp == null){
+            if (tmp == null) {
                 throw ExceptionResultEnum.ERROR.exception("印刷计划id不存在 id= " + id);
             }
             PrintPlanStatusEnum status = tmp.getStatus();
@@ -243,12 +243,12 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
     public Boolean removePrintPlan(DeleteParams deleteParams) {
         Long id = deleteParams.getId();
         ExamPrintPlan examPrintPlan = this.getById(id);
-        if (examPrintPlan == null){
+        if (examPrintPlan == null) {
             throw ExceptionResultEnum.ERROR.exception("要删除的项目计划不存在 id = " + id);
         }
         // TODO: 2021/4/23 只有新建能删除  && !PrintPlanStatusEnum.READY.equals(examPrintPlan.getStatus())
-        if (!PrintPlanStatusEnum.NEW.equals(examPrintPlan.getStatus())){
-            throw ExceptionResultEnum.ERROR.exception("只有'新建'状态的项目计划可以被删除 status = " + examPrintPlan.getStatus());
+        if (!PrintPlanStatusEnum.NEW.equals(examPrintPlan.getStatus())) {
+            throw ExceptionResultEnum.ERROR.exception("只有'新建'状态的项目计划可以被删除");
         }
 //        if (!PrintPlanStatusEnum.NEW.equals(examPrintPlan.getStatus()) && !PrintPlanStatusEnum.READY.equals(examPrintPlan.getStatus())){
 //            throw ExceptionResultEnum.ERROR.exception("只有'新建'状态的项目计划可以被删除 status = " + examPrintPlan.getStatus());
@@ -277,13 +277,13 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
 
     @Override
     public IPage<ClientPrintTaskDto> listClientPrintTask(Page<ClientPrintTaskDto> page, Long schoolId, Long machineCode, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Set<Long> orgIds) {
-        return this.baseMapper.listClientPrintTask(page, schoolId,machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime,isDownload,validate, orgIds);
+        return this.baseMapper.listClientPrintTask(page, schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
     }
 
 
     @Override
     public List<ClientPrintTaskDto> listClientPrintTask(Long schoolId, Long machineCode, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Set<Long> orgIds) {
-        return this.baseMapper.listClientPrintTask(schoolId,machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime,isDownload,validate, orgIds);
+        return this.baseMapper.listClientPrintTask(schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
     }
 
 
@@ -307,12 +307,12 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         return resultList;
     }
 
-    public Map<String, String> getAttachment(Map map){
+    public Map<String, String> getAttachment(Map map) {
         Map<String, String> fMap = new HashMap<>();
-        fMap.put("type",map.get("type").toString());
+        fMap.put("type", map.get("type").toString());
         String attachmentId = map.get("attachmentId").toString();
         BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
-        if(attachment.getType().equals(".ftl") || attachment.getType().equals(".html")){
+        if (attachment.getType().equals(".ftl") || attachment.getType().equals(".html")) {
             String content = commonService.readFileContent(attachment.getPath());
             fMap.put("content", content);
             fMap.put("utl", null);
@@ -321,7 +321,7 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
 
             Map<String, String> urlMap = commonService.filePreview(attachmentId, false);
             fMap.put("url", urlMap.get("pathUrl"));
-        } else{
+        } else {
             throw ExceptionResultEnum.ERROR.exception("不支持的类型");
         }
         return fMap;

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

@@ -182,9 +182,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         JSONArray jsonArrayOrdinary = JSONArray.parseArray(examPrintPlan.getOrdinaryContent());
                         for (int i = 0; i < jsonArrayOrdinary.size(); i++) {
                             JSONObject jsonObjectOrdinary = jsonArrayOrdinary.getJSONObject(i);
-                            Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
-                            BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                            createPdfUtil.createCheckIn(basicAttachment, ordinaryPdfList, (Integer) jsonObjectOrdinary.get("backupCount"));
+                            if (Objects.nonNull(jsonObjectOrdinary.get("attachmentId"))) {
+                                Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
+                                BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
+                                createPdfUtil.createCheckIn(basicAttachment, ordinaryPdfList, (Integer) jsonObjectOrdinary.get("backupCount"));
+                            }
                         }
                     }
 
@@ -230,7 +232,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             examTaskDetail.setRelatePaperType(paperType);
 
                             //获取试卷pdf
-                            boolean tag = createPdfUtil.getPaperPdf(paperType, examTaskDetail, examPrintPlan.getBackupCount(), paperPdfTempList, backupPaperTempPdfList);
+                            PdfDto pdfDto = createPdfUtil.getPaperPdf(paperType, examTaskDetail, examPrintPlan.getBackupCount(), paperPdfTempList, backupPaperTempPdfList);
+                            examDetailCourse.setPaperPagesA3(pdfDto.getPageCount());
                             paperPdfList.addAll(paperPdfTempList);
                             backupPaperPdfList.addAll(backupPaperTempPdfList);
 
@@ -243,7 +246,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                 String studentContent = cardContent;
 
                                 for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
-                                    basicAttachmentList.add(createPdfUtil.cardHtml(String.format("%02d", i), cardContent, paperType, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList));
+                                    BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, paperType, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList);
+                                    examDetailCourse.setCardPagesA3(basicAttachment.getPages());
+                                    basicAttachmentList.add(basicAttachment);
                                 }
                                 cardPdfList.addAll(cardPdfTempList);
 
@@ -259,13 +264,15 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                     for (int i = 0; i < jsonArrayVariable.size(); i++) {
                                         JSONObject jsonObjectVariable = jsonArrayVariable.getJSONObject(i);
                                         String type = (String) jsonObjectVariable.get("type");
-                                        Long attachmentId = Long.parseLong((String) jsonObjectVariable.get("attachmentId"));
-                                        BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                                        ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
-                                        if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
-                                            createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
-                                        } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
-                                            createPdfUtil.createPaperPackage(tag, basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
+                                        if (Objects.nonNull(jsonObjectVariable.get("attachmentId"))) {
+                                            Long attachmentId = Long.parseLong((String) jsonObjectVariable.get("attachmentId"));
+                                            BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
+                                            ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
+                                            if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
+                                                createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
+                                            } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
+                                                createPdfUtil.createPaperPackage(pdfDto.isTag(), basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
+                                            }
                                         }
                                     }
                                 }
@@ -288,13 +295,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             examCardDetailService.saveOrUpdateBatch(examCardDetailList);
                         }
                         examTaskDetailService.saveOrUpdateBatch(examTaskDetailList);
-
-                        Integer paperPageA3 = 0;
-                        Integer cardPageA3 = 0;
-                        paperPageA3 = paperPageA3 + paperPdfTempList.stream().mapToInt(PdfDto::getPageCount).sum() + backupPaperTempPdfList.stream().mapToInt(PdfDto::getPageCount).sum();
-                        cardPageA3 = cardPageA3 + examStudentTempPdfList.stream().mapToInt(PdfDto::getPageCount).sum() + cardPdfTempList.stream().mapToInt(PdfDto::getPageCount).sum();
-                        examDetailCourse.setPaperPagesA3(paperPageA3);
-                        examDetailCourse.setCardPagesA3(cardPageA3);
                     }
                     detailCourseService.saveOrUpdateBatch(examDetailCourseList);
                     //合并pdf
@@ -363,7 +363,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         ExamPrintPlan examPrintPlan = examPrintPlanService.getById(printPlanId);
 
         if (examPrintPlan == null) {
-            throw ExceptionResultEnum.ERROR.exception("印刷计划不存在printPlanId : " + printPlanId);
+            throw ExceptionResultEnum.ERROR.exception("[印刷计划]不存在");
         }
 
         PrintPlanStatusEnum printPlanStatus = examPrintPlan.getStatus();
@@ -447,6 +447,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
                 Cell cell = row.getCell(index);
                 String cellValue = String.valueOf(ExcelUtil.convert(cell));
+                if (cellValue == null || cellValue.length() < 1 || cellValue.equals("null")) {
+                    throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
+                }
+
                 // TODO: 2021/4/20 可以优化 
                 if (ExaminationDBFieldsEnum.STUDENT_CODE.getDesc().equals(name)) {
                     studentCode = cellValue;
@@ -478,7 +482,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         throw ExceptionResultEnum.ERROR.exception("有数据库不需要的必选字段 : " + name);
                     }
                     if ("secondary".equals(level)) {
-                        // 备选字段处理
                         FieldsDto secondaryField = new FieldsDto();
                         secondaryField.setLevel(level);
                         secondaryField.setCode(code);

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

@@ -14,7 +14,6 @@ import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.PageSizeEnum;
 import com.qmth.distributed.print.business.enums.PrintMethodEnum;
 import com.qmth.distributed.print.business.service.BasicAttachmentService;
-import com.qmth.distributed.print.business.service.BasicExamRuleService;
 import com.qmth.distributed.print.business.service.CommonService;
 import com.qmth.distributed.print.business.service.ExamDetailService;
 import com.qmth.distributed.print.common.contant.SystemConstant;
@@ -74,9 +73,9 @@ public class CreatePdfUtil {
             String filePath = (String) jsonObject.get(SystemConstant.PATH);
             String url = SystemConstant.TEMP_FILES_DIR + File.separator + filePath;
             File localFile = ossUtil.ossDownload(filePath, url);
-            int pageCount = PdfUtil.addPdfPage(localFile);
+            PdfDto pdfDto = PdfUtil.addPdfPage(localFile);
             for (int i = 0; i < printCount; i++) {
-                ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pageCount));
+                ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
             }
         } else {
             basicAttachmentService.saveAttachmentPdf(basicAttachment, ordinaryPdfList, printCount, 0);
@@ -297,8 +296,9 @@ public class CreatePdfUtil {
      * @return
      * @throws IOException
      */
-    public boolean getPaperPdf(String paperType, ExamTaskDetail examTaskDetail, Integer backupCount, List<PdfDto>... pdfList) throws IOException {
+    public PdfDto getPaperPdf(String paperType, ExamTaskDetail examTaskDetail, Integer backupCount, List<PdfDto>... pdfList) throws IOException {
         boolean tag = true;
+        int pages = 0;
         JSONArray jsonArrayPaper = JSONArray.parseArray(examTaskDetail.getPaperAttachmentIds());
         for (int i = 0; i < jsonArrayPaper.size(); i++) {
             JSONObject object = (JSONObject) jsonArrayPaper.get(i);
@@ -311,17 +311,17 @@ public class CreatePdfUtil {
                 String name = (String) object.get("name");
                 if (Objects.equals(name.toUpperCase(), paperType.toUpperCase())) {
                     File file = commonService.getFile(basicAttachment.getPath(), false);
-                    int pages = (int) object.get("pages");
+                    pages = (int) object.get("pages");
                     tag = pages > 2 ? true : false;
-                    int pageCount = PdfUtil.addPdfPage(file);
-                    pdfList[0].add(new PdfDto(file.getPath(), PageSizeEnum.A3, pageCount));
+                    PdfDto pdfDto = PdfUtil.addPdfPage(file);
+                    pdfList[0].add(new PdfDto(file.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
                     for (int j = 1; j <= backupCount; j++) {
-                        pdfList[1].add(new PdfDto(file.getPath(), PageSizeEnum.A3, pageCount));
+                        pdfList[1].add(new PdfDto(file.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
                     }
                 }
             }
         }
-        return tag;
+        return new PdfDto(PageSizeEnum.A3, pages, tag);
     }
 
     /**

+ 7 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfUtil.java

@@ -5,6 +5,9 @@ import com.itextpdf.text.pdf.PdfCopy;
 import com.itextpdf.text.pdf.PdfImportedPage;
 import com.itextpdf.text.pdf.PdfReader;
 import com.itextpdf.text.pdf.PdfStamper;
+import com.qmth.distributed.print.business.bean.dto.PdfDto;
+import com.qmth.distributed.print.business.entity.BasicAttachment;
+import com.qmth.distributed.print.business.enums.PageSizeEnum;
 import com.qmth.distributed.print.business.enums.UploadFileEnum;
 import com.qmth.distributed.print.common.contant.SystemConstant;
 import org.apache.commons.io.IOUtils;
@@ -88,12 +91,13 @@ public class PdfUtil {
      * @return
      * @throws IOException
      */
-    public static int addPdfPage(File pdfFile) throws IOException {
+    public static PdfDto addPdfPage(File pdfFile) throws IOException {
         PdfReader reader = null;
         FileOutputStream fileOutputStream = null;
+        int pageCount = 0;
         try {
             reader = new PdfReader(pdfFile.getPath());
-            int pageCount = reader.getNumberOfPages();
+            pageCount = reader.getNumberOfPages();
             if (Math.abs(pageCount % 2) == 1) {//取偶
                 ByteArrayOutputStream baos = new ByteArrayOutputStream();
                 PdfStamper stamper = new PdfStamper(reader, baos);
@@ -113,7 +117,7 @@ public class PdfUtil {
                 fileOutputStream.close();
             }
         }
-        return Objects.nonNull(reader) ? reader.getNumberOfPages() : 0;
+        return new PdfDto(PageSizeEnum.A3, Objects.nonNull(reader) ? reader.getNumberOfPages() : 0, pageCount);
     }
 
     /**

+ 1 - 0
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -175,6 +175,7 @@
             <if test="endTime != null and endTime != ''">
                 and a.startTime &lt;= #{endTime}
             </if>
+            and (a.auditStatus <![CDATA[ <> ]]> 'AUDITED' and a.reviewStatus <![CDATA[ <> ]]> 'PASS')
         </where>
     </select>
     <select id="listTaskReviewUnaudited" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDto">