浏览代码

印刷任务管理优化和合并pdf修改

wangliang 2 年之前
父节点
当前提交
15444edf71
共有 21 个文件被更改,包括 471 次插入120 次删除
  1. 14 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/PaperPdfDto.java
  2. 13 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/TSchoolPrivilegeParam.java
  3. 48 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/CustomPrivilegeResult.java
  4. 19 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/EditResult.java
  5. 67 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/TSchoolPrivilegeResult.java
  6. 13 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  7. 6 7
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradeBatchServiceImpl.java
  8. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/export/AsyncExportTaskTemplete.java
  9. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/importData/AsyncImportTaskTemplete.java
  10. 5 9
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/push/AsyncPushTaskTemplate.java
  11. 14 14
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  12. 36 26
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java
  13. 23 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfUtil.java
  14. 28 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/MenuCustomController.java
  15. 42 43
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java
  16. 4 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java
  17. 17 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/SysConfig.java
  18. 1 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/PageSizeEnum.java
  19. 5 2
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/PdfTypeEnum.java
  20. 46 2
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java
  21. 68 4
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java

+ 14 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/PaperPdfDto.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.business.bean.dto;
 package com.qmth.distributed.print.business.bean.dto;
 
 
+import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
 import java.io.File;
 import java.io.File;
@@ -23,6 +24,9 @@ public class PaperPdfDto implements Serializable {
     @ApiModelProperty(name = "卷型")
     @ApiModelProperty(name = "卷型")
     String type;
     String type;
 
 
+    @ApiModelProperty(value = "pdf格式")
+    PageSizeEnum pageSize;
+
     public PaperPdfDto() {
     public PaperPdfDto() {
 
 
     }
     }
@@ -32,10 +36,19 @@ public class PaperPdfDto implements Serializable {
         this.pages = pages;
         this.pages = pages;
     }
     }
 
 
