| 
					
				 | 
			
			
				@@ -7,10 +7,12 @@ import com.fs.his.config.FsSysConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.hisStore.config.FsErpConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.system.domain.SysConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.system.mapper.SysConfigMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class ConfigUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     FsSysConfig fsSysConfig; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,17 +59,38 @@ public class ConfigUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public JSONObject generateConfigByKey(String key){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("开始根据配置键[{}]获取配置信息", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey(key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (sysConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("未找到配置键[{}]对应的配置信息", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String configValue = sysConfig.getConfigValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("配置键[{}]对应的配置值为: {}", key, configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        JSONObject result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(configValue != null && configValue.trim().startsWith("[")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("配置键[{}]的值为JSON数组格式", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             JSONArray array = JSON.parseArray(configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (array.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return array.getJSONObject(0); // 取第一个元素 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("配置键[{}]的JSON数组长度为{},返回第一个元素", key, array.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                result = array.getJSONObject(0); // 取第一个元素 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("配置键[{}]的JSON数组为空", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("配置键[{}]的值为JSON对象格式", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            result = JSONObject.parseObject(configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return JSONObject.parseObject(configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("配置键[{}]生成配置对象完成", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |