From 9619e60e3075a432d692f3cd8b76787568c53aad Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 07 五月 2025 15:56:58 +0800
Subject: [PATCH] 1、完善代码;2、禁止输出SpringBoot启动时Banner。
---
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java
new file mode 100644
index 0000000..ae28607
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java
@@ -0,0 +1,67 @@
+package com.dy.pipIrrWebFile.fm;
+
+import com.dy.common.util.NumUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.core.env.Environment;
+import org.springframework.lang.NonNull;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DyFmListener implements ApplicationListener<ApplicationReadyEvent> {
+
+ @Autowired
+ private Environment env;
+
+ public static DyFileSvConf.Group dyFileGroup = new DyFileSvConf.Group() ;
+
+ /**
+ * SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡
+ * @param event 浜嬩欢
+ */
+ @Override
+ public void onApplicationEvent(@NonNull ApplicationReadyEvent event) {
+ try {
+ //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴�
+ Thread.sleep(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }finally {
+ try{
+ parseConfig() ;
+ }catch(Exception e){
+ e.printStackTrace();
+ dyFileGroup = null ;
+ }
+ }
+ }
+ private void parseConfig() throws Exception{
+ String fmUrl = env.getProperty("dy.webFile.fmUrl");
+ for(int i = 1 ; i <= 12 ; i++){
+ String id = env.getProperty("dy.webFile.sv" + i + ".id");
+ String absolutePath = env.getProperty("dy.webFile.sv" + i + ".absolutePath");
+ String relativePath = env.getProperty("dy.webFile.sv" + i + ".relativePath");
+ String hashStart = env.getProperty("dy.webFile.sv" + i + ".hashStart");
+ String hashEnd = env.getProperty("dy.webFile.sv" + i + ".hashEnd");
+ String restUrl = env.getProperty("dy.webFile.sv" + i + ".restUrl");
+ String webUrl = env.getProperty("dy.webFile.sv" + i + ".webUrl");
+ String webDownloadPath = env.getProperty("dy.webFile.sv" + i + ".webDownloadPath");
+ if(!NumUtil.isPlusIntNumber(hashStart)){
+ throw new Exception("閰嶇疆dy.webFile.sv" + i + ".hashStart 涓嶆槸鏁存暟") ;
+ }
+ if(!NumUtil.isPlusIntNumber(hashEnd)){
+ throw new Exception("閰嶇疆dy.webFile.sv" + i + ".hashEnd 涓嶆槸鏁存暟") ;
+ }
+ dyFileGroup.add(new DyFileSvConf.Vo(id,
+ absolutePath,
+ relativePath,
+ restUrl,
+ webUrl,
+ webDownloadPath,
+ Integer.parseInt(hashStart),
+ Integer.parseInt(hashEnd))) ;
+ }
+ dyFileGroup.check();
+ }
+}
--
Gitblit v1.8.0