Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
JAVA小学生-王铁柱
eladmin
提交
d9a25328
E
eladmin
项目概览
JAVA小学生-王铁柱
/
eladmin
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
eladmin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d9a25328
编写于
4月 27, 2021
作者:
Z
Zheng Jie
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into deploy
上级
c97aa160
f207d003
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
50 addition
and
23 deletion
+50
-23
eladmin-common/src/main/java/me/zhengjie/annotation/Query.java
...in-common/src/main/java/me/zhengjie/annotation/Query.java
+2
-0
eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
...min-common/src/main/java/me/zhengjie/utils/QueryHelp.java
+7
-2
eladmin-common/src/main/java/me/zhengjie/utils/RsaUtils.java
eladmin-common/src/main/java/me/zhengjie/utils/RsaUtils.java
+15
-11
eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java
...n-common/src/main/java/me/zhengjie/utils/StringUtils.java
+12
-5
eladmin-system/pom.xml
eladmin-system/pom.xml
+2
-2
eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
...gjie/modules/security/service/UserDetailsServiceImpl.java
+7
-0
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java
...zhengjie/modules/system/service/impl/DeptServiceImpl.java
+2
-0
pom.xml
pom.xml
+3
-3
未找到文件。
eladmin-common/src/main/java/me/zhengjie/annotation/Query.java
浏览文件 @
d9a25328
...
...
@@ -65,6 +65,8 @@ public @interface Query {
,
LESS_THAN_NQ
// jie 2019/6/4 包含
,
IN
// 不包含
,
NOT_IN
// 不等于
,
NOT_EQUAL
// between
...
...
eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
浏览文件 @
d9a25328
...
...
@@ -141,8 +141,13 @@ public class QueryHelp {
.
as
(
String
.
class
),
val
.
toString
()
+
"%"
));
break
;
case
IN:
if
(
CollUtil
.
isNotEmpty
((
Collection
<
Long
>)
val
))
{
list
.
add
(
getExpression
(
attributeName
,
join
,
root
).
in
((
Collection
<
Long
>)
val
));
if
(
CollUtil
.
isNotEmpty
((
Collection
<
Object
>)
val
))
{
list
.
add
(
getExpression
(
attributeName
,
join
,
root
).
in
((
Collection
<
Object
>)
val
));
}
break
;
case
NOT_IN:
if
(
CollUtil
.
isNotEmpty
((
Collection
<
Object
>)
val
))
{
list
.
add
(
getExpression
(
attributeName
,
join
,
root
).
in
((
Collection
<
Object
>)
val
).
not
());
}
break
;
case
NOT_EQUAL:
...
...
eladmin-common/src/main/java/me/zhengjie/utils/RsaUtils.java
浏览文件 @
d9a25328
...
...
@@ -81,7 +81,7 @@ public class RsaUtils {
PublicKey
publicKey
=
keyFactory
.
generatePublic
(
x509EncodedKeySpec
);
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
publicKey
);
byte
[]
result
=
doLongerCipherFinal
(
cipher
,
Base64
.
decodeBase64
(
text
));
byte
[]
result
=
doLongerCipherFinal
(
Cipher
.
DECRYPT_MODE
,
cipher
,
Base64
.
decodeBase64
(
text
));
return
new
String
(
result
);
}
...
...
@@ -99,7 +99,7 @@ public class RsaUtils {
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
pkcs8EncodedKeySpec
);
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
privateKey
);
byte
[]
result
=
doLongerCipherFinal
(
cipher
,
text
.
getBytes
());
byte
[]
result
=
doLongerCipherFinal
(
Cipher
.
ENCRYPT_MODE
,
cipher
,
text
.
getBytes
());
return
Base64
.
encodeBase64String
(
result
);
}
...
...
@@ -117,7 +117,7 @@ public class RsaUtils {
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
pkcs8EncodedKeySpec5
);
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
byte
[]
result
=
doLongerCipherFinal
(
cipher
,
Base64
.
decodeBase64
(
text
));
byte
[]
result
=
doLongerCipherFinal
(
Cipher
.
DECRYPT_MODE
,
cipher
,
Base64
.
decodeBase64
(
text
));
return
new
String
(
result
);
}
...
...
@@ -134,18 +134,22 @@ public class RsaUtils {
PublicKey
publicKey
=
keyFactory
.
generatePublic
(
x509EncodedKeySpec2
);
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
publicKey
);
byte
[]
result
=
doLongerCipherFinal
(
cipher
,
text
.
getBytes
());
byte
[]
result
=
doLongerCipherFinal
(
Cipher
.
ENCRYPT_MODE
,
cipher
,
text
.
getBytes
());
return
Base64
.
encodeBase64String
(
result
);
}
private
static
byte
[]
doLongerCipherFinal
(
Cipher
cipher
,
byte
[]
source
)
throws
Exception
{
int
offset
=
0
;
int
totalSize
=
source
.
length
;
private
static
byte
[]
doLongerCipherFinal
(
int
opMode
,
Cipher
cipher
,
byte
[]
source
)
throws
Exception
{
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
while
(
totalSize
-
offset
>
0
)
{
int
size
=
Math
.
min
(
1024
/
8
-
11
,
totalSize
-
offset
);
out
.
write
(
cipher
.
doFinal
(
source
,
offset
,
size
));
offset
+=
size
;
if
(
opMode
==
Cipher
.
DECRYPT_MODE
)
{
out
.
write
(
cipher
.
doFinal
(
source
));
}
else
{
int
offset
=
0
;
int
totalSize
=
source
.
length
;
while
(
totalSize
-
offset
>
0
)
{
int
size
=
Math
.
min
(
cipher
.
getOutputSize
(
0
)
-
11
,
totalSize
-
offset
);
out
.
write
(
cipher
.
doFinal
(
source
,
offset
,
size
));
offset
+=
size
;
}
}
out
.
close
();
return
out
.
toByteArray
();
...
...
eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java
浏览文件 @
d9a25328
...
...
@@ -18,8 +18,8 @@ package me.zhengjie.utils;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
eu.bitwalker.useragentutils.Browser
;
import
eu.bitwalker.useragentutils.UserAgent
;
import
nl.basjes.parse.useragent.UserAgent
;
import
nl.basjes.parse.useragent.UserAgentAnalyzer
;
import
org.lionsoul.ip2region.DataBlock
;
import
org.lionsoul.ip2region.DbConfig
;
import
org.lionsoul.ip2region.DbSearcher
;
...
...
@@ -50,6 +50,14 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
private
static
final
char
SEPARATOR
=
'_'
;
private
static
final
String
UNKNOWN
=
"unknown"
;
private
static
final
UserAgentAnalyzer
userAgentAnalyzer
=
UserAgentAnalyzer
.
newBuilder
()
.
hideMatcherLoadStats
()
.
withCache
(
10000
)
.
withField
(
UserAgent
.
AGENT_NAME_VERSION
)
.
build
();
static
{
SpringContextHolder
.
addCallBacks
(()
->
{
StringUtils
.
ipLocal
=
SpringContextHolder
.
getProperties
(
"ip.local-parsing"
,
false
,
Boolean
.
class
);
...
...
@@ -225,9 +233,8 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
}
public
static
String
getBrowser
(
HttpServletRequest
request
)
{
UserAgent
userAgent
=
UserAgent
.
parseUserAgentString
(
request
.
getHeader
(
"User-Agent"
));
Browser
browser
=
userAgent
.
getBrowser
();
return
browser
.
getName
();
UserAgent
.
ImmutableUserAgent
userAgent
=
userAgentAnalyzer
.
parse
(
request
.
getHeader
(
"User-Agent"
));
return
userAgent
.
get
(
UserAgent
.
AGENT_NAME_VERSION
).
getValue
();
}
/**
...
...
eladmin-system/pom.xml
浏览文件 @
d9a25328
...
...
@@ -15,7 +15,7 @@
<properties>
<jjwt.version>
0.11.1
</jjwt.version>
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
<jna.version>
5.
6
.0
</jna.version>
<jna.version>
5.
8
.0
</jna.version>
</properties>
<dependencies>
...
...
@@ -84,7 +84,7 @@
<dependency>
<groupId>
com.github.oshi
</groupId>
<artifactId>
oshi-core
</artifactId>
<version>
5.
3.6
</version>
<version>
5.
7.1
</version>
</dependency>
</dependencies>
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
浏览文件 @
d9a25328
...
...
@@ -27,6 +27,8 @@ import me.zhengjie.modules.system.service.dto.UserDto;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -41,6 +43,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
private
final
RoleService
roleService
;
private
final
DataService
dataService
;
private
final
LoginProperties
loginProperties
;
public
void
setEnableCache
(
boolean
enableCache
)
{
this
.
loginProperties
.
setCacheEnable
(
enableCache
);
}
...
...
@@ -58,6 +61,10 @@ public class UserDetailsServiceImpl implements UserDetailsService {
JwtUserDto
jwtUserDto
=
null
;
if
(
loginProperties
.
isCacheEnable
()
&&
userDtoCache
.
containsKey
(
username
))
{
jwtUserDto
=
userDtoCache
.
get
(
username
);
// 检查dataScope是否修改
List
<
Long
>
dataScopes
=
jwtUserDto
.
getDataScopes
();
dataScopes
.
clear
();
dataScopes
.
addAll
(
dataService
.
getDeptIds
(
jwtUserDto
.
getUser
()));
searchDb
=
false
;
}
if
(
searchDb
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java
浏览文件 @
d9a25328
...
...
@@ -113,6 +113,8 @@ public class DeptServiceImpl implements DeptService {
resources
.
setSubCount
(
0
);
// 清理缓存
updateSubCnt
(
resources
.
getPid
());
// 清理自定义角色权限的datascope缓存
delCaches
(
resources
.
getPid
());
}
@Override
...
...
pom.xml
浏览文件 @
d9a25328
...
...
@@ -203,9 +203,9 @@
<!-- 解析客户端操作系统、浏览器信息 -->
<dependency>
<groupId>
eu.bitwalker
</groupId>
<artifactId>
UserAgentUtils
</artifactId>
<version>
1.21
</version>
<groupId>
nl.basjes.parse.useragent
</groupId>
<artifactId>
yauaa
</artifactId>
<version>
5.23
</version>
</dependency>
</dependencies>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录