diff --git a/document-test/pom.xml b/document-test/pom.xml
new file mode 100644
index 0000000..e6c0069
--- /dev/null
+++ b/document-test/pom.xml
@@ -0,0 +1,80 @@
+
+
+ 4.0.0
+
+ com.optima
+ document
+ 2.0.0
+
+ document-test
+ Document Test
+ 文档操作测试
+
+
+
+
+
+ com.optima
+ document-api
+ 2.0.0
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ 2.7.18
+
+
+
+
+ org.springframework
+ spring-web
+ 5.3.31
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.16.20
+ provided
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.3.0
+
+
+
+
+ com.example.MyApp
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.1
+
+
+ attach-sources
+ package
+
+ jar-no-fork
+
+
+
+
+
+
+
diff --git a/document-test/src/main/java/com/optima/document/test/DocumentServerTest.java b/document-test/src/main/java/com/optima/document/test/DocumentServerTest.java
new file mode 100644
index 0000000..7d66130
--- /dev/null
+++ b/document-test/src/main/java/com/optima/document/test/DocumentServerTest.java
@@ -0,0 +1,11 @@
+package com.optima.document.test;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DocumentServerTest {
+ public static void main(String[] args) {
+ SpringApplication.run(DocumentServerTest.class, args);
+ }
+}
diff --git a/document-test/src/main/java/com/optima/document/test/bean/DocumentConverter.java b/document-test/src/main/java/com/optima/document/test/bean/DocumentConverter.java
new file mode 100644
index 0000000..5c45df5
--- /dev/null
+++ b/document-test/src/main/java/com/optima/document/test/bean/DocumentConverter.java
@@ -0,0 +1,38 @@
+package com.optima.document.test.bean;
+
+import com.optima.document.api.DocumentService;
+import com.optima.document.test.config.DocumentServiceConfig;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+
+@Component
+public class DocumentConverter {
+ @Resource
+ private DocumentServiceConfig documentServiceConfig;
+ @Resource
+ private DocumentService documentService;
+
+ @PostConstruct
+ public void init() throws IOException {
+ String sourceFilePath = documentServiceConfig.getSourceFile();
+ String targetFilePath = documentServiceConfig.getTargetFile();
+
+ File sourceFile = new File(sourceFilePath);
+ File targetFile = new File(targetFilePath);
+
+ if (targetFile.exists()) {
+ targetFile.delete();
+ }
+
+ String sourceExtension = sourceFile.getName().substring(sourceFile.getName().lastIndexOf("."));
+ String targetExtension = targetFile.getName().substring(targetFile.getName().lastIndexOf("."));
+
+ byte[] converted = documentService.convert(Files.readAllBytes(sourceFile.toPath()), sourceExtension, targetExtension);
+ Files.write(targetFile.toPath(), converted);
+ }
+}
diff --git a/document-test/src/main/java/com/optima/document/test/config/DocumentServiceConfig.java b/document-test/src/main/java/com/optima/document/test/config/DocumentServiceConfig.java
new file mode 100644
index 0000000..b793210
--- /dev/null
+++ b/document-test/src/main/java/com/optima/document/test/config/DocumentServiceConfig.java
@@ -0,0 +1,38 @@
+package com.optima.document.test.config;
+
+import com.optima.document.api.DocumentService;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
+
+
+@Getter
+@Setter
+@Configuration
+@ConfigurationProperties(prefix = "document")
+public class DocumentServiceConfig {
+ private String server;
+ private String sourceFile;
+ private String targetFile;
+
+ @SuppressWarnings("deprecation")
+ @Bean
+ public DocumentService documentService() {
+ // 创建客户端代理
+ HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();
+ String serviceUrl;
+ if (server.endsWith("/")) {
+ serviceUrl = server + "document-service";
+ } else {
+ serviceUrl = server + "/document-service";
+ }
+ factoryBean.setServiceUrl(serviceUrl);
+ factoryBean.setServiceInterface(DocumentService.class);
+ factoryBean.afterPropertiesSet();
+
+ return (DocumentService) factoryBean.getObject();
+ }
+}
diff --git a/document-test/src/main/resources/application.yml b/document-test/src/main/resources/application.yml
new file mode 100644
index 0000000..231e1b9
--- /dev/null
+++ b/document-test/src/main/resources/application.yml
@@ -0,0 +1,4 @@
+document:
+ server: http://127.0.0.1:9004
+ source-file: /Users/yanghuanglin/Downloads/test.docx
+ target-file: /Users/yanghuanglin/Downloads/test.pdf
diff --git a/pom.xml b/pom.xml
index f2a85ac..4100d6e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,6 +10,7 @@
文档操作模块
document-api
+ document-test
document-server