-    public PaperPdfDto(String type, File file, int pages) {
+    public PaperPdfDto(String type, File file, int pages, PageSizeEnum pageSize) {
         this.type = type;
         this.type = type;
         this.file = file;
         this.file = file;
         this.pages = pages;
         this.pages = pages;
+        this.pageSize = pageSize;
+    }
+
+    public PageSizeEnum getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(PageSizeEnum pageSize) {
+        this.pageSize = pageSize;
     }
     }
 
 
     public File getFile() {
     public File getFile() {

+ 13 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/TSchoolPrivilegeParam.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.entity.TSchoolPrivilege;
 import com.qmth.teachcloud.common.entity.TSchoolPrivilege;
+import io.swagger.annotations.ApiModelProperty;
 
 
 /**
 /**
  * @Description: 学校自定义菜单 param
  * @Description: 学校自定义菜单 param
@@ -16,8 +17,12 @@ import com.qmth.teachcloud.common.entity.TSchoolPrivilege;
 public class TSchoolPrivilegeParam extends TSchoolPrivilege {
 public class TSchoolPrivilegeParam extends TSchoolPrivilege {
 
 
     @JsonSerialize(using = ToStringSerializer.class)
     @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "权限id数组")
     private Long[] privilegeIds;
     private Long[] privilegeIds;
 
 
+    @ApiModelProperty(value = "pdf格式数组")
+    private String[] pdfSize;
+
     public Long[] getPrivilegeIds() {
     public Long[] getPrivilegeIds() {
         return privilegeIds;
         return privilegeIds;
     }
     }
@@ -25,4 +30,12 @@ public class TSchoolPrivilegeParam extends TSchoolPrivilege {
     public void setPrivilegeIds(Long[] privilegeIds) {
     public void setPrivilegeIds(Long[] privilegeIds) {
         this.privilegeIds = privilegeIds;
         this.privilegeIds = privilegeIds;
     }
     }
+
+    public String[] getPdfSize() {
+        return pdfSize;
+    }
+
+    public void setPdfSize(String[] pdfSize) {
+        this.pdfSize = pdfSize;
+    }
 }
 }

+ 48 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/CustomPrivilegeResult.java

@@ -0,0 +1,48 @@
+package com.qmth.distributed.print.business.bean.result;
+
+import com.qmth.teachcloud.common.bean.dto.PrivilegeDto;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description: 自定义菜单result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/8/24
+ */
+public class CustomPrivilegeResult implements Serializable {
+
+    @ApiModelProperty(value = "自定义菜单")
+    List<PrivilegeDto> customPrivilegeList;
+
+    @ApiModelProperty(value = "全局pdf格式")
+    List<String> sysPdfSize;
+
+    public CustomPrivilegeResult() {
+
+    }
+
+    public CustomPrivilegeResult(List<PrivilegeDto> customPrivilegeList, List<String> sysPdfSize) {
+        this.customPrivilegeList = customPrivilegeList;
+        this.sysPdfSize = sysPdfSize;
+    }
+
+    public List<PrivilegeDto> getCustomPrivilegeList() {
+        return customPrivilegeList;
+    }
+
+    public void setCustomPrivilegeList(List<PrivilegeDto> customPrivilegeList) {
+        this.customPrivilegeList = customPrivilegeList;
+    }
+
+    public List<String> getSysPdfSize() {
+        return sysPdfSize;
+    }
+
+    public void setSysPdfSize(List<String> sysPdfSize) {
+        this.sysPdfSize = sysPdfSize;
+    }
+}

+ 19 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/EditResult.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.bean.result;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
@@ -34,6 +35,17 @@ public class EditResult implements Serializable {
     @ApiModelProperty(value = "pdf总页数")
     @ApiModelProperty(value = "pdf总页数")
     Integer pages;
     Integer pages;
 
 
+    @ApiModelProperty(value = "pdf格式")
+    PageSizeEnum pageSize;
+
+    public PageSizeEnum getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(PageSizeEnum pageSize) {
+        this.pageSize = pageSize;
+    }
+
     public String getUrl() {
     public String getUrl() {
         return url;
         return url;
     }
     }
@@ -98,6 +110,13 @@ public class EditResult implements Serializable {
         this.pages = pages;
         this.pages = pages;
     }
     }
 
 
+    public EditResult(Long id, String url, Integer pages, PageSizeEnum pageSize) {
+        this.id = id;
+        this.url = url;
+        this.pages = pages;
+        this.pageSize = pageSize;
+    }
+
     public EditResult(String url) {
     public EditResult(String url) {
         this.url = url;
         this.url = url;
     }
     }

+ 67 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/TSchoolPrivilegeResult.java

@@ -0,0 +1,67 @@
+package com.qmth.distributed.print.business.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description: 自定义菜单result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/8/24
+ */
+public class TSchoolPrivilegeResult implements Serializable {
+
+    @ApiModelProperty(value = "学校id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long schoolId;
+
+    @ApiModelProperty(value = "自定义菜单id")
+    List<String> privilegeIdList;
+
+    @ApiModelProperty(value = "pdf格式")
+    List<String> pdfSize;
+
+    public TSchoolPrivilegeResult() {
+
+    }
+
+    public TSchoolPrivilegeResult(List<String> privilegeIdList, List<String> pdfSize) {
+        this.privilegeIdList = privilegeIdList;
+        this.pdfSize = pdfSize;
+    }
+
+    public TSchoolPrivilegeResult(Long schoolId, List<String> privilegeIdList, List<String> pdfSize) {
+        this.schoolId = schoolId;
+        this.privilegeIdList = privilegeIdList;
+        this.pdfSize = pdfSize;
+    }
+
+    public List<String> getPrivilegeIdList() {
+        return privilegeIdList;
+    }
+
+    public void setPrivilegeIdList(List<String> privilegeIdList) {
+        this.privilegeIdList = privilegeIdList;
+    }
+
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
+    public List<String> getPdfSize() {
+        return pdfSize;
+    }
+
+    public void setPdfSize(List<String> pdfSize) {
+        this.pdfSize = pdfSize;
+    }
+}

+ 13 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.business.service.impl;
 package com.qmth.distributed.print.business.service.impl;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -154,7 +155,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         List<JSONObject> list = new ArrayList<>();
         List<JSONObject> list = new ArrayList<>();
         if (examDetail.getAttachmentId() != null) {
         if (examDetail.getAttachmentId() != null) {
             JSONObject jsonObject = new JSONObject();
             JSONObject jsonObject = new JSONObject();
-            jsonObject.put("type", PdfTypeEnum.ALL_A3);
+            jsonObject.put("type", PdfTypeEnum.PAPER);
             BasicAttachment attachment = basicAttachmentService.getById(examDetail.getAttachmentId());
             BasicAttachment attachment = basicAttachmentService.getById(examDetail.getAttachmentId());
             jsonObject.put("url", attachment == null ? null : teachcloudCommonService.filePreview(attachment.getPath()));
             jsonObject.put("url", attachment == null ? null : teachcloudCommonService.filePreview(attachment.getPath()));
             list.add(jsonObject);
             list.add(jsonObject);
@@ -166,6 +167,17 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             jsonObject.put("url", attachment == null ? null : teachcloudCommonService.filePreview(attachment.getPath()));
             jsonObject.put("url", attachment == null ? null : teachcloudCommonService.filePreview(attachment.getPath()));
             list.add(jsonObject);
             list.add(jsonObject);
         }
         }
+        if (Objects.nonNull(examDetail.getAttachmentPath())) {
+            JSONObject js = JSONObject.parseObject(examDetail.getAttachmentPath());
+            JSONArray jsonArray = js.getJSONArray("path");
+            for (int i = 0; i < jsonArray.size(); i++) {
+                JSONObject object = jsonArray.getJSONObject(i);
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("type", Objects.nonNull(object.get("printType")) ? PdfTypeEnum.valueOf((String) object.get("printType")) : null);
+                jsonObject.put("url", Objects.nonNull(object.get("pdfPath")) ? teachcloudCommonService.filePreviewByPathAndType((String) object.get("pdfPath"), (String) object.get("type"), false) : null);
+                list.add(jsonObject);
+            }
+        }
         return list;
         return list;
     }
     }
 
 

+ 6 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradeBatchServiceImpl.java

@@ -34,7 +34,6 @@ import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
@@ -211,7 +210,7 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
         lockStyle.setLocked(true);//设置锁定
         lockStyle.setLocked(true);//设置锁定
 
 
         // 未锁定样式
         // 未锁定样式
-        XSSFCellStyle unlockStyle=wb.createCellStyle();
+        XSSFCellStyle unlockStyle = wb.createCellStyle();
         unlockStyle.setLocked(false);//设置未锁定
         unlockStyle.setLocked(false);//设置未锁定
 
 
         XSSFRow headRow = sheet.createRow(0);
         XSSFRow headRow = sheet.createRow(0);
@@ -260,21 +259,21 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
             XSSFCell cell6 = row.createCell(6);
             XSSFCell cell6 = row.createCell(6);
             cell6.setCellStyle(unlockStyle);
             cell6.setCellStyle(unlockStyle);
             cell6.setCellType(CellType.STRING);
             cell6.setCellType(CellType.STRING);
-            if(StringUtils.isNotBlank(examStudentCourseDto.getTeacherName())){
+            if (StringUtils.isNotBlank(examStudentCourseDto.getTeacherName())) {
                 cell6.setCellValue(examStudentCourseDto.getTeacherName());
                 cell6.setCellValue(examStudentCourseDto.getTeacherName());
             }
             }
 
 
             XSSFCell cell7 = row.createCell(7);
             XSSFCell cell7 = row.createCell(7);
             cell7.setCellStyle(unlockStyle);
             cell7.setCellStyle(unlockStyle);
             cell7.setCellType(CellType.STRING);
             cell7.setCellType(CellType.STRING);
-            if(StringUtils.isNotBlank(examStudentCourseDto.getTeacherNumber())){
+            if (StringUtils.isNotBlank(examStudentCourseDto.getTeacherNumber())) {
                 cell7.setCellValue(examStudentCourseDto.getTeacherNumber());
                 cell7.setCellValue(examStudentCourseDto.getTeacherNumber());
             }
             }
         }
         }
 
 
         for (int i = 0; i < fieldsNameList.length; i++) {
         for (int i = 0; i < fieldsNameList.length; i++) {
             sheet.autoSizeColumn(i);
             sheet.autoSizeColumn(i);
-            sheet.setColumnWidth(i,sheet.getColumnWidth(i)*17/10);
+            sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 17 / 10);
         }
         }
 
 
         // sheet添加保护,这个一定要否则光锁定还是可以编辑的
         // sheet添加保护,这个一定要否则光锁定还是可以编辑的
@@ -382,7 +381,7 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
                 String charset = SystemConstant.CHARSET_GBK;
                 String charset = SystemConstant.CHARSET_GBK;
                 CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
                 CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
                 if (commonCacheService != null) {
                 if (commonCacheService != null) {
-                    SysConfig sysConfig = commonCacheService.txtCharsetCache();
+                    SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_CONFIG_KEY_CHARSETS);
                     if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                     if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                         charset = sysConfig.getConfigValue();
                         charset = sysConfig.getConfigValue();
                     }
                     }
@@ -398,7 +397,7 @@ public class GradeBatchServiceImpl extends ServiceImpl<GradeBatchMapper, GradeBa
                     jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
                     jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
                     jsonObject.put(SystemConstant.PATH, dirName);
                     jsonObject.put(SystemConstant.PATH, dirName);
                 } else {//上传至服务器
                 } else {//上传至服务器
-                    fileStoreUtil.copyInputStreamToFile(inputStream,new File(stringJoiner.toString()),DigestUtils.md5Hex(new ByteArrayInputStream(bookByteAry)),LocalCatalogEnum.LOCAL_FILE);
+                    fileStoreUtil.copyInputStreamToFile(inputStream, new File(stringJoiner.toString()), DigestUtils.md5Hex(new ByteArrayInputStream(bookByteAry)), LocalCatalogEnum.LOCAL_FILE);
                     jsonObject.put(SystemConstant.TYPE, SystemConstant.LOCAL);
                     jsonObject.put(SystemConstant.TYPE, SystemConstant.LOCAL);
                     jsonObject.put(SystemConstant.PATH, stringJoiner.toString());
                     jsonObject.put(SystemConstant.PATH, stringJoiner.toString());
                 }
                 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/export/AsyncExportTaskTemplete.java

