From df702972ff8ae890991021663d919f47dc864606 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期二, 24 十二月 2024 10:35:23 +0800
Subject: [PATCH] 优化ReportDataHandler响应处理逻辑

---
 src/main/java/com/zy/system/entity/license/LicenseCheckListener.java |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java b/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
index 139b49d..dcb61b1 100644
--- a/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
+++ b/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
@@ -10,6 +10,8 @@
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.stereotype.Component;
 
+import java.io.File;
+
 /**
  * 鍦ㄩ」鐩惎鍔ㄦ椂瀹夎璇佷功
  */
@@ -52,7 +54,7 @@
         //root application context 娌℃湁parent
         ApplicationContext context = event.getApplicationContext().getParent();
         if(context == null){
-            loadLicense();
+            //loadLicense();
         }
     }
 
@@ -61,20 +63,30 @@
         if(!Cools.isEmpty(licensePath)){
             logger.info("++++++++ 寮�濮嬪姞杞借鍙瘉 ++++++++");
 
-            LicenseVerifyParam param = new LicenseVerifyParam();
-            param.setSubject(subject);
-            param.setPublicAlias(publicAlias);
-            param.setStorePass(storePass);
-            param.setLicensePath(licensePath);
-            param.setPublicKeysStorePath(publicKeysStorePath);
+            try {
+                String publicKeysStoreFileName = this.getClass().getClassLoader().getResource(publicKeysStorePath).getPath();
+                File publicKeysStoreFile = new File(publicKeysStoreFileName);
 
-            LicenseVerify licenseVerify = new LicenseVerify();
-            //瀹夎璇佷功
-            LicenseContent install = licenseVerify.install(param);
+                String licensePathFileName = this.getClass().getClassLoader().getResource(licensePath).getPath();
+                File licensePathFile = new File(licensePathFileName);
 
-            logger.info("++++++++ 璁稿彲璇佸姞杞界粨鏉� ++++++++");
+                LicenseVerifyParam param = new LicenseVerifyParam();
+                param.setSubject(subject);
+                param.setPublicAlias(publicAlias);
+                param.setStorePass(storePass);
+                param.setLicensePath(licensePathFile.getPath());
+                param.setPublicKeysStorePath(publicKeysStoreFile.getPath());
 
-            return install != null;
+                LicenseVerify licenseVerify = new LicenseVerify();
+                //瀹夎璇佷功
+                LicenseContent install = licenseVerify.install(param);
+
+                logger.info("++++++++ 璁稿彲璇佸姞杞界粨鏉� ++++++++");
+
+                return install != null;
+            } catch (Exception e) {
+                return false;
+            }
         }
 
         return false;

--
Gitblit v1.9.1