Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
b4376a07
提交
b4376a07
authored
5月 31, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: license 提醒: 无license,不提醒;过期以及无效,提醒
上级
688a59d5
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
17 行增加
和
32 行删除
+17
-32
DefaultLicenseService.java
...va/io/dataease/commons/license/DefaultLicenseService.java
+1
-23
F2CLicenseResponse.java
.../java/io/dataease/commons/license/F2CLicenseResponse.java
+9
-0
LicenseController.java
...c/main/java/io/dataease/controller/LicenseController.java
+7
-8
lic.js
frontend/src/store/modules/lic.js
+0
-1
没有找到文件。
backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java
浏览文件 @
b4376a07
...
...
@@ -41,18 +41,6 @@ public class DefaultLicenseService {
f2CLicenseResponse
.
setMessage
(
"The license is unavailable for this product."
);
return
f2CLicenseResponse
;
}
// 检查每个模块的PLU限制
// if(!Arrays.asList(NO_PLU_LIMIT_MODULES).contains(moduleId)){
// AuthorizationUnit authorizationUnit= CommonBeanFactory.getBean(AuthorizationUnit.class);
// try{
// authorizationUnit.calculateAssets(f2CLicenseResponse.getLicense().getCount());
// return f2CLicenseResponse;
// }catch (Exception e){
// f2CLicenseResponse.setStatus(F2CLicenseResponse.Status.invalid);
// f2CLicenseResponse.setMessage(e.getMessage());
// }
// }
return
f2CLicenseResponse
;
}
catch
(
Exception
e
){
return
F2CLicenseResponse
.
invalid
(
e
.
getMessage
());
...
...
@@ -79,16 +67,10 @@ public class DefaultLicenseService {
License
license
=
readLicense
();
return
validateLicense
(
product
,
license
.
getLicense
());
}
catch
(
Exception
e
)
{
return
F2CLicenseResponse
.
invalid
(
e
.
getMessage
()
);
return
F2CLicenseResponse
.
noRecord
(
);
}
}
public
void
validateF2cLicense
(){
License
license
=
readLicense
();
F2CLicenseResponse
f2CLicenseResponse
=
validateLicense
(
product
,
license
.
getLicense
());
writeLicense
(
license
.
getLicense
(),
f2CLicenseResponse
);
}
public
F2CLicenseResponse
updateLicense
(
String
product
,
String
licenseKey
)
{
// 验证license
F2CLicenseResponse
response
=
validateLicense
(
product
,
licenseKey
);
...
...
@@ -104,12 +86,10 @@ public class DefaultLicenseService {
public
License
readLicense
()
{
License
license
=
innerLicenseService
.
getLicense
(
LICENSE_ID
);
if
(
license
==
null
)
{
/*DEException.throwException(Translator.get("i18n_no_license_record"));*/
DEException
.
throwException
(
"i18n_no_license_record"
);
}
if
(
StringUtils
.
isBlank
(
license
.
getLicense
()))
{
DEException
.
throwException
(
"i18n_license_is_empty"
);
//F2CException.throwException(Translator.get("i18n_license_is_empty"));
}
return
license
;
}
...
...
@@ -117,9 +97,7 @@ public class DefaultLicenseService {
// 创建或更新License
private
void
writeLicense
(
String
licenseKey
,
F2CLicenseResponse
response
)
{
if
(
StringUtils
.
isBlank
(
licenseKey
))
{
DEException
.
throwException
(
"i18n_license_is_empty"
);
}
License
license
=
new
License
();
license
.
setId
(
LICENSE_ID
);
...
...
backend/src/main/java/io/dataease/commons/license/F2CLicenseResponse.java
浏览文件 @
b4376a07
...
...
@@ -31,6 +31,7 @@ public class F2CLicenseResponse {
}
public
static
enum
Status
{
no_record
,
valid
,
invalid
,
expired
;
...
...
@@ -43,4 +44,12 @@ public class F2CLicenseResponse {
f2CLicenseResponse
.
setMessage
(
a
);
return
f2CLicenseResponse
;
}
public
static
F2CLicenseResponse
noRecord
()
{
F2CLicenseResponse
f2CLicenseResponse
=
new
F2CLicenseResponse
();
f2CLicenseResponse
.
setStatus
(
Status
.
no_record
);
f2CLicenseResponse
.
setLicense
(
null
);
f2CLicenseResponse
.
setMessage
(
"No license record"
);
return
f2CLicenseResponse
;
}
}
backend/src/main/java/io/dataease/controller/LicenseController.java
浏览文件 @
b4376a07
...
...
@@ -2,6 +2,7 @@ package io.dataease.controller;
import
com.google.gson.Gson
;
import
io.dataease.commons.license.DefaultLicenseService
;
import
io.dataease.commons.license.F2CLicenseResponse
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -22,16 +23,14 @@ public class LicenseController {
@GetMapping
(
value
=
"anonymous/license/validate"
)
public
ResultHolder
validateLicense
()
throws
Exception
{
if
(!
need_validate_lic
)
{
return
ResultHolder
.
success
(
null
);
}
/* License license = defaultLicenseService.readLicense();
if(StringUtils.isEmpty(license.getF2cLicense())){
throw new Exception("Invalid License.");
}
F2CLicenseResponse f2CLicenseResponse = new Gson().fromJson(license.getF2cLicense(), F2CLicenseResponse.class);*/
// if (!need_validate_lic) {
// return ResultHolder.success(null);
// }
F2CLicenseResponse
f2CLicenseResponse
=
defaultLicenseService
.
validateLicense
();
System
.
out
.
println
(
new
Gson
().
toJson
(
f2CLicenseResponse
));
switch
(
f2CLicenseResponse
.
getStatus
())
{
case
no_record:
return
ResultHolder
.
success
(
f2CLicenseResponse
);
case
valid:
return
ResultHolder
.
success
(
null
);
case
expired:
...
...
frontend/src/store/modules/lic.js
浏览文件 @
b4376a07
...
...
@@ -32,7 +32,6 @@ const actions = {
})
})
}
}
export
default
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论