wangggziwen 5 месяцев назад
Родитель
Сommit
6e99199543

+ 5 - 0
master/pom.xml

@@ -405,6 +405,11 @@
             <artifactId>spring-boot-starter-freemarker</artifactId>
             <version>2.3.12.RELEASE</version>
         </dependency>
+        <dependency>
+            <groupId>fr.opensagres.xdocreport</groupId>
+            <artifactId>fr.opensagres.poi.xwpf.converter.pdf-gae</artifactId>
+            <version>1.0.6</version>
+        </dependency>
         <dependency>
             <groupId>com.itextpdf</groupId>
             <artifactId>itextpdf</artifactId>

+ 14 - 2
master/src/main/java/com/ruoyi/project/pssr/controller/TPssrApproveController.java

@@ -37,13 +37,13 @@ import org.activiti.engine.impl.util.CollectionUtil;
 import org.activiti.engine.runtime.ProcessInstance;
 import org.activiti.engine.task.Task;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.io.File;
-import java.io.IOException;
+import java.io.*;
 import java.nio.file.Files;
 import java.nio.file.NoSuchFileException;
 import java.nio.file.Paths;
@@ -1639,6 +1639,18 @@ public class TPssrApproveController extends BaseController {
 //        Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg.replace("/profile/pssr/", "")), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
 //        files.add(new File(rootPath + subTitle + msg));
 
+        // word转pdf
+        FileInputStream fis = new FileInputStream(path);
+        XWPFDocument document = new XWPFDocument(fis);
+        OutputStream out = new FileOutputStream(path.replace(".docx", ".pdf"));
+        document.write(out);
+        out.close();
+        fis.close();
+        this.copyFileIgnoreException(path.replace(".docx", ".pdf"),
+                rootPath + subTitle + msg.replace("/profile/pssr/", "").replace(".docx", ".pdf"),
+                files,
+                rootPath + subTitle + msg.replace(".docx", ".pdf"));
+
         for (TPssrSubcontent tPssrSubcontent : tPssrSubcontents) {
             TPssrPatrol patrol = new TPssrPatrol();
             patrol.setSubId(tPssrSubcontent.getId());

+ 14 - 14
ui/src/views/pssr/aboveall/index.vue

@@ -129,20 +129,20 @@
             @click="gotoSubIndex(scope.row)"
           >检查内容
           </el-button>
-          <!--<el-button-->
-            <!--size="mini"-->
-            <!--type="text"-->
-            <!--icon="el-icon-download"-->
-            <!--@click="handleZip(scope.row)"-->
-          <!--&gt;打包-->
-          <!--</el-button>-->
-          <!--<el-button-->
-            <!--size="mini"-->
-            <!--type="text"-->
-            <!--icon="el-icon-download"-->
-            <!--@click="handleDownload(scope.row)"-->
-          <!--&gt;导出-->
-          <!--</el-button>-->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-download"
+            @click="handleZip(scope.row)"
+          >打包
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-download"
+            @click="handleDownload(scope.row)"
+          >导出
+          </el-button>
           <el-button
             size="mini"
             type="text"