Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
64cac2a9
提交
64cac2a9
authored
6月 01, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 使用lic结果过滤xpack插件菜单
上级
89c758a5
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
55 行增加
和
21 行删除
+55
-21
LicenseController.java
...c/main/java/io/dataease/controller/LicenseController.java
+3
-3
MyScanner.java
...d/src/main/java/io/dataease/plugins/loader/MyScanner.java
+2
-8
PluginUtils.java
...d/src/main/java/io/dataease/plugins/util/PluginUtils.java
+31
-1
Licbar.vue
frontend/src/layout/components/Licbar.vue
+5
-2
permission.js
frontend/src/permission.js
+1
-5
lic.js
frontend/src/store/modules/lic.js
+13
-2
没有找到文件。
backend/src/main/java/io/dataease/controller/LicenseController.java
浏览文件 @
64cac2a9
...
...
@@ -23,9 +23,9 @@ public class LicenseController {
@GetMapping
(
value
=
"anonymous/license/validate"
)
public
ResultHolder
validateLicense
()
throws
Exception
{
//
if (!need_validate_lic) {
//
return ResultHolder.success(null);
//
}
if
(!
need_validate_lic
)
{
return
ResultHolder
.
success
(
null
);
}
F2CLicenseResponse
f2CLicenseResponse
=
defaultLicenseService
.
validateLicense
();
System
.
out
.
println
(
new
Gson
().
toJson
(
f2CLicenseResponse
));
switch
(
f2CLicenseResponse
.
getStatus
())
{
...
...
backend/src/main/java/io/dataease/plugins/loader/MyScanner.java
浏览文件 @
64cac2a9
...
...
@@ -8,20 +8,16 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import
org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
@Component
public
class
MyScanner
implements
BeanDefinitionRegistryPostProcessor
{
@Resource
private
MapperScannerConfigurer
mapperScannerConfigurer
;
private
BeanDefinitionRegistry
beanDefinitionRegistry
;
@Override
public
void
postProcessBeanDefinitionRegistry
(
BeanDefinitionRegistry
beanDefinitionRegistry
)
throws
BeansException
{
this
.
beanDefinitionRegistry
=
beanDefinitionRegistry
;
System
.
out
.
println
(
"-----"
);
}
@Override
...
...
@@ -30,9 +26,7 @@ public class MyScanner implements BeanDefinitionRegistryPostProcessor {
}
public
void
scanner
()
{
if
(
null
==
mapperScannerConfigurer
){
mapperScannerConfigurer
=
SpringContextUtil
.
getBean
(
MapperScannerConfigurer
.
class
);
}
MapperScannerConfigurer
mapperScannerConfigurer
=
SpringContextUtil
.
getBean
(
MapperScannerConfigurer
.
class
);
mapperScannerConfigurer
.
postProcessBeanDefinitionRegistry
(
this
.
beanDefinitionRegistry
);
}
...
...
backend/src/main/java/io/dataease/plugins/util/PluginUtils.java
浏览文件 @
64cac2a9
package
io
.
dataease
.
plugins
.
util
;
import
io.dataease.commons.license.DefaultLicenseService
;
import
io.dataease.commons.license.F2CLicenseResponse
;
import
io.dataease.plugins.common.dto.PluginSysMenu
;
import
io.dataease.plugins.common.service.PluginMenuService
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
public
class
PluginUtils
{
private
static
DefaultLicenseService
defaultLicenseService
;
@Autowired
public
void
setDefaultLicenseService
(
DefaultLicenseService
defaultLicenseService
)
{
PluginUtils
.
defaultLicenseService
=
defaultLicenseService
;
}
public
static
List
<
PluginSysMenu
>
pluginMenus
()
{
F2CLicenseResponse
f2CLicenseResponse
=
currentLic
();
if
(
f2CLicenseResponse
.
getStatus
()
!=
F2CLicenseResponse
.
Status
.
valid
)
return
new
ArrayList
<>();
Map
<
String
,
PluginMenuService
>
pluginMenuServiceMap
=
SpringContextUtil
.
getApplicationContext
().
getBeansOfType
(
PluginMenuService
.
class
);
List
<
PluginSysMenu
>
menus
=
pluginMenuServiceMap
.
values
().
stream
().
flatMap
(
item
->
item
.
menus
().
stream
()).
collect
(
Collectors
.
toList
());
return
menus
;
}
public
static
F2CLicenseResponse
currentLic
()
{
Environment
environment
=
SpringContextUtil
.
getBean
(
Environment
.
class
);
Boolean
need_validate_lic
=
environment
.
getProperty
(
"dataease.need_validate_lic"
,
Boolean
.
class
,
true
);
if
(!
need_validate_lic
)
{
F2CLicenseResponse
f2CLicenseResponse
=
new
F2CLicenseResponse
();
f2CLicenseResponse
.
setStatus
(
F2CLicenseResponse
.
Status
.
valid
);
return
f2CLicenseResponse
;
}
F2CLicenseResponse
f2CLicenseResponse
=
defaultLicenseService
.
validateLicense
();
return
f2CLicenseResponse
;
}
...
...
frontend/src/layout/components/Licbar.vue
浏览文件 @
64cac2a9
<
template
>
<div
v-if=
"!lic
status
"
class=
"lic"
>
<div
v-if=
"!lic
Validate && licStatus !== 'no_record'
"
class=
"lic"
>
<strong>
{{
$t
(
licMsg
)
}}
</strong>
</div>
</
template
>
...
...
@@ -20,9 +20,12 @@ export default {
theme
()
{
return
this
.
$store
.
state
.
settings
.
theme
},
lic
status
()
{
lic
Validate
()
{
return
this
.
$store
.
state
.
lic
.
validate
},
licStatus
()
{
return
this
.
$store
.
state
.
lic
.
licStatus
||
''
},
licMsg
()
{
return
this
.
$store
.
state
.
lic
.
licMsg
?
(
'license.'
+
this
.
$store
.
state
.
lic
.
licMsg
)
:
null
}
...
...
frontend/src/permission.js
浏览文件 @
64cac2a9
...
...
@@ -152,12 +152,8 @@ const hasPermission = (router, user_permissions) => {
}
return
true
}
const
xpackMenuNames
=
[
'system-param'
,
'system-plugin'
]
const
filterLic
=
(
router
)
=>
{
if
(
xpackMenuNames
.
some
(
name
=>
name
===
router
.
name
)
&&
!
store
.
getters
.
validate
)
{
return
false
}
return
true
return
!
router
.
isPlugin
||
store
.
getters
.
validate
}
router
.
afterEach
(()
=>
{
// finish progress bar
...
...
frontend/src/store/modules/lic.js
浏览文件 @
64cac2a9
import
{
validateLic
}
from
'@/api/system/lic'
const
state
=
{
validate
:
true
,
licStatus
:
null
,
licMsg
:
null
}
...
...
@@ -10,6 +11,9 @@ const mutations = {
},
SET_LIC_MSG
:
(
state
,
msg
)
=>
{
state
.
licMsg
=
msg
},
SET_LIC_STATUS
:
(
state
,
data
)
=>
{
state
.
licStatus
=
data
}
}
...
...
@@ -22,8 +26,15 @@ const actions = {
return
new
Promise
((
resolve
,
reject
)
=>
{
validateLic
().
then
(
response
=>
{
const
{
data
}
=
response
commit
(
'SET_VALIDATE'
,
true
)
commit
(
'SET_LIC_MSG'
,
null
)
if
(
data
&&
data
.
status
&&
data
.
status
===
'no_record'
)
{
commit
(
'SET_VALIDATE'
,
false
)
commit
(
'SET_LIC_MSG'
,
data
.
message
)
commit
(
'SET_LIC_STATUS'
,
data
.
status
)
}
else
{
commit
(
'SET_VALIDATE'
,
true
)
commit
(
'SET_LIC_MSG'
,
null
)
}
resolve
(
data
)
}).
catch
(
error
=>
{
commit
(
'SET_VALIDATE'
,
false
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论