wangliang před 4 roky
rodič
revize
14c0a71f4f

+ 0 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamStudentDto.java

@@ -1,8 +1,5 @@
 package com.qmth.distributed.print.business.bean.dto;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import io.swagger.annotations.ApiModelProperty;
 

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/CommonService.java

@@ -9,10 +9,10 @@ import com.qmth.distributed.print.business.entity.SysUser;
 import com.qmth.distributed.print.business.entity.SysUserRole;
 import com.qmth.distributed.print.business.enums.PrivilegePropertyEnum;
 
-import java.io.IOException;
-import java.io.InputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.security.NoSuchAlgorithmException;
 import java.util.List;
 
@@ -129,7 +129,7 @@ public interface CommonService {
      * @param pdf
      * @return
      */
-    public String getFile(String path, boolean pdf) throws IOException;
+    public File getFile(String path, boolean pdf) throws IOException;
 
     /**
      * 下载文件到本地

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

@@ -416,7 +416,7 @@ public class CommonServiceImpl implements CommonService {
      * @throws IOException
      */
     @Override
-    public String getFile(String path, boolean pdf) throws IOException {
+    public File getFile(String path, boolean pdf) throws IOException {
         File file = null;
         JSONObject jsonObject = JSONObject.parseObject(path);
         String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
@@ -427,7 +427,7 @@ public class CommonServiceImpl implements CommonService {
         } else {
             file = new File(localPath.toString());
         }
-        return file.getPath();
+        return file;
     }
 
     @Override

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

@@ -37,10 +37,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.LinkedMultiValueMap;
 
 import javax.annotation.Resource;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
 import java.io.*;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -275,15 +271,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                     String type = (String) jsonObjectVariable.get("type");
                                     Long attachmentId = (Long) jsonObjectVariable.get("attachmentId");
                                     BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                                    String htmlContent = new String(commonService.getFileByte(basicAttachment.getPath(), false), StandardCharsets.UTF_8);
-                                    log.info("htmlContent:{}", htmlContent);
+                                    commonService.getFile(basicAttachment.getPath(), false);
+//                                    log.info("htmlContent:{}", htmlContent);
                                     if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
                                         signVariableBackupCount = (Integer) jsonObjectVariable.get("backupCount");
+                                        createSignBook(basicAttachment, basicSchool.getName(), examDetailCourse, examStudentList, variablePdfList);
                                     } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAG")) {//卷袋贴
                                         packagVariableBackupCount = (Integer) jsonObjectVariable.get("backupCount");
                                     }
-//                                    createSignBook(basicAttachment, htmlContent, examDetailCourse, basicSchool.getName(), examStudentList, variablePdfList);
-                                    createSignBook(basicAttachment, examDetailCourse, basicSchool.getName(), examStudentList, variablePdfList);
                                 }
                             }
 
