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
554aa58c
"src/vscode:/vscode.git/clone" did not exist on "3212423620a5da486af4b3d286b83f2cf8b7ab37"
Commit
554aa58c
authored
Dec 18, 2019
by
Elune
Browse files
代码优化
parent
8c7217eb
Changes
24
Show whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java
View file @
554aa58c
...
@@ -7,6 +7,7 @@ import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
...
@@ -7,6 +7,7 @@ import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
me.zhengjie.modules.mnt.service.mapper.ServerDeployMapper
;
import
me.zhengjie.modules.mnt.service.mapper.ServerDeployMapper
;
import
me.zhengjie.modules.mnt.util.ExecuteShellUtil
;
import
me.zhengjie.modules.mnt.util.ExecuteShellUtil
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
me.zhengjie.utils.ValidationUtil
;
...
@@ -15,6 +16,9 @@ import org.springframework.data.domain.Pageable;
...
@@ -15,6 +16,9 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.*
;
/**
/**
* @author zhanghouying
* @author zhanghouying
...
@@ -40,7 +44,7 @@ public class ServerDeployServiceImpl implements ServerDeployService {
...
@@ -40,7 +44,7 @@ public class ServerDeployServiceImpl implements ServerDeployService {
}
}
@Override
@Override
public
Object
queryAll
(
ServerDeployQueryCriteria
criteria
){
public
List
<
ServerDeployDto
>
queryAll
(
ServerDeployQueryCriteria
criteria
){
return
serverDeployMapper
.
toDto
(
serverDeployRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
return
serverDeployMapper
.
toDto
(
serverDeployRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
}
...
@@ -89,7 +93,24 @@ public class ServerDeployServiceImpl implements ServerDeployService {
...
@@ -89,7 +93,24 @@ public class ServerDeployServiceImpl implements ServerDeployService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
public
void
delete
(
Set
<
Long
>
ids
)
{
for
(
Long
id
:
ids
)
{
serverDeployRepository
.
deleteById
(
id
);
serverDeployRepository
.
deleteById
(
id
);
}
}
}
@Override
public
void
download
(
List
<
ServerDeployDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
ServerDeployDto
deployDto
:
queryAll
)
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"服务器名称"
,
deployDto
.
getName
());
map
.
put
(
"服务器IP"
,
deployDto
.
getIp
());
map
.
put
(
"端口"
,
deployDto
.
getPort
());
map
.
put
(
"账号"
,
deployDto
.
getAccount
());
map
.
put
(
"创建日期"
,
deployDto
.
getCreateTime
());
list
.
add
(
map
);
}
FileUtil
.
downloadExcel
(
list
,
response
);
}
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
View file @
554aa58c
...
@@ -198,7 +198,7 @@ public class UserServiceImpl implements UserService {
...
@@ -198,7 +198,7 @@ public class UserServiceImpl implements UserService {
public
void
download
(
List
<
UserDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
{
public
void
download
(
List
<
UserDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
UserDto
userDTO
:
queryAll
)
{
for
(
UserDto
userDTO
:
queryAll
)
{
List
roles
=
userDTO
.
getRoles
().
stream
().
map
(
RoleSmallDto:
:
getName
).
collect
(
Collectors
.
toList
());
List
<
String
>
roles
=
userDTO
.
getRoles
().
stream
().
map
(
RoleSmallDto:
:
getName
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"用户名"
,
userDTO
.
getUsername
());
map
.
put
(
"用户名"
,
userDTO
.
getUsername
());
map
.
put
(
"头像"
,
userDTO
.
getAvatar
());
map
.
put
(
"头像"
,
userDTO
.
getAvatar
());
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java
View file @
554aa58c
...
@@ -101,7 +101,7 @@ public class AliPayController {
...
@@ -101,7 +101,7 @@ public class AliPayController {
@AnonymousAccess
@AnonymousAccess
@SuppressWarnings
(
"all"
)
@SuppressWarnings
(
"all"
)
@ApiOperation
(
"支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理"
)
@ApiOperation
(
"支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理"
)
public
ResponseEntity
notify
(
HttpServletRequest
request
){
public
ResponseEntity
<
Object
>
notify
(
HttpServletRequest
request
){
AlipayConfig
alipay
=
alipayService
.
find
();
AlipayConfig
alipay
=
alipayService
.
find
();
Map
<
String
,
String
[]>
parameterMap
=
request
.
getParameterMap
();
Map
<
String
,
String
[]>
parameterMap
=
request
.
getParameterMap
();
//内容验签,防止黑客篡改参数
//内容验签,防止黑客篡改参数
...
@@ -118,8 +118,8 @@ public class AliPayController {
...
@@ -118,8 +118,8 @@ public class AliPayController {
if
(
tradeStatus
.
equals
(
AliPayStatusEnum
.
SUCCESS
.
getValue
())||
tradeStatus
.
equals
(
AliPayStatusEnum
.
FINISHED
.
getValue
())){
if
(
tradeStatus
.
equals
(
AliPayStatusEnum
.
SUCCESS
.
getValue
())||
tradeStatus
.
equals
(
AliPayStatusEnum
.
FINISHED
.
getValue
())){
// 验证通过后应该根据业务需要处理订单
// 验证通过后应该根据业务需要处理订单
}
}
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
HttpStatus
.
OK
);
}
}
return
new
ResponseEntity
(
HttpStatus
.
BAD_REQUEST
);
return
new
ResponseEntity
<>
(
HttpStatus
.
BAD_REQUEST
);
}
}
}
}
eladmin-tools/src/main/java/me/zhengjie/rest/PictureController.java
View file @
554aa58c
...
@@ -77,8 +77,8 @@ public class PictureController {
...
@@ -77,8 +77,8 @@ public class PictureController {
@ApiOperation
(
"多选删除图片"
)
@ApiOperation
(
"多选删除图片"
)
@PreAuthorize
(
"@el.check('pictures:del')"
)
@PreAuthorize
(
"@el.check('pictures:del')"
)
@DeleteMapping
@DeleteMapping
public
ResponseEntity
deleteAll
(
@RequestBody
Long
[]
ids
)
{
public
ResponseEntity
<
Object
>
deleteAll
(
@RequestBody
Long
[]
ids
)
{
pictureService
.
deleteAll
(
ids
);
pictureService
.
deleteAll
(
ids
);
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