@@ -103,7 +103,7 @@ public abstract class AsyncExportTaskTemplete {
             String charset = SystemConstant.CHARSET_GBK;
             String charset = SystemConstant.CHARSET_GBK;
             CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
             CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
             if (commonCacheService != null) {
             if (commonCacheService != null) {
-                SysConfig sysConfig = commonCacheService.txtCharsetCache();
+                SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_CONFIG_KEY_CHARSETS);
                 if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                 if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                     charset = sysConfig.getConfigValue();
                     charset = sysConfig.getConfigValue();
                 }
                 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/importData/AsyncImportTaskTemplete.java

@@ -115,7 +115,7 @@ public abstract class AsyncImportTaskTemplete {
             String charset = SystemConstant.CHARSET_GBK;
             String charset = SystemConstant.CHARSET_GBK;
             CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
             CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
             if (commonCacheService != null) {
             if (commonCacheService != null) {
-                SysConfig sysConfig = commonCacheService.txtCharsetCache();
+                SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_CONFIG_KEY_CHARSETS);
                 if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                 if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                     charset = sysConfig.getConfigValue();
                     charset = sysConfig.getConfigValue();
                 }
                 }

+ 5 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/push/AsyncPushTaskTemplate.java

@@ -5,30 +5,26 @@ import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.entity.TBSyncTask;
 import com.qmth.distributed.print.business.entity.TBSyncTask;
 import com.qmth.distributed.print.business.service.TBSyncTaskService;
 import com.qmth.distributed.print.business.service.TBSyncTaskService;
-import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysConfig;
 import com.qmth.teachcloud.common.entity.SysConfig;
-import com.qmth.teachcloud.common.entity.TBTask;
-import com.qmth.teachcloud.common.enums.*;
+import com.qmth.teachcloud.common.enums.LocalCatalogEnum;
+import com.qmth.teachcloud.common.enums.TaskResultEnum;
+import com.qmth.teachcloud.common.enums.TaskStatusEnum;
+import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.CommonCacheService;
-import com.qmth.teachcloud.common.service.SysConfigService;
-import com.qmth.teachcloud.common.service.TBTaskService;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.io.*;
 import java.io.*;
-import java.nio.charset.StandardCharsets;
 import java.text.MessageFormat;
 import java.text.MessageFormat;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.Date;
@@ -81,7 +77,7 @@ public abstract class AsyncPushTaskTemplate {
             String charset = SystemConstant.CHARSET_GBK;
             String charset = SystemConstant.CHARSET_GBK;
             CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
             CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
             if(commonCacheService != null) {
             if(commonCacheService != null) {
-                SysConfig sysConfig = commonCacheService.txtCharsetCache();
+                SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_CONFIG_KEY_CHARSETS);
                 if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                 if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
                     charset = sysConfig.getConfigValue();
                     charset = sysConfig.getConfigValue();
                 }
                 }

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

@@ -170,9 +170,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Lazy
     @Lazy
     PrintCommonService printCommonService;
     PrintCommonService printCommonService;
 
 
-    @Resource
-    private BasicExamService basicExamService;
-
     @Resource
     @Resource
     private DownloadService downloadService;
     private DownloadService downloadService;
 
 
@@ -318,7 +315,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
                     List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
 
 
                     // 查询考试
                     // 查询考试
-                    BasicExam basicExam = basicExamService.getById(examTask.getExamId());
+//                    BasicExam basicExam = basicExamService.getById(examTask.getExamId());
                     //
                     //
                     List<String> paperTypes = Arrays.stream(paperType.split(",")).sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
                     List<String> paperTypes = Arrays.stream(paperType.split(",")).sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
                     int backupCount = examPrintPlan.getBackupCount() != null ? examPrintPlan.getBackupCount() : 0;
                     int backupCount = examPrintPlan.getBackupCount() != null ? examPrintPlan.getBackupCount() : 0;
@@ -349,7 +346,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         if (examStudentList != null && examStudentList.size() > 0) {
                         if (examStudentList != null && examStudentList.size() > 0) {
                             for (ExamStudent t : examStudentList) {
                             for (ExamStudent t : examStudentList) {
                                 if (Objects.nonNull(pdfDto)) {
                                 if (Objects.nonNull(pdfDto)) {
-                                    PdfDto stuPdfDto = createPdfUtil.getExamStudentPaperPdf(t.getPaperType(), paperPdfDto, studentPaperPdfList);
+                                    createPdfUtil.getExamStudentPaperPdf(t.getPaperType(), paperPdfDto, studentPaperPdfList);
                                 }
                                 }
                             }
                             }
                         } else if (examDetail.getPrintCount() != null) {
                         } else if (examDetail.getPrintCount() != null) {
@@ -359,7 +356,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                 int seq = atomicInteger.getAndIncrement();
                                 int seq = atomicInteger.getAndIncrement();
                                 int mod = seq % examTaskDetail.getDrawCount();
                                 int mod = seq % examTaskDetail.getDrawCount();
                                 if (Objects.nonNull(pdfDto)) {
                                 if (Objects.nonNull(pdfDto)) {
-                                    PdfDto stuPdfDto = createPdfUtil.getExamStudentPaperPdf(paperTypes.get(mod), paperPdfDto, studentPaperPdfList);
+                                    createPdfUtil.getExamStudentPaperPdf(paperTypes.get(mod), paperPdfDto, studentPaperPdfList);
                                 }
                                 }
                                 i++;
                                 i++;
                             }
                             }
@@ -562,7 +559,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 List<PdfDto> paperPdfList = new ArrayList<>();//所有试卷
                 List<PdfDto> paperPdfList = new ArrayList<>();//所有试卷
                 List<PdfDto> examStudentPdfList = new ArrayList<>();//所有题卡
                 List<PdfDto> examStudentPdfList = new ArrayList<>();//所有题卡
                 List<PdfDto> backupPaperPdfList = new ArrayList<>();//备份试卷
                 List<PdfDto> backupPaperPdfList = new ArrayList<>();//备份试卷
-                List<PdfDto> cardPdfList = new ArrayList<>();//备份题卡
+                List<PdfDto> backupCardPdfList = new ArrayList<>();//备份题卡
 
 
                 //创建pdf核心逻辑
                 //创建pdf核心逻辑
                 basicAttachmentList = createPdfCoreLogic(examDetailCourseList,
                 basicAttachmentList = createPdfCoreLogic(examDetailCourseList,
@@ -573,23 +570,26 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         basicAttachmentList,
                         basicAttachmentList,
                         attachmentIds,
                         attachmentIds,
                         backupPaperPdfList,
                         backupPaperPdfList,
-                        cardPdfList,
+                        backupCardPdfList,
                         paperPdfList,
                         paperPdfList,
                         examStudentPdfList);
                         examStudentPdfList);
 
 
                 createA4File(examPrintPlan, examDetail, basicSchool, ftlList, examDetailCourseList, ordinaryPdfList, variablePdfList);
                 createA4File(examPrintPlan, examDetail, basicSchool, ftlList, examDetailCourseList, ordinaryPdfList, variablePdfList);
 
 
                 //合并A3(试卷+题卡+备用试卷+备用题卡)
                 //合并A3(试卷+题卡+备用试卷+备用题卡)
-                String dirNameA3 = createPdfUtil.mergeA3Pdf(paperPdfList, examStudentPdfList, backupPaperPdfList, cardPdfList);
+//                String dirNameA3 = createPdfUtil.mergeA3Pdf(paperPdfList, examStudentPdfList, backupPaperPdfList, backupCardPdfList);
+                //合并(试卷+备用试卷)
+                String dirNamePaper = createPdfUtil.mergeA3Pdf(paperPdfList, backupPaperPdfList);
                 //合并A4(签到表+卷袋贴+登记表)
                 //合并A4(签到表+卷袋贴+登记表)
                 String dirNameA4 = createPdfUtil.mergeA4Pdf(variablePdfList, ordinaryPdfList);
                 String dirNameA4 = createPdfUtil.mergeA4Pdf(variablePdfList, ordinaryPdfList);
                 //合并A3(题卡+备用题卡)
                 //合并A3(题卡+备用题卡)
-                String dirNameCardA3 = createPdfUtil.mergeA3Pdf(examStudentPdfList, cardPdfList);
+                String dirNameCardA3 = createPdfUtil.mergeA3Pdf(examStudentPdfList, backupCardPdfList);
 
 
                 List<PdfDto> mergePdfDeleteList = new ArrayList<>();
                 List<PdfDto> mergePdfDeleteList = new ArrayList<>();
                 mergePdfDeleteList.addAll(examStudentPdfList);
                 mergePdfDeleteList.addAll(examStudentPdfList);
-                mergePdfDeleteList.addAll(cardPdfList);
-                BasicAttachment attachment = createPdfUtil.mergePdfSaveDb(dirNameA4, dirNameA3, dirNameCardA3, tbTask, sysUser.getId(), examDetail, basicExamRule, mergePdfDeleteList);
+                mergePdfDeleteList.addAll(backupCardPdfList);
+//                BasicAttachment attachment = createPdfUtil.mergePdfSaveDb(dirNameA4, dirNameA3, dirNameCardA3, tbTask, sysUser.getId(), examDetail, basicExamRule, mergePdfDeleteList);
+                BasicAttachment attachment = createPdfUtil.mergePdfSaveDb(dirNameA4, dirNamePaper, dirNameCardA3, tbTask, sysUser.getId(), examDetail, basicExamRule, mergePdfDeleteList);
                 if (basicAttachmentList != null) {
                 if (basicAttachmentList != null) {
                     basicAttachmentList.add(attachment);
                     basicAttachmentList.add(attachment);
                 }
                 }
@@ -1384,9 +1384,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 }
                 }
             }
             }
         }
         }
