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
960782f1
Commit
960782f1
authored
Jun 11, 2023
by
Zheng Jie
Browse files
Merge branch 'master' into deploy
parents
063fed5e
6c5e7061
Changes
9
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/config/
ElPermission
Config.java
→
eladmin-common/src/main/java/me/zhengjie/config/
Authority
Config.java
View file @
960782f1
...
@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
...
@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
* @author Zheng Jie
* @author Zheng Jie
*/
*/
@Service
(
value
=
"el"
)
@Service
(
value
=
"el"
)
public
class
ElPermission
Config
{
public
class
Authority
Config
{
public
Boolean
check
(
String
...
permissions
){
public
Boolean
check
(
String
...
permissions
){
// 获取当前用户的所有权限
// 获取当前用户的所有权限
...
...
eladmin-common/src/main/java/me/zhengjie/config/ElAdminProperties.java
deleted
100644 → 0
View file @
063fed5e
/*
* 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.config
;
import
lombok.Data
;
import
me.zhengjie.utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
/**
* @author Zheng Jie
* @description
* @date 2021-11-22
**/
@Data
@Component
public
class
ElAdminProperties
{
public
static
Boolean
ipLocal
;
@Value
(
"${ip.local-parsing}"
)
public
void
setIpLocal
(
Boolean
ipLocal
)
{
ElAdminProperties
.
ipLocal
=
ipLocal
;
}
}
eladmin-common/src/main/java/me/zhengjie/config/FileProperties.java
View file @
960782f1
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
package
me.zhengjie.config
;
package
me.zhengjie.config
;
import
lombok.Data
;
import
lombok.Data
;
import
me.zhengjie.utils.El
Admin
Constant
;
import
me.zhengjie.utils.ElConstant
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -42,9 +42,9 @@ public class FileProperties {
...
@@ -42,9 +42,9 @@ public class FileProperties {
public
ElPath
getPath
(){
public
ElPath
getPath
(){
String
os
=
System
.
getProperty
(
"os.name"
);
String
os
=
System
.
getProperty
(
"os.name"
);
if
(
os
.
toLowerCase
().
startsWith
(
El
Admin
Constant
.
WIN
))
{
if
(
os
.
toLowerCase
().
startsWith
(
ElConstant
.
WIN
))
{
return
windows
;
return
windows
;
}
else
if
(
os
.
toLowerCase
().
startsWith
(
El
Admin
Constant
.
MAC
)){
}
else
if
(
os
.
toLowerCase
().
startsWith
(
ElConstant
.
MAC
)){
return
mac
;
return
mac
;
}
}
return
linux
;
return
linux
;
...
...
eladmin-common/src/main/java/me/zhengjie/utils/El
Admin
Constant.java
→
eladmin-common/src/main/java/me/zhengjie/utils/ElConstant.java
View file @
960782f1
...
@@ -21,12 +21,7 @@ package me.zhengjie.utils;
...
@@ -21,12 +21,7 @@ package me.zhengjie.utils;
* @author Zheng Jie
* @author Zheng Jie
* @date 2018-12-26
* @date 2018-12-26
*/
*/
public
class
ElAdminConstant
{
public
class
ElConstant
{
/**
* 用于IP定位转换
*/
public
static
final
String
REGION
=
"内网IP|内网IP"
;
/**
/**
* win 系统
* win 系统
*/
*/
...
@@ -36,12 +31,4 @@ public class ElAdminConstant {
...
@@ -36,12 +31,4 @@ public class ElAdminConstant {
* mac 系统
* mac 系统
*/
*/
public
static
final
String
MAC
=
"mac"
;
public
static
final
String
MAC
=
"mac"
;
/**
* 常用接口
*/
public
static
class
Url
{
// IP归属地查询
public
static
final
String
IP_URL
=
"http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true"
;
}
}
}
eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java
View file @
960782f1
...
@@ -15,11 +15,7 @@
...
@@ -15,11 +15,7 @@
*/
*/
package
me.zhengjie.utils
;
package
me.zhengjie.utils
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.config.ElAdminProperties
;
import
net.dreamlu.mica.ip2region.core.Ip2regionSearcher
;
import
net.dreamlu.mica.ip2region.core.Ip2regionSearcher
;
import
net.dreamlu.mica.ip2region.core.IpInfo
;
import
net.dreamlu.mica.ip2region.core.IpInfo
;
import
nl.basjes.parse.useragent.UserAgent
;
import
nl.basjes.parse.useragent.UserAgent
;
...
@@ -174,32 +170,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
...
@@ -174,32 +170,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* 根据ip获取详细地址
* 根据ip获取详细地址
*/
*/
public
static
String
getCityInfo
(
String
ip
)
{
public
static
String
getCityInfo
(
String
ip
)
{
if
(
ElAdminProperties
.
ipLocal
)
{
return
getLocalCityInfo
(
ip
);
}
else
{
return
getHttpCityInfo
(
ip
);
}
}
/**
* 根据ip获取详细地址
*/
public
static
String
getHttpCityInfo
(
String
ip
)
{
String
api
=
String
.
format
(
ElAdminConstant
.
Url
.
IP_URL
,
ip
);
JSONObject
object
=
JSONUtil
.
parseObj
(
HttpUtil
.
get
(
api
));
return
object
.
get
(
"addr"
,
String
.
class
);
}
/**
* 根据ip获取详细地址
*/
public
static
String
getLocalCityInfo
(
String
ip
)
{
IpInfo
ipInfo
=
IP_SEARCHER
.
memorySearch
(
ip
);
IpInfo
ipInfo
=
IP_SEARCHER
.
memorySearch
(
ip
);
if
(
ipInfo
!=
null
){
if
(
ipInfo
!=
null
){
return
ipInfo
.
getAddress
();
return
ipInfo
.
getAddress
();
}
}
return
null
;
return
null
;
}
}
public
static
String
getBrowser
(
HttpServletRequest
request
)
{
public
static
String
getBrowser
(
HttpServletRequest
request
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java
View file @
960782f1
...
@@ -18,7 +18,7 @@ package me.zhengjie.modules.system.service.impl;
...
@@ -18,7 +18,7 @@ package me.zhengjie.modules.system.service.impl;
import
cn.hutool.core.date.BetweenFormatter.Level
;
import
cn.hutool.core.date.BetweenFormatter.Level
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
me.zhengjie.modules.system.service.MonitorService
;
import
me.zhengjie.modules.system.service.MonitorService
;
import
me.zhengjie.utils.El
Admin
Constant
;
import
me.zhengjie.utils.ElConstant
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.StringUtils
;
import
me.zhengjie.utils.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService {
...
@@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService {
long
available
=
0
,
total
=
0
;
long
available
=
0
,
total
=
0
;
for
(
OSFileStore
fs
:
fsArray
){
for
(
OSFileStore
fs
:
fsArray
){
// windows 需要将所有磁盘分区累加,linux 和 mac 直接累加会出现磁盘重复的问题,待修复
// windows 需要将所有磁盘分区累加,linux 和 mac 直接累加会出现磁盘重复的问题,待修复
if
(
osName
.
toLowerCase
().
startsWith
(
El
Admin
Constant
.
WIN
))
{
if
(
osName
.
toLowerCase
().
startsWith
(
ElConstant
.
WIN
))
{
available
+=
fs
.
getUsableSpace
();
available
+=
fs
.
getUsableSpace
();
total
+=
fs
.
getTotalSpace
();
total
+=
fs
.
getTotalSpace
();
}
else
{
}
else
{
...
...
eladmin-system/src/main/resources/config/application-dev.yml
View file @
960782f1
...
@@ -100,10 +100,6 @@ generator:
...
@@ -100,10 +100,6 @@ generator:
swagger
:
swagger
:
enabled
:
true
enabled
:
true
# IP 本地解析
ip
:
local-parsing
:
true
# 文件存储路径
# 文件存储路径
file
:
file
:
mac
:
mac
:
...
...
eladmin-system/src/main/resources/config/application-prod.yml
View file @
960782f1
...
@@ -94,10 +94,6 @@ jwt:
...
@@ -94,10 +94,6 @@ jwt:
# 续期时间范围,默认 1小时,这里单位毫秒
# 续期时间范围,默认 1小时,这里单位毫秒
renew
:
3600000
renew
:
3600000
# IP 本地解析
ip
:
local-parsing
:
true
#是否允许生成代码,生产环境设置为false
#是否允许生成代码,生产环境设置为false
generator
:
generator
:
enabled
:
false
enabled
:
false
...
...
pom.xml
View file @
960782f1
...
@@ -121,12 +121,11 @@
...
@@ -121,12 +121,11 @@
<version>
${druid.version}
</version>
<version>
${druid.version}
</version>
</dependency>
</dependency>
<!-- ip2region IP库 -->
<!-- https://mvnrepository.com/artifact/net.dreamlu/mica-ip2region -->
<!-- https://mvnrepository.com/artifact/net.dreamlu/mica-ip2region -->
<dependency>
<dependency>
<groupId>
net.dreamlu
</groupId>
<groupId>
net.dreamlu
</groupId>
<artifactId>
mica-ip2region
</artifactId>
<artifactId>
mica-ip2region
</artifactId>
<version>
2.
6.3
</version>
<version>
2.
7.12
</version>
</dependency>
</dependency>
<!--lombok插件-->
<!--lombok插件-->
...
...
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