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
6ab1caac
Commit
6ab1caac
authored
Apr 17, 2023
by
Zheng Jie
Browse files
Merge branch 'master' into deploy
parents
72148f1f
19dea052
Changes
29
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
6ab1caac
<h1
style=
"text-align: center"
>
EL
-
ADMIN 后台管理系统
</h1>
<h1
style=
"text-align: center"
>
ELADMIN 后台管理系统
</h1>
<div
style=
"text-align: center"
>
<div
style=
"text-align: center"
>
[

](https://github.com/elunez/eladmin/blob/master/LICENSE)
[

](https://github.com/elunez/eladmin/blob/master/LICENSE)
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
#### 项目简介
#### 项目简介
一个基于 Spring Boot 2.1.0 、 Spring Boot Jpa、 JWT、Spring Security、Redis、Vue的前后端分离的后台管理系统
一个基于 Spring Boot 2.1.0 、 Spring Boot Jpa、 JWT、Spring Security、Redis、Vue的前后端分离的后台管理系统
**开发文档:**
[
https://el
-
admin.vip
](
https://el
-
admin.vip
)
**开发文档:**
[
https://eladmin.vip
](
https://eladmin.vip
)
**体验地址:**
[
https://el
-
admin.vip/demo
](
https://el
-
admin.vip/demo
)
**体验地址:**
[
https://eladmin.vip/demo
](
https://eladmin.vip/demo
)
**账号密码:**
`admin / 123456`
**账号密码:**
`admin / 123456`
...
@@ -87,9 +87,9 @@
...
@@ -87,9 +87,9 @@
#### 特别鸣谢
#### 特别鸣谢
-
感谢
[
JetBrains
](
https://
www.jetbrains.com/
)
提供的非商业开源软件开发授权
-
感谢
[
七牛云
](
https://
portal.qiniu.com/signup?utm_source=kaiyuan&utm_media=ELADMIN
)
提供的免费云存储与CDN加速支持
-
感谢
[
七牛云
](
https://www.
qiniu
.com/
)
提供的
免费云存储与CDN加速支持
-
感谢
[
JetBrains
](
https://www.
jetbrains
.com/
)
提供的
非商业开源软件开发授权
-
感谢
[
PanJiaChen
](
https://github.com/PanJiaChen/vue-element-admin
)
大佬提供的前端模板
-
感谢
[
PanJiaChen
](
https://github.com/PanJiaChen/vue-element-admin
)
大佬提供的前端模板
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
-
感谢
[
d15801543974
](
https://github.com/d15801543974
)
大佬提供的基于注解的通用查询方式
-
感谢
[
d15801543974
](
https://github.com/d15801543974
)
大佬提供的基于注解的通用查询方式
#### 项目捐赠
#### 项目捐赠
项目的发展离不开你的支持,请作者喝杯咖啡吧☕
[
Donate
](
https://el
-
admin.vip/donation/
)
项目的发展离不开你的支持,请作者喝杯咖啡吧☕
[
Donate
](
https://eladmin.vip/donation/
)
#### 反馈交流
#### 反馈交流
-
QQ交流群:一群:
<strike>
891137268
</strike>
、二群:
<strike>
947578238
</strike>
、三群:659622532
-
QQ交流群:一群:
<strike>
891137268
</strike>
、二群:
<strike>
947578238
</strike>
、三群:659622532
\ No newline at end of file
eladmin-common/src/main/java/me/zhengjie/annotation/DataPermission.java
View file @
6ab1caac
...
@@ -28,7 +28,7 @@ import java.lang.annotation.Target;
...
@@ -28,7 +28,7 @@ import java.lang.annotation.Target;
* 应该是 @DataPermission(joinName = "dept", fieldName = "id")
* 应该是 @DataPermission(joinName = "dept", fieldName = "id")
* </p>
* </p>
* @author Zheng Jie
* @author Zheng Jie
* @website https://el
-
admin.vip
* @website https://eladmin.vip
* @date 2020-05-07
* @date 2020-05-07
**/
**/
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
...
...
eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
View file @
6ab1caac
...
@@ -106,7 +106,7 @@ public class RedisConfig extends CachingConfigurerSupport {
...
@@ -106,7 +106,7 @@ public class RedisConfig extends CachingConfigurerSupport {
@Override
@Override
public
KeyGenerator
keyGenerator
()
{
public
KeyGenerator
keyGenerator
()
{
return
(
target
,
method
,
params
)
->
{
return
(
target
,
method
,
params
)
->
{
Map
<
String
,
Object
>
container
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
container
=
new
HashMap
<>(
8
);
Class
<?>
targetClassClass
=
target
.
getClass
();
Class
<?>
targetClassClass
=
target
.
getClass
();
// 类地址
// 类地址
container
.
put
(
"class"
,
targetClassClass
.
toGenericString
());
container
.
put
(
"class"
,
targetClassClass
.
toGenericString
());
...
...
eladmin-common/src/main/java/me/zhengjie/config/RsaProperties.java
View file @
6ab1caac
...
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
...
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @website https://el
-
admin.vip
* @website https://eladmin.vip
* @description
* @description
* @date 2020-05-18
* @date 2020-05-18
**/
**/
...
...
eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java
View file @
6ab1caac
...
@@ -77,7 +77,7 @@ public class SwaggerConfig {
...
@@ -77,7 +77,7 @@ public class SwaggerConfig {
private
ApiInfo
apiInfo
()
{
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
return
new
ApiInfoBuilder
()
.
description
(
"一个简单且易上手的 Spring boot 后台管理框架"
)
.
description
(
"一个简单且易上手的 Spring boot 后台管理框架"
)
.
title
(
"EL
-
ADMIN 接口文档"
)
.
title
(
"ELADMIN 接口文档"
)
.
version
(
"2.6"
)
.
version
(
"2.6"
)
.
build
();
.
build
();
}
}
...
...
eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java
View file @
6ab1caac
...
@@ -23,10 +23,11 @@ import me.zhengjie.utils.ThrowableUtil;
...
@@ -23,10 +23,11 @@ import me.zhengjie.utils.ThrowableUtil;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.validation.FieldError
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
java.util.Objects
;
import
static
org
.
springframework
.
http
.
HttpStatus
.*;
import
static
org
.
springframework
.
http
.
HttpStatus
.*;
/**
/**
...
@@ -95,11 +96,10 @@ public class GlobalExceptionHandler {
...
@@ -95,11 +96,10 @@ public class GlobalExceptionHandler {
public
ResponseEntity
<
ApiError
>
handleMethodArgumentNotValidException
(
MethodArgumentNotValidException
e
){
public
ResponseEntity
<
ApiError
>
handleMethodArgumentNotValidException
(
MethodArgumentNotValidException
e
){
// 打印堆栈信息
// 打印堆栈信息
log
.
error
(
ThrowableUtil
.
getStackTrace
(
e
));
log
.
error
(
ThrowableUtil
.
getStackTrace
(
e
));
String
[]
str
=
Objects
.
requireNonNull
(
e
.
getBindingResult
().
getAllErrors
().
get
(
0
).
getCodes
())[
1
].
split
(
"\\."
);
ObjectError
objectError
=
e
.
getBindingResult
().
getAllErrors
().
get
(
0
);
String
message
=
e
.
getBindingResult
().
getAllErrors
().
get
(
0
).
getDefaultMessage
();
String
message
=
objectError
.
getDefaultMessage
();
String
msg
=
"不能为空"
;
if
(
objectError
instanceof
FieldError
)
{
if
(
msg
.
equals
(
message
)){
message
=
((
FieldError
)
objectError
).
getField
()
+
": "
+
message
;
message
=
str
[
1
]
+
":"
+
message
;
}
}
return
buildResponseEntity
(
ApiError
.
error
(
message
));
return
buildResponseEntity
(
ApiError
.
error
(
message
));
}
}
...
...
eladmin-common/src/main/java/me/zhengjie/utils/CloseUtil.java
View file @
6ab1caac
...
@@ -19,7 +19,7 @@ import java.io.Closeable;
...
@@ -19,7 +19,7 @@ import java.io.Closeable;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @website https://el
-
admin.vip
* @website https://eladmin.vip
* @description 用于关闭各种连接,缺啥补啥
* @description 用于关闭各种连接,缺啥补啥
* @date 2021-03-05
* @date 2021-03-05
**/
**/
...
...
eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
View file @
6ab1caac
...
@@ -182,7 +182,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -182,7 +182,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
public
static
File
upload
(
MultipartFile
file
,
String
filePath
)
{
public
static
File
upload
(
MultipartFile
file
,
String
filePath
)
{
Date
date
=
new
Date
();
Date
date
=
new
Date
();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMddhhmmssS"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMddhhmmssS"
);
String
name
=
getFileNameNoEx
(
file
.
getOriginalFilename
());
// 过滤非法文件名
String
name
=
getFileNameNoEx
(
verifyFilename
(
file
.
getOriginalFilename
()));
String
suffix
=
getExtensionName
(
file
.
getOriginalFilename
());
String
suffix
=
getExtensionName
(
file
.
getOriginalFilename
());
String
nowStr
=
"-"
+
format
.
format
(
date
);
String
nowStr
=
"-"
+
format
.
format
(
date
);
try
{
try
{
...
@@ -350,6 +351,44 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -350,6 +351,44 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
}
}
}
}
/**
* 验证并过滤非法的文件名
* @param fileName 文件名
* @return 文件名
*/
public
static
String
verifyFilename
(
String
fileName
)
{
// 过滤掉特殊字符
fileName
=
fileName
.
replaceAll
(
"[\\\\/:*?\"<>|~\\s]"
,
""
);
// 去掉文件名开头和结尾的空格和点
fileName
=
fileName
.
trim
().
replaceAll
(
"^[. ]+|[. ]+$"
,
""
);
// 不允许文件名超过255(在Mac和Linux中)或260(在Windows中)个字符
int
maxFileNameLength
=
255
;
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
))
{
maxFileNameLength
=
260
;
}
if
(
fileName
.
length
()
>
maxFileNameLength
)
{
fileName
=
fileName
.
substring
(
0
,
maxFileNameLength
);
}
// 过滤掉控制字符
fileName
=
fileName
.
replaceAll
(
"[\\p{Cntrl}]"
,
""
);
// 过滤掉 ".." 路径
fileName
=
fileName
.
replaceAll
(
"\\.{2,}"
,
""
);
// 去掉文件名开头的 ".."
fileName
=
fileName
.
replaceAll
(
"^\\.+/"
,
""
);
// 保留文件名中最后一个 "." 字符,过滤掉其他 "."
fileName
=
fileName
.
replaceAll
(
"^(.*)(\\.[^.]*)$"
,
"$1"
).
replaceAll
(
"\\."
,
""
)
+
fileName
.
replaceAll
(
"^(.*)(\\.[^.]*)$"
,
"$2"
);
return
fileName
;
}
public
static
String
getMd5
(
File
file
)
{
public
static
String
getMd5
(
File
file
)
{
return
getMd5
(
getByte
(
file
));
return
getMd5
(
getByte
(
file
));
}
}
...
...
eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
View file @
6ab1caac
...
@@ -161,8 +161,10 @@ public class QueryHelp {
...
@@ -161,8 +161,10 @@ public class QueryHelp {
break
;
break
;
case
BETWEEN:
case
BETWEEN:
List
<
Object
>
between
=
new
ArrayList
<>((
List
<
Object
>)
val
);
List
<
Object
>
between
=
new
ArrayList
<>((
List
<
Object
>)
val
);
list
.
add
(
cb
.
between
(
getExpression
(
attributeName
,
join
,
root
).
as
((
Class
<?
extends
Comparable
>)
between
.
get
(
0
).
getClass
()),
if
(
between
.
size
()
==
2
){
(
Comparable
)
between
.
get
(
0
),
(
Comparable
)
between
.
get
(
1
)));
list
.
add
(
cb
.
between
(
getExpression
(
attributeName
,
join
,
root
).
as
((
Class
<?
extends
Comparable
>)
between
.
get
(
0
).
getClass
()),
(
Comparable
)
between
.
get
(
0
),
(
Comparable
)
between
.
get
(
1
)));
}
break
;
break
;
default
:
break
;
default
:
break
;
}
}
...
...
eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java
View file @
6ab1caac
...
@@ -185,7 +185,8 @@ public class RedisUtils {
...
@@ -185,7 +185,8 @@ public class RedisUtils {
}
else
{
}
else
{
Set
<
Object
>
keySet
=
new
HashSet
<>();
Set
<
Object
>
keySet
=
new
HashSet
<>();
for
(
String
key
:
keys
)
{
for
(
String
key
:
keys
)
{
keySet
.
addAll
(
redisTemplate
.
keys
(
key
));
if
(
redisTemplate
.
hasKey
(
key
))
keySet
.
add
(
key
);
}
}
long
count
=
redisTemplate
.
delete
(
keySet
);
long
count
=
redisTemplate
.
delete
(
keySet
);
log
.
debug
(
"--------------------------------------------"
);
log
.
debug
(
"--------------------------------------------"
);
...
...
eladmin-common/src/main/java/me/zhengjie/utils/enums/RequestMethodEnum.java
View file @
6ab1caac
...
@@ -20,7 +20,7 @@ import lombok.Getter;
...
@@ -20,7 +20,7 @@ import lombok.Getter;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @website https://el
-
admin.vip
* @website https://eladmin.vip
* @description
* @description
* @date 2020-06-10
* @date 2020-06-10
**/
**/
...
...
eladmin-generator/src/main/java/me/zhengjie/service/impl/GeneratorServiceImpl.java
View file @
6ab1caac
...
@@ -59,6 +59,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -59,6 +59,7 @@ public class GeneratorServiceImpl implements GeneratorService {
private
final
ColumnInfoRepository
columnInfoRepository
;
private
final
ColumnInfoRepository
columnInfoRepository
;
private
final
String
CONFIG_MESSAGE
=
"请先配置生成器"
;
@Override
@Override
public
Object
getTables
()
{
public
Object
getTables
()
{
// 使用预编译防止sql注入
// 使用预编译防止sql注入
...
@@ -169,7 +170,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -169,7 +170,7 @@ public class GeneratorServiceImpl implements GeneratorService {
@Override
@Override
public
void
generator
(
GenConfig
genConfig
,
List
<
ColumnInfo
>
columns
)
{
public
void
generator
(
GenConfig
genConfig
,
List
<
ColumnInfo
>
columns
)
{
if
(
genConfig
.
getId
()
==
null
)
{
if
(
genConfig
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"请先配置生成器"
);
throw
new
BadRequestException
(
CONFIG_MESSAGE
);
}
}
try
{
try
{
GenUtil
.
generatorCode
(
columns
,
genConfig
);
GenUtil
.
generatorCode
(
columns
,
genConfig
);
...
@@ -182,7 +183,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -182,7 +183,7 @@ public class GeneratorServiceImpl implements GeneratorService {
@Override
@Override
public
ResponseEntity
<
Object
>
preview
(
GenConfig
genConfig
,
List
<
ColumnInfo
>
columns
)
{
public
ResponseEntity
<
Object
>
preview
(
GenConfig
genConfig
,
List
<
ColumnInfo
>
columns
)
{
if
(
genConfig
.
getId
()
==
null
)
{
if
(
genConfig
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"请先配置生成器"
);
throw
new
BadRequestException
(
CONFIG_MESSAGE
);
}
}
List
<
Map
<
String
,
Object
>>
genList
=
GenUtil
.
preview
(
columns
,
genConfig
);
List
<
Map
<
String
,
Object
>>
genList
=
GenUtil
.
preview
(
columns
,
genConfig
);
return
new
ResponseEntity
<>(
genList
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
genList
,
HttpStatus
.
OK
);
...
@@ -191,7 +192,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -191,7 +192,7 @@ public class GeneratorServiceImpl implements GeneratorService {
@Override
@Override
public
void
download
(
GenConfig
genConfig
,
List
<
ColumnInfo
>
columns
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
download
(
GenConfig
genConfig
,
List
<
ColumnInfo
>
columns
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
if
(
genConfig
.
getId
()
==
null
)
{
if
(
genConfig
.
getId
()
==
null
)
{
throw
new
BadRequestException
(
"请先配置生成器"
);
throw
new
BadRequestException
(
CONFIG_MESSAGE
);
}
}
try
{
try
{
File
file
=
new
File
(
GenUtil
.
download
(
columns
,
genConfig
));
File
file
=
new
File
(
GenUtil
.
download
(
columns
,
genConfig
));
...
...
eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java
View file @
6ab1caac
...
@@ -96,9 +96,9 @@ public class LogServiceImpl implements LogService {
...
@@ -96,9 +96,9 @@ public class LogServiceImpl implements LogService {
log
.
setUsername
(
username
);
log
.
setUsername
(
username
);
log
.
setParams
(
getParameter
(
method
,
joinPoint
.
getArgs
()));
log
.
setParams
(
getParameter
(
method
,
joinPoint
.
getArgs
()));
// 记录登录用户,隐藏密码信息
// 记录登录用户,隐藏密码信息
if
(
log
.
getDescription
().
equals
(
"用户登录"
)){
if
(
signature
.
getName
().
equals
(
"login"
)
&&
StringUtils
.
isNotEmpty
(
log
.
getParams
()
)){
JSONObject
obj
=
JSONUtil
.
parseObj
(
log
.
getParams
());
JSONObject
obj
=
JSONUtil
.
parseObj
(
log
.
getParams
());
log
.
setUsername
(
obj
.
get
(
"username"
).
toString
(
));
log
.
setUsername
(
obj
.
get
Str
(
"username"
,
""
));
log
.
setParams
(
JSONUtil
.
toJsonStr
(
Dict
.
create
().
set
(
"username"
,
log
.
getUsername
())));
log
.
setParams
(
JSONUtil
.
toJsonStr
(
Dict
.
create
().
set
(
"username"
,
log
.
getUsername
())));
}
}
log
.
setBrowser
(
browser
);
log
.
setBrowser
(
browser
);
...
@@ -120,7 +120,7 @@ public class LogServiceImpl implements LogService {
...
@@ -120,7 +120,7 @@ public class LogServiceImpl implements LogService {
//将RequestParam注解修饰的参数作为请求参数
//将RequestParam注解修饰的参数作为请求参数
RequestParam
requestParam
=
parameters
[
i
].
getAnnotation
(
RequestParam
.
class
);
RequestParam
requestParam
=
parameters
[
i
].
getAnnotation
(
RequestParam
.
class
);
if
(
requestParam
!=
null
)
{
if
(
requestParam
!=
null
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
String
key
=
parameters
[
i
].
getName
();
String
key
=
parameters
[
i
].
getName
();
if
(!
StringUtils
.
isEmpty
(
requestParam
.
value
()))
{
if
(!
StringUtils
.
isEmpty
(
requestParam
.
value
()))
{
key
=
requestParam
.
value
();
key
=
requestParam
.
value
();
...
...
eladmin-system/src/main/java/me/zhengjie/AppRun.java
View file @
6ab1caac
...
@@ -58,13 +58,6 @@ public class AppRun {
...
@@ -58,13 +58,6 @@ public class AppRun {
return
new
SpringContextHolder
();
return
new
SpringContextHolder
();
}
}
@Bean
public
ServletWebServerFactory
webServerFactory
()
{
TomcatServletWebServerFactory
fa
=
new
TomcatServletWebServerFactory
();
fa
.
addConnectorCustomizers
(
connector
->
connector
.
setProperty
(
"relaxedQueryChars"
,
"[]{}"
));
return
fa
;
}
/**
/**
* 访问首页提示
* 访问首页提示
*
*
...
...
eladmin-system/src/main/java/me/zhengjie/config/RelaxedQueryCharsConnectorCustomizer
0 → 100644
View file @
6ab1caac
package
me
.
zhengjie
.
config
;
import
org
.
apache
.
catalina
.
connector
.
Connector
;
import
org
.
springframework
.
boot
.
web
.
embedded
.
tomcat
.
TomcatConnectorCustomizer
;
import
org
.
springframework
.
context
.
annotation
.
Configuration
;
/**
*
@
author
bearBoy80
*/
@
Configuration
(
proxyBeanMethods
=
false
)
public
class
RelaxedQueryCharsConnectorCustomizer
implements
TomcatConnectorCustomizer
{
@
Override
public
void
customize
(
Connector
connector
)
{
connector
.
setProperty
(
"relaxedQueryChars"
,
"[]{}"
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java
View file @
6ab1caac
...
@@ -30,7 +30,7 @@ import java.util.*;
...
@@ -30,7 +30,7 @@ import java.util.*;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @website https://el
-
admin.vip
* @website https://eladmin.vip
* @description 数据权限服务实现
* @description 数据权限服务实现
* @date 2020-05-07
* @date 2020-05-07
**/
**/
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java
View file @
6ab1caac
...
@@ -59,6 +59,12 @@ public class MenuServiceImpl implements MenuService {
...
@@ -59,6 +59,12 @@ public class MenuServiceImpl implements MenuService {
private
final
RoleService
roleService
;
private
final
RoleService
roleService
;
private
final
RedisUtils
redisUtils
;
private
final
RedisUtils
redisUtils
;
private
static
final
String
HTTP_PRE
=
"http://"
;
private
static
final
String
HTTPS_PRE
=
"https://"
;
private
static
final
String
YES_STR
=
"是"
;
private
static
final
String
NO_STR
=
"否"
;
private
static
final
String
BAD_REQUEST
=
"外链必须以http://或者https://开头"
;
@Override
@Override
public
List
<
MenuDto
>
queryAll
(
MenuQueryCriteria
criteria
,
Boolean
isQuery
)
throws
Exception
{
public
List
<
MenuDto
>
queryAll
(
MenuQueryCriteria
criteria
,
Boolean
isQuery
)
throws
Exception
{
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"menuSort"
);
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"menuSort"
);
...
@@ -114,13 +120,12 @@ public class MenuServiceImpl implements MenuService {
...
@@ -114,13 +120,12 @@ public class MenuServiceImpl implements MenuService {
throw
new
EntityExistException
(
Menu
.
class
,
"componentName"
,
resources
.
getComponentName
());
throw
new
EntityExistException
(
Menu
.
class
,
"componentName"
,
resources
.
getComponentName
());
}
}
}
}
if
(
resources
.
getPid
()
.
equals
(
0L
)){
if
(
Long
.
valueOf
(
0L
).
equals
(
resources
.
getPid
()))
{
resources
.
setPid
(
null
);
resources
.
setPid
(
null
);
}
}
if
(
resources
.
getIFrame
()){
if
(
resources
.
getIFrame
()){
String
http
=
"http://"
,
https
=
"https://"
;
if
(!(
resources
.
getPath
().
toLowerCase
().
startsWith
(
HTTP_PRE
)||
resources
.
getPath
().
toLowerCase
().
startsWith
(
HTTPS_PRE
)))
{
if
(!(
resources
.
getPath
().
toLowerCase
().
startsWith
(
http
)||
resources
.
getPath
().
toLowerCase
().
startsWith
(
https
)))
{
throw
new
BadRequestException
(
BAD_REQUEST
);
throw
new
BadRequestException
(
"外链必须以http://或者https://开头"
);
}
}
}
}
menuRepository
.
save
(
resources
);
menuRepository
.
save
(
resources
);
...
@@ -140,9 +145,8 @@ public class MenuServiceImpl implements MenuService {
...
@@ -140,9 +145,8 @@ public class MenuServiceImpl implements MenuService {
ValidationUtil
.
isNull
(
menu
.
getId
(),
"Permission"
,
"id"
,
resources
.
getId
());
ValidationUtil
.
isNull
(
menu
.
getId
(),
"Permission"
,
"id"
,
resources
.
getId
());
if
(
resources
.
getIFrame
()){
if
(
resources
.
getIFrame
()){
String
http
=
"http://"
,
https
=
"https://"
;
if
(!(
resources
.
getPath
().
toLowerCase
().
startsWith
(
HTTP_PRE
)||
resources
.
getPath
().
toLowerCase
().
startsWith
(
HTTPS_PRE
)))
{
if
(!(
resources
.
getPath
().
toLowerCase
().
startsWith
(
http
)||
resources
.
getPath
().
toLowerCase
().
startsWith
(
https
)))
{
throw
new
BadRequestException
(
BAD_REQUEST
);
throw
new
BadRequestException
(
"外链必须以http://或者https://开头"
);
}
}
}
}
Menu
menu1
=
menuRepository
.
findByTitle
(
resources
.
getTitle
());
Menu
menu1
=
menuRepository
.
findByTitle
(
resources
.
getTitle
());
...
@@ -322,9 +326,9 @@ public class MenuServiceImpl implements MenuService {
...
@@ -322,9 +326,9 @@ public class MenuServiceImpl implements MenuService {
map
.
put
(
"菜单标题"
,
menuDTO
.
getTitle
());
map
.
put
(
"菜单标题"
,
menuDTO
.
getTitle
());
map
.
put
(
"菜单类型"
,
menuDTO
.
getType
()
==
null
?
"目录"
:
menuDTO
.
getType
()
==
1
?
"菜单"
:
"按钮"
);
map
.
put
(
"菜单类型"
,
menuDTO
.
getType
()
==
null
?
"目录"
:
menuDTO
.
getType
()
==
1
?
"菜单"
:
"按钮"
);
map
.
put
(
"权限标识"
,
menuDTO
.
getPermission
());
map
.
put
(
"权限标识"
,
menuDTO
.
getPermission
());
map
.
put
(
"外链菜单"
,
menuDTO
.
getIFrame
()
?
"是"
:
"否"
);
map
.
put
(
"外链菜单"
,
menuDTO
.
getIFrame
()
?
YES_STR
:
NO_STR
);
map
.
put
(
"菜单可见"
,
menuDTO
.
getHidden
()
?
"否"
:
"是"
);
map
.
put
(
"菜单可见"
,
menuDTO
.
getHidden
()
?
NO_STR
:
YES_STR
);
map
.
put
(
"是否缓存"
,
menuDTO
.
getCache
()
?
"是"
:
"否"
);
map
.
put
(
"是否缓存"
,
menuDTO
.
getCache
()
?
YES_STR
:
NO_STR
);
map
.
put
(
"创建日期"
,
menuDTO
.
getCreateTime
());
map
.
put
(
"创建日期"
,
menuDTO
.
getCreateTime
());
list
.
add
(
map
);
list
.
add
(
map
);
}
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/VerifyServiceImpl.java
View file @
6ab1caac
...
@@ -60,11 +60,11 @@ public class VerifyServiceImpl implements VerifyService {
...
@@ -60,11 +60,11 @@ public class VerifyServiceImpl implements VerifyService {
throw
new
BadRequestException
(
"服务异常,请联系网站负责人"
);
throw
new
BadRequestException
(
"服务异常,请联系网站负责人"
);
}
}
content
=
template
.
render
(
Dict
.
create
().
set
(
"code"
,
code
));
content
=
template
.
render
(
Dict
.
create
().
set
(
"code"
,
code
));
emailVo
=
new
EmailVo
(
Collections
.
singletonList
(
email
),
"EL
-
ADMIN后台管理系统"
,
content
);
emailVo
=
new
EmailVo
(
Collections
.
singletonList
(
email
),
"ELADMIN后台管理系统"
,
content
);
// 存在就再次发送原来的验证码
// 存在就再次发送原来的验证码
}
else
{
}
else
{
content
=
template
.
render
(
Dict
.
create
().
set
(
"code"
,
oldCode
));
content
=
template
.
render
(
Dict
.
create
().
set
(
"code"
,
oldCode
));
emailVo
=
new
EmailVo
(
Collections
.
singletonList
(
email
),
"EL
-
ADMIN后台管理系统"
,
content
);
emailVo
=
new
EmailVo
(
Collections
.
singletonList
(
email
),
"ELADMIN后台管理系统"
,
content
);
}
}
return
emailVo
;
return
emailVo
;
}
}
...
...
eladmin-system/src/main/resources/template/email/email.ftl
View file @
6ab1caac
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
font-size: 12px;
font-size: 12px;
padding: 20px 0px;
padding: 20px 0px;
font-family: Microsoft YaHei;">
font-family: Microsoft YaHei;">
Copyright ©$
{
.now
?
string
(
"yyyy"
)}
<a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">EL
-
ADMIN</a> 后台管理系统 All Rights Reserved.
Copyright ©$
{
.now
?
string
(
"yyyy"
)}
<a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a> 后台管理系统 All Rights Reserved.
</div>
</div>
</div>
</div>
...
...
eladmin-system/src/main/resources/template/email/taskAlarm.ftl
View file @
6ab1caac
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
font-size: 12px;
font-size: 12px;
padding: 20px 0px;
padding: 20px 0px;
font-family: Microsoft YaHei;">
font-family: Microsoft YaHei;">
Copyright ©$
{
.now
?
string
(
"yyyy"
)}
<a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">EL
-
ADMIN</a> 后台管理系统 All Rights Reserved.
Copyright ©$
{
.now
?
string
(
"yyyy"
)}
<a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a> 后台管理系统 All Rights Reserved.
</div>
</div>
</div>
</div>
...
...
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