From ec0a1f95240b0e6e1351998167a5d1b897d1c2c3 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 11 Jun 2021 16:06:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=80=90ID1004304=E3=80=91=E5=85=A8?= =?UTF-8?q?=E6=96=B0=E5=AE=89=E8=A3=85=E7=9A=84=E7=8E=AF=E5=A2=83=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0license=E7=9A=84=E6=97=B6=E5=80=99=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/AboutService.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/AboutService.java b/backend/src/main/java/io/dataease/service/AboutService.java index 9568c4f6b9..5041719751 100644 --- a/backend/src/main/java/io/dataease/service/AboutService.java +++ b/backend/src/main/java/io/dataease/service/AboutService.java @@ -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;