瀏覽代碼

change the dataSourceInformation's type to JSONObject

sunyj 8 年之前
父節點
當前提交
3b6eaf1c03

+ 2 - 2
report/src/main/java/com/uas/report/DynamicProperties.java

@@ -85,7 +85,7 @@ public class DynamicProperties {
 	 * 数据源配置信息
 	 */
 	@DynamicValue("datasource")
-	private String dataSourceInformation;
+	private JSONObject dataSourceInformation;
 
     /**
      * PC端支持打印的最大记录行数
@@ -274,7 +274,7 @@ public class DynamicProperties {
 		return shareJrxmlsWithSubMaster;
 	}
 
-	public String getDataSourceInformation() {
+	public JSONObject getDataSourceInformation() {
         mayLoad();
 		return dataSourceInformation;
 	}

+ 1 - 1
report/src/main/java/com/uas/report/util/MasterManager.java

@@ -47,7 +47,7 @@ public class MasterManager {
 	private static void initAllDataSources() {
 		// 从配置中获取数据源信息
 		DynamicProperties dynamicProperties = ContextUtils.getBean(DynamicProperties.class);
-		JSONObject jsonObject = JSONObject.parseObject(dynamicProperties.getDataSourceInformation());
+		JSONObject jsonObject = dynamicProperties.getDataSourceInformation();
 		Set<Entry<String, Object>> entrySet = jsonObject.entrySet();
 		for (Entry<String, Object> entry : entrySet) {
 			DruidDataSource dataSource = JSONObject.parseObject(entry.getValue().toString(), DruidDataSource.class);

+ 3 - 0
report/src/main/java/com/uas/report/util/ObjectUtils.java

@@ -1,6 +1,7 @@
 package com.uas.report.util;
 
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 
 import java.io.*;
 import java.lang.reflect.Field;
@@ -332,6 +333,8 @@ public class ObjectUtils {
                 value = Byte.valueOf(value.toString());
             } else if (typeString.equals("class java.lang.Boolean") || typeString.equals("boolean")) {
                 value = Boolean.valueOf(value.toString());
+            } else if (typeString.equals("class com.alibaba.fastjson.JSONObject")) {
+                value = JSONObject.parseObject(value.toString());
             } else if (typeString.startsWith("java.util.List")) {
                 Class<?> clazz = Object.class;
                 if (typeString.matches("^java.util.List<[\\s\\S]+?>$")) {

+ 1 - 1
report/src/main/resources/report.properties

@@ -13,4 +13,4 @@ use-xlsx=false
 # support PDF, XLS, XLS_DATA, XLSX, XLSX_DATA, DOC, TXT in com.uas.report.model.ExportType
 page.preview.show-export-buttons=PDF, XLS, XLS_DATA
 
-datasource={"UAS":{"driverClassName":"oracle.jdbc.driver.OracleDriver","url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl","username":"UAS","password":"select!#%*(","initialSize":1,"minIdle":0,"maxActive":20,"maxWait":60000,"timeBetweenEvictionRunsMillis":60000,"minEvictableIdleTimeMillis":300000,"validationQuery":"SELECT 1 FROM DUAL","testWhileIdle":true,"testOnBorrow":true,"testOnReturn":false,"removeAbandoned":true,"removeAbandonedTimeout":120,"logAbandoned":true,"timeBetweenLogStatsMillis":600000,"poolPreparedStatements":true,"maxPoolPreparedStatementPerConnectionSize":20,"filters":"stat,slf4j","connectionProperties":"druid.stat.mergeSql=false;druid.stat.slowSqlMillis=5000"}}
+datasource={"B2B_dev":{"driverClassName":"oracle.jdbc.driver.OracleDriver","url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl","username":"uuplatformdemo","password":"selectuuplatform","initialSize":1,"minIdle":0,"maxActive":20,"maxWait":60000,"timeBetweenEvictionRunsMillis":60000,"minEvictableIdleTimeMillis":300000,"validationQuery":"SELECT 1 FROM DUAL","testWhileIdle":true,"testOnBorrow":true,"testOnReturn":false,"removeAbandoned":true,"removeAbandonedTimeout":120,"logAbandoned":true,"timeBetweenLogStatsMillis":600000,"poolPreparedStatements":true,"maxPoolPreparedStatementPerConnectionSize":20,"filters":"stat,slf4j","connectionProperties":"druid.stat.mergeSql=false;druid.stat.slowSqlMillis=5000"}, "UAS":{"driverClassName":"oracle.jdbc.driver.OracleDriver","url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl","username":"UAS","password":"select!#%*(","initialSize":1,"minIdle":0,"maxActive":20,"maxWait":60000,"timeBetweenEvictionRunsMillis":60000,"minEvictableIdleTimeMillis":300000,"validationQuery":"SELECT 1 FROM DUAL","testWhileIdle":true,"testOnBorrow":true,"testOnReturn":false,"removeAbandoned":true,"removeAbandonedTimeout":120,"logAbandoned":true,"timeBetweenLogStatsMillis":600000,"poolPreparedStatements":true,"maxPoolPreparedStatementPerConnectionSize":20,"filters":"stat,slf4j","connectionProperties":"druid.stat.mergeSql=false;druid.stat.slowSqlMillis=5000"}}