Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EL-ADMIN
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JiangSN
EL-ADMIN
Commits
3f4791ae
Commit
3f4791ae
authored
Oct 29, 2021
by
JiangSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除七牛云相关代码、执行定时任务时加入exception输出
parent
eb29c9c7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
5 additions
and
1145 deletions
+5
-1145
qiniu.js
eladmin-web/src/api/tools/qiniu.js
+0
-40
getters.js
eladmin-web/src/store/getters.js
+0
-1
api.js
eladmin-web/src/store/modules/api.js
+0
-2
home.vue
eladmin-web/src/views/home.vue
+1
-1
index.vue
eladmin-web/src/views/tools/storage/index.vue
+2
-8
form.vue
eladmin-web/src/views/tools/storage/qiniu/form.vue
+0
-98
index.vue
eladmin-web/src/views/tools/storage/qiniu/index.vue
+0
-189
ExecutionJob.java
...n/java/me/zhengjie/modules/quartz/utils/ExecutionJob.java
+1
-0
application.yml
.../eladmin-system/src/main/resources/config/application.yml
+0
-5
pom.xml
eladmin/eladmin-tools/pom.xml
+1
-9
QiniuConfig.java
...n-tools/src/main/java/me/zhengjie/domain/QiniuConfig.java
+0
-71
QiniuContent.java
...-tools/src/main/java/me/zhengjie/domain/QiniuContent.java
+0
-67
QiNiuConfigRepository.java
...in/java/me/zhengjie/repository/QiNiuConfigRepository.java
+0
-36
QiniuContentRepository.java
...n/java/me/zhengjie/repository/QiniuContentRepository.java
+0
-34
QiniuController.java
...tools/src/main/java/me/zhengjie/rest/QiniuController.java
+0
-122
QiNiuService.java
...tools/src/main/java/me/zhengjie/service/QiNiuService.java
+0
-118
QiniuQueryCriteria.java
...main/java/me/zhengjie/service/dto/QiniuQueryCriteria.java
+0
-36
QiNiuServiceImpl.java
.../main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java
+0
-237
QiNiuUtil.java
...dmin-tools/src/main/java/me/zhengjie/utils/QiNiuUtil.java
+0
-71
No files found.
eladmin-web/src/api/tools/qiniu.js
deleted
100644 → 0
View file @
eb29c9c7
import
request
from
'@/utils/request'
export
function
get
()
{
return
request
({
url
:
'api/qiNiuContent/config'
,
method
:
'get'
})
}
export
function
update
(
data
)
{
return
request
({
url
:
'api/qiNiuContent/config'
,
data
,
method
:
'put'
})
}
export
function
download
(
id
)
{
return
request
({
url
:
'api/qiNiuContent/download/'
+
id
,
method
:
'get'
})
}
export
function
sync
()
{
return
request
({
url
:
'api/qiNiuContent/synchronize'
,
method
:
'post'
})
}
export
function
del
(
ids
)
{
return
request
({
url
:
'api/qiNiuContent'
,
method
:
'delete'
,
data
:
ids
})
}
export
default
{
del
,
download
,
sync
}
eladmin-web/src/store/getters.js
View file @
3f4791ae
...
@@ -17,7 +17,6 @@ const getters = {
...
@@ -17,7 +17,6 @@ const getters = {
baseApi
:
state
=>
state
.
api
.
baseApi
,
baseApi
:
state
=>
state
.
api
.
baseApi
,
fileUploadApi
:
state
=>
state
.
api
.
fileUploadApi
,
fileUploadApi
:
state
=>
state
.
api
.
fileUploadApi
,
updateAvatarApi
:
state
=>
state
.
api
.
updateAvatarApi
,
updateAvatarApi
:
state
=>
state
.
api
.
updateAvatarApi
,
qiNiuUploadApi
:
state
=>
state
.
api
.
qiNiuUploadApi
,
sqlApi
:
state
=>
state
.
api
.
sqlApi
,
sqlApi
:
state
=>
state
.
api
.
sqlApi
,
swaggerApi
:
state
=>
state
.
api
.
swaggerApi
,
swaggerApi
:
state
=>
state
.
api
.
swaggerApi
,
sidebarRouters
:
state
=>
state
.
permission
.
sidebarRouters
sidebarRouters
:
state
=>
state
.
permission
.
sidebarRouters
...
...
eladmin-web/src/store/modules/api.js
View file @
3f4791ae
...
@@ -12,8 +12,6 @@ const api = {
...
@@ -12,8 +12,6 @@ const api = {
imagesUploadApi
:
baseUrl
+
'/api/localStorage/pictures'
,
imagesUploadApi
:
baseUrl
+
'/api/localStorage/pictures'
,
// 修改头像
// 修改头像
updateAvatarApi
:
baseUrl
+
'/api/users/updateAvatar'
,
updateAvatarApi
:
baseUrl
+
'/api/users/updateAvatar'
,
// 上传文件到七牛云
qiNiuUploadApi
:
baseUrl
+
'/api/qiNiuContent'
,
// Sql 监控
// Sql 监控
sqlApi
:
baseUrl
+
'/druid/index.html'
,
sqlApi
:
baseUrl
+
'/druid/index.html'
,
// swagger
// swagger
...
...
eladmin-web/src/views/home.vue
View file @
3f4791ae
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<el-row
style=
"background:#fff;padding:16px 16px 0;margin-bottom:32px;"
>
<el-row
style=
"background:#fff;padding:16px 16px 0;margin-bottom:32px;"
>
<line-chart
:chart-data=
"lineChartData"
/>
<line-chart
:chart-data=
"lineChartData"
/>
</el-row>
</el-row>
<!--
<el-row
:gutter=
"32"
>
<!--
<el-row
:gutter=
"32"
>
<el-col
:xs=
"24"
:sm=
"24"
:lg=
"8"
>
<el-col
:xs=
"24"
:sm=
"24"
:lg=
"8"
>
<div
class=
"chart-wrapper"
>
<div
class=
"chart-wrapper"
>
<radar-chart
/>
<radar-chart
/>
...
...
eladmin-web/src/views/tools/storage/index.vue
View file @
3f4791ae
...
@@ -3,18 +3,14 @@
...
@@ -3,18 +3,14 @@
<el-tab-pane
label=
"本地存储"
name=
"first"
>
<el-tab-pane
label=
"本地存储"
name=
"first"
>
<Local
ref=
"local"
/>
<Local
ref=
"local"
/>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"七牛云存储"
name=
"second"
>
<QiNiu
ref=
"qiNiu"
/>
</el-tab-pane>
</el-tabs>
</el-tabs>
</
template
>
</
template
>
<
script
>
<
script
>
import
QiNiu
from
'./qiniu/index'
import
Local
from
'./local/index'
import
Local
from
'./local/index'
export
default
{
export
default
{
name
:
'Storage'
,
name
:
'Storage'
,
components
:
{
QiNiu
,
Local
},
components
:
{
Local
},
data
()
{
data
()
{
return
{
return
{
activeName
:
'first'
activeName
:
'first'
...
@@ -24,9 +20,7 @@ export default {
...
@@ -24,9 +20,7 @@ export default {
tabClick
(
name
)
{
tabClick
(
name
)
{
if
(
this
.
activeName
===
'first'
)
{
if
(
this
.
activeName
===
'first'
)
{
this
.
$refs
.
local
.
crud
.
toQuery
()
this
.
$refs
.
local
.
crud
.
toQuery
()
}
else
{
}
this
.
$refs
.
qiNiu
.
crud
.
toQuery
()
}
}
}
}
}
}
}
...
...
eladmin-web/src/views/tools/storage/qiniu/form.vue
deleted
100644 → 0
View file @
eb29c9c7
<
template
>
<el-dialog
:visible
.
sync=
"dialog"
:close-on-click-modal=
"false"
title=
"七牛云配置"
append-to-body
width=
"580px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
style=
"margin-top: 6px;"
size=
"small"
label-width=
"110px"
>
<el-form-item
label=
"Access Key"
prop=
"accessKey"
>
<el-input
v-model=
"form.accessKey"
style=
"width: 95%"
placeholder=
"accessKey,在安全中心,秘钥管理中查看"
/>
</el-form-item>
<el-form-item
label=
"Secret Key"
prop=
"secretKey"
>
<el-input
v-model=
"form.secretKey"
type=
"password"
style=
"width: 95%;"
placeholder=
"secretKey,在安全中心,秘钥管理中查看"
/>
</el-form-item>
<el-form-item
label=
"空间名称"
prop=
"bucket"
>
<el-input
v-model=
"form.bucket"
style=
"width: 95%;"
placeholder=
"存储空间名称作为唯一的 Bucket 识别符"
/>
</el-form-item>
<el-form-item
label=
"外链域名"
prop=
"host"
>
<el-input
v-model=
"form.host"
style=
"width: 95%;"
placeholder=
"外链域名,可自定义,需在七牛云绑定"
/>
</el-form-item>
<el-form-item
label=
"存储区域"
>
<el-select
v-model=
"form.zone"
placeholder=
"请选择存储区域"
>
<el-option
v-for=
"item in zones"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"空间类型"
prop=
"type"
>
<el-radio
v-model=
"form.type"
label=
"公开"
>
公开
</el-radio>
<el-radio
v-model=
"form.type"
label=
"私有"
>
私有
</el-radio>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"text"
@
click=
"dialog = false"
>
取消
</el-button>
<el-button
:loading=
"loading"
type=
"primary"
@
click=
"doSubmit"
>
确认
</el-button>
</div>
</el-dialog>
</
template
>
<
script
>
import
{
get
,
update
}
from
'@/api/tools/qiniu'
export
default
{
data
()
{
return
{
zones
:
[
'华东'
,
'华北'
,
'华南'
,
'北美'
,
'东南亚'
],
dialog
:
false
,
loading
:
false
,
form
:
{
accessKey
:
''
,
secretKey
:
''
,
bucket
:
''
,
host
:
''
,
zone
:
''
,
type
:
''
},
rules
:
{
accessKey
:
[
{
required
:
true
,
message
:
'请输入accessKey'
,
trigger
:
'blur'
}
],
secretKey
:
[
{
required
:
true
,
message
:
'请输入secretKey'
,
trigger
:
'blur'
}
],
bucket
:
[
{
required
:
true
,
message
:
'请输入空间名称'
,
trigger
:
'blur'
}
],
host
:
[
{
required
:
true
,
message
:
'请输入外链域名'
,
trigger
:
'blur'
}
],
type
:
[
{
required
:
true
,
message
:
'空间类型不能为空'
,
trigger
:
'blur'
}
]
}
}
},
methods
:
{
init
()
{
get
().
then
(
res
=>
{
this
.
form
=
res
})
},
doSubmit
()
{
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
loading
=
true
update
(
this
.
form
).
then
(
res
=>
{
this
.
$notify
({
title
:
'修改成功'
,
type
:
'success'
,
duration
:
2500
})
this
.
$parent
.
crud
.
toQuery
()
this
.
loading
=
false
this
.
dialog
=
false
}).
catch
(
err
=>
{
this
.
loading
=
false
console
.
log
(
err
.
response
.
data
.
message
)
})
}
else
{
return
false
}
})
}
}
}
</
script
>
<
style
scoped
>
</
style
>
eladmin-web/src/views/tools/storage/qiniu/index.vue
deleted
100644 → 0
View file @
eb29c9c7
<
template
>
<div
class=
"app-container"
style=
"padding: 8px;"
>
<!--表单组件-->
<eForm
ref=
"form"
/>
<!-- 工具栏 -->
<div
class=
"head-container"
>
<div
v-if=
"crud.props.searchToggle"
>
<!-- 搜索 -->
<el-input
v-model=
"query.key"
clearable
size=
"small"
placeholder=
"输入文件名称搜索"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"toQuery"
/>
<date-range-picker
v-model=
"query.createTime"
class=
"date-item"
/>
<rrOperation
/>
</div>
<crudOperation
:permission=
"permission"
>
<template
slot=
"left"
>
<!-- 上传 -->
<el-button
class=
"filter-item"
size=
"mini"
type=
"primary"
icon=
"el-icon-upload"
@
click=
"dialog = true"
>
上传
</el-button>
<!-- 同步 -->
<el-button
:icon=
"icon"
class=
"filter-item"
size=
"mini"
type=
"warning"
@
click=
"synchronize"
>
同步
</el-button>
<!-- 配置 -->
<el-button
class=
"filter-item"
size=
"mini"
type=
"success"
icon=
"el-icon-s-tools"
@
click=
"doConfig"
>
配置
</el-button>
</
template
>
</crudOperation>
<!-- 文件上传 -->
<el-dialog
:visible
.
sync=
"dialog"
:close-on-click-modal=
"false"
append-to-body
width=
"500px"
@
close=
"doSubmit"
>
<el-upload
:before-remove=
"handleBeforeRemove"
:on-success=
"handleSuccess"
:on-error=
"handleError"
:file-list=
"fileList"
:headers=
"headers"
:action=
"qiNiuUploadApi"
class=
"upload-demo"
multiple
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<div
slot=
"tip"
style=
"display: block;"
class=
"el-upload__tip"
>
请勿上传违法文件,且文件不超过15M
</div>
</el-upload>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"doSubmit"
>
确认
</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref=
"table"
v-loading=
"crud.loading"
:data=
"crud.data"
style=
"width: 100%;"
@
selection-change=
"crud.selectionChangeHandler"
>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
prop=
"name"
:show-overflow-tooltip=
"true"
label=
"文件名"
>
<
template
slot-scope=
"scope"
>
<a
href=
"JavaScript:"
class=
"el-link el-link--primary"
target=
"_blank"
type=
"primary"
@
click=
"download(scope.row.id)"
>
{{
scope
.
row
.
key
}}
</a>
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
prop=
"suffix"
label=
"文件类型"
@
selection-change=
"crud.selectionChangeHandler"
/>
<el-table-column
prop=
"bucket"
label=
"空间名称"
/>
<el-table-column
prop=
"size"
label=
"文件大小"
/>
<el-table-column
prop=
"type"
label=
"空间类型"
/>
<el-table-column
prop=
"updateTime"
label=
"创建日期"
/>
</el-table>
<!--分页组件-->
<pagination
/>
</div>
</div>
</template>
<
script
>
import
crudQiNiu
from
'@/api/tools/qiniu'
import
{
mapGetters
}
from
'vuex'
import
{
getToken
}
from
'@/utils/auth'
import
eForm
from
'./form'
import
CRUD
,
{
presenter
,
header
,
crud
}
from
'@crud/crud'
import
rrOperation
from
'@crud/RR.operation'
import
crudOperation
from
'@crud/CRUD.operation'
import
pagination
from
'@crud/Pagination'
import
DateRangePicker
from
'@/components/DateRangePicker'
export
default
{
components
:
{
eForm
,
pagination
,
crudOperation
,
rrOperation
,
DateRangePicker
},
cruds
()
{
return
CRUD
({
title
:
'七牛云文件'
,
url
:
'api/qiNiuContent'
,
crudMethod
:
{
...
crudQiNiu
}})
},
mixins
:
[
presenter
(),
header
(),
crud
()],
data
()
{
return
{
permission
:
{
del
:
[
'admin'
,
'storage:del'
]
},
title
:
'文件'
,
dialog
:
false
,
icon
:
'el-icon-refresh'
,
url
:
''
,
headers
:
{
'Authorization'
:
getToken
()
},
dialogImageUrl
:
''
,
dialogVisible
:
false
,
fileList
:
[],
files
:
[],
newWin
:
null
}
},
computed
:
{
...
mapGetters
([
'qiNiuUploadApi'
])
},
watch
:
{
url
(
newVal
,
oldVal
)
{
if
(
newVal
&&
this
.
newWin
)
{
this
.
newWin
.
sessionStorage
.
clear
()
this
.
newWin
.
location
.
href
=
newVal
// 重定向后把url和newWin重置
this
.
url
=
''
this
.
newWin
=
null
}
}
},
created
()
{
this
.
crud
.
optShow
.
add
=
false
this
.
crud
.
optShow
.
edit
=
false
},
methods
:
{
// 七牛云配置
doConfig
()
{
const
_this
=
this
.
$refs
.
form
_this
.
init
()
_this
.
dialog
=
true
},
handleSuccess
(
response
,
file
,
fileList
)
{
const
uid
=
file
.
uid
const
id
=
response
.
id
this
.
files
.
push
({
uid
,
id
})
},
handleBeforeRemove
(
file
,
fileList
)
{
for
(
let
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
if
(
this
.
files
[
i
].
uid
===
file
.
uid
)
{
crudQiNiu
.
del
([
this
.
files
[
i
].
id
]).
then
(
res
=>
{})
return
true
}
}
},
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
this
.
dialogVisible
=
true
},
// 刷新列表数据
doSubmit
()
{
this
.
fileList
=
[]
this
.
dialogVisible
=
false
this
.
dialogImageUrl
=
''
this
.
dialog
=
false
this
.
crud
.
toQuery
()
},
// 监听上传失败
handleError
(
e
,
file
,
fileList
)
{
const
msg
=
JSON
.
parse
(
e
.
message
)
this
.
crud
.
notify
(
msg
.
message
,
CRUD
.
NOTIFICATION_TYPE
.
ERROR
)
},
// 下载文件
download
(
id
)
{
this
.
downloadLoading
=
true
// 先打开一个空的新窗口,再请求
this
.
newWin
=
window
.
open
()
crudQiNiu
.
download
(
id
).
then
(
res
=>
{
this
.
downloadLoading
=
false
this
.
url
=
res
.
url
}).
catch
(
err
=>
{
this
.
downloadLoading
=
false
console
.
log
(
err
.
response
.
data
.
message
)
})
},
// 同步数据
synchronize
()
{
this
.
icon
=
'el-icon-loading'
crudQiNiu
.
sync
().
then
(
res
=>
{
this
.
icon
=
'el-icon-refresh'
this
.
$message
({
showClose
:
true
,
message
:
'数据同步成功'
,
type
:
'success'
,
duration
:
1500
})
this
.
crud
.
toQuery
()
}).
catch
(
err
=>
{
this
.
icon
=
'el-icon-refresh'
console
.
log
(
err
.
response
.
data
.
message
)
})
}
}
}
</
script
>
<
style
scoped
>
</
style
>
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/ExecutionJob.java
View file @
3f4791ae
...
@@ -88,6 +88,7 @@ public class ExecutionJob extends QuartzJobBean {
...
@@ -88,6 +88,7 @@ public class ExecutionJob extends QuartzJobBean {
quartzJobService
.
executionSubJob
(
tasks
);
quartzJobService
.
executionSubJob
(
tasks
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
if
(
StringUtils
.
isNotBlank
(
uuid
))
{
if
(
StringUtils
.
isNotBlank
(
uuid
))
{
redisUtils
.
set
(
uuid
,
false
);
redisUtils
.
set
(
uuid
,
false
);
}
}
...
...
eladmin/eladmin-system/src/main/resources/config/application.yml
View file @
3f4791ae
...
@@ -73,11 +73,6 @@ task:
...
@@ -73,11 +73,6 @@ task:
# 队列容量
# 队列容量
queue-capacity
:
50
queue-capacity
:
50
#七牛云
qiniu
:
# 文件大小 /M
max-size
:
15
#邮箱验证码有效时间/秒
#邮箱验证码有效时间/秒
code
:
code
:
expiration
:
300
expiration
:
300
...
...
eladmin/eladmin-tools/pom.xml
View file @
3f4791ae
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
<properties>
<properties>
<mail.version>
1.4.7
</mail.version>
<mail.version>
1.4.7
</mail.version>
<qiniu.version>
[7.2.0, 7.2.99]
</qiniu.version>
<alipay.version>
4.9.153.ALL
</alipay.version>
<alipay.version>
4.9.153.ALL
</alipay.version>
</properties>
</properties>
...
@@ -33,13 +32,6 @@
...
@@ -33,13 +32,6 @@
<version>
${mail.version}
</version>
<version>
${mail.version}
</version>
</dependency>
</dependency>
<!--七牛云存储-->
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<version>
${qiniu.version}
</version>
</dependency>
<!--支付宝依赖-->
<!--支付宝依赖-->
<dependency>
<dependency>
<groupId>
com.alipay.sdk
</groupId>
<groupId>
com.alipay.sdk
</groupId>
...
@@ -47,4 +39,4 @@
...
@@ -47,4 +39,4 @@
<version>
${alipay.version}
</version>
<version>
${alipay.version}
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuConfig.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* 七牛云对象存储配置类
* @author Zheng Jie
* @date 2018-12-31
*/
@Data
@Entity
@Table
(
name
=
"SJGX_TOOL_QINIU_CONFIG"
)
public
class
QiniuConfig
implements
Serializable
{
@Id
@Column
(
name
=
"CONFIG_ID"
)
@ApiModelProperty
(
value
=
"ID"
)
@SequenceGenerator
(
name
=
"qiniuConfigGenerator"
,
sequenceName
=
"SEQ_SJGX_TOOL_QINIU_CONFIG"
)
@GeneratedValue
(
strategy
=
GenerationType
.
SEQUENCE
,
generator
=
"qiniuConfigGenerator"
)
private
Long
id
;
@NotBlank
@ApiModelProperty
(
value
=
"accessKey"
)
private
String
accessKey
;
@NotBlank
@ApiModelProperty
(
value
=
"secretKey"
)
private
String
secretKey
;
@NotBlank
@ApiModelProperty
(
value
=
"存储空间名称作为唯一的 Bucket 识别符"
)
private
String
bucket
;
/**
* Zone表示与机房的对应关系
* 华东 Zone.zone0()
* 华北 Zone.zone1()
* 华南 Zone.zone2()
* 北美 Zone.zoneNa0()
* 东南亚 Zone.zoneAs0()
*/
@NotBlank
@ApiModelProperty
(
value
=
"Zone表示与机房的对应关系"
)
private
String
zone
;
@NotBlank
@ApiModelProperty
(
value
=
"外链域名,可自定义,需在七牛云绑定"
)
private
String
host
;
@ApiModelProperty
(
value
=
"空间类型:公开/私有"
)
private
String
type
=
"公开"
;
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuContent.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* 上传成功后,存储结果
* @author Zheng Jie
* @date 2018-12-31
*/
@Data
@Entity
@Table
(
name
=
"SJGX_TOOL_QINIU_CONTENT"
)
public
class
QiniuContent
implements
Serializable
{
@Id
@Column
(
name
=
"CONTENT_ID"
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@SequenceGenerator
(
name
=
"qiniuContentGenerator"
,
sequenceName
=
"SEQ_SJGX_TOOL_QINIU_CONTENT"
)
@GeneratedValue
(
strategy
=
GenerationType
.
SEQUENCE
,
generator
=
"qiniuContentGenerator"
)
private
Long
id
;
@Column
(
name
=
"NAME"
)
@ApiModelProperty
(
value
=
"文件名"
)
private
String
key
;
@ApiModelProperty
(
value
=
"空间名"
)
private
String
bucket
;
@ApiModelProperty
(
value
=
"大小"
)
@Column
(
name
=
"TOOL_QINIU_CONTENT_SIZE"
)
private
String
size
;
@ApiModelProperty
(
value
=
"文件地址"
)
private
String
url
;
@ApiModelProperty
(
value
=
"文件类型"
)
private
String
suffix
;
@ApiModelProperty
(
value
=
"空间类型:公开/私有"
)
@Column
(
name
=
"TOOL_QINIU_CONTENT_TYPE"
)
private
String
type
=
"公开"
;
@UpdateTimestamp
@ApiModelProperty
(
value
=
"创建或更新时间"
)
@Column
(
name
=
"UPDATE_TIME"
)
private
Timestamp
updateTime
;
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/repository/QiNiuConfigRepository.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
repository
;
import
me.zhengjie.domain.QiniuConfig
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
/**
* @author Zheng Jie
* @date 2018-12-31
*/
public
interface
QiNiuConfigRepository
extends
JpaRepository
<
QiniuConfig
,
Long
>
{
/**
* 编辑类型
* @param type
*/
@Modifying
@Query
(
value
=
"update QiniuConfig set type = ?1"
)
void
update
(
String
type
);
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/repository/QiniuContentRepository.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
repository
;
import
me.zhengjie.domain.QiniuContent
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author Zheng Jie
* @date 2018-12-31
*/
public
interface
QiniuContentRepository
extends
JpaRepository
<
QiniuContent
,
Long
>,
JpaSpecificationExecutor
<
QiniuContent
>
{
/**
* 根据key查询
* @param key 文件名
* @return QiniuContent
*/
QiniuContent
findByKey
(
String
key
);
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.domain.QiniuConfig
;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.service.QiNiuService
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 发送邮件
* @author 郑杰
* @date 2018/09/28 6:55:53
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/api/qiNiuContent"
)
@Api
(
tags
=
"工具:七牛云存储管理"
)
public
class
QiniuController
{
private
final
QiNiuService
qiNiuService
;
@GetMapping
(
value
=
"/config"
)
public
ResponseEntity
<
Object
>
queryConfig
(){
return
new
ResponseEntity
<>(
qiNiuService
.
find
(),
HttpStatus
.
OK
);
}
@Log
(
"配置七牛云存储"
)
@ApiOperation
(
"配置七牛云存储"
)
@PutMapping
(
value
=
"/config"
)
public
ResponseEntity
<
Object
>
updateConfig
(
@Validated
@RequestBody
QiniuConfig
qiniuConfig
){
qiNiuService
.
config
(
qiniuConfig
);
qiNiuService
.
update
(
qiniuConfig
.
getType
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
@ApiOperation
(
"导出数据"
)
@GetMapping
(
value
=
"/download"
)
public
void
download
(
HttpServletResponse
response
,
QiniuQueryCriteria
criteria
)
throws
IOException
{
qiNiuService
.
downloadList
(
qiNiuService
.
queryAll
(
criteria
),
response
);
}
@ApiOperation
(
"查询文件"
)
@GetMapping
public
ResponseEntity
<
Object
>
query
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
qiNiuService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"上传文件"
)
@ApiOperation
(
"上传文件"
)
@PostMapping
public
ResponseEntity
<
Object
>
upload
(
@RequestParam
MultipartFile
file
){
QiniuContent
qiniuContent
=
qiNiuService
.
upload
(
file
,
qiNiuService
.
find
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
3
);
map
.
put
(
"id"
,
qiniuContent
.
getId
());
map
.
put
(
"errno"
,
0
);
map
.
put
(
"data"
,
new
String
[]{
qiniuContent
.
getUrl
()});
return
new
ResponseEntity
<>(
map
,
HttpStatus
.
OK
);
}
@Log
(
"同步七牛云数据"
)
@ApiOperation
(
"同步七牛云数据"
)
@PostMapping
(
value
=
"/synchronize"
)
public
ResponseEntity
<
Object
>
synchronize
(){
qiNiuService
.
synchronize
(
qiNiuService
.
find
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
@Log
(
"下载文件"
)
@ApiOperation
(
"下载文件"
)
@GetMapping
(
value
=
"/download/{id}"
)
public
ResponseEntity
<
Object
>
download
(
@PathVariable
Long
id
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
1
);
map
.
put
(
"url"
,
qiNiuService
.
download
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
()));
return
new
ResponseEntity
<>(
map
,
HttpStatus
.
OK
);
}
@Log
(
"删除文件"
)
@ApiOperation
(
"删除文件"
)
@DeleteMapping
(
value
=
"/{id}"
)
public
ResponseEntity
<
Object
>
delete
(
@PathVariable
Long
id
){
qiNiuService
.
delete
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
@Log
(
"删除多张图片"
)
@ApiOperation
(
"删除多张图片"
)
@DeleteMapping
public
ResponseEntity
<
Object
>
deleteAll
(
@RequestBody
Long
[]
ids
)
{
qiNiuService
.
deleteAll
(
ids
,
qiNiuService
.
find
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiNiuService.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
service
;
import
me.zhengjie.domain.QiniuConfig
;
import
me.zhengjie.domain.QiniuContent
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
* @author Zheng Jie
* @date 2018-12-31
*/
public
interface
QiNiuService
{
/**
* 查配置
* @return QiniuConfig
*/
QiniuConfig
find
();
/**
* 修改配置
* @param qiniuConfig 配置
* @return QiniuConfig
*/
QiniuConfig
config
(
QiniuConfig
qiniuConfig
);
/**
* 分页查询
* @param criteria 条件
* @param pageable 分页参数
* @return /
*/
Object
queryAll
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
);
/**
* 查询全部
* @param criteria 条件
* @return /
*/
List
<
QiniuContent
>
queryAll
(
QiniuQueryCriteria
criteria
);
/**
* 上传文件
* @param file 文件
* @param qiniuConfig 配置
* @return QiniuContent
*/
QiniuContent
upload
(
MultipartFile
file
,
QiniuConfig
qiniuConfig
);
/**
* 查询文件
* @param id 文件ID
* @return QiniuContent
*/
QiniuContent
findByContentId
(
Long
id
);
/**
* 下载文件
* @param content 文件信息
* @param config 配置
* @return String
*/
String
download
(
QiniuContent
content
,
QiniuConfig
config
);
/**
* 删除文件
* @param content 文件
* @param config 配置
*/
void
delete
(
QiniuContent
content
,
QiniuConfig
config
);
/**
* 同步数据
* @param config 配置
*/
void
synchronize
(
QiniuConfig
config
);
/**
* 删除文件
* @param ids 文件ID数组
* @param config 配置
*/
void
deleteAll
(
Long
[]
ids
,
QiniuConfig
config
);
/**
* 更新数据
* @param type 类型
*/
void
update
(
String
type
);
/**
* 导出数据
* @param queryAll /
* @param response /
* @throws IOException /
*/
void
downloadList
(
List
<
QiniuContent
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
;
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/service/dto/QiniuQueryCriteria.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
service
.
dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
* @author Zheng Jie
* @date 2019-6-4 09:54:37
*/
@Data
public
class
QiniuQueryCriteria
{
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
key
;
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
List
<
Timestamp
>
createTime
;
}
eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java
deleted
100644 → 0
View file @
eb29c9c7
This diff is collapsed.
Click to expand it.
eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/QiNiuUtil.java
deleted
100644 → 0
View file @
eb29c9c7
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
utils
;
import
com.qiniu.storage.Region
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* 七牛云存储工具类
* @author Zheng Jie
* @date 2018-12-31
*/
public
class
QiNiuUtil
{
private
static
final
String
HUAD
=
"华东"
;
private
static
final
String
HUAB
=
"华北"
;
private
static
final
String
HUAN
=
"华南"
;
private
static
final
String
BEIM
=
"北美"
;
/**
* 得到机房的对应关系
* @param zone 机房名称
* @return Region
*/
public
static
Region
getRegion
(
String
zone
){
if
(
HUAD
.
equals
(
zone
)){
return
Region
.
huadong
();
}
else
if
(
HUAB
.
equals
(
zone
)){
return
Region
.
huabei
();
}
else
if
(
HUAN
.
equals
(
zone
)){
return
Region
.
huanan
();
}
else
if
(
BEIM
.
equals
(
zone
)){
return
Region
.
beimei
();
// 否则就是东南亚
}
else
{
return
Region
.
qvmHuadong
();
}
}
/**
* 默认不指定key的情况下,以文件内容的hash值作为文件名
* @param file 文件名
* @return String
*/
public
static
String
getKey
(
String
file
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
Date
date
=
new
Date
();
return
FileUtil
.
getFileNameNoEx
(
file
)
+
"-"
+
sdf
.
format
(
date
)
+
"."
+
FileUtil
.
getExtensionName
(
file
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment