测试代码变动
This commit is contained in:
@@ -19,6 +19,11 @@
|
||||
<artifactId>document-api</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.deepoove</groupId>
|
||||
<artifactId>poi-tl</artifactId>
|
||||
<version>1.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 基础 Spring Boot Starter(不包含 Web) -->
|
||||
<dependency>
|
||||
@@ -38,38 +43,8 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.20</version>
|
||||
<version>1.18.38</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.optima.document.test.bean;
|
||||
|
||||
import com.deepoove.poi.data.Pictures;
|
||||
import com.optima.document.api.DocumentService;
|
||||
import com.optima.document.test.config.DocumentServiceConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -10,6 +11,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -42,6 +44,9 @@ public class DocumentConverter {
|
||||
departmentList.add("处置部门2");
|
||||
params.put("departmentList", departmentList);
|
||||
|
||||
byte[] bytes = Files.readAllBytes(Paths.get("/Users/yanghuanglin/Downloads/02.png"));
|
||||
params.put("img", Pictures.ofBytes(bytes).size(48, 27).create());
|
||||
|
||||
// 生成word,并转为pdf
|
||||
byte[] generatedWord = documentService.generateWord(Files.readAllBytes(sourceFile.toPath()), params);
|
||||
byte[] wordedToPdf = documentService.wordToPdf(generatedWord, true);
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Configuration
|
||||
@@ -23,6 +22,7 @@ public class DocumentServiceConfig {
|
||||
public DocumentService documentService() {
|
||||
// 创建客户端代理
|
||||
HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();
|
||||
|
||||
String serviceUrl;
|
||||
if (server.endsWith("/")) {
|
||||
serviceUrl = server + "document-service";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
document:
|
||||
server: http://127.0.0.1:9004
|
||||
source-file: /Users/yanghuanglin/Downloads/test.docx
|
||||
target-file: /Users/yanghuanglin/Downloads/test.pdf
|
||||
source-file: "/Volumes/Working/Works/Git Sources/document/document-test/src/main/resources/test.docx"
|
||||
target-file: "/Users/yanghuanglin/Downloads/test.pdf"
|
||||
|
||||
BIN
document-test/src/main/resources/test.docx
Normal file
BIN
document-test/src/main/resources/test.docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user