From 686fe55892de7bf8d206cddbead77a5fbdb0e091 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 08 三月 2026 19:59:29 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/system/entity/license/LicenseVerify.java | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/system/entity/license/LicenseVerify.java b/src/main/java/com/zy/system/entity/license/LicenseVerify.java
index da239c0..22e287b 100644
--- a/src/main/java/com/zy/system/entity/license/LicenseVerify.java
+++ b/src/main/java/com/zy/system/entity/license/LicenseVerify.java
@@ -6,6 +6,7 @@
import java.io.File;
import java.io.IOException;
+import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.DateFormat;
@@ -35,6 +36,28 @@
File tempFileFromBase64 = createTempFileFromBase64(license);
result = licenseManager.install(tempFileFromBase64);
+ logger.info(MessageFormat.format("璁稿彲璇佸姞杞芥垚鍔燂紝璁稿彲璇佹湁鏁堟湡锛歿0} - {1}", format.format(result.getNotBefore()), format.format(result.getNotAfter())));
+ } catch (Exception e) {
+ logger.error("璁稿彲璇佸姞杞藉け璐ワ紒", e);
+ }
+
+ return result;
+ }
+
+ public synchronized LicenseContent install(LicenseVerifyParam param) {
+ LicenseContent result = null;
+ DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ try {
+ LicenseParam licenseParam = initLicenseParam(param);
+ LicenseManager licenseManager = LicenseManagerHolder.getInstance(licenseParam);
+ licenseManager.uninstall();
+
+ File licenseFile = resolveLicenseFile(param.getLicensePath());
+ if (licenseFile == null || !licenseFile.exists()) {
+ return null;
+ }
+ result = licenseManager.install(licenseFile);
logger.info(MessageFormat.format("璁稿彲璇佸姞杞芥垚鍔燂紝璁稿彲璇佹湁鏁堟湡锛歿0} - {1}", format.format(result.getNotBefore()), format.format(result.getNotAfter())));
} catch (Exception e) {
logger.error("璁稿彲璇佸姞杞藉け璐ワ紒", e);
@@ -123,4 +146,15 @@
return base64ToTempFile(base64Data, "temp_license_", ".bin");
}
-}
\ No newline at end of file
+ private File resolveLicenseFile(String licensePath) {
+ try {
+ URL url = this.getClass().getClassLoader().getResource(licensePath);
+ if (url != null) {
+ return new File(url.toURI());
+ }
+ } catch (Exception ignored) {
+ }
+ return new File(licensePath);
+ }
+
+}
--
Gitblit v1.9.1