forked from github/dataease
fix: 【ID1004304】全新安装的环境,添加license的时候页面报错
This commit is contained in:
parent
2a7685c274
commit
ec0a1f9524
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user