Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
900ca221
Commit
900ca221
authored
Dec 10, 2019
by
Elune
Browse files
代码优化
parent
a9e12b5c
Changes
26
Hide whitespace changes
Inline
Side-by-side
eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java
View file @
900ca221
...
...
@@ -47,10 +47,10 @@ public class AliPayController {
@Log
(
"配置支付宝"
)
@ApiOperation
(
"配置支付宝"
)
@PutMapping
public
ResponseEntity
payConfig
(
@Validated
@RequestBody
AlipayConfig
alipayConfig
){
public
ResponseEntity
<
Object
>
payConfig
(
@Validated
@RequestBody
AlipayConfig
alipayConfig
){
alipayConfig
.
setId
(
1L
);
alipayService
.
update
(
alipayConfig
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"支付宝PC网页支付"
)
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java
View file @
900ca221
...
...
@@ -28,23 +28,23 @@ public class EmailController {
}
@GetMapping
public
ResponseEntity
get
(){
public
ResponseEntity
<
Object
>
get
(){
return
new
ResponseEntity
<>(
emailService
.
find
(),
HttpStatus
.
OK
);
}
@Log
(
"配置邮件"
)
@PutMapping
@ApiOperation
(
"配置邮件"
)
public
ResponseEntity
emailConfig
(
@Validated
@RequestBody
EmailConfig
emailConfig
){
public
ResponseEntity
<
Object
>
emailConfig
(
@Validated
@RequestBody
EmailConfig
emailConfig
){
emailService
.
update
(
emailConfig
,
emailService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"发送邮件"
)
@PostMapping
@ApiOperation
(
"发送邮件"
)
public
ResponseEntity
send
(
@Validated
@RequestBody
EmailVo
emailVo
)
throws
Exception
{
public
ResponseEntity
<
Object
>
send
(
@Validated
@RequestBody
EmailVo
emailVo
)
throws
Exception
{
emailService
.
send
(
emailVo
,
emailService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
}
eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java
View file @
900ca221
...
...
@@ -34,7 +34,7 @@ public class LocalStorageController {
@ApiOperation
(
"查询文件"
)
@GetMapping
@PreAuthorize
(
"@el.check('storage:list')"
)
public
ResponseEntity
getLocalStorages
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
Object
>
getLocalStorages
(
LocalStorageQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
localStorageService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
...
...
@@ -49,31 +49,31 @@ public class LocalStorageController {
@ApiOperation
(
"上传文件"
)
@PostMapping
@PreAuthorize
(
"@el.check('storage:add')"
)
public
ResponseEntity
create
(
@RequestParam
String
name
,
@RequestParam
(
"file"
)
MultipartFile
file
){
public
ResponseEntity
<
Object
>
create
(
@RequestParam
String
name
,
@RequestParam
(
"file"
)
MultipartFile
file
){
return
new
ResponseEntity
<>(
localStorageService
.
create
(
name
,
file
),
HttpStatus
.
CREATED
);
}
@ApiOperation
(
"修改文件"
)
@PutMapping
@PreAuthorize
(
"@el.check('storage:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
LocalStorage
resources
){
public
ResponseEntity
<
Object
>
update
(
@Validated
@RequestBody
LocalStorage
resources
){
localStorageService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
return
new
ResponseEntity
<>
(
HttpStatus
.
NO_CONTENT
);
}
@ApiOperation
(
"删除文件"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('storage:del')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
<
Object
>
delete
(
@PathVariable
Long
id
){
localStorageService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"多选删除"
)
@DeleteMapping
@ApiOperation
(
"多选删除"
)
public
ResponseEntity
deleteAll
(
@RequestBody
Long
[]
ids
)
{
public
ResponseEntity
<
Object
>
deleteAll
(
@RequestBody
Long
[]
ids
)
{
localStorageService
.
deleteAll
(
ids
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
}
\ No newline at end of file
eladmin-tools/src/main/java/me/zhengjie/rest/PictureController.java
View file @
900ca221
...
...
@@ -38,7 +38,7 @@ public class PictureController {
@PreAuthorize
(
"@el.check('pictures:list')"
)
@GetMapping
@ApiOperation
(
"查询图片"
)
public
ResponseEntity
getRoles
(
PictureQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
Object
>
getRoles
(
PictureQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
pictureService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
...
...
@@ -54,7 +54,7 @@ public class PictureController {
@PreAuthorize
(
"@el.check('pictures:add')"
)
@PostMapping
@ApiOperation
(
"上传图片"
)
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
public
ResponseEntity
<
Object
>
upload
(
@RequestParam
MultipartFile
file
){
String
userName
=
SecurityUtils
.
getUsername
();
Picture
picture
=
pictureService
.
upload
(
file
,
userName
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
3
);
...
...
@@ -68,9 +68,9 @@ public class PictureController {
@ApiOperation
(
"删除图片"
)
@PreAuthorize
(
"@el.check('pictures:del')"
)
@DeleteMapping
(
value
=
"/{id}"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
)
{
public
ResponseEntity
<
Object
>
delete
(
@PathVariable
Long
id
)
{
pictureService
.
delete
(
pictureService
.
findById
(
id
));
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"多选删除图片"
)
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
View file @
900ca221
...
...
@@ -37,17 +37,17 @@ public class QiniuController {
}
@GetMapping
(
value
=
"/config"
)
public
ResponseEntity
get
(){
public
ResponseEntity
<
Object
>
get
(){
return
new
ResponseEntity
<>(
qiNiuService
.
find
(),
HttpStatus
.
OK
);
}
@Log
(
"配置七牛云存储"
)
@ApiOperation
(
"配置七牛云存储"
)
@PutMapping
(
value
=
"/config"
)
public
ResponseEntity
emailConfig
(
@Validated
@RequestBody
QiniuConfig
qiniuConfig
){
public
ResponseEntity
<
Object
>
emailConfig
(
@Validated
@RequestBody
QiniuConfig
qiniuConfig
){
qiNiuService
.
update
(
qiniuConfig
);
qiNiuService
.
update
(
qiniuConfig
.
getType
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"导出数据"
)
...
...
@@ -60,14 +60,14 @@ public class QiniuController {
@Log
(
"查询文件"
)
@ApiOperation
(
"查询文件"
)
@GetMapping
public
ResponseEntity
getRoles
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
public
ResponseEntity
<
Object
>
getRoles
(
QiniuQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
qiNiuService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"上传文件"
)
@ApiOperation
(
"上传文件"
)
@PostMapping
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
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
());
...
...
@@ -79,15 +79,15 @@ public class QiniuController {
@Log
(
"同步七牛云数据"
)
@ApiOperation
(
"同步七牛云数据"
)
@PostMapping
(
value
=
"/synchronize"
)
public
ResponseEntity
synchronize
(){
public
ResponseEntity
<
Object
>
synchronize
(){
qiNiuService
.
synchronize
(
qiNiuService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"下载文件"
)
@ApiOperation
(
"下载文件"
)
@GetMapping
(
value
=
"/download/{id}"
)
public
ResponseEntity
download
(
@PathVariable
Long
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
);
...
...
@@ -96,16 +96,16 @@ public class QiniuController {
@Log
(
"删除文件"
)
@ApiOperation
(
"删除文件"
)
@DeleteMapping
(
value
=
"/{id}"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
<
Object
>
delete
(
@PathVariable
Long
id
){
qiNiuService
.
delete
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@Log
(
"删除多张图片"
)
@ApiOperation
(
"删除多张图片"
)
@DeleteMapping
public
ResponseEntity
deleteAll
(
@RequestBody
Long
[]
ids
)
{
public
ResponseEntity
<
Object
>
deleteAll
(
@RequestBody
Long
[]
ids
)
{
qiNiuService
.
deleteAll
(
ids
,
qiNiuService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
}
eladmin-tools/src/main/java/me/zhengjie/rest/VerificationCodeController.java
View file @
900ca221
...
...
@@ -31,29 +31,29 @@ public class VerificationCodeController {
@PostMapping
(
value
=
"/resetEmail"
)
@ApiOperation
(
"重置邮箱,发送验证码"
)
public
ResponseEntity
resetEmail
(
@RequestBody
VerificationCode
code
)
throws
Exception
{
public
ResponseEntity
<
Object
>
resetEmail
(
@RequestBody
VerificationCode
code
)
throws
Exception
{
code
.
setScenes
(
ElAdminConstant
.
RESET_MAIL
);
EmailVo
emailVo
=
verificationCodeService
.
sendEmail
(
code
);
emailService
.
send
(
emailVo
,
emailService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@PostMapping
(
value
=
"/email/resetPass"
)
@ApiOperation
(
"重置密码,发送验证码"
)
public
ResponseEntity
resetPass
(
@RequestParam
String
email
)
throws
Exception
{
public
ResponseEntity
<
Object
>
resetPass
(
@RequestParam
String
email
)
throws
Exception
{
VerificationCode
code
=
new
VerificationCode
();
code
.
setType
(
"email"
);
code
.
setValue
(
email
);
code
.
setScenes
(
ElAdminConstant
.
RESET_MAIL
);
EmailVo
emailVo
=
verificationCodeService
.
sendEmail
(
code
);
emailService
.
send
(
emailVo
,
emailService
.
find
());
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
@GetMapping
(
value
=
"/validated"
)
@ApiOperation
(
"验证码验证"
)
public
ResponseEntity
validated
(
VerificationCode
code
){
public
ResponseEntity
<
Object
>
validated
(
VerificationCode
code
){
verificationCodeService
.
validated
(
code
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
}
Prev
1
2
Next
Write
Preview
Supports
Markdown
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