@@ -317,30 +312,30 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public Map<String,Object> executeExaminationLogic(Map<String, Object> map) throws Exception {
+    public Map<String, Object> executeExaminationLogic(Map<String, Object> map) throws Exception {
 //        printPlanId, courseCode, paperNumber, examPlace, examRoom, packageCode,
         Long printPlanId = null;
-        if (map.get("printPlanId") != null){
+        if (map.get("printPlanId") != null) {
             printPlanId = SystemConstant.convertIdToLong(String.valueOf(map.get("printPlanId")));
         }
         String courseCode = null;
-        if (map.get("courseCode") != null){
+        if (map.get("courseCode") != null) {
             courseCode = String.valueOf(map.get("courseCode"));
         }
         String paperNumber = null;
-        if (map.get("paperNumber") != null){
+        if (map.get("paperNumber") != null) {
             paperNumber = String.valueOf(map.get("paperNumber"));
         }
         String examPlace = null;
-        if (map.get("examPlace") != null){
+        if (map.get("examPlace") != null) {
             examPlace = String.valueOf(map.get("examPlace"));
         }
         String examRoom = null;
-        if (map.get("examRoom") != null){
+        if (map.get("examRoom") != null) {
             examRoom = String.valueOf(map.get("examRoom"));
         }
         String packageCode = null;
-        if (map.get("packageCode") != null){
+        if (map.get("packageCode") != null) {
             packageCode = String.valueOf(map.get("packageCode"));
         }
 
@@ -354,7 +349,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         System.out.println("examinationResultList = " + JSON.toJSONString(examinationResultList));
 
         OutputStream outputStream = new ByteArrayOutputStream();
-        ExcelUtil.excelMake(ExaminationResult.class,examinationResultList,outputStream);
+        ExcelUtil.excelMake(ExaminationResult.class, examinationResultList, outputStream);
 
         InputStream in = ConvertUtil.parse(outputStream);
 
@@ -371,7 +366,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         Long userId = tbTask.getCreateId();
         ExamPrintPlan examPrintPlan = examPrintPlanService.getById(printPlanId);
 
-        if (examPrintPlan == null){
+        if (examPrintPlan == null) {
             throw ExceptionResultEnum.ERROR.exception("印刷计划不存在printPlanId : " + printPlanId);
         }
         String printPlanName = examPrintPlan.getName();
@@ -505,11 +500,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
 
         // 组装exam_detail数据
-        examDetailService.disposeExamDetailByExaminationExcel(dataList,userId);
+        examDetailService.disposeExamDetailByExaminationExcel(dataList, userId);
         // 组装exam_detail_course数据
-        examDetailService.disposeExamDetailCourseByExaminationExcel(dataList,userId);
+        examDetailService.disposeExamDetailCourseByExaminationExcel(dataList, userId);
         // 组装exam_student数据
-        examDetailService.disposeExamStudentByExaminationExcel(dataList,userId);
+        examDetailService.disposeExamStudentByExaminationExcel(dataList, userId);
         return null;
     }
 
@@ -517,148 +512,27 @@ public class TaskLogicServiceImpl implements TaskLogicService {
      * 创建签到表
      *
      * @param basicAttachment
-     * @param examDetailCourse
      * @param schoolName
+     * @param examDetailCourse
      * @param examStudentList
      * @param variablePdfList
      * @throws IOException
      */
-    private void createSignBook(BasicAttachment basicAttachment,
-//                                String htmlContent,
-                                ExamDetailCourse examDetailCourse, String schoolName, List<ExamStudent> examStudentList, List<String> variablePdfList) throws IOException {
-        /**html
-         htmlContent = htmlContent.replaceAll("\\$\\{examDetailCourseId\\}", examDetailCourse.getId() + "");
-         htmlContent = htmlContent.replaceAll("\\$\\{schoolName\\}", schoolName);
-         htmlContent = htmlContent.replaceAll("\\$\\{courseName\\}", examDetailCourse.getCourseName());
-         htmlContent = htmlContent.replaceAll("\\$\\{courseCode\\}", examDetailCourse.getCourseCode());
-
-         //        htmlMap.put("examName", exam.getExamName());
-         //        htmlMap.put("examRoom", examDetailMap.get("examRoom"));
-         //        htmlMap.put("examRoomId", examDetailMap.get("examRoomId"));
-         //        htmlMap.put("startTime", examDetailMap.get("startTime"));
-         //        htmlMap.put("endTime", examDetailMap.get("endTime"));
-         //        htmlMap.put("sceneNumberId", examDetailMap.get("sceneNumberId"));
-
-         htmlContent = htmlContent.replaceAll("\\$\\{paperCode\\}", examDetailCourse.getPaperNumber());
-         htmlContent = htmlContent.replaceAll("\\$\\{paperCodeImg\\}", GoogleBarCodeUtil.createBarCode(examDetailCourse.getPaperNumber(), false));
-
-         //        List<Map> students = tcPExamStudentService.clientStudentByDetailId(examDetailId);
-
-         //        List<String> extendColumnList = students.stream().map(m -> m.get("extendColumn").toString()).distinct().collect(Collectors.toList());
-         //        Set<String> classTeacher = new HashSet();
-         //        if (extendColumnList != null && extendColumnList.size() > 0) {
-         //            for (String s : extendColumnList) {
-         //                List<Map> mapList = JSONObject.parseArray(s, Map.class);
-         //                for (Map map : mapList) {
-         //                    if (Objects.equals("classTeacher", map.get("code").toString())) {
-         //                        classTeacher.add(map.get("value").toString());
-         //                    }
-         //                }
-         //            }
-         //        }
-
-         //        htmlMap.put("classTeacher", String.join(",", classTeacher));
-
-         int totalCount = examStudentList.size();
-         if (totalCount > 0) {
-         //            List<Map> subList = new ArrayList<>();
-         int pageCount = totalCount % 80 == 0 ? totalCount / 80 : totalCount / 80 + 1;
-         for (int i = 0; i < pageCount; i++) {
-         Map subMap = new HashMap();
-         subMap.put("index", i + 1);
-         int studentCount;
-         List<ExamStudent> subStudents;
-         if (pageCount == 1) {
-         studentCount = totalCount;
-         subStudents = examStudentList;
-         } else if (pageCount > 1 && i == pageCount - 1) {
-         studentCount = totalCount - (pageCount - 1) * 80;
-         subStudents = examStudentList.subList(80 * i, examStudentList.size());
-         } else {
-         studentCount = 80;
-         subStudents = examStudentList.subList(80 * i, 80 * (i + 1));
-         }
-         subMap.put("studentCount", studentCount);
-         List<ExamStudentDto> examStudentList1 = new ArrayList<>();
-         List<ExamStudentDto> examStudentList2 = new ArrayList<>();
-
-         Gson gson = new Gson();
-         int mod = subStudents.size() % 2;
-         int htmlTableCount = mod == 0 ? subStudents.size() / 2 : subStudents.size() / 2 + 1;
-         for (int j = 0; j < htmlTableCount; j++) {
-         ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
-         examStudentDto.setIndex(j + 1);
-         examStudentList1.add(examStudentDto);
-         //                    Map map = subStudents.get(j);
-         //                    TcPExamStudent tcPExamStudent = new TcPExamStudent();
-         //                    tcPExamStudent.setIndex(j + 1);
-         //                    tcPExamStudent.setSiteNumber(String.valueOf(map.get("siteNumber")));
-         //                    tcPExamStudent.setStudentCode(String.valueOf(map.get("studentCode")));
-         //                    tcPExamStudent.setName(String.valueOf(map.get("name")));
-         //                    tcPExamStudent.setExtendColumn(getClassName(map.get("extendColumn").toString()));
-         //                    tcPExamStudentList1.add(tcPExamStudent);
-         }
-         for (int j = htmlTableCount; j < subStudents.size(); j++) {
-         ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
-         examStudentDto.setIndex(j + 1);
-         examStudentList2.add(examStudentDto);
-         //                    Map map = students.get(j);
-         //                    TcPExamStudent tcPExamStudent = new TcPExamStudent();
-         //                    tcPExamStudent.setIndex(j + 1);
-         //                    tcPExamStudent.setSiteNumber(String.valueOf(map.get("siteNumber")));
-         //                    tcPExamStudent.setStudentCode(String.valueOf(map.get("studentCode")));
-         //                    tcPExamStudent.setName(String.valueOf(map.get("name")));
-         //                    tcPExamStudent.setExtendColumn(getClassName(map.get("extendColumn").toString()));
-         //                    tcPExamStudentList2.add(tcPExamStudent);
-         }
-         if (examStudentList1.size() > examStudentList2.size()) {
-         for (int j = subStudents.size() - htmlTableCount; j < examStudentList1.size(); j++) {
-         examStudentList2.add(new ExamStudentDto());
-         }
-         }
-
-         //                subMap.put("studentList1", examStudentList1);
-         //                subMap.put("studentList2", examStudentList2);
-
-         //                  htmlContent = htmlContent.replaceAll("\\$\\{studentList1\\}", examStudentList1);
-         //                  htmlContent = htmlContent.replaceAll("\\$\\{studentList2\\}", examStudentList2);
-
-         //                subList.add(subMap);
-         }
-         //            htmlMap.put("subList", subList);
-         }
-         basicAttachmentService.saveAttachmentPdf(basicAttachment, variablePdfList);
-         **/
-
+    private void createSignBook(BasicAttachment basicAttachment, String schoolName, ExamDetailCourse examDetailCourse, List<ExamStudent> examStudentList, List<String> variablePdfList) throws IOException {
         Map<String, Object> htmlMap = new HashMap<>();
         htmlMap.put("examDetailCourseId", examDetailCourse.getId());
         htmlMap.put("schoolName", schoolName);
 
         htmlMap.put("courseName", examDetailCourse.getCourseName());
         htmlMap.put("courseCode", examDetailCourse.getCourseCode());
-//        htmlMap.put("examName", exam.getExamName());
-//        htmlMap.put("examRoom", examDetailMap.get("examRoom"));
-//        htmlMap.put("examRoomId", examDetailMap.get("examRoomId"));
-//        htmlMap.put("startTime", examDetailMap.get("startTime"));
-//        htmlMap.put("endTime", examDetailMap.get("endTime"));
-//        htmlMap.put("sceneNumberId", examDetailMap.get("sceneNumberId"));
+        htmlMap.put("examName", "测试exam1");
+        htmlMap.put("examRoom", "测试examRoom1");
+        htmlMap.put("classTeacher", "测试老师1");
+        htmlMap.put("startTime", "2021-04-13 00:00:00");
+        htmlMap.put("endTime", "2021-04-14 00:00:00");
         htmlMap.put("paperCode", examDetailCourse.getPaperNumber());
         htmlMap.put("paperCodeImg", GoogleBarCodeUtil.createBarCode(examDetailCourse.getPaperNumber(), false));
 
-//        List<String> extendColumnList = students.stream().map(m -> m.get("extendColumn").toString()).distinct().collect(Collectors.toList());
-//        Set<String> classTeacher = new HashSet();
-//        if (extendColumnList != null && extendColumnList.size() > 0) {
-//            for (String s : extendColumnList) {
-//                List<Map> mapList = JSONObject.parseArray(s, Map.class);
-//                for (Map map : mapList) {
-//                    if (Objects.equals("classTeacher", map.get("code").toString())) {
-//                        classTeacher.add(map.get("value").toString());
-//                    }
-//                }
-//            }
-//        }
-//        htmlMap.put("classTeacher", String.join(",", classTeacher));
-
         int totalCount = examStudentList.size();
         if (totalCount > 0) {
             List<Map> subList = new ArrayList<>();
@@ -689,40 +563,29 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     examStudentDto.setIndex(j + 1);
                     examStudentList1.add(examStudentDto);
-//                    Map map = subStudents.get(j);
-//                    TcPExamStudent tcPExamStudent = new TcPExamStudent();
-//                    tcPExamStudent.setIndex(j + 1);
-//                    tcPExamStudent.setSiteNumber(String.valueOf(map.get("siteNumber")));
-//                    tcPExamStudent.setStudentCode(String.valueOf(map.get("studentCode")));
-//                    tcPExamStudent.setName(String.valueOf(map.get("name")));
-//                    tcPExamStudent.setExtendColumn(getClassName(map.get("extendColumn").toString()));
-//                    tcPExamStudentList1.add(tcPExamStudent);
                 }
                 for (int j = htmlTableCount; j < subStudents.size(); j++) {
                     ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
                     examStudentDto.setIndex(j + 1);
                     examStudentList2.add(examStudentDto);
-//                    Map map = students.get(j);
-//                    TcPExamStudent tcPExamStudent = new TcPExamStudent();
-//                    tcPExamStudent.setIndex(j + 1);
-//                    tcPExamStudent.setSiteNumber(String.valueOf(map.get("siteNumber")));
-//                    tcPExamStudent.setStudentCode(String.valueOf(map.get("studentCode")));
-//                    tcPExamStudent.setName(String.valueOf(map.get("name")));
-//                    tcPExamStudent.setExtendColumn(getClassName(map.get("extendColumn").toString()));
-//                    tcPExamStudentList2.add(tcPExamStudent);
                 }
                 if (examStudentList1.size() > examStudentList2.size()) {
                     for (int j = subStudents.size() - htmlTableCount; j < examStudentList1.size(); j++) {
                         examStudentList2.add(new ExamStudentDto());
                     }
                 }
-
                 subMap.put("studentList1", examStudentList1);
                 subMap.put("studentList2", examStudentList2);
                 subList.add(subMap);
             }
             htmlMap.put("subList", subList);
         }
+        JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
+        String path = (String) jsonObject.get("path");
+        String ftlPath = path.substring(0, path.lastIndexOf("/"));
+        String ftlName = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."));
+        htmlMap.computeIfAbsent("ftlPath", v -> ftlPath);
+        htmlMap.computeIfAbsent("ftlName", v -> ftlName);
         freemarkerUtil.createSignBook(htmlMap);
     }
 
@@ -777,7 +640,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             if (Objects.nonNull(object.get("attachmentId"))) {
                 Long attachmentId = Long.parseLong(String.valueOf(object.get("attachmentId")));
                 BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                String filePath = commonService.getFile(basicAttachment.getPath(), false);
+                String filePath = commonService.getFile(basicAttachment.getPath(), false).getPath();
                 pdfList[0].add(filePath);
                 for (int j = 1; j <= backupCount; j++) {
                     pdfList[1].add(filePath);

+ 24 - 35
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/FreemarkerUtil.java

@@ -14,6 +14,7 @@ import org.springframework.util.ResourceUtils;
 
 import javax.annotation.Resource;
 import java.io.*;
+import java.time.LocalDateTime;
 import java.util.Map;
 import java.util.Objects;
 import java.util.StringJoiner;
@@ -45,15 +46,7 @@ public class FreemarkerUtil {
         if (Objects.isNull(dataMap) || dataMap.size() == 0) {
             throw ExceptionResultEnum.ERROR.exception("签到表数据为空");
         }
-        Configuration configuration = new Configuration(Configuration.VERSION_2_3_29);
-        if (SystemConstant.TEMP_FILES_DIR.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
-            File templates = ResourceUtils.getFile(SystemConstant.TEMP_FILES_DIR);
-            configuration.setDirectoryForTemplateLoading(templates);
-        } else {
-//            templates = new File(dictionaryConfig.sysDomain().getFreemarkerPath());
-            configuration.setClassForTemplateLoading(this.getClass(), SystemConstant.TEMP_FILES_DIR);//classes下读取
-        }
-        this.createSignBookAndPaperPackageHtml(configuration, "signBook", (String) dataMap.get("schoolName"), dataMap);
+        this.createSignBookAndPaperPackageHtml(dataMap);
     }
 
     /**
@@ -66,53 +59,49 @@ public class FreemarkerUtil {
         if (Objects.isNull(dataMap) || dataMap.size() == 0) {
             throw ExceptionResultEnum.ERROR.exception("卷袋贴数据为空");
         }
-        Configuration configuration = new Configuration(Configuration.VERSION_2_3_29);
-        if (SystemConstant.TEMP_FILES_DIR.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
-            File templates = ResourceUtils.getFile(SystemConstant.TEMP_FILES_DIR);
-            configuration.setDirectoryForTemplateLoading(templates);
-        } else {
-//            templates = new File(dictionaryConfig.sysDomain().getFreemarkerPath());
-            configuration.setClassForTemplateLoading(this.getClass(), SystemConstant.TEMP_FILES_DIR);//classes下读取
-        }
-        this.createSignBookAndPaperPackageHtml(configuration, "paperPackage", (String) dataMap.get("schoolName"), dataMap);
+        this.createSignBookAndPaperPackageHtml(dataMap);
     }
 
     /**
      * 创建签到表
      *
-     * @param configuration
-     * @param schoolName
      * @param dataMap
      * @throws IOException
      */
-    private void createSignBookAndPaperPackageHtml(Configuration configuration, String ftlName, String schoolName, Map<String, Object> dataMap) throws IOException {
+    private void createSignBookAndPaperPackageHtml(Map<String, Object> dataMap) throws IOException {
         Writer out = null;
         try {
+            String ftlPath = (String) dataMap.get("ftlPath");
+            String ftlName = (String) dataMap.get("ftlName");
+            Configuration configuration = new Configuration(Configuration.VERSION_2_3_29);
+            File templates = ResourceUtils.getFile(SystemConstant.TEMP_FILES_DIR + File.separator + ftlPath);
+            configuration.setDirectoryForTemplateLoading(templates);
             // step1 加载模版文件
-            Template template = configuration.getTemplate(ftlName + ".ftl");
+            Template template = configuration.getTemplate(ftlName + SystemConstant.FTL_PREFIX);
             // step2 生成数据
-            String serverUpload = dictionaryConfig.sysDomain().getServerUpload();
-            File mkdir = null;
-            if (Objects.nonNull(serverUpload) && !Objects.equals(serverUpload, "")) {
-                mkdir = new File(serverUpload + File.separator + UploadFileEnum.HTML.name());
-                if (!mkdir.exists()) {
-                    mkdir.mkdirs();
-                }
-            }
-            File htmlFile = new File(new StringJoiner("").add(mkdir.toString()).add(File.separator).add(schoolName).add(ftlName).add(".html").toString());
+            StringJoiner localStringJoiner = new StringJoiner("");
+            localStringJoiner.add(SystemConstant.TEMP_FILES_DIR + File.separator + ftlPath)
+                    .add(File.separator)
+                    .add(ftlName)
+                    .add(SystemConstant.HTML_PREFIX);
+            File htmlFile = new File(localStringJoiner.toString());
             out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile)));
             // step3 输出文件
             template.process(dataMap, out);
             out.flush();
             boolean oss = dictionaryConfig.sysDomain().isOss();
             if (oss) {
-                StringJoiner stringJoiner = new StringJoiner("").add(UploadFileEnum.HTML.name())
-                        .add(File.separator).add(schoolName).add(htmlFile.getName());
-                ossUtil.ossUpload(stringJoiner.toString(), new FileInputStream(htmlFile), DigestUtils.md5Hex(new FileInputStream(htmlFile)));
+                LocalDateTime nowTime = LocalDateTime.now();
+                StringJoiner stringJoiner = new StringJoiner("");
+                stringJoiner.add(UploadFileEnum.HTML.name()).add(File.separator)
+                        .add(String.valueOf(nowTime.getYear())).add(File.separator)
+                        .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
+                        .add(String.format("%02d", nowTime.getDayOfMonth()));
+                ossUtil.ossUpload(stringJoiner.toString(), htmlFile, DigestUtils.md5Hex(new FileInputStream(htmlFile)));
             }
             log.info("{}文件创建成功", htmlFile.toString());
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("请求出错", e);
         } finally {
             if (Objects.nonNull(out)) {
                 out.close();

+ 1 - 6
distributed-print-common/src/main/java/com/qmth/distributed/print/common/contant/SystemConstant.java

@@ -53,6 +53,7 @@ public class SystemConstant {
     public static final String SIZE = "size";
     public static final String HTML_PREFIX = ".html";
     public static final String PDF_PREFIX = ".pdf";
+    public static final String FTL_PREFIX = ".ftl";
     public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss";
     public static final int PAGE_NUMBER = 0;
     public static final int PAGE_SIZE = 10000000;
@@ -102,7 +103,6 @@ public class SystemConstant {
     /**
      * 变量
      */
-    public static String ftl_FILES_DIR;
     public static String TEMP_FILES_DIR;
     public static String PDF_TEMP_FILES_DIR;
 
@@ -126,13 +126,8 @@ public class SystemConstant {
         if (!pdfTempDir.exists()) {
             pdfTempDir.mkdirs();
         }
-        File ftlTempDir = new File(new StringBuffer(mkdir).append(File.separator).append(FTL_TEMP).toString());
-        if (!ftlTempDir.exists()) {
-            ftlTempDir.mkdirs();
-        }
         TEMP_FILES_DIR = fileTempDir.getPath();
         PDF_TEMP_FILES_DIR = pdfTempDir.getPath();
-        ftl_FILES_DIR = ftlTempDir.getPath();
     }
 
     /**

+ 1 - 1
distributed-print/src/main/resources/application.properties

@@ -44,7 +44,7 @@ aliyun.oss.url=http://${aliyun.oss.bucket}.${aliyun.oss.name}
 
 #\u7CFB\u7EDF\u914D\u7F6E
 sys.config.oss=true
-sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe
+sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
 sys.config.serverUpload=