-        if (orgInfoList.size() > 0){
+        if (orgInfoList.size() > 0) {
             SysUser requestUser = (SysUser) map.get(SystemConstant.SYS_USER);
             SysUser requestUser = (SysUser) map.get(SystemConstant.SYS_USER);
-            sysOrgService.createOrGetOrgByOrgInfo(orgInfoList,requestUser);
+            sysOrgService.createOrGetOrgByOrgInfo(orgInfoList, requestUser);
         }
         }
         return map;
         return map;
     }
     }

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

@@ -16,9 +16,14 @@ import com.qmth.distributed.print.business.service.ExamStudentService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.*;
+import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.BasicClazz;
+import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.enums.*;
-import com.qmth.teachcloud.common.service.*;
+import com.qmth.teachcloud.common.service.BasicAttachmentService;
+import com.qmth.teachcloud.common.service.BasicCampusService;
+import com.qmth.teachcloud.common.service.BasicClazzService;
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
@@ -77,17 +82,17 @@ public class CreatePdfUtil {
     @Resource
     @Resource
     BasicCampusService basicCampusService;
     BasicCampusService basicCampusService;
 
 
-    @Resource
-    SysOrgService sysOrgService;
+//    @Resource
+//    SysOrgService sysOrgService;
 
 
-    @Resource
-    BasicCourseService basicCourseService;
+//    @Resource
+//    BasicCourseService basicCourseService;
 
 
     @Resource
     @Resource
     BasicClazzService basicClazzService;
     BasicClazzService basicClazzService;
 
 
-    @Resource
-    BasicSchoolService basicSchoolService;
+//    @Resource
+//    BasicSchoolService basicSchoolService;
 
 
     @Resource
     @Resource
     ExamDetailService examDetailService;
     ExamDetailService examDetailService;
@@ -107,7 +112,7 @@ public class CreatePdfUtil {
      * @param printCount
      * @param printCount
      */
      */
     public void createCheckIn(ExamDetail examDetail, BasicAttachment basicAttachment, List<PdfDto> ordinaryPdfList, Integer printCount) throws Exception {
     public void createCheckIn(ExamDetail examDetail, BasicAttachment basicAttachment, List<PdfDto> ordinaryPdfList, Integer printCount) throws Exception {
-        BasicSchool basicSchool = basicSchoolService.getById(examDetail.getSchoolId());
+//        BasicSchool basicSchool = basicSchoolService.getById(examDetail.getSchoolId());
 //        Map<String, List<String>> flowSchoolCodeMap = SystemConstant.getFlowSchoolCodeMap();
 //        Map<String, List<String>> flowSchoolCodeMap = SystemConstant.getFlowSchoolCodeMap();
         if (Objects.isNull(basicAttachment)) {
         if (Objects.isNull(basicAttachment)) {
             throw ExceptionResultEnum.ATTACHMENT_IS_NULL.exception();
             throw ExceptionResultEnum.ATTACHMENT_IS_NULL.exception();
@@ -129,7 +134,7 @@ public class CreatePdfUtil {
 //                } else if (flowSchoolCodeMap.get(SystemConstant.JXZYY_FLOW_KEY).contains(basicSchool.getCode())) {
 //                } else if (flowSchoolCodeMap.get(SystemConstant.JXZYY_FLOW_KEY).contains(basicSchool.getCode())) {
 //                    ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
 //                    ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
 //                } else {
 //                } else {
-                    ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
+                ordinaryPdfList.add(new PdfDto(localFile.getPath(), PageSizeEnum.A4, pdfDto.getPageCount()));
 //                }
 //                }
             }
             }
         } else {
         } else {
@@ -555,11 +560,11 @@ public class CreatePdfUtil {
                     int pages = dto.getPages();
                     int pages = dto.getPages();
                     pagesList.add(pages);
                     pagesList.add(pages);
                     PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
                     PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
-                    pdfList.add(new PdfDto(dto.getFile().getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
+                    pdfList.add(new PdfDto(dto.getFile().getPath(), dto.getPageSize(), pdfDto.getPageCount()));
                 }
                 }
             }
             }
             int pageCount = pagesList.stream().mapToInt(Integer::intValue).sum();
             int pageCount = pagesList.stream().mapToInt(Integer::intValue).sum();
-            return new PdfDto(PageSizeEnum.A3, pageCount);
+            return new PdfDto(paperPdfDto.get(0).getPageSize(), pageCount);
         } else {
         } else {
             return null;
             return null;
         }
         }
@@ -582,11 +587,11 @@ public class CreatePdfUtil {
                 tag = pages > 2;
                 tag = pages > 2;
                 PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
                 PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
                 for (int j = 1; j <= backupCount; j++) {
                 for (int j = 1; j <= backupCount; j++) {
-                    pdfList.add(new PdfDto(dto.getFile().getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
+                    pdfList.add(new PdfDto(dto.getFile().getPath(), dto.getPageSize(), pdfDto.getPageCount()));
                 }
                 }
             }
             }
             int pageCount = pagesList.stream().mapToInt(Integer::intValue).sum();
             int pageCount = pagesList.stream().mapToInt(Integer::intValue).sum();
-            return new PdfDto(PageSizeEnum.A3, pageCount, tag);
+            return new PdfDto(paperPdfDto.get(0).getPageSize(), pageCount, tag);
         } else {
         } else {
             return null;
             return null;
         }
         }
@@ -612,12 +617,17 @@ public class CreatePdfUtil {
                     throw ExceptionResultEnum.ATTACHMENT_IS_NULL.exception();
                     throw ExceptionResultEnum.ATTACHMENT_IS_NULL.exception();
                 }
                 }
                 String name = (String) object.get("name");
                 String name = (String) object.get("name");
