Przeglądaj źródła

更改账套配置方式

sunyj 9 lat temu
rodzic
commit
624cf6fac8

+ 4 - 4
src/main/java/com/uas/report/controller/PrintController.java

@@ -54,7 +54,7 @@ public class PrintController {
 	 * @param userName
 	 *            不为null;当前账套名称
 	 * @param profile
-	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
+	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
 	 * @param reportName
 	 *            不为null;需要导出的报表的名称,不带任何后缀(如导出采购单,即为"Purchase")
 	 * @param whereCondition
@@ -106,7 +106,7 @@ public class PrintController {
 	 * @param userName
 	 *            不为null;当前账套名称
 	 * @param profile
-	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
+	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
 	 * @param reportName
 	 *            不为null;需要导出的报表的名称,不带任何后缀(如导出采购单,即为"Purchase")
 	 * @param whereCondition
@@ -194,7 +194,7 @@ public class PrintController {
 	 * @param userName
 	 *            不为null;当前账套名称
 	 * @param profile
-	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
+	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
 	 * @param reportName
 	 *            不为null;需要预览的报表的名称,不带任何后缀(如预览采购单,即为"Purchase")
 	 * @param whereCondition
@@ -273,7 +273,7 @@ public class PrintController {
 	 * @param userName
 	 *            不为null;当前账套名称
 	 * @param profile
-	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
+	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
 	 * @param reportName
 	 *            不为null;需要预览的报表的名称,不带任何后缀(如预览采购单,即为"Purchase")
 	 * @param whereCondition

+ 1 - 1
src/main/java/com/uas/report/service/PrintService.java

@@ -58,7 +58,7 @@ public interface PrintService {
 	 * @param userName
 	 *            不为null;当前账套用户名
 	 * @param profile
-	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
+	 *            可选(UAS系统不必传递该参数),用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
 	 * @param reportName
 	 *            不为null;需要预览的报表的名称,不带任何后缀(如预览采购单,即为"Purchase")
 	 * @param whereCondition

+ 2 - 16
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -66,13 +66,7 @@ public class PrintServiceImpl implements PrintService {
 	@Override
 	public byte[] export(String userName, String profile, String reportName, String whereCondition,
 			String otherParameters, String exportFileType) {
-		DataSource dataSource = null;
-		if (!StringUtils.isEmpty(profile)) {
-			dataSource = DataSourceUtils.getPlatformDataSource(userName, profile);
-		} else {
-			// 为空,说明不是来自B2C或B2B的请求,而是UAS系统
-			dataSource = DataSourceUtils.getUASDataSource(userName);
-		}
+		DataSource dataSource = DataSourceUtils.getDataSource(userName, profile);
 		if (dataSource == null) {
 			throw new ReportException("获取数据源失败");
 		}
@@ -87,15 +81,7 @@ public class PrintServiceImpl implements PrintService {
 	@Override
 	public Map<String, Object> preview(String userName, String profile, String reportName, String whereCondition,
 			String otherParameters, Integer pageIndex) {
-		DataSource dataSource = null;
-		if (!StringUtils.isEmpty(profile)) {
-			logger.info("getPlatformDataSource...");
-			dataSource = DataSourceUtils.getPlatformDataSource(userName, profile);
-		} else {
-			logger.info("getUASDataSource...");
-			// 为空,说明不是来自B2C或B2B的请求,而是UAS系统
-			dataSource = DataSourceUtils.getUASDataSource(userName);
-		}
+		DataSource dataSource = DataSourceUtils.getDataSource(userName, profile);
 		if (dataSource == null) {
 			throw new ReportException("获取数据源失败");
 		}

+ 153 - 67
src/main/java/com/uas/report/util/DataSourceUtils.java

@@ -1,10 +1,18 @@
 package com.uas.report.util;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.Properties;
+import java.sql.SQLSyntaxErrorException;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.sql.DataSource;
 
@@ -12,7 +20,7 @@ import org.apache.log4j.Logger;
 import org.springframework.util.StringUtils;
 
 import com.alibaba.druid.pool.DruidDataSource;
-import com.alibaba.druid.pool.DruidDataSourceFactory;
+import com.alibaba.fastjson.JSONObject;
 import com.uas.report.core.exception.ReportException;
 
 /**
@@ -23,107 +31,185 @@ import com.uas.report.core.exception.ReportException;
  */
 public class DataSourceUtils {
 
+	/**
+	 * 数据源
+	 */
+	private static Map<String, DruidDataSource> dataSources = new ConcurrentHashMap<>();
+
 	private static Logger logger = Logger.getLogger(DataSourceUtils.class);
 
+	public static DataSource getDataSource(String userName, String profile) {
+		if (StringUtils.isEmpty(userName)) {
+			return null;
+		}
+		// 需要考虑B2B打印时账套名为B2B/10045740等类似的情况
+		if (!StringUtils.isEmpty(profile)) {
+			userName = userName.split("/")[0] + "." + profile;
+		}
+		DruidDataSource dataSource = dataSources.get(userName);
+		// 如果Map里未存放该数据源,从jdbc配置文件获取数据源
+		if (dataSource == null) {
+			dataSource = getDataSource(ReportConstants.JDBC_FILES_ABSOLUTE_PATH + userName + ".json");
+			// jdbc文件并未配置,则可能是子帐套,需要从主账套表中获取
+			if (dataSource != null) {
+				dataSources.put(userName, dataSource);
+			} else {
+				initAllDataSources();
+				Set<Entry<String, DruidDataSource>> entrySet = dataSources.entrySet();
+				for (Entry<String, DruidDataSource> entry : entrySet) {
+					dataSource = getDataSourceFromMainMaster(entry.getValue(), userName);
+					if (dataSource != null) {
+						dataSources.put(userName, dataSource);
+						return dataSource;
+					}
+				}
+			}
+		}
+		return dataSource;
+	}
+
+	/**
+	 * 初始化所有数据源
+	 */
+	private static void initAllDataSources() {
+		File file = new File(ReportConstants.JDBC_FILES_ABSOLUTE_PATH);
+		// 获取所有jdbc配置文件
+		if (file.exists() && file.listFiles().length > 0) {
+			File[] files = file.listFiles();
+			for (File f : files) {
+				String userName = f.getName().replaceAll(".json", "");
+				if (dataSources.get(userName) == null) {
+					DruidDataSource dataSource = getDataSource(f.getPath());
+					if (dataSource != null) {
+						dataSources.put(userName, dataSource);
+					}
+				}
+			}
+		}
+	}
+
 	/**
-	 * 根据当前账套用户名,从主数据库master表获取(UAS系统)账套数据库配置信息,作为报表模板的数据源
+	 * 从文件中读取jdbc配置,获取数据源
 	 * 
-	 * @param userName
-	 *            当前账套用户名
+	 * @param jdbcFileAbsolutePath
+	 *            jdbc配置文件
 	 * @return 数据源
 	 */
-	public static DataSource getUASDataSource(String userName) {
-		if (StringUtils.isEmpty(userName)) {
-			return null;
-		}
-		// 默认数据源(主数据库)
-		DruidDataSource defaultDataSource = ContextUtils.getApplicationContext().getBean("defaultSob",
-				DruidDataSource.class);
-		if (defaultDataSource == null) {
+	public static DruidDataSource getDataSource(String jdbcFileAbsolutePath) {
+		if (StringUtils.isEmpty(jdbcFileAbsolutePath)) {
 			return null;
 		}
-		// 若当前账套用户名为默认数据库用户名
-		if (userName.equals(defaultDataSource.getUsername())) {
-			return defaultDataSource;
+		File file = new File(jdbcFileAbsolutePath);
+		if (file.exists()) {
+			BufferedReader bufferedReader = null;
+			try {
+				bufferedReader = new BufferedReader(new FileReader(file));
+				StringBuilder stringBuilder = new StringBuilder();
+				String line = "";
+				while (!StringUtils.isEmpty(line = bufferedReader.readLine())) {
+					stringBuilder.append(line);
+				}
+				JSONObject jsonObject = JSONObject.parseObject(stringBuilder.toString());
+				DruidDataSource dataSource = new DruidDataSource();
+				dataSource.setDriverClassName(jsonObject.getString("driverClassName"));
+				dataSource.setUrl(jsonObject.getString("url"));
+				dataSource.setUsername(jsonObject.getString("username"));
+				dataSource.setPassword(jsonObject.getString("password"));
+				dataSource.setInitialSize(jsonObject.getIntValue("initialSize"));
+				dataSource.setMinIdle(jsonObject.getIntValue("minIdle"));
+				dataSource.setMaxActive(jsonObject.getIntValue("maxActive"));
+				dataSource.setMaxWait(jsonObject.getLongValue("maxWait"));
+				dataSource.setTimeBetweenEvictionRunsMillis(jsonObject.getLongValue("timeBetweenEvictionRunsMillis"));
+				dataSource.setMinEvictableIdleTimeMillis(jsonObject.getLongValue("minEvictableIdleTimeMillis"));
+				dataSource.setValidationQuery(jsonObject.getString("validationQuery"));
+				dataSource.setTestWhileIdle(jsonObject.getBooleanValue("testWhileIdle"));
+				dataSource.setTestOnBorrow(jsonObject.getBooleanValue("testOnBorrow"));
+				dataSource.setTestOnReturn(jsonObject.getBooleanValue("testOnReturn"));
+				dataSource.setRemoveAbandoned(jsonObject.getBooleanValue("removeAbandoned"));
+				dataSource.setRemoveAbandoned(jsonObject.getBooleanValue("removeAbandonedTimeout"));
+				dataSource.setLogAbandoned(jsonObject.getBooleanValue("logAbandoned"));
+				dataSource.setPoolPreparedStatements(jsonObject.getBooleanValue("poolPreparedStatements"));
+				dataSource.setMaxPoolPreparedStatementPerConnectionSize(
+						jsonObject.getIntValue("maxPoolPreparedStatementPerConnectionSize"));
+				dataSource.setFilters(jsonObject.getString("filters"));
+				return dataSource;
+			} catch (IOException e) {
+				e.printStackTrace();
+			} catch (SQLException e) {
+				logger.error("druid configuration initialization filter");
+			} finally {
+				if (bufferedReader != null) {
+					try {
+						bufferedReader.close();
+					} catch (IOException e) {
+						e.printStackTrace();
+					}
+				}
+			}
 		}
+		return null;
+	}
 
+	/**
+	 * 从主账套的MA_USER表中获取子账套数据源
+	 * 
+	 * @param mainMaster
+	 * @param userName
+	 * @return
+	 */
+	private static DruidDataSource getDataSourceFromMainMaster(DruidDataSource mainMaster, String userName) {
 		Connection connection = null;
 		PreparedStatement preparedStatement = null;
 		ResultSet resultSet = null;
 		try {
-			logger.info("defaultDataSource.getConnection...");
-			connection = defaultDataSource.getConnection();
-			logger.info("defaultDataSource.getConnection done...");
+			logger.info("mainMaster.getConnection...");
+			connection = mainMaster.getConnection();
+			logger.info("mainMaster.getConnection done...");
 			// 根据当前账套用户名获取其数据库配置信息
 			String sql = "select * from master where MA_USER = ?";
 			preparedStatement = connection.prepareStatement(sql);
 			preparedStatement.setString(1, userName);
-			resultSet = preparedStatement.executeQuery();
+			try {
+				resultSet = preparedStatement.executeQuery();
+			} catch (SQLSyntaxErrorException e) {
+				// 并不是每个数据源都有MA_USER表,因此,出现异常,返回空,紧接着遍历下一个数据源
+				return null;
+			}
 			if (resultSet.next()) {
 				String password = resultSet.getString("MS_PWD");
 				if (!StringUtils.isEmpty(password)) {
-					Properties properties = new Properties();
-					properties.put("driverClassName", defaultDataSource.getDriverClassName());
-					properties.put("url", defaultDataSource.getUrl());
-					properties.put("username", userName);
-					properties.put("password", password);
-					properties.put("testWhileIdle", "true");
-					properties.put("validationQuery", "select 1 from SYS.DUAL");
-					logger.info("DruidDataSourceFactory.createDataSource...");
-					return DruidDataSourceFactory.createDataSource(properties);
+					// 除了用户名、密码,其他属性一样
+					DruidDataSource result = mainMaster.cloneDruidDataSource();
+					result.setUsername(userName);
+					result.setPassword(password);
+					return result;
 				}
 			}
 		} catch (Exception e) {
 			throw new ReportException(e).setDetailedMessage(e);
 		} finally {
-			try {
-				if (resultSet != null) {
+			if (resultSet != null) {
+				try {
 					resultSet.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
 				}
-			} catch (SQLException e) {
-				e.printStackTrace();
 			}
-			try {
-				if (preparedStatement != null) {
+			if (preparedStatement != null) {
+				try {
 					preparedStatement.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
 				}
-			} catch (SQLException e) {
-				e.printStackTrace();
 			}
-			try {
-				if (connection != null) {
+			if (connection != null) {
+				try {
 					connection.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
 				}
-			} catch (SQLException e) {
-				throw new ReportException(e).setDetailedMessage(e);
 			}
 		}
 		return null;
 	}
-
-	/**
-	 * 根据当前账套用户名和profile配置,获取相应B2C、B2B数据源
-	 * 
-	 * @param userName
-	 *            当前账套用户名
-	 * @param profile
-	 *            用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
-	 * @return 数据源
-	 */
-	public static DataSource getPlatformDataSource(String userName, String profile) {
-		// 如果userName是B2C或B2B,直接获取配置好的B2C数据源(B2B数据源与B2C相同)
-		if (userName.toUpperCase().startsWith("B2C") || userName.toUpperCase().startsWith("B2B")) {
-			if (profile.equalsIgnoreCase("dev")) {
-				return ContextUtils.getApplicationContext().getBean("platformDevDataSource", DruidDataSource.class);
-			} else if (profile.equalsIgnoreCase("test")) {
-				return ContextUtils.getApplicationContext().getBean("platformTestDataSource", DruidDataSource.class);
-			} else if (profile.equalsIgnoreCase("prod")) {
-				return ContextUtils.getApplicationContext().getBean("platformProdDataSource", DruidDataSource.class);
-			} else {
-				throw new ReportException("profile只能为:dev、test或prod,不可为" + profile);
-			}
-		} else {
-			throw new ReportException("暂时不支持" + userName);
-		}
-	}
 }

+ 5 - 0
src/main/java/com/uas/report/util/ReportConstants.java

@@ -57,4 +57,9 @@ public class ReportConstants {
 	 * 生成的pdf、excel等文件的相对路径
 	 */
 	public static final String GENERATED_FILES_PATH = "resources/generate/";
+
+	/**
+	 * jdbc配置文件的绝对路径
+	 */
+	public static final String JDBC_FILES_ABSOLUTE_PATH = PathUtils.getClassPath() + "classes/jdbc/";
 }

+ 22 - 0
src/main/resources/jdbc/B2B.dev.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+	"username":"uuplatformdemo",
+	"password":"selectuuplatform",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/B2B.prod.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@10.10.100.200:1521:orcl",
+	"username":"platform$b2b",
+	"password":"select*fromuu",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/B2B.test.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+	"username":"uuplatformdemo",
+	"password":"selectuuplatform",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/B2C.dev.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+	"username":"uuplatformdemo",
+	"password":"selectuuplatform",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/B2C.prod.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@10.10.100.200:1521:orcl",
+	"username":"platform$b2b",
+	"password":"select*fromuu",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/B2C.test.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+	"username":"uuplatformdemo",
+	"password":"selectuuplatform",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/BACKUP_YITOA_DIGITTECH.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@218.18.115.198:1523:orcl",
+	"username":"BACKUP_YITOA_DIGITTECH",
+	"password":"select!#%*(",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 22 - 0
src/main/resources/jdbc/UAS.json

@@ -0,0 +1,22 @@
+{
+	"driverClassName":"oracle.jdbc.driver.OracleDriver",
+	"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+	"username":"UAS",
+	"password":"select!#%*(",
+	"initialSize":3,
+	"minIdle":3,
+	"maxActive":20,
+	"maxWait":60000,
+	"timeBetweenEvictionRunsMillis":60000,
+	"minEvictableIdleTimeMillis":300000,
+	"validationQuery":"SELECT 1 FROM DUAL",
+	"testWhileIdle":true,
+	"testOnBorrow":false,
+	"testOnReturn":false,
+	"removeAbandoned":true,
+	"removeAbandonedTimeout":1800,
+	"logAbandoned":true,
+	"poolPreparedStatements":true,
+	"maxPoolPreparedStatementPerConnectionSize":20,
+	"filters":"stat"
+}

+ 0 - 172
src/main/resources/spring/applicationContext.xml

@@ -13,7 +13,6 @@
 	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.1.xsd">
 
 	<context:property-placeholder location="classpath*:spring/*.properties" />
-	<context:property-placeholder location="classpath*:${profile}/*.properties" />
 
 	<!-- 注册spring上下文对象 -->
 	<bean class="com.uas.report.support.ApplicationContextRegister" />
@@ -30,175 +29,4 @@
 	<!-- 扫描的包 -->
 	<context:component-scan base-package="com.uas.report" />
 
-	<!-- UAS标准帐套 -->
-	<bean id="defaultSob" class="com.alibaba.druid.pool.DruidDataSource"
-		init-method="init" destroy-method="close">
-		<!-- 基本属性 url、user、password -->
-		<property name="driverClassName" value="${jdbc.driverClassName}" />
-		<property name="url" value="${jdbc.url}" />
-		<property name="username" value="${jdbc.username}" />
-		<property name="password" value="${jdbc.password}" />
-
-		<!-- 配置初始化大小、最小、最大 -->
-		<property name="initialSize" value="${jdbc.initialSize}" />
-		<property name="minIdle" value="${jdbc.minIdle}" />
-		<property name="maxActive" value="${jdbc.maxActive}" />
-
-		<!-- 配置获取连接等待超时的时间 -->
-		<property name="maxWait" value="${jdbc.maxWait}" />
-
-		<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
-		<property name="timeBetweenEvictionRunsMillis" value="${jdbc.timeBetweenEvictionRunsMillis}" />
-
-		<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
-		<property name="minEvictableIdleTimeMillis" value="${jdbc.minEvictableIdleTimeMillis}" />
-
-		<property name="validationQuery" value="SELECT 1 FROM DUAL" />
-		<property name="testWhileIdle" value="true" />
-		<property name="testOnBorrow" value="false" />
-		<property name="testOnReturn" value="false" />
-
-		<!-- 关闭长时间不使用的连接,打开removeAbandoned功能 -->
-		<property name="removeAbandoned" value="true" />
-		<property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" />
-		<!-- 关闭abanded连接时输出错误日志 -->
-		<property name="logAbandoned" value="true" />
-
-		<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
-		<property name="poolPreparedStatements" value="true" />
-		<property name="maxPoolPreparedStatementPerConnectionSize"
-			value="${jdbc.maxPoolPreparedStatementPerConnectionSize}" />
-
-		<!-- 配置监控统计拦截的filters -->
-		<property name="filters" value="stat" />
-	</bean>
-
-	<!-- platform dev数据库 -->
-	<bean id="platformDevDataSource" class="com.alibaba.druid.pool.DruidDataSource"
-		init-method="init" destroy-method="close">
-		<property name="driverClassName" value="${jdbc.platform.driverClassName}" />
-		<property name="url" value="${jdbc.platform.dev.url}" />
-		<property name="username" value="${jdbc.platform.dev.username}" />
-		<property name="password" value="${jdbc.platform.dev.password}" />
-
-		<!-- 配置初始化大小、最小、最大 -->
-		<property name="initialSize" value="${jdbc.platform.initialSize}" />
-		<property name="minIdle" value="${jdbc.platform.minIdle}" />
-		<property name="maxActive" value="${jdbc.platform.maxActive}" />
-
-		<!-- 配置获取连接等待超时的时间 -->
-		<property name="maxWait" value="${jdbc.platform.maxWait}" />
-
-		<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
-		<property name="timeBetweenEvictionRunsMillis"
-			value="${jdbc.platform.timeBetweenEvictionRunsMillis}" />
-
-		<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
-		<property name="minEvictableIdleTimeMillis" value="${jdbc.platform.minEvictableIdleTimeMillis}" />
-
-		<property name="validationQuery" value="SELECT 1 FROM DUAL" />
-		<property name="testWhileIdle" value="true" />
-		<property name="testOnBorrow" value="false" />
-		<property name="testOnReturn" value="false" />
-
-		<!-- 关闭长时间不使用的连接,打开removeAbandoned功能 -->
-		<property name="removeAbandoned" value="true" />
-		<property name="removeAbandonedTimeout" value="${jdbc.platform.removeAbandonedTimeout}" />
-		<!-- 关闭abanded连接时输出错误日志 -->
-		<property name="logAbandoned" value="true" />
-
-		<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
-		<property name="poolPreparedStatements" value="true" />
-		<property name="maxPoolPreparedStatementPerConnectionSize"
-			value="${jdbc.platform.maxPoolPreparedStatementPerConnectionSize}" />
-
-		<!-- 配置监控统计拦截的filters -->
-		<property name="filters" value="stat" />
-	</bean>
-
-	<!-- platform test数据库 -->
-	<bean id="platformTestDataSource" class="com.alibaba.druid.pool.DruidDataSource"
-		init-method="init" destroy-method="close">
-		<property name="driverClassName" value="${jdbc.platform.driverClassName}" />
-		<property name="url" value="${jdbc.platform.test.url}" />
-		<property name="username" value="${jdbc.platform.test.username}" />
-		<property name="password" value="${jdbc.platform.test.password}" />
-
-		<!-- 配置初始化大小、最小、最大 -->
-		<property name="initialSize" value="${jdbc.platform.initialSize}" />
-		<property name="minIdle" value="${jdbc.platform.minIdle}" />
-		<property name="maxActive" value="${jdbc.platform.maxActive}" />
-
-		<!-- 配置获取连接等待超时的时间 -->
-		<property name="maxWait" value="${jdbc.platform.maxWait}" />
-
-		<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
-		<property name="timeBetweenEvictionRunsMillis"
-			value="${jdbc.platform.timeBetweenEvictionRunsMillis}" />
-
-		<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
-		<property name="minEvictableIdleTimeMillis" value="${jdbc.platform.minEvictableIdleTimeMillis}" />
-
-		<property name="validationQuery" value="SELECT 1 FROM DUAL" />
-		<property name="testWhileIdle" value="true" />
-		<property name="testOnBorrow" value="false" />
-		<property name="testOnReturn" value="false" />
-
-		<!-- 关闭长时间不使用的连接,打开removeAbandoned功能 -->
-		<property name="removeAbandoned" value="true" />
-		<property name="removeAbandonedTimeout" value="${jdbc.platform.removeAbandonedTimeout}" />
-		<!-- 关闭abanded连接时输出错误日志 -->
-		<property name="logAbandoned" value="true" />
-
-		<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
-		<property name="poolPreparedStatements" value="true" />
-		<property name="maxPoolPreparedStatementPerConnectionSize"
-			value="${jdbc.platform.maxPoolPreparedStatementPerConnectionSize}" />
-
-		<!-- 配置监控统计拦截的filters -->
-		<property name="filters" value="stat" />
-	</bean>
-
-	<!-- platform prod数据库 -->
-	<bean id="platformProdDataSource" class="com.alibaba.druid.pool.DruidDataSource"
-		init-method="init" destroy-method="close">
-		<property name="driverClassName" value="${jdbc.platform.driverClassName}" />
-		<property name="url" value="${jdbc.platform.prod.url}" />
-		<property name="username" value="${jdbc.platform.prod.username}" />
-		<property name="password" value="${jdbc.platform.prod.password}" />
-
-		<!-- 配置初始化大小、最小、最大 -->
-		<property name="initialSize" value="${jdbc.platform.initialSize}" />
-		<property name="minIdle" value="${jdbc.platform.minIdle}" />
-		<property name="maxActive" value="${jdbc.platform.maxActive}" />
-
-		<!-- 配置获取连接等待超时的时间 -->
-		<property name="maxWait" value="${jdbc.platform.maxWait}" />
-
-		<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
-		<property name="timeBetweenEvictionRunsMillis"
-			value="${jdbc.platform.timeBetweenEvictionRunsMillis}" />
-
-		<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
-		<property name="minEvictableIdleTimeMillis" value="${jdbc.platform.minEvictableIdleTimeMillis}" />
-
-		<property name="validationQuery" value="SELECT 1 FROM DUAL" />
-		<property name="testWhileIdle" value="true" />
-		<property name="testOnBorrow" value="false" />
-		<property name="testOnReturn" value="false" />
-
-		<!-- 关闭长时间不使用的连接,打开removeAbandoned功能 -->
-		<property name="removeAbandoned" value="true" />
-		<property name="removeAbandonedTimeout" value="${jdbc.platform.removeAbandonedTimeout}" />
-		<!-- 关闭abanded连接时输出错误日志 -->
-		<property name="logAbandoned" value="true" />
-
-		<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
-		<property name="poolPreparedStatements" value="true" />
-		<property name="maxPoolPreparedStatementPerConnectionSize"
-			value="${jdbc.platform.maxPoolPreparedStatementPerConnectionSize}" />
-
-		<!-- 配置监控统计拦截的filters -->
-		<property name="filters" value="stat" />
-	</bean>
 </beans>

+ 0 - 24
src/main/resources/spring/jdbc-platform.properties

@@ -1,24 +0,0 @@
-#platform
-#dev
-jdbc.platform.dev.url=jdbc:oracle:thin:@192.168.253.6:1521:orcl
-jdbc.platform.dev.username=uuplatformdemo
-jdbc.platform.dev.password=selectuuplatform
-#test
-jdbc.platform.test.url=jdbc:oracle:thin:@192.168.253.6:1521:orcl
-jdbc.platform.test.username=uuplatformdemo
-jdbc.platform.test.password=selectuuplatform
-#prod
-jdbc.platform.prod.url=jdbc:oracle:thin:@10.10.100.200:1521:orcl
-jdbc.platform.prod.username=platform$b2b
-jdbc.platform.prod.password=select*fromuu
-#other configuration
-jdbc.platform.driverClassName=oracle.jdbc.driver.OracleDriver
-jdbc.platform.initialSize=3
-jdbc.platform.minIdle=3
-jdbc.platform.maxActive=20
-jdbc.platform.maxWait=60000
-jdbc.platform.timeBetweenEvictionRunsMillis=60000
-jdbc.platform.minEvictableIdleTimeMillis=300000
-#1800s
-jdbc.platform.removeAbandonedTimeout=1800
-jdbc.platform.maxPoolPreparedStatementPerConnectionSize=20

+ 0 - 14
src/main/resources/spring/jdbc-uas.properties

@@ -1,14 +0,0 @@
-#UAS—
-jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
-jdbc.url=jdbc:oracle:thin:@192.168.253.6:1521:orcl
-jdbc.username=UAS
-jdbc.password=select!#%*(
-jdbc.initialSize=3
-jdbc.minIdle=3
-jdbc.maxActive=20
-jdbc.maxWait=60000
-jdbc.timeBetweenEvictionRunsMillis=60000
-jdbc.minEvictableIdleTimeMillis=300000
-#1800s
-jdbc.removeAbandonedTimeout=1800
-jdbc.maxPoolPreparedStatementPerConnectionSize=20