Преглед на файлове

v2.2.2bug修改-新登记表

xiaof преди 3 години
родител
ревизия
61c1274aa1

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

@@ -143,6 +143,9 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
     @Transactional
     public BasicAttachment saveAttachmentPdf(ClassifyEnum classifyEnum, ExamDetail examDetail, BasicAttachment basicAttachment, List<PdfDto> pdfList, Integer printCount, Integer sequence) throws IOException, DocumentException {
         try {
+            BasicSchool basicSchool = (BasicSchool) ServletUtil.getRequestSchool();
+            Map<String, String> flowSchoolCodeMap = SystemConstant.getFlowSchoolCodeMap();
+
             boolean oss = dictionaryConfig.sysDomain().isOss();
             JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
             String type = basicAttachment.getType();
@@ -180,7 +183,12 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
                 pdfFile.getParentFile().mkdirs();
                 pdfFile.createNewFile();
             }
-            HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A4);
+            if (Objects.equals(basicSchool.getCode(), flowSchoolCodeMap.get(SystemConstant.GDYKDX_FLOW_KEY))) {
+                HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A3);
+            } else if(Objects.equals(basicSchool.getCode(), flowSchoolCodeMap.get(SystemConstant.JXZYY_FLOW_KEY))){
+                HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A4);
+            }
+
 //            File pdfFile = asposePdfUtil.documentToPdf(htmlFile.getPath(), destUrl, PaperSize.A4);
             String htmlFileMd5 = DigestUtils.md5Hex(new FileInputStream(htmlFile));
             byte[] data = ByteArray.fromFile(pdfFile).value();
@@ -215,7 +223,11 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
             examDetail.setAttachmentPath(attachmentPath.toJSONString());
             basicAttachment.setPages(pdfDto.getActualPageCount());
             for (int i = 0; i < printCount; i++) {
-                pdfList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount(), sequence));
+                if (Objects.equals(basicSchool.getCode(), flowSchoolCodeMap.get(SystemConstant.GDYKDX_FLOW_KEY))) {
+                    pdfList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A3, pdfDto.getPageCount(), sequence));
+                } else if(Objects.equals(basicSchool.getCode(), flowSchoolCodeMap.get(SystemConstant.JXZYY_FLOW_KEY))){
+                    pdfList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount(), sequence));
+                }
             }
         } catch (Exception e) {
             log.error("请求出错", e);

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

@@ -24,6 +24,7 @@ import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -98,6 +99,8 @@ public class CreatePdfUtil {
      * @param printCount
      */
     public void createCheckIn(ExamDetail examDetail, BasicAttachment basicAttachment, List<PdfDto> ordinaryPdfList, Integer printCount) throws Exception {
+        BasicSchool basicSchool = (BasicSchool) ServletUtil.getRequestSchool();
+        Map<String, String> flowSchoolCodeMap = SystemConstant.getFlowSchoolCodeMap();
         if (Objects.isNull(basicAttachment)) {
             throw ExceptionResultEnum.ATTACHMENT_IS_NULL.exception();
         }
@@ -113,7 +116,11 @@ public class CreatePdfUtil {
             File localFile = fileStoreUtil.ossDownload(filePath, url, uploadFileEnum.getFssType());
             PdfDto pdfDto = PdfUtil.addPdfPage(localFile);
             for (int i = 0; i < printCount; i++) {
-                ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
+                if (Objects.equals(basicSchool.getCode(), flowSchoolCodeMap.get(SystemConstant.GDYKDX_FLOW_KEY))) {
+                    ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
+                } else if(Objects.equals(basicSchool.getCode(), flowSchoolCodeMap.get(SystemConstant.JXZYY_FLOW_KEY))){
+                    ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
+                }
             }
         } else {
             printCommonService.saveAttachmentPdf(ClassifyEnum.CHECK_IN, examDetail, basicAttachment, ordinaryPdfList, printCount, 0);