提交 ec0a1f95 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

fix: 【ID1004304】全新安装的环境,添加license的时候页面报错

上级 2a7685c2
......@@ -4,6 +4,7 @@ import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.DateUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.listener.util.CacheUtils;
import org.apache.commons.io.FileUtils;
......@@ -27,11 +28,17 @@ public class AboutService {
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.updateLicense(product, licenseKey);
Optional.ofNullable(f2CLicenseResponse).ifPresent(resp -> {
if (resp.getStatus() == F2CLicenseResponse.Status.valid){
CacheUtils.updateLicCache(new Date(f2CLicenseResponse.getLicense().getExpired()));
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
String dateStr = f2CLicenseResponse.getLicense().getExpired();
LogUtil.info("update valid lic, expired date is {}", dateStr);
try {
Date date = DateUtils.getDate(dateStr);
CacheUtils.updateLicCache(date);
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
} catch (Exception e) {
LogUtil.error(e);
}
}
});
return f2CLicenseResponse;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论