初始代码
This commit is contained in:
23
yunzhupaas-file/yunzhupaas-file-entity/pom.xml
Normal file
23
yunzhupaas-file/yunzhupaas-file-entity/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yunzhupaas-file</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-file-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-common-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author YUNZHUPAAS
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_file")
|
||||
public class FileEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 文件编辑版本
|
||||
*/
|
||||
@TableField("f_file_version")
|
||||
private String fileVersionId;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
@TableField("f_file_name")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件上传方式
|
||||
*/
|
||||
@TableField("f_type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 上传的url
|
||||
*/
|
||||
@TableField("f_url")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 上次文件版本
|
||||
*/
|
||||
@TableField("f_old_file_version_id")
|
||||
private String oldFileVersionId;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yunzhupaas.enums;
|
||||
/**
|
||||
* 文件预览方式
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/5/6
|
||||
*/
|
||||
public enum FilePreviewTypeEnum {
|
||||
/**
|
||||
* yozo:永中预览; doc:kk文档预览;
|
||||
*/
|
||||
YOZO_ONLINE_PREVIEW("yozoOnlinePreview"),
|
||||
LOCAL_PREVIEW("localPreview");
|
||||
FilePreviewTypeEnum(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class Chunk implements Serializable {
|
||||
/**
|
||||
* 当前文件块,从1开始
|
||||
*/
|
||||
@Schema(description = "当前文件块")
|
||||
private Integer chunkNumber;
|
||||
/**
|
||||
* 分块大小
|
||||
*/
|
||||
@Schema(description = "分块大小")
|
||||
private Long chunkSize;
|
||||
/**
|
||||
* 当前分块大小
|
||||
*/
|
||||
@Schema(description = "当前分块大小")
|
||||
private Long currentChunkSize;
|
||||
/**
|
||||
* 总大小
|
||||
*/
|
||||
@Schema(description = "总大小")
|
||||
private Long totalSize;
|
||||
/**
|
||||
* 文件标识
|
||||
*/
|
||||
@Schema(description = "文件标识")
|
||||
private String identifier;
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
/**
|
||||
* 相对路径
|
||||
*/
|
||||
@Schema(description = "相对路径")
|
||||
private String relativePath;
|
||||
/**
|
||||
* 总块数
|
||||
*/
|
||||
@Schema(description = "总块数")
|
||||
private Integer totalChunks;
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
@Schema(description = "文件类型")
|
||||
private String type;
|
||||
|
||||
private String extension;
|
||||
|
||||
private String fileType;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 分片上传响应
|
||||
* @date 2024/6/10 20:59
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class ChunkRes implements Serializable {
|
||||
|
||||
@Schema(description = "块数")
|
||||
private List<Integer> chunkNumbers = new ArrayList<>();
|
||||
|
||||
@Schema(description = "是否合并")
|
||||
private Boolean merge;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/5/14
|
||||
*/
|
||||
@Data
|
||||
public class FileForm {
|
||||
private String fileId;
|
||||
private String fileVersionId;
|
||||
private String fileName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LanguageVO {
|
||||
@Schema(description ="语言编码")
|
||||
private String encode;
|
||||
@Schema(description ="语言名称")
|
||||
private String fullName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @date 2024/6/10 20:39
|
||||
*/
|
||||
@Data
|
||||
public class MergeChunkDto implements Serializable {
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "分片")
|
||||
private String identifier;
|
||||
|
||||
@Schema(description = "文件大小")
|
||||
private Long filesize;
|
||||
|
||||
@Schema(description = "扩展")
|
||||
private String extension;
|
||||
|
||||
@Schema(description = "文件类型")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "父级id")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 文件上传路径类型
|
||||
*/
|
||||
@Schema(description = "文件上传路径类型")
|
||||
private String pathType;
|
||||
|
||||
@Schema(description = "文件上传路径规则")
|
||||
private String sortRule;
|
||||
|
||||
|
||||
@Schema(description = "时间存储格式")
|
||||
private String timeFormat;
|
||||
/**
|
||||
* 文件路径,子级文件用“/”隔开,如:文件1/文件1-1
|
||||
*/
|
||||
@Schema(description = "文件路径")
|
||||
private String folder;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文件上传路径配置模型
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
@Data
|
||||
public class PathTypeModel implements Serializable{
|
||||
|
||||
private String pathType;
|
||||
|
||||
private String sortRule;
|
||||
|
||||
private String timeFormat;
|
||||
|
||||
private String folder;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.3
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2022/3/30
|
||||
*/
|
||||
@Data
|
||||
public class PreviewParams {
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
@Schema(description = "预览文件id")
|
||||
private String fileVersionId;
|
||||
@Schema(description = "文件下载路径")
|
||||
private String fileDownloadUrl;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 预览文件相关参数
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/5/6
|
||||
*/
|
||||
@Data
|
||||
public class SuffixParams {
|
||||
/**
|
||||
* 是否强制重新转换(忽略缓存),true为强制重新转换,false为不强制重新转换。
|
||||
*/
|
||||
@Schema(description = "是否强制重新转换")
|
||||
private Boolean noCache;
|
||||
|
||||
/**
|
||||
* 针对单文档设置水印内容。
|
||||
*/
|
||||
@Schema(description = "设置水印内容")
|
||||
private String watermark;
|
||||
|
||||
/**
|
||||
* 0否1是,默认为0。针对单文档设置是否防复制
|
||||
*/
|
||||
@Schema(description = "是否防复制")
|
||||
private Integer isCopy;
|
||||
|
||||
/**
|
||||
* 试读功能(转换页数的起始页和转换页数的终止页,拥有对应权限的域名才能调用)
|
||||
*/
|
||||
@Schema(description = "开始")
|
||||
private Integer pageStart;
|
||||
|
||||
@Schema(description = "结束")
|
||||
private Integer pageEnd;
|
||||
|
||||
/**
|
||||
* 用于无文件后缀链接,指定预览文件后缀名
|
||||
*/
|
||||
@Schema(description = "文件后缀链接")
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class UploaderVO {
|
||||
@Schema(description ="名称")
|
||||
private String name;
|
||||
@Schema(description ="请求接口")
|
||||
private String url;
|
||||
@Schema(description ="预览文件id")
|
||||
private String fileVersionId;
|
||||
@Schema(description ="文件大小")
|
||||
private Long fileSize;
|
||||
@Schema(description ="文件后缀")
|
||||
private String fileExtension;
|
||||
@Schema(description ="缩略图")
|
||||
private String thumbUrl;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author YUNZHUPAAS
|
||||
*/
|
||||
@Data
|
||||
public class YozoFileParams {
|
||||
@Schema(description = "路径")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 是否强制重新转换(忽略缓存),true为强制重新转换,false为不强制重新转换。
|
||||
*/
|
||||
@Schema(description = "是否强制重新转换")
|
||||
private Boolean noCache;
|
||||
|
||||
/**
|
||||
* 针对单文档设置水印内容。
|
||||
*/
|
||||
@Schema(description = "设置水印内容")
|
||||
private String watermark;
|
||||
|
||||
/**
|
||||
* 0否1是,默认为0。针对单文档设置是否防复制
|
||||
*/
|
||||
@Schema(description = "是否防复制")
|
||||
private Integer isCopy;
|
||||
|
||||
/**
|
||||
* 试读功能(转换页数的起始页和转换页数的终止页,拥有对应权限的域名才能调用)
|
||||
*/
|
||||
@Schema(description = "开始")
|
||||
private Integer pageStart;
|
||||
|
||||
@Schema(description = "结束")
|
||||
private Integer pageEnd;
|
||||
|
||||
/**
|
||||
* 用于无文件后缀链接,指定预览文件后缀名
|
||||
*/
|
||||
@Schema(description = "文件后缀链接")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author YUNZHUPAAS
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
public class YozoParams implements InitializingBean {
|
||||
|
||||
@Value("${config.YozoDomainKey}")
|
||||
private String domainKey;
|
||||
|
||||
@Value("${config.YozoDomain}")
|
||||
private String domain;
|
||||
|
||||
@Value("${config.YozoCloudDomain}")
|
||||
private String cloudDomain;
|
||||
|
||||
@Value("${config.YozoAppId}")
|
||||
private String appId;
|
||||
|
||||
@Value("${config.YozoAppKey}")
|
||||
private String appKey;
|
||||
|
||||
@Value("${config.YozoEditDomain}")
|
||||
private String editDomain;
|
||||
|
||||
@Value("${config.ApiDomain}")
|
||||
private String yunzhupaasDomain;
|
||||
|
||||
public static String DOMAIN_KEY;
|
||||
public static String DOMAIN;
|
||||
public static String CLOUD_DOMAIN;
|
||||
public static String APP_ID;
|
||||
public static String APP_KEY;
|
||||
public static String EDIT_DOMAIN;
|
||||
public static String YUNZHUPAAS_DOMAINS;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
DOMAIN = domain;
|
||||
DOMAIN_KEY = domainKey;
|
||||
CLOUD_DOMAIN = cloudDomain;
|
||||
APP_ID = appId;
|
||||
APP_KEY = appKey;
|
||||
EDIT_DOMAIN = editDomain;
|
||||
YUNZHUPAAS_DOMAINS = yunzhupaasDomain;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yunzhupaas.utils;
|
||||
|
||||
import com.yunzhupaas.model.YozoFileParams;
|
||||
import com.yunzhupaas.model.YozoParams;
|
||||
import com.yunzhupaas.util.XSSEscape;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
*/
|
||||
public class SplicingUrlUtil {
|
||||
/**
|
||||
* 永中预览url拼接
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public static String getPreviewUrl(YozoFileParams params) {
|
||||
StringBuilder paramsUrl = new StringBuilder();
|
||||
if (!StringUtils.isEmpty(params.getNoCache())) {
|
||||
paramsUrl.append("&noCache=" + params.getNoCache());
|
||||
}
|
||||
if (!StringUtils.isEmpty(params.getWatermark())) {
|
||||
String watermark = XSSEscape.escape(params.getWatermark());
|
||||
paramsUrl.append("&watermark=" + watermark);
|
||||
}
|
||||
if (!StringUtils.isEmpty(params.getIsCopy())) {
|
||||
paramsUrl.append("&isCopy=" + params.getIsCopy());
|
||||
}
|
||||
if (!StringUtils.isEmpty(params.getPageStart())) {
|
||||
paramsUrl.append("&pageStart=" + params.getPageStart());
|
||||
}
|
||||
if (!StringUtils.isEmpty(params.getPageEnd())) {
|
||||
paramsUrl.append("&pageEnd=" + params.getPageEnd());
|
||||
}
|
||||
if (!StringUtils.isEmpty(params.getType())) {
|
||||
String type = XSSEscape.escape(params.getType());
|
||||
paramsUrl.append("&type=" + type);
|
||||
}
|
||||
String s = paramsUrl.toString();
|
||||
String previewUrl= YozoParams.DOMAIN+"?k=" + YozoParams.DOMAIN_KEY + "&url=" + params.getUrl() + s;
|
||||
return previewUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user