Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
6bbe35dc
提交
6bbe35dc
编写于
5月 05, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
7a1a7183
变更
11
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
103 行增加
和
18 行删除
+103
-18
wfdyna-exp-grid-view-engine.ts
app_web/src/engine/view/wfdyna-exp-grid-view-engine.ts
+37
-0
wfgroups.ts
app_web/src/mock/entity/wfgroups/wfgroups.ts
+5
-0
wfmembers.ts
app_web/src/mock/entity/wfmembers/wfmembers.ts
+5
-0
wfprocess-definitions.ts
...ock/entity/wfprocess-definitions/wfprocess-definitions.ts
+5
-0
wfsystems.ts
app_web/src/mock/entity/wfsystems/wfsystems.ts
+5
-0
wfusers.ts
app_web/src/mock/entity/wfusers/wfusers.ts
+5
-0
webSecurityConfig.java
...rc/main/java/cn/ibizlab/web/config/webSecurityConfig.java
+13
-0
DevBootSecurityConfig.java
...rc/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
+13
-0
FileItem.java
...f-util/src/main/java/cn/ibizlab/util/domain/FileItem.java
+2
-0
FileController.java
...il/src/main/java/cn/ibizlab/util/rest/FileController.java
+3
-4
SimpleFileService.java
.../main/java/cn/ibizlab/util/service/SimpleFileService.java
+10
-14
未找到文件。
app_web/src/engine/view/wfdyna-exp-grid-view-engine.ts
0 → 100644
浏览文件 @
6bbe35dc
import
GridViewEngine
from
'./grid-view-engine'
;
/**
* 视图引擎基础
*
* @export
* @class WFDynaExpGridViewEngine
* @extends {GridViewEngine}
*/
export
default
class
WFDynaExpGridViewEngine
extends
GridViewEngine
{
/**
* Creates an instance of WFDynaExpGridViewEngine.
* @memberof WFDynaExpGridViewEngine
*/
constructor
()
{
super
();
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof WFDynaExpGridViewEngine
*/
public
load
(
opts
:
any
=
{},
isnotify
:
boolean
=
false
):
void
{
this
.
view
.
getWFStepModel
().
then
((
res
:
any
)
=>
{
if
(
!
this
.
view
.
isformDruipart
){
super
.
load
(
opts
);
}
else
{
if
(
isnotify
){
super
.
load
(
opts
);
}
}
})
}
}
\ No newline at end of file
app_web/src/mock/entity/wfgroups/wfgroups.ts
浏览文件 @
6bbe35dc
...
...
@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfgroups
\/[
a-zA-Z0-9
\-\;]
+
\/
usertasks
\/[
a-zA-Z0-9
\-\;]
+
\/
ways$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfgroup 方法: getwflink"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfgroups\/[a-zA-Z0-9\-\;]+\/use
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfgroups
\/
process-definitions-nodes$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfgroup 方法: getwfstep"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfgroups\/process-definitions-n
mock
.
onPost
(
new
RegExp
(
/^
\/
wfgroups
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfgroup 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
mock
.
onPut
(
new
RegExp
(
/^
\/
wfgroups
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfgroup 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
mock
.
onDelete
(
new
RegExp
(
/^
\/
wfgroups
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfgroup 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
app_web/src/mock/entity/wfmembers/wfmembers.ts
浏览文件 @
6bbe35dc
...
...
@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfmembers
\/[
a-zA-Z0-9
\-\;]
+
\/
usertasks
\/[
a-zA-Z0-9
\-\;]
+
\/
ways$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfmember 方法: getwflink"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfmembers\/[a-zA-Z0-9\-\;]+\/us
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfmembers
\/
process-definitions-nodes$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfmember 方法: getwfstep"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfmembers\/process-definitions-
mock
.
onPost
(
new
RegExp
(
/^
\/
wfmembers
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfmember 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
mock
.
onPut
(
new
RegExp
(
/^
\/
wfmembers
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfmember 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
mock
.
onDelete
(
new
RegExp
(
/^
\/
wfmembers
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfmember 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
app_web/src/mock/entity/wfprocess-definitions/wfprocess-definitions.ts
浏览文件 @
6bbe35dc
...
...
@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfprocessdefinitions
\/[
a-zA-Z0-9
\-\;]
+
\/
usertasks
\/[
a-zA-Z0-9
\-\;]
+
\/
ways$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfprocessdefinition 方法: getwflink"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfprocessdefinitions\/[a-zA-Z0-
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfprocessdefinitions
\/
process-definitions-nodes$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfprocessdefinition 方法: getwfstep"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfprocessdefinitions\/process-d
mock
.
onPost
(
new
RegExp
(
/^
\/
wfprocessdefinitions
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfprocessdefinition 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) =
mock
.
onPut
(
new
RegExp
(
/^
\/
wfprocessdefinitions
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfprocessdefinition 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) =>
mock
.
onDelete
(
new
RegExp
(
/^
\/
wfprocessdefinitions
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfprocessdefinition 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
app_web/src/mock/entity/wfsystems/wfsystems.ts
浏览文件 @
6bbe35dc
...
...
@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfsystems
\/[
a-zA-Z0-9
\-\;]
+
\/
usertasks
\/[
a-zA-Z0-9
\-\;]
+
\/
ways$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfsystem 方法: getwflink"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfsystems\/[a-zA-Z0-9\-\;]+\/us
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfsystems
\/
process-definitions-nodes$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfsystem 方法: getwfstep"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfsystems\/process-definitions-
mock
.
onPost
(
new
RegExp
(
/^
\/
wfsystems
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfsystem 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
mock
.
onPut
(
new
RegExp
(
/^
\/
wfsystems
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfsystem 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
mock
.
onDelete
(
new
RegExp
(
/^
\/
wfsystems
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfsystem 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
app_web/src/mock/entity/wfusers/wfusers.ts
浏览文件 @
6bbe35dc
...
...
@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfusers
\/[
a-zA-Z0-9
\-\;]
+
\/
usertasks
\/[
a-zA-Z0-9
\-\;]
+
\/
ways$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfuser 方法: getwflink"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfusers\/[a-zA-Z0-9\-\;]+\/user
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibzwf-app-web
\/
wfusers
\/
process-definitions-nodes$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfuser 方法: getwfstep"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfusers\/process-definitions-no
mock
.
onPost
(
new
RegExp
(
/^
\/
wfusers
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfuser 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
mock
.
onPut
(
new
RegExp
(
/^
\/
wfusers
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfuser 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
mock
.
onDelete
(
new
RegExp
(
/^
\/
wfusers
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:wfuser 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
...
...
ibzwf-app/ibzwf-app-web/src/main/java/cn/ibizlab/web/config/webSecurityConfig.java
浏览文件 @
6bbe35dc
...
...
@@ -41,6 +41,15 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
@Value
(
"${ibiz.auth.path:v7/login}"
)
private
String
loginPath
;
@Value
(
"${ibiz.file.uploadpath:ibizutil/upload}"
)
private
String
uploadpath
;
@Value
(
"${ibiz.file.downloadpath:ibizutil/download}"
)
private
String
downloadpath
;
@Value
(
"${ibiz.file.previewpath:ibizutil/preview}"
)
private
String
previewpath
;
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
...
...
@@ -97,6 +106,10 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
).
permitAll
()
//放行登录请求
.
antMatchers
(
HttpMethod
.
POST
,
"/"
+
loginPath
).
permitAll
()
// 文件操作
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
...
...
ibzwf-boot/src/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
浏览文件 @
6bbe35dc
...
...
@@ -40,6 +40,15 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
@Value
(
"${ibiz.auth.path:v7/login}"
)
private
String
loginPath
;
@Value
(
"${ibiz.file.uploadpath:ibizutil/upload}"
)
private
String
uploadpath
;
@Value
(
"${ibiz.file.downloadpath:ibizutil/download}"
)
private
String
downloadpath
;
@Value
(
"${ibiz.file.previewpath:ibizutil/preview}"
)
private
String
previewpath
;
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
...
...
@@ -92,6 +101,10 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
).
permitAll
()
//放行登录请求
.
antMatchers
(
HttpMethod
.
POST
,
"/"
+
loginPath
).
permitAll
()
// 文件操作
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
.
and
().
headers
().
frameOptions
().
disable
();
...
...
ibzwf-util/src/main/java/cn/ibizlab/util/domain/FileItem.java
浏览文件 @
6bbe35dc
...
...
@@ -14,6 +14,8 @@ public class FileItem
{
private
String
id
;
private
String
name
;
private
String
fileid
;
private
String
filename
;
private
long
size
;
private
String
ext
;
}
ibzwf-util/src/main/java/cn/ibizlab/util/rest/FileController.java
浏览文件 @
6bbe35dc
...
...
@@ -14,21 +14,20 @@ import java.io.*;
@Slf4j
@RestController
@RequestMapping
(
"/"
)
public
class
FileController
{
@Autowired
private
FileService
fileService
;
@PostMapping
(
value
=
"${ibiz.
uploadpath.
path:ibizutil/upload}"
)
@PostMapping
(
value
=
"${ibiz.
file.upload
path:ibizutil/upload}"
)
public
ResponseEntity
<
FileItem
>
upload
(
@RequestParam
(
"file"
)
MultipartFile
multipartFile
){
return
ResponseEntity
.
ok
().
body
(
fileService
.
saveFile
(
multipartFile
));
}
private
final
String
defaultdownloadpath
=
"ibizutil/download/{id}"
;
protected
String
getDefaultdownloadpath
(){
return
defaultdownloadpath
;
}
@GetMapping
(
value
=
"${ibiz.file.downloadpath:"
+
defaultdownloadpath
+
"}"
)
@ResponseStatus
(
HttpStatus
.
OK
)
...
...
ibzwf-util/src/main/java/cn/ibizlab/util/service/SimpleFileService.java
浏览文件 @
6bbe35dc
...
...
@@ -3,6 +3,7 @@ package cn.ibizlab.util.service;
import
cn.ibizlab.util.domain.FileItem
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
...
...
@@ -11,7 +12,6 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.util.UUID
;
@Primary
@Slf4j
...
...
@@ -21,26 +21,22 @@ public class SimpleFileService implements FileService {
@Value
(
"${ibiz.filePath:/app/file/}"
)
private
String
fileRoot
;
@Override
public
FileItem
saveFile
(
MultipartFile
multipartFile
)
{
FileItem
item
=
null
;
// 获取文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
// 获取文件后缀
String
extname
=
"."
+
getExtensionName
(
fileName
);
// 用uuid作为文件名,防止生成的临时文件重复
String
fileid
=
UUID
.
randomUUID
().
toString
();
String
fileFullPath
=
this
.
fileRoot
+
"ibztuit"
+
File
.
separator
+
fileid
+
File
.
separator
+
fileName
;
try
{
String
fileid
=
DigestUtils
.
md5Hex
(
multipartFile
.
getInputStream
());
String
fileFullPath
=
this
.
fileRoot
+
"ibizutil"
+
File
.
separator
+
fileid
+
File
.
separator
+
fileName
;
File
file
=
new
File
(
fileFullPath
);
File
parent
=
new
File
(
file
.
getParent
());
if
(!
parent
.
exists
())
parent
.
mkdirs
();
try
{
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
()
,
Files
.
newOutputStream
(
file
.
toPath
()));
item
=
new
FileItem
(
fileid
,
fileName
,
(
int
)
multipartFile
.
getSize
()
,
extname
);
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
(),
Files
.
newOutputStream
(
file
.
toPath
()));
item
=
new
FileItem
(
fileid
,
fileName
,
fileid
,
fileName
,(
int
)
multipartFile
.
getSize
(),
extname
);
}
catch
(
IOException
e
)
{
throw
new
InternalServerErrorException
(
"文件上传失败"
);
}
...
...
@@ -49,7 +45,7 @@ public class SimpleFileService implements FileService {
@Override
public
File
getFile
(
String
fileid
)
{
String
dirpath
=
this
.
fileRoot
+
"ib
ztuit
"
+
File
.
separator
+
fileid
;
String
dirpath
=
this
.
fileRoot
+
"ib
izutil
"
+
File
.
separator
+
fileid
;
File
parent
=
new
File
(
dirpath
);
if
(
parent
.
exists
()
&&
parent
.
isDirectory
()
&&
parent
.
listFiles
().
length
>
0
)
{
return
parent
.
listFiles
()[
0
];
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录