From f44135f835bf62319f9bb8a32e4592a707e5e8c1 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 27 四月 2025 11:09:55 +0800
Subject: [PATCH] SSO登录逻辑再修改

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigProperties.java |   83 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigProperties.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigProperties.java
new file mode 100644
index 0000000..52714b0
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigProperties.java
@@ -0,0 +1,83 @@
+package com.dy.common.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+@SuppressWarnings("unused")
+public class ConfigProperties {
+	private static HashMap<String, String> properties = new HashMap<>();
+	
+	private ConfigProperties() {
+	}
+	
+	/**
+	 * 鏄惁鏈夊睘鎬т簡
+	 * @return 瀛樺湪灞炴�ч厤缃繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse
+	 */
+	public static boolean hasProperties(){
+		return properties != null && properties.size() > 0;
+	}
+	
+	/**
+	 * 鏍规嵁閰嶇疆鍚嶇О寰楀埌閰嶇疆鍊�
+	 * 
+	 * @param name 灞炴�у悕
+	 * @return 灞炴�у��
+	 */
+	public static String getConfig(String name) {
+		if (properties == null) {
+			return null;
+		}
+		if(name.trim().equals("")){
+			return "" ;
+		}
+		return properties.get(name);
+	}
+
+	/**
+	 * 鍒濆鍖栭厤缃�
+	 * 
+	 * @param in 杈撳叆娴�
+	 * @param repeatCover 鏄惁閲嶅
+	 * @throws Exception  鎶涘嚭寮傚父
+	 */
+	public static void init(InputStream in, boolean repeatCover) throws Exception {
+		if(in == null){
+			throw new Exception("灞炴�ч厤缃枃浠朵笉瀛樺湪锛�") ;
+		}
+		if(properties.size() > 0){
+			if(repeatCover){
+				parseProperties(in);		
+			}
+		}else{
+			parseProperties(in);		
+		}
+	}
+
+	/**
+	 * 閲嶆柊鍒濆鍖�
+	 * 
+	 * @param in 杈撳叆娴�
+	 * @throws Exception 鎶涘嚭寮傚父
+	 */
+	public static void reInit(InputStream in) throws Exception {
+		properties = new HashMap<>();
+		parseProperties(in);
+	}
+	
+	
+	private static void parseProperties(InputStream in) throws IOException{
+		 Properties prop = new Properties();         
+		 prop.load(in); 
+		 Iterator<Entry<Object, Object>> it = prop.entrySet().iterator() ;
+		 Entry<Object, Object> entry ;
+		 while(it.hasNext()){
+			 entry = it.next() ;
+			 properties.put((String)entry.getKey(), (String)entry.getValue()) ;
+		 }
+	}
+}

--
Gitblit v1.8.0