Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
b0934c5d
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b0934c5d
编写于
4月 07, 2022
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加附件阿里云存储OSS支持
上级
c3634246
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
8 deletion
+29
-8
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java
...t/src/main/java/com/x/base/core/entity/StorageObject.java
+19
-2
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java
...src/main/java/com/x/base/core/entity/StorageProtocol.java
+1
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalStorageSource.java
...com/x/base/core/project/config/ExternalStorageSource.java
+9
-5
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java
浏览文件 @
b0934c5d
...
...
@@ -252,6 +252,11 @@ public abstract class StorageObject extends SliceJpaObject {
+
URLEncoder
.
encode
(
mapping
.
getPassword
(),
DefaultCharset
.
name
)
+
"@"
+
mapping
.
getHost
()
+
":"
+
mapping
.
getPort
();
break
;
case
ali:
prefix
=
"ali://"
+
URLEncoder
.
encode
(
mapping
.
getUsername
(),
DefaultCharset
.
name
)
+
":"
+
URLEncoder
.
encode
(
mapping
.
getPassword
(),
DefaultCharset
.
name
)
+
"@"
+
mapping
.
getHost
()
+
"/"
+
mapping
.
getName
();
break
;
case
file:
prefix
=
"file://"
;
break
;
...
...
@@ -261,7 +266,18 @@ public abstract class StorageObject extends SliceJpaObject {
default
:
break
;
}
return
prefix
+
(
StringUtils
.
isEmpty
(
mapping
.
getPrefix
())
?
""
:
(
"/"
+
mapping
.
getPrefix
()));
String
mappingPrefix
=
""
;
if
(
StringUtils
.
isNotBlank
(
mapping
.
getPrefix
())){
if
(
mapping
.
getPrefix
().
startsWith
(
"/"
)){
mappingPrefix
=
mapping
.
getPrefix
();
}
else
{
mappingPrefix
=
"/"
+
mapping
.
getPrefix
();
}
if
(
mappingPrefix
.
endsWith
(
"/"
))
{
mappingPrefix
=
mappingPrefix
.
substring
(
0
,
mappingPrefix
.
length
()-
1
);
}
}
return
prefix
+
mappingPrefix
;
}
private
FileSystemOptions
getOptions
(
StorageMapping
mapping
)
throws
Exception
{
...
...
@@ -356,7 +372,8 @@ public abstract class StorageObject extends SliceJpaObject {
length
=
IOUtils
.
copyLarge
(
inputStream
,
output
);
this
.
setLength
(
length
);
if
((!
Objects
.
equals
(
StorageProtocol
.
webdav
,
mapping
.
getProtocol
()))
&&
(!
Objects
.
equals
(
StorageProtocol
.
sftp
,
mapping
.
getProtocol
())))
{
&&
(!
Objects
.
equals
(
StorageProtocol
.
sftp
,
mapping
.
getProtocol
()))
&&
(!
Objects
.
equals
(
StorageProtocol
.
ali
,
mapping
.
getProtocol
())))
{
/* webdav关闭会试图去关闭commons.httpClient */
manager
.
closeFileSystem
(
fo
.
getFileSystem
());
}
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java
浏览文件 @
b0934c5d
package
com.x.base.core.entity
;
public
enum
StorageProtocol
{
ftp
,
ftps
,
webdav
,
cifs
,
file
,
sftp
,
hdfs
;
ftp
,
ftps
,
webdav
,
cifs
,
file
,
sftp
,
hdfs
,
ali
;
public
static
final
int
length
=
JpaObject
.
length_16B
;
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalStorageSource.java
浏览文件 @
b0934c5d
...
...
@@ -7,10 +7,14 @@ import com.x.base.core.entity.StorageProtocol;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.tools.Crypto
;
/**
* 第三方附件存储配置
* @author sword
*/
public
class
ExternalStorageSource
extends
ConfigObject
{
private
static
final
long
serialVersionUID
=
5926439816241094368L
;
// 无需保存
private
transient
String
_password
;
...
...
@@ -43,13 +47,13 @@ public class ExternalStorageSource extends ConfigObject {
public
static
final
String
DEFAULT_NAME
=
"251"
;
public
static
final
Boolean
DEFAULT_DEEPPATH
=
false
;
@FieldDescribe
(
"协议,可选值ftp
,webdav...
"
)
@FieldDescribe
(
"协议,可选值ftp
、sftp、webdav、file、hdfs、ali
"
)
private
StorageProtocol
protocol
;
@FieldDescribe
(
"登录用户名."
)
private
String
username
;
@FieldDescribe
(
"登录密码."
)
private
String
password
;
@FieldDescribe
(
"主机地址."
)
@FieldDescribe
(
"主机地址
或阿里云endpoint
."
)
private
String
host
;
@FieldDescribe
(
"端口."
)
private
Integer
port
;
...
...
@@ -59,7 +63,7 @@ public class ExternalStorageSource extends ConfigObject {
private
Boolean
enable
;
@FieldDescribe
(
"设置权重."
)
private
Integer
weight
;
@FieldDescribe
(
"存储节点名,对应存储名称,
谨慎修改
."
)
@FieldDescribe
(
"存储节点名,对应存储名称,
阿里云为bucket(桶)名称
."
)
private
String
name
;
@FieldDescribe
(
"是否使用更深的路径."
)
private
Boolean
deepPath
;
...
...
@@ -107,4 +111,4 @@ public class ExternalStorageSource extends ConfigObject {
return
BooleanUtils
.
isTrue
(
this
.
deepPath
);
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录