+                JSONObject jsonObject = (JSONObject) object.get("original");
                 // 返回抽中的试卷
                 // 返回抽中的试卷
                 for (String type : paperTypes) {
                 for (String type : paperTypes) {
                     if (Objects.equals(name.toUpperCase(), type.toUpperCase())) {
                     if (Objects.equals(name.toUpperCase(), type.toUpperCase())) {
                         File file = teachcloudCommonService.getFile(basicAttachment.getPath(), false);
                         File file = teachcloudCommonService.getFile(basicAttachment.getPath(), false);
                         int pages = (int) object.get("pages");
                         int pages = (int) object.get("pages");
-                        paperPdfDto = new PaperPdfDto(type, file, pages);
+
+                        PageSizeEnum pageSizeEnum = PageSizeEnum.valueOf((String) jsonObject.get("pageSize"));
+                        Optional.ofNullable(pageSizeEnum).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未设置pdf格式"));
+
+                        paperPdfDto = new PaperPdfDto(type, file, pages, pageSizeEnum);
                         paperPdfDtoList.add(paperPdfDto);
                         paperPdfDtoList.add(paperPdfDto);
                         break;
                         break;
                     }
                     }
@@ -766,7 +776,7 @@ public class CreatePdfUtil {
      * 合并pdf后保存数据库
      * 合并pdf后保存数据库
      *
      *
      * @param dirNameA4
      * @param dirNameA4
-     * @param dirNameA3
+     * @param dirNamePaper
      * @param dirNameCardA3
      * @param dirNameCardA3
      * @param tbTask
      * @param tbTask
      * @param userId
      * @param userId
@@ -778,7 +788,7 @@ public class CreatePdfUtil {
      */
      */
     @Transactional
     @Transactional
     public BasicAttachment mergePdfSaveDb(String dirNameA4,
     public BasicAttachment mergePdfSaveDb(String dirNameA4,
-                                          String dirNameA3,
+                                          String dirNamePaper,
                                           String dirNameCardA3,
                                           String dirNameCardA3,
                                           TBTask tbTask,
                                           TBTask tbTask,
                                           Long userId,
                                           Long userId,
@@ -788,17 +798,17 @@ public class CreatePdfUtil {
         boolean oss = dictionaryConfig.sysDomain().isOss();
         boolean oss = dictionaryConfig.sysDomain().isOss();
         StringJoiner stringJoiner = new StringJoiner("").add(dictionaryConfig.fssLocalPdfDomain().getConfig()).add(File.separator);
         StringJoiner stringJoiner = new StringJoiner("").add(dictionaryConfig.fssLocalPdfDomain().getConfig()).add(File.separator);
         // oss上只认"/",windows生成的路径分隔符全部替换为"/"
         // oss上只认"/",windows生成的路径分隔符全部替换为"/"
-        File localA4PdfFile = null, localA3PdfFile = null, localA3PdfCardFile = null;
+        File localA4PdfFile = null, localPaperPdfFile = null, localA3PdfCardFile = null;
         BasicAttachment basicAttachment = null;
         BasicAttachment basicAttachment = null;
         if (Objects.nonNull(dirNameA4)) {
         if (Objects.nonNull(dirNameA4)) {
             dirNameA4 = dirNameA4.replaceAll("\\\\", "/");
             dirNameA4 = dirNameA4.replaceAll("\\\\", "/");
             localA4PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA4);
             localA4PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA4);
         }
         }
         // 试卷+题卡
         // 试卷+题卡
-        if (Objects.nonNull(dirNameA3)) {
-            dirNameA3 = dirNameA3.replaceAll("\\\\", "/");
-            localA3PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA3);
-            basicAttachment = basicAttachmentService.saveAttachmentPdf(dirNameA3, userId);
+        if (Objects.nonNull(dirNamePaper)) {
+            dirNamePaper = dirNamePaper.replaceAll("\\\\", "/");
+            localPaperPdfFile = new File(stringJoiner.toString() + File.separator + dirNamePaper);
+            basicAttachment = basicAttachmentService.saveAttachmentPdf(dirNamePaper, userId);
             tbTask.setImportFileName(basicAttachment.getName());
             tbTask.setImportFileName(basicAttachment.getName());
             tbTask.setImportFilePath(basicAttachment.getPath());
             tbTask.setImportFilePath(basicAttachment.getPath());
             examDetail.setAttachmentId(basicAttachment.getId());
             examDetail.setAttachmentId(basicAttachment.getId());
@@ -816,7 +826,7 @@ public class CreatePdfUtil {
             }
             }
             examDetail.setCardAttachmentId(basicAttachment.getId());
             examDetail.setCardAttachmentId(basicAttachment.getId());
         }
         }
-        examDetail.setPagesA3(PdfUtil.getPdfPages(localA3PdfFile));
+        examDetail.setPagesA3(PdfUtil.getPdfPages(localPaperPdfFile));
         examDetail.setPagesA4(PdfUtil.getPdfPages(localA4PdfFile));
         examDetail.setPagesA4(PdfUtil.getPdfPages(localA4PdfFile));
         if (PrintMethodEnum.AUTO == basicExamRule.getPrintMethod()) {
         if (PrintMethodEnum.AUTO == basicExamRule.getPrintMethod()) {
             examDetail.setStatus(ExamDetailStatusEnum.WAITING);
             examDetail.setStatus(ExamDetailStatusEnum.WAITING);
@@ -824,10 +834,10 @@ public class CreatePdfUtil {
             examDetail.setStatus(ExamDetailStatusEnum.READY);
             examDetail.setStatus(ExamDetailStatusEnum.READY);
         }
         }
         detailService.saveOrUpdate(examDetail);
         detailService.saveOrUpdate(examDetail);
-        if (Objects.nonNull(localA3PdfFile) && oss) {
+        if (Objects.nonNull(localPaperPdfFile) && oss) {
 //            ossUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)));
 //            ossUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)));
-            fileStoreUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)), fileStoreUtil.getUploadEnumByPath(dirNameA3).getFssType());
-            localA3PdfFile.delete();
+            fileStoreUtil.ossUpload(dirNamePaper, localPaperPdfFile, DigestUtils.md5Hex(new FileInputStream(localPaperPdfFile)), fileStoreUtil.getUploadEnumByPath(dirNamePaper).getFssType());
+            localPaperPdfFile.delete();
         }
         }
         if (Objects.nonNull(localA3PdfCardFile) && oss) {
         if (Objects.nonNull(localA3PdfCardFile) && oss) {
             fileStoreUtil.ossUpload(dirNameCardA3, localA3PdfCardFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfCardFile)), fileStoreUtil.getUploadEnumByPath(dirNameCardA3).getFssType());
             fileStoreUtil.ossUpload(dirNameCardA3, localA3PdfCardFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfCardFile)), fileStoreUtil.getUploadEnumByPath(dirNameCardA3).getFssType());

