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
7c35a79c
Commit
7c35a79c
authored
May 05, 2020
by
ZhengJie
Browse files
[新增功能](el-admin v2.5): v2.5 beta
详情
https://www.ydyno.com/archives/1225.html
parent
d35ffc9d
Changes
295
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java
View file @
7c35a79c
/*
* 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.modules.system.repository
;
import
me.zhengjie.modules.system.domain.Menu
;
...
...
@@ -15,11 +30,11 @@ import java.util.Set;
public
interface
MenuRepository
extends
JpaRepository
<
Menu
,
Long
>,
JpaSpecificationExecutor
<
Menu
>
{
/**
* 根据菜单
名称
查询
* @param
nam
e 菜单
名称
* 根据菜单
标题
查询
* @param
titl
e 菜单
标题
* @return /
*/
Menu
findBy
Nam
e
(
String
nam
e
);
Menu
findBy
Titl
e
(
String
titl
e
);
/**
* 根据组件名称查询
...
...
@@ -41,5 +56,5 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
* @param type 类型
* @return /
*/
LinkedHashSet
<
Menu
>
findByRoles_IdInAndTypeNotOrderBySortAsc
(
Set
<
Long
>
roleIds
,
int
type
);
LinkedHashSet
<
Menu
>
findByRoles_IdInAndTypeNotOrderBy
Menu
SortAsc
(
Set
<
Long
>
roleIds
,
int
type
);
}
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java
View file @
7c35a79c
/*
* 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.modules.system.repository
;
import
me.zhengjie.modules.system.domain.Role
;
...
...
@@ -35,11 +50,4 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
@Modifying
@Query
(
value
=
"delete from roles_menus where menu_id = ?1"
,
nativeQuery
=
true
)
void
untiedMenu
(
Long
id
);
/**
* 根据角色权限查询
* @param permission /
* @return /
*/
Role
findByPermission
(
String
permission
);
}
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserAvatarRepository.java
deleted
100644 → 0
View file @
d35ffc9d
package
me.zhengjie.modules.system.repository
;
import
me.zhengjie.modules.system.domain.UserAvatar
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author Zheng Jie
* @date 2018-11-22
*/
public
interface
UserAvatarRepository
extends
JpaRepository
<
UserAvatar
,
Long
>,
JpaSpecificationExecutor
<
UserAvatar
>
{
}
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java
View file @
7c35a79c
/*
* 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.modules.system.repository
;
import
me.zhengjie.modules.system.domain.User
;
...
...
@@ -34,7 +49,7 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
* @param lastPasswordResetTime /
*/
@Modifying
@Query
(
value
=
"update user set password = ?2 ,
last_passwor
d_reset_time = ?3 where username = ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"update
sys_
user set password = ?2 ,
pw
d_reset_time = ?3 where username = ?1"
,
nativeQuery
=
true
)
void
updatePass
(
String
username
,
String
pass
,
Date
lastPasswordResetTime
);
/**
...
...
@@ -43,6 +58,6 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
* @param email 邮箱
*/
@Modifying
@Query
(
value
=
"update user set email = ?2 where username = ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"update
sys_
user set email = ?2 where username = ?1"
,
nativeQuery
=
true
)
void
updateEmail
(
String
username
,
String
email
);
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
cn.hutool.core.collection.CollectionUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.config.DataScope
;
import
me.zhengjie.exception.BadRequestException
;
...
...
@@ -27,21 +43,15 @@ import java.util.Set;
* @date 2019-03-25
*/
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:部门管理"
)
@RequestMapping
(
"/api/dept"
)
public
class
DeptController
{
private
final
DeptService
deptService
;
private
final
DataScope
dataScope
;
private
static
final
String
ENTITY_NAME
=
"dept"
;
public
DeptController
(
DeptService
deptService
,
DataScope
dataScope
)
{
this
.
deptService
=
deptService
;
this
.
dataScope
=
dataScope
;
}
@Log
(
"导出部门数据"
)
@ApiOperation
(
"导出部门数据"
)
@GetMapping
(
value
=
"/download"
)
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.Dict
;
...
...
@@ -13,7 +29,6 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.Set
;
...
...
@@ -22,19 +37,15 @@ import java.util.Set;
* @author Zheng Jie
* @date 2019-04-10
*/
@Api
(
tags
=
"系统:字典管理"
)
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:字典管理"
)
@RequestMapping
(
"/api/dict"
)
public
class
DictController
{
private
final
DictService
dictService
;
private
static
final
String
ENTITY_NAME
=
"dict"
;
public
DictController
(
DictService
dictService
)
{
this
.
dictService
=
dictService
;
}
@Log
(
"导出字典数据"
)
@ApiOperation
(
"导出字典数据"
)
@GetMapping
(
value
=
"/download"
)
...
...
@@ -55,7 +66,7 @@ public class DictController {
@ApiOperation
(
"查询字典"
)
@GetMapping
@PreAuthorize
(
"@el.check('dict:list')"
)
public
ResponseEntity
<
Object
>
get
Dicts
(
DictQueryCriteria
resources
,
Pageable
pageable
){
public
ResponseEntity
<
Object
>
get
ByQuery
(
DictQueryCriteria
resources
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
dictService
.
queryAll
(
resources
,
pageable
),
HttpStatus
.
OK
);
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.DictDetail
;
...
...
@@ -23,23 +39,19 @@ import java.util.Map;
* @date 2019-04-10
*/
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:字典详情管理"
)
@RequestMapping
(
"/api/dictDetail"
)
public
class
DictDetailController
{
private
final
DictDetailService
dictDetailService
;
private
static
final
String
ENTITY_NAME
=
"dictDetail"
;
public
DictDetailController
(
DictDetailService
dictDetailService
)
{
this
.
dictDetailService
=
dictDetailService
;
}
@Log
(
"查询字典详情"
)
@ApiOperation
(
"查询字典详情"
)
@GetMapping
public
ResponseEntity
<
Object
>
getDictDetails
(
DictDetailQueryCriteria
criteria
,
@PageableDefault
(
sort
=
{
"
s
ort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
@PageableDefault
(
sort
=
{
"
dictS
ort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
return
new
ResponseEntity
<>(
dictDetailService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
...
...
@@ -47,7 +59,7 @@ public class DictDetailController {
@ApiOperation
(
"查询多个字典详情"
)
@GetMapping
(
value
=
"/map"
)
public
ResponseEntity
<
Object
>
getDictDetailMaps
(
DictDetailQueryCriteria
criteria
,
@PageableDefault
(
sort
=
{
"
s
ort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
@PageableDefault
(
sort
=
{
"
dictS
ort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
String
[]
names
=
criteria
.
getDictName
().
split
(
","
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
names
.
length
);
for
(
String
name
:
names
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.config.DataScope
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.Job
;
import
me.zhengjie.modules.system.service.JobService
;
...
...
@@ -23,22 +38,15 @@ import java.util.Set;
* @author Zheng Jie
* @date 2019-03-29
*/
@Api
(
tags
=
"系统:岗位管理"
)
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:岗位管理"
)
@RequestMapping
(
"/api/job"
)
public
class
JobController
{
private
final
JobService
jobService
;
private
final
DataScope
dataScope
;
private
static
final
String
ENTITY_NAME
=
"job"
;
public
JobController
(
JobService
jobService
,
DataScope
dataScope
)
{
this
.
jobService
=
jobService
;
this
.
dataScope
=
dataScope
;
}
@Log
(
"导出岗位数据"
)
@ApiOperation
(
"导出岗位数据"
)
@GetMapping
(
value
=
"/download"
)
...
...
@@ -52,8 +60,6 @@ public class JobController {
@GetMapping
@PreAuthorize
(
"@el.check('job:list','user:list')"
)
public
ResponseEntity
<
Object
>
getJobs
(
JobQueryCriteria
criteria
,
Pageable
pageable
){
// 数据权限
criteria
.
setDeptIds
(
dataScope
.
getDeptIds
());
return
new
ResponseEntity
<>(
jobService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/
monitor
/rest/LimitController.java
→
eladmin-system/src/main/java/me/zhengjie/modules/
system
/rest/LimitController.java
View file @
7c35a79c
package
me.zhengjie.modules.monitor.rest
;
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.system.domain.Menu
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.service.MenuService
;
import
me.zhengjie.modules.system.service.RoleService
;
import
me.zhengjie.modules.system.service.UserService
;
import
me.zhengjie.modules.system.service.dto.MenuDto
;
import
me.zhengjie.modules.system.service.dto.MenuQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.UserDto
;
import
me.zhengjie.utils.SecurityUtils
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.HashSet
;
...
...
@@ -28,26 +41,18 @@ import java.util.Set;
* @author Zheng Jie
* @date 2018-12-03
*/
@Api
(
tags
=
"系统:菜单管理"
)
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:菜单管理"
)
@RequestMapping
(
"/api/menus"
)
@SuppressWarnings
(
"unchecked"
)
public
class
MenuController
{
private
final
MenuService
menuService
;
private
final
UserService
userService
;
private
final
RoleService
roleService
;
private
static
final
String
ENTITY_NAME
=
"menu"
;
public
MenuController
(
MenuService
menuService
,
UserService
userService
,
RoleService
roleService
)
{
this
.
menuService
=
menuService
;
this
.
userService
=
userService
;
this
.
roleService
=
roleService
;
}
@Log
(
"导出菜单数据"
)
@ApiOperation
(
"导出菜单数据"
)
@GetMapping
(
value
=
"/download"
)
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MonitorController.java
0 → 100644
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.system.service.MonitorService
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author Zheng Jie
* @date 2020-05-02
*/
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统-服务监控管理"
)
@RequestMapping
(
"/api/monitor"
)
public
class
MonitorController
{
private
final
MonitorService
serverService
;
@GetMapping
@ApiOperation
(
"查询服务监控"
)
@PreAuthorize
(
"@el.check('monitor:list')"
)
public
ResponseEntity
<
Object
>
getServers
(){
return
new
ResponseEntity
<>(
serverService
.
getServers
(),
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
cn.hutool.core.lang.Dict
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.system.domain.Role
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.service.RoleService
;
import
me.zhengjie.modules.system.service.UserService
;
import
me.zhengjie.modules.system.service.dto.RoleDto
;
import
me.zhengjie.modules.system.service.dto.RoleQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.RoleSmallDto
;
import
me.zhengjie.modules.system.service.dto.UserDto
;
import
me.zhengjie.utils.SecurityUtils
;
import
me.zhengjie.utils.ThrowableUtil
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -33,21 +47,16 @@ import java.util.stream.Collectors;
* @author Zheng Jie
* @date 2018-12-03
*/
@Api
(
tags
=
"系统:角色管理"
)
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:角色管理"
)
@RequestMapping
(
"/api/roles"
)
public
class
RoleController
{
private
final
RoleService
roleService
;
private
final
UserService
userService
;
private
static
final
String
ENTITY_NAME
=
"role"
;
public
RoleController
(
RoleService
roleService
,
UserService
userService
)
{
this
.
roleService
=
roleService
;
this
.
userService
=
userService
;
}
@ApiOperation
(
"获取单个role"
)
@GetMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('roles:list')"
)
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
View file @
7c35a79c
/*
* 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.modules.system.rest
;
import
cn.hutool.crypto.asymmetric.KeyType
;
import
cn.hutool.crypto.asymmetric.RSA
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.config.DataScope
;
import
me.zhengjie.domain.VerificationCode
;
import
me.zhengjie.modules.system.domain.User
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.vo.UserPassVo
;
...
...
@@ -15,9 +30,10 @@ import me.zhengjie.modules.system.service.RoleService;
import
me.zhengjie.modules.system.service.dto.RoleSmallDto
;
import
me.zhengjie.modules.system.service.dto.UserDto
;
import
me.zhengjie.modules.system.service.dto.UserQueryCriteria
;
import
me.zhengjie.service.Verif
icationCode
Service
;
import
me.zhengjie.
modules.system.
service.Verif
y
Service
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.modules.system.service.UserService
;
import
me.zhengjie.utils.enums.CodeEnum
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -41,6 +57,7 @@ import java.util.stream.Collectors;
@Api
(
tags
=
"系统:用户管理"
)
@RestController
@RequestMapping
(
"/api/users"
)
@RequiredArgsConstructor
public
class
UserController
{
@Value
(
"${rsa.private_key}"
)
...
...
@@ -50,16 +67,7 @@ public class UserController {
private
final
DataScope
dataScope
;
private
final
DeptService
deptService
;
private
final
RoleService
roleService
;
private
final
VerificationCodeService
verificationCodeService
;
public
UserController
(
PasswordEncoder
passwordEncoder
,
UserService
userService
,
DataScope
dataScope
,
DeptService
deptService
,
RoleService
roleService
,
VerificationCodeService
verificationCodeService
)
{
this
.
passwordEncoder
=
passwordEncoder
;
this
.
userService
=
userService
;
this
.
dataScope
=
dataScope
;
this
.
deptService
=
deptService
;
this
.
roleService
=
roleService
;
this
.
verificationCodeService
=
verificationCodeService
;
}
private
final
VerifyService
verificationCodeService
;
@Log
(
"导出用户数据"
)
@ApiOperation
(
"导出用户数据"
)
...
...
@@ -187,8 +195,7 @@ public class UserController {
if
(!
passwordEncoder
.
matches
(
password
,
userDto
.
getPassword
())){
throw
new
BadRequestException
(
"密码错误"
);
}
VerificationCode
verificationCode
=
new
VerificationCode
(
code
,
ElAdminConstant
.
RESET_MAIL
,
"email"
,
user
.
getEmail
());
verificationCodeService
.
validated
(
verificationCode
);
verificationCodeService
.
validated
(
CodeEnum
.
EMAIL_RESET_EMAIL_CODE
.
getKey
()
+
user
.
getEmail
(),
code
);
userService
.
updateEmail
(
userDto
.
getUsername
(),
user
.
getEmail
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
...
...
eladmin-
tools
/src/main/java/me/zhengjie/
rest/VerificationCode
Controller.java
→
eladmin-
system
/src/main/java/me/zhengjie/
modules/system/rest/Verify
Controller.java
View file @
7c35a79c
package
me.zhengjie.rest
;
/*
* 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.modules.system.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
me.zhengjie.domain.VerificationCode
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.domain.vo.EmailVo
;
import
me.zhengjie.service.EmailService
;
import
me.zhengjie.service.VerificationCodeService
;
import
me.zhengjie.utils.ElAdminConstant
;
import
me.zhengjie.modules.system.service.VerifyService
;
import
me.zhengjie.utils.enums.CodeBiEnum
;
import
me.zhengjie.utils.enums.CodeEnum
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Objects
;
/**
* @author Zheng Jie
* @date 2018-12-26
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/api/code"
)
@Api
(
tags
=
"工具:验证码管理"
)
public
class
VerificationCodeController
{
private
final
VerificationCodeService
verificationCodeService
;
@Api
(
tags
=
"系统:验证码管理"
)
public
class
VerifyController
{
private
final
VerifyService
verificationCodeService
;
private
final
EmailService
emailService
;
public
VerificationCodeController
(
VerificationCodeService
verificationCodeService
,
EmailService
emailService
)
{
this
.
verificationCodeService
=
verificationCodeService
;
this
.
emailService
=
emailService
;
}
@PostMapping
(
value
=
"/resetEmail"
)
@ApiOperation
(
"重置邮箱,发送验证码"
)
public
ResponseEntity
<
Object
>
resetEmail
(
@RequestBody
VerificationCode
code
)
throws
Exception
{
code
.
setScenes
(
ElAdminConstant
.
RESET_MAIL
);
EmailVo
emailVo
=
verificationCodeService
.
sendEmail
(
code
);
public
ResponseEntity
<
Object
>
resetEmail
(
@RequestParam
String
email
){
EmailVo
emailVo
=
verificationCodeService
.
sendEmail
(
email
,
CodeEnum
.
EMAIL_RESET_EMAIL_CODE
.
getKey
());
emailService
.
send
(
emailVo
,
emailService
.
find
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
@PostMapping
(
value
=
"/email/resetPass"
)
@ApiOperation
(
"重置密码,发送验证码"
)
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
);
public
ResponseEntity
<
Object
>
resetPass
(
@RequestParam
String
email
){
EmailVo
emailVo
=
verificationCodeService
.
sendEmail
(
email
,
CodeEnum
.
EMAIL_RESET_PWD_CODE
.
getKey
());
emailService
.
send
(
emailVo
,
emailService
.
find
());
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
@GetMapping
(
value
=
"/validated"
)
@ApiOperation
(
"验证码验证"
)
public
ResponseEntity
<
Object
>
validated
(
VerificationCode
code
){
verificationCodeService
.
validated
(
code
);
public
ResponseEntity
<
Object
>
validated
(
@RequestParam
String
email
,
@RequestParam
String
code
,
@RequestParam
Integer
codeBi
){
CodeBiEnum
biEnum
=
CodeBiEnum
.
find
(
codeBi
);
switch
(
Objects
.
requireNonNull
(
biEnum
)){
case
ONE:
verificationCodeService
.
validated
(
CodeEnum
.
EMAIL_RESET_EMAIL_CODE
.
getKey
()
+
email
,
code
);
break
;
case
TWO:
verificationCodeService
.
validated
(
CodeEnum
.
EMAIL_RESET_PWD_CODE
.
getKey
()
+
email
,
code
);
break
;
}
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java
View file @
7c35a79c
/*
* 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.modules.system.service
;
import
me.zhengjie.modules.system.domain.Dept
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java
View file @
7c35a79c
/*
* 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.modules.system.service
;
import
me.zhengjie.modules.system.domain.DictDetail
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java
View file @
7c35a79c
/*
* 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.modules.system.service
;
import
me.zhengjie.modules.system.domain.Dict
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java
View file @
7c35a79c
/*
* 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.modules.system.service
;
import
me.zhengjie.modules.system.domain.Job
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java
View file @
7c35a79c
/*
* 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.modules.system.service
;
import
me.zhengjie.modules.system.domain.Menu
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/MonitorService.java
0 → 100644
View file @
7c35a79c
/*
* 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.modules.system.service
;
import
java.util.Map
;
/**
* @author Zheng Jie
* @date 2020-05-02
*/
public
interface
MonitorService
{
/**
* 查询数据分页
* @return Map<String,Object>
*/
Map
<
String
,
Object
>
getServers
();
}
Prev
1
…
6
7
8
9
10
11
12
13
14
15
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