调整项目模块,jodconverter-core重命名为office-plugin。jdocnverter-web重命名为server
This commit is contained in:
83
server/src/main/java/cn/keking/model/FileAttribute.java
Normal file
83
server/src/main/java/cn/keking/model/FileAttribute.java
Normal file
@ -0,0 +1,83 @@
|
||||
package cn.keking.model;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :
|
||||
*/
|
||||
public class FileAttribute {
|
||||
|
||||
private FileType type;
|
||||
private String suffix;
|
||||
private String name;
|
||||
private String url;
|
||||
private String fileKey;
|
||||
private String officePreviewType = ConfigConstants.getOfficePreviewType();
|
||||
|
||||
public FileAttribute() {
|
||||
}
|
||||
|
||||
public FileAttribute(FileType type, String suffix, String name, String url) {
|
||||
this.type = type;
|
||||
this.suffix = suffix;
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public FileAttribute(FileType type, String suffix, String name, String url, String officePreviewType) {
|
||||
this.type = type;
|
||||
this.suffix = suffix;
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.officePreviewType = officePreviewType;
|
||||
}
|
||||
|
||||
public String getFileKey() {
|
||||
return fileKey;
|
||||
}
|
||||
|
||||
public void setFileKey(String fileKey) {
|
||||
this.fileKey = fileKey;
|
||||
}
|
||||
|
||||
public String getOfficePreviewType() {
|
||||
return officePreviewType;
|
||||
}
|
||||
|
||||
public void setOfficePreviewType(String officePreviewType) {
|
||||
this.officePreviewType = officePreviewType;
|
||||
}
|
||||
|
||||
public FileType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(FileType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
67
server/src/main/java/cn/keking/model/FileType.java
Normal file
67
server/src/main/java/cn/keking/model/FileType.java
Normal file
@ -0,0 +1,67 @@
|
||||
package cn.keking.model;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :文件类型,文本,office,压缩包等等
|
||||
*/
|
||||
public enum FileType {
|
||||
picture("pictureFilePreviewImpl"),
|
||||
compress("compressFilePreviewImpl"),
|
||||
office("officeFilePreviewImpl"),
|
||||
simText("simTextFilePreviewImpl"),
|
||||
pdf("pdfFilePreviewImpl"),
|
||||
other("otherFilePreviewImpl"),
|
||||
media("mediaFilePreviewImpl"),
|
||||
markdown("markdownFilePreviewImpl"),
|
||||
xml("xmlFilePreviewImpl"),
|
||||
cad("cadFilePreviewImpl");
|
||||
|
||||
private static final String[] OFFICE_TYPES = {"docx", "doc", "xls", "xlsx", "ppt", "pptx"};
|
||||
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "RAW"};
|
||||
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
|
||||
private static final String[] SIMTEXT_TYPES = ConfigConstants.getSimText();
|
||||
private static final String[] MEDIA_TYPES = ConfigConstants.getMedia();
|
||||
private static final Map<String, FileType> FILE_TYPE_MAPPER = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (String office : OFFICE_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(office, FileType.office);
|
||||
}
|
||||
for (String picture : PICTURE_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(picture, FileType.picture);
|
||||
}
|
||||
for (String archive : ARCHIVE_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(archive, FileType.compress);
|
||||
}
|
||||
for (String text : SIMTEXT_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(text, FileType.simText);
|
||||
}
|
||||
for (String media : MEDIA_TYPES) {
|
||||
FILE_TYPE_MAPPER.put(media, FileType.media);
|
||||
}
|
||||
FILE_TYPE_MAPPER.put("md", FileType.markdown);
|
||||
FILE_TYPE_MAPPER.put("xml", FileType.xml);
|
||||
FILE_TYPE_MAPPER.put("pdf", FileType.pdf);
|
||||
FILE_TYPE_MAPPER.put("dwg", FileType.cad);
|
||||
}
|
||||
|
||||
public static FileType to(String fileType){
|
||||
return FILE_TYPE_MAPPER.getOrDefault(fileType,other);
|
||||
}
|
||||
|
||||
private final String instanceName;
|
||||
|
||||
FileType(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
}
|
||||
57
server/src/main/java/cn/keking/model/ReturnResponse.java
Normal file
57
server/src/main/java/cn/keking/model/ReturnResponse.java
Normal file
@ -0,0 +1,57 @@
|
||||
package cn.keking.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 接口返回值结构
|
||||
* @author yudian-it
|
||||
* @date 2017/11/17
|
||||
*/
|
||||
public class ReturnResponse<T> implements Serializable{
|
||||
private static final long serialVersionUID = 313975329998789878L;
|
||||
/**
|
||||
* 返回状态
|
||||
* 0. 成功
|
||||
* 1. 失败
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 返回状态描述
|
||||
* XXX成功
|
||||
* XXX失败
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
private T content;
|
||||
|
||||
public ReturnResponse(int code, String msg, T content) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(T content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user