+ 23 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfUtil.java

@@ -8,9 +8,11 @@ import com.qmth.distributed.print.business.bean.dto.PdfDto;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysConfig;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
@@ -18,9 +20,7 @@ import org.slf4j.LoggerFactory;
 
 
 import java.io.*;
 import java.io.*;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.StringJoiner;
+import java.util.*;
 
 
 /**
 /**
  * @Description: 合并pdf util
  * @Description: 合并pdf util
@@ -100,10 +100,13 @@ public class PdfUtil {
         PdfReader reader = null;
         PdfReader reader = null;
         FileOutputStream fileOutputStream = null;
         FileOutputStream fileOutputStream = null;
         int pageCount = 0;
         int pageCount = 0;
+        PageSizeEnum pageSizeEnum = null;
         try {
         try {
             if (Objects.nonNull(pdfFile)) {
             if (Objects.nonNull(pdfFile)) {
                 reader = new PdfReader(ByteArray.fromFile(pdfFile).value());
                 reader = new PdfReader(ByteArray.fromFile(pdfFile).value());
                 pageCount = reader.getNumberOfPages();
                 pageCount = reader.getNumberOfPages();
+                Rectangle rectangle = reader.getPageSize(1);
+                pageSizeEnum = PageSizeEnum.convertToEnum(rectangle.getWidth(), rectangle.getHeight());
                 if (Math.abs(pageCount % 2) == 1) {//取偶
                 if (Math.abs(pageCount % 2) == 1) {//取偶
                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
                     PdfStamper stamper = new PdfStamper(reader, baos);
                     PdfStamper stamper = new PdfStamper(reader, baos);
@@ -124,7 +127,7 @@ public class PdfUtil {
                 fileOutputStream.close();
                 fileOutputStream.close();
             }
             }
         }
         }
-        return new PdfDto(PageSizeEnum.A3, Objects.nonNull(reader) ? reader.getNumberOfPages() : 0, pageCount);
+        return new PdfDto(pageSizeEnum, Objects.nonNull(reader) ? reader.getNumberOfPages() : 0, pageCount);
     }
     }
 
 
     /**
     /**
@@ -186,6 +189,22 @@ public class PdfUtil {
 //                }
 //                }
 //            }
 //            }
         }
         }
+        Long schoolId = SystemConstant.getHeadOrUserSchoolId();
+        CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
+        SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
+        if (Objects.isNull(sysConfig)) {
+            sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
+        }
+        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("未配置全局pdf格式清单"));
+
+        String pdfSize = sysConfig.getConfigValue().replace("8K", "A6");
+        List<String> pdfSizeList = Objects.nonNull(sysConfig) ? Arrays.asList(pdfSize.replaceAll("\\[", "").replaceAll("\\]", "").split(", ")) : null;
+
+        PageSizeEnum finalPageSizeEnum = pageSizeEnum;
+        long count = pdfSizeList.stream().filter(s -> finalPageSizeEnum.name().equalsIgnoreCase(s)).count();
+        if (count == 0) {
+            throw ExceptionResultEnum.ERROR.exception("pdf文件格式只能为" + sysConfig.getConfigValue());
+        }
         return pageSizeEnum;
         return pageSizeEnum;
     }
     }
 
 

+ 28 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/MenuCustomController.java

@@ -4,6 +4,7 @@ package com.qmth.distributed.print.api;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.params.TSchoolPrivilegeParam;
 import com.qmth.distributed.print.business.bean.params.TSchoolPrivilegeParam;
+import com.qmth.teachcloud.common.bean.dto.PrivilegeDto;
 import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.Result;
@@ -57,11 +58,18 @@ public class MenuCustomController {
     @Resource
     @Resource
     TeachcloudCommonService commonService;
     TeachcloudCommonService commonService;
 
 
+    @Resource
+    SysConfigService sysConfigService;
+
     @ApiOperation(value = "查询自定义菜单权限")
     @ApiOperation(value = "查询自定义菜单权限")
     @ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysPrivilege.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysPrivilege.class)})
     @RequestMapping(value = "/custom/list", method = RequestMethod.POST)
     @RequestMapping(value = "/custom/list", method = RequestMethod.POST)
     public Result customList() {
     public Result customList() {
-        return ResultUtil.ok(sysPrivilegeService.addCustomList());
+        List<PrivilegeDto> customPrivilegeList = sysPrivilegeService.addCustomList();
+//        SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
+//        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("未配置全局pdf格式清单"));
+//        return ResultUtil.ok(new CustomPrivilegeResult(customPrivilegeList, Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "))));
+        return ResultUtil.ok(customPrivilegeList);
     }
     }
 
 
     @ApiOperation(value = "学校新增/修改自定义菜单权限")
     @ApiOperation(value = "学校新增/修改自定义菜单权限")
@@ -127,6 +135,21 @@ public class MenuCustomController {
                 }
                 }
             }
             }
         }
         }
+
+//        SysConfig sysConfig = commonCacheService.addSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
+//        if (Objects.isNull(sysConfig)) {
+//            sysConfig = new SysConfig(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST, "pdf格式清单", Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
+//            commonCacheService.updateSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
+//        } else {
+//            if (Objects.nonNull(tSchoolPrivilegeParam.getPdfSize()) && tSchoolPrivilegeParam.getPdfSize().length > 0) {
+//                sysConfig.setConfigValue(Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
+//                commonCacheService.updateSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
+//            } else {
+//                sysConfig.setConfigValue(null);
+//                commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
+//            }
+//        }
+//        sysConfigService.saveOrUpdate(sysConfig);
         return ResultUtil.ok(true);
         return ResultUtil.ok(true);
     }
     }
 
 
@@ -135,6 +158,9 @@ public class MenuCustomController {
     @RequestMapping(value = "/custom/get_school_custom_privileges", method = RequestMethod.POST)
     @RequestMapping(value = "/custom/get_school_custom_privileges", method = RequestMethod.POST)
     public Result getRolePrivileges(@RequestParam(value = "schoolId", required = true) Long schoolId) {
     public Result getRolePrivileges(@RequestParam(value = "schoolId", required = true) Long schoolId) {
         List<TSchoolPrivilege> tSchoolPrivilegeList = tSchoolPrivilegeService.findBySchoolId(schoolId);
         List<TSchoolPrivilege> tSchoolPrivilegeList = tSchoolPrivilegeService.findBySchoolId(schoolId);
-        return ResultUtil.ok(tSchoolPrivilegeList.stream().map(s -> String.valueOf(s.getPrivilegeId())).collect(Collectors.toList()));
+        List<String> privilegeIdList = tSchoolPrivilegeList.stream().map(s -> String.valueOf(s.getPrivilegeId())).collect(Collectors.toList());
+//        SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
+//        return ResultUtil.ok(new TSchoolPrivilegeResult(schoolId, privilegeIdList, Objects.nonNull(sysConfig) ? Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")) : null));
+        return ResultUtil.ok(privilegeIdList);
     }
     }
 }
 }

+ 42 - 43
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -30,13 +30,10 @@ import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
-import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.http.entity.ContentType;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -45,9 +42,6 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import javax.validation.Valid;
 import java.io.File;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -429,49 +423,54 @@ public class SysController {
         Map<String, EditResult> resultMap = new HashMap<>();
         Map<String, EditResult> resultMap = new HashMap<>();
         BasicAttachment basicOriginalAttachment = null;
         BasicAttachment basicOriginalAttachment = null;
         BasicAttachment basicTranslateAttachment = null;
         BasicAttachment basicTranslateAttachment = null;
-        EditResult original = new EditResult();
-        EditResult translate = new EditResult();
         File pdfOriginalFile = null;
         File pdfOriginalFile = null;
         File localTempFile = null;
         File localTempFile = null;
         try {
         try {
             pdfOriginalFile = FileUtil.multipartFileToFile(file);
             pdfOriginalFile = FileUtil.multipartFileToFile(file);
             PageSizeEnum pageSizeEnum = PdfUtil.getPdfFormat(pdfOriginalFile);
             PageSizeEnum pageSizeEnum = PdfUtil.getPdfFormat(pdfOriginalFile);
-            switch (pageSizeEnum) {
-                case A3:
-                    basicOriginalAttachment = printCommonService.saveAttachment(file, ServletUtil.getRequestMd5(), type);
-                    if (Objects.isNull(basicOriginalAttachment)) {
-                        throw ExceptionResultEnum.ATTACHMENT_ERROR.exception();
-                    }
-                    original.setId(basicOriginalAttachment.getId());
-                    original.setUrl(teachcloudCommonService.filePreview(basicOriginalAttachment.getPath()));
-                    original.setPages(basicOriginalAttachment.getPages());
-
-                    BeanUtils.copyProperties(original, translate);
-                    break;
-                case A4:
-                    basicOriginalAttachment = printCommonService.saveAttachment(file, ServletUtil.getRequestMd5(), type);
-                    if (Objects.isNull(basicOriginalAttachment)) {
-                        throw ExceptionResultEnum.ATTACHMENT_ERROR.exception();
-                    }
-                    original.setId(basicOriginalAttachment.getId());
-                    original.setUrl(teachcloudCommonService.filePreview(basicOriginalAttachment.getPath()));
-                    original.setPages(basicOriginalAttachment.getPages());
-
-                    String destUrl = dictionaryConfig.fssLocalPdfDomain().getConfig() + File.separator + file.getOriginalFilename();
-                    localTempFile = new File(destUrl);
-                    OutputStream out = new FileOutputStream(localTempFile);
-                    PdfUtil.concatPDFs(new FileInputStream(pdfOriginalFile), out, false);
-                    // File转换成MutipartFile
-                    FileInputStream inputStream = new FileInputStream(localTempFile);
-                    MultipartFile multipartFile = new MockMultipartFile(localTempFile.getName(), localTempFile.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
-                    basicTranslateAttachment = printCommonService.saveAttachment(multipartFile, DigestUtils.md5Hex(multipartFile.getBytes()), type);
-                    translate.setId(basicTranslateAttachment.getId());
-                    translate.setUrl(teachcloudCommonService.filePreview(basicTranslateAttachment.getPath()));
-                    translate.setPages(basicTranslateAttachment.getPages());
-                    break;
-                default:
-                    throw ExceptionResultEnum.ERROR.exception("请上传A4或A3格式的试卷文件");
+            basicOriginalAttachment = printCommonService.saveAttachment(file, ServletUtil.getRequestMd5(), type);
+            if (Objects.isNull(basicOriginalAttachment)) {
+                throw ExceptionResultEnum.ATTACHMENT_ERROR.exception();
             }
             }
+            EditResult original = new EditResult(basicOriginalAttachment.getId(), teachcloudCommonService.filePreview(basicOriginalAttachment.getPath()), basicOriginalAttachment.getPages(), pageSizeEnum);
+            EditResult translate = new EditResult();
+            BeanUtils.copyProperties(original, translate);
+            //            switch (pageSizeEnum) {
+//                case A3:
+//                    basicOriginalAttachment = printCommonService.saveAttachment(file, ServletUtil.getRequestMd5(), type);
+//                    if (Objects.isNull(basicOriginalAttachment)) {
+//                        throw ExceptionResultEnum.ATTACHMENT_ERROR.exception();
+//                    }
+//                    original.setId(basicOriginalAttachment.getId());
+//                    original.setUrl(teachcloudCommonService.filePreview(basicOriginalAttachment.getPath()));
+//                    original.setPages(basicOriginalAttachment.getPages());
+//
+//                    BeanUtils.copyProperties(original, translate);
+//                    break;
+//                case A4:
+//                    basicOriginalAttachment = printCommonService.saveAttachment(file, ServletUtil.getRequestMd5(), type);
+//                    if (Objects.isNull(basicOriginalAttachment)) {
+//                        throw ExceptionResultEnum.ATTACHMENT_ERROR.exception();
+//                    }
+//                    original.setId(basicOriginalAttachment.getId());
+//                    original.setUrl(teachcloudCommonService.filePreview(basicOriginalAttachment.getPath()));
+//                    original.setPages(basicOriginalAttachment.getPages());
+//
+//                    String destUrl = dictionaryConfig.fssLocalPdfDomain().getConfig() + File.separator + file.getOriginalFilename();
+//                    localTempFile = new File(destUrl);
+//                    OutputStream out = new FileOutputStream(localTempFile);
+//                    PdfUtil.concatPDFs(new FileInputStream(pdfOriginalFile), out, false);
+//                    // File转换成MutipartFile
+//                    FileInputStream inputStream = new FileInputStream(localTempFile);
+//                    MultipartFile multipartFile = new MockMultipartFile(localTempFile.getName(), localTempFile.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
+//                    basicTranslateAttachment = printCommonService.saveAttachment(multipartFile, DigestUtils.md5Hex(multipartFile.getBytes()), type);
+//                    translate.setId(basicTranslateAttachment.getId());
+//                    translate.setUrl(teachcloudCommonService.filePreview(basicTranslateAttachment.getPath()));
+//                    translate.setPages(basicTranslateAttachment.getPages());
+//                    break;
+//                default:
+//                    throw ExceptionResultEnum.ERROR.exception("请上传A4或A3格式的试卷文件");
+//            }
             resultMap.put("original", original);
             resultMap.put("original", original);
             resultMap.put("translate", translate);
             resultMap.put("translate", translate);
         } catch (Exception e) {
         } catch (Exception e) {

+ 4 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -40,6 +40,9 @@ public class SystemConstant {
     /**
     /**
      * 系统常量
      * 系统常量
      */
      */
