初次提交

This commit is contained in:
yanghuanglin
2022-08-03 16:54:52 +08:00
parent 276c6f4a90
commit 22538415b9
19 changed files with 2511 additions and 5 deletions

33
api/pom.xml Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.optima</groupId>
<artifactId>document-api</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<name>document api</name>
<description>文档操作api</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.20</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,71 @@
package com.optima.document.api;
import java.util.List;
import java.util.Map;
/**
* 文档接口
* @author Elias
* @date 2021-09-28 16:00
*/
public interface DocumentService {
/**
* generate word
* @param templateData word模版流
* @param dataModel 数据模型
* @return 修改后的文档流
*/
default byte[] generateWord(byte[] templateData, Map<String, Object> dataModel) {
throw new UnsupportedOperationException();
}
/**
* word to pdf
* @param templateData word模版流
* @param clear 是否清除占位符
* @return
*/
default byte[] wordToPdf(byte[] templateData, boolean clear) {
throw new UnsupportedOperationException();
}
/**
* word to image
* @param templateData word模版流
* @param targetFormat 目标格式 支持jpeg, jpg, gif, tiff or png
* @return
*/
default byte[] wordToImage(byte[] templateData, String targetFormat) {
throw new UnsupportedOperationException();
}
/**
*
* @param source 文档
* @param toFindText 需要替换的文本
* @param imgSource 图片
* @param width 宽度
* @param height 高度
* @return 修改后的文档
*/
default byte[] insertJpeg(byte[] source, String toFindText, byte[] imgSource, int width, int height){
throw new UnsupportedOperationException();
}
/**
*
* @param source
* @param toFindText
* @param imgSource
* @param width
* @param height
* @return
*/
default byte[] insertJpeg(byte[] source, String toFindText, List<byte[]> imgSource, int width, int height) {
throw new UnsupportedOperationException();
}
default byte[] fieldToWord(byte[] source, Map<String, Object> infoMap) {
throw new UnsupportedOperationException();
}
}