+    public static final String SYS_CONFIG_KEY_CHARSETS = "sys.txt.charset";
+    public static final String SYS_PDF_SIZE_LIST = "sys.pdf.size.list";
+    public static final String PDF_SIZE_LIST = "pdf.size.list";
     public static final String CHARSET_NAME = "UTF-8";
     public static final String CHARSET_NAME = "UTF-8";
     //    public static final String CHARSET_GB2312 = "gb2312";
     //    public static final String CHARSET_GB2312 = "gb2312";
     public static final String CHARSET_GBK = "gbk";
     public static final String CHARSET_GBK = "gbk";
@@ -144,7 +147,7 @@ public class SystemConstant {
     public static final String USER_ROLE_PRIVILEGE_CACHE = "user:role:privilege:cache";
     public static final String USER_ROLE_PRIVILEGE_CACHE = "user:role:privilege:cache";
     public static final String ROLE_CACHE = "role:cache";
     public static final String ROLE_CACHE = "role:cache";
     public static final String AUTH_INFO_CACHE = "auth:info:cache";
     public static final String AUTH_INFO_CACHE = "auth:info:cache";
-    public static final String TXT_CHARSET_CACHE = "charset:txt:cache";
+    public static final String SYS_CONFIG_CACHE = "sys:config:cache";
     public static final String CUSTOM_PRIVILEGE_CACHE = "custom:privilege:cache";
     public static final String CUSTOM_PRIVILEGE_CACHE = "custom:privilege:cache";
 
 
     /**
     /**

+ 17 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/SysConfig.java

@@ -1,10 +1,12 @@
 package com.qmth.teachcloud.common.entity;
 package com.qmth.teachcloud.common.entity;
 
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.base.BaseEntity;
+import com.qmth.teachcloud.common.contant.SystemConstant;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -46,11 +48,25 @@ public class SysConfig extends BaseEntity implements Serializable {
     /**
     /**
      * 参数键值
      * 参数键值
      */
      */
-    @TableField("config_value")
+    @TableField(value = "config_value", updateStrategy = FieldStrategy.IGNORED)
     private String configValue;
     private String configValue;
 
 
     private String remark;
     private String remark;
 
 
+    public SysConfig() {
+
+    }
+
+    public SysConfig(Long schoolId, String configKey, String configName, String configValue) {
+        setId(SystemConstant.getDbUuid());
+        this.schoolId = schoolId;
+        this.configKey = configKey;
+        this.configName = configName;
+        this.configValue = configValue;
+        setCreateId(1L);
+        setCreateTime(System.currentTimeMillis());
+    }
+
     public static long getSerialVersionUID() {
     public static long getSerialVersionUID() {
         return serialVersionUID;
         return serialVersionUID;
     }
     }

+ 1 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/PageSizeEnum.java

@@ -16,7 +16,7 @@ public enum PageSizeEnum {
     A3(842.0F, 1191.0F),
     A3(842.0F, 1191.0F),
     A4(595.0F, 842.0F),
     A4(595.0F, 842.0F),
     A5(420.0F, 595.0F),
     A5(420.0F, 595.0F),
-    A6(297.0F, 420.0F),
+    A6(297.0F, 420.0F),//8K
     A7(210.0F, 297.0F),
     A7(210.0F, 297.0F),
     A8(148.0F, 210.0F),
     A8(148.0F, 210.0F),
     A9(105.0F, 148.0F),
     A9(105.0F, 148.0F),

+ 5 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/PdfTypeEnum.java

@@ -9,8 +9,11 @@ import java.util.List;
  */
  */
 public enum PdfTypeEnum {
 public enum PdfTypeEnum {
 
 
-    ALL_A3("所有A3合并文件"),
-    CARD_A3("题卡A3合并文件");
+    PAPER("试卷合并文件"),
+    CARD_A3("题卡A3合并文件"),
+    PACKAGE("卷袋贴文件"),
+    SIGN("签到表文件"),
+    CHECK_IN("登记表文件");
 
 
     PdfTypeEnum(String desc) {
     PdfTypeEnum(String desc) {
         this.desc = desc;
         this.desc = desc;

+ 46 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java

@@ -359,7 +359,51 @@ public interface CommonCacheService {
     public void removeAuthInfoCache(String code);
     public void removeAuthInfoCache(String code);
 
 
     /**
     /**
-     * 添加编码缓存
+     * 添加系统参数缓存
+     *
+     * @param key
+     * @return
+     */
+    public SysConfig addSysConfigCache(String key);
+
+    /**
+     * 更新系统参数缓存
+     *
+     * @param key
+     * @return
+     */
+    public SysConfig updateSysConfigCache(String key);
+
+    /**
+     * 删除系统参数缓存
+     *
+     * @param key
+     */
+    public void removeSysConfigCache(String key);
+
+    /**
+     * 添加系统参数缓存
+     *
+     * @param schoolId
+     * @param key
+     * @return
+     */
+    public SysConfig addSysConfigCache(Long schoolId, String key);
+
+    /**
+     * 更新系统参数缓存
+     *
+     * @param schoolId
+     * @param key
+     * @return
+     */
+    public SysConfig updateSysConfigCache(Long schoolId, String key);
+
+    /**
+     * 删除系统参数缓存
+     *
+     * @param schoolId
+     * @param key
      */
      */
-    public SysConfig txtCharsetCache();
+    public void removeSysConfigCache(Long schoolId, String key);
 }
 }

+ 68 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java

@@ -573,11 +573,75 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     }
     }
 
 
     /**
     /**
-     * 添加编码缓存
+     * 添加系统参数缓存
+     *
+     * @param key
+     * @return
+     */
+    @Override
+    @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0")
+    public SysConfig addSysConfigCache(String key) {
+        return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
+    }
+
+    /**
+     * 更新系统参数缓存
+     *
+     * @param key
+     * @return
+     */
+    @Override
+    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", condition = "#result != null")
+    public SysConfig updateSysConfigCache(String key) {
+        return sysConfigService.getById(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
+    }
+
+    /**
+     * 删除系统参数缓存
+     *
+     * @param key
+     */
+    @Override
+    @CacheEvict(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0")
+    public void removeSysConfigCache(String key) {
+
+    }
+
+    /**
+     * 添加系统参数缓存
+     *
+     * @param schoolId
+     * @param key
+     * @return
+     */
+    @Override
+    @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1")
+    public SysConfig addSysConfigCache(Long schoolId, String key) {
+        return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getSchoolId, schoolId).eq(SysConfig::getConfigKey, key));
+    }
+
+    /**
+     * 更新系统参数缓存
+     *
+     * @param schoolId
+     * @param key
+     * @return
+     */
+    @Override
+    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", condition = "#result != null")
+    public SysConfig updateSysConfigCache(Long schoolId, String key) {
+        return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getSchoolId, schoolId).eq(SysConfig::getConfigKey, key));
+    }
+
+    /**
+     * 删除系统参数缓存
+     *
+     * @param schoolId
+     * @param key
      */
      */
     @Override
     @Override
-    @Cacheable(value = SystemConstant.TXT_CHARSET_CACHE)
-    public SysConfig txtCharsetCache() {
-        return sysConfigService.getByKey("sys.txt.charset");
+    @CacheEvict(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1")
+    public void removeSysConfigCache(Long schoolId, String key) {
+
     }
     }
 }
 }