Selaa lähdekoodia

【中测】中测数据解析

zhouy 1 kuukausi sitten
vanhempi
commit
687849fab9

+ 11 - 6
pom.xml

@@ -125,26 +125,32 @@
 			<artifactId>druid</artifactId>
 			<version>1.0.26</version>
 		</dependency>
-
 	<!--	<dependency>
 			<groupId>org.samba.jcifs</groupId>
 			<artifactId>jcifs</artifactId>
 			<version>1.3.17</version>
 		</dependency>-->
-
 		<dependency>
 			<groupId>org.codelibs</groupId>
 			<artifactId>jcifs</artifactId>
 			<version>2.1.34</version>
 		</dependency>
-
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi</artifactId>
 			<version>3.14</version>
 		</dependency>
-
-	</dependencies>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi-ooxml</artifactId>
+			<version>3.14</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-net</groupId>
+			<artifactId>commons-net</artifactId>
+			<version>3.8.0</version>
+		</dependency>
+</dependencies>
 
 	<build>
 		<plugins>
@@ -155,7 +161,6 @@
 					<!-- 指定SpringBoot程序的main函数入口类 -->
 					<mainClass>com.uas.eis.UasEisApplication</mainClass>
 				</configuration>
-
 				<executions>
 					<execution>
 						<goals>

+ 53 - 0
src/main/java/com/uas/eis/core/TableCreator.java

@@ -0,0 +1,53 @@
+package com.uas.eis.core;
+
+import com.uas.eis.dao.BaseDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Component;
+
+@Component
+public class TableCreator {
+    @Autowired
+    private BaseDao baseDao;
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+
+    public boolean createTable(String tableName) {
+        System.out.println("创建表:"+tableName);
+        System.out.println(checkTableExist(tableName));
+        if(!checkTableExist(tableName)){
+            baseDao.execute(buildCreateTableSql(tableName));
+            baseDao.execute(buildCreateIndexSql(tableName));
+            logger.info("创建表成功:{}",tableName);
+        }
+        return true;
+    }
+    private boolean checkTableExist(String tableName) {
+        return baseDao.checkIf("USER_TABLES","TABLE_NAME='"+tableName+"'" );
+    }
+    private String buildCreateTableSql(String tableName) {
+        StringBuilder sql = new StringBuilder();
+        sql.append("CREATE TABLE ").append(tableName).append(" (");
+        sql.append("\"WAFER_ID\" VARCHAR2(100 BYTE), ");
+        sql.append("\"DETNO_\" NUMBER, ");
+        sql.append("\"DATATYPE_\" VARCHAR2(20 BYTE), ");
+        sql.append("\"FLAG_\" VARCHAR2(20 BYTE), ");
+        for (int i = 1; i <= 30; i++) {
+            sql.append("\"ITEM").append(i).append("\" VARCHAR2(20 BYTE) ");
+            if (i < 30) {
+                sql.append(", ");
+            }
+        }
+        sql.append(")");
+        return sql.toString();
+    }
+    /**
+     * 构建创建索引SQL
+     */
+    private String buildCreateIndexSql(String tableName) {
+        return "CREATE INDEX idx_" + tableName.toLowerCase() + "_wafer_id ON " +
+                tableName + "(\"WAFER_ID\")";
+    }
+
+}

+ 0 - 102
src/main/java/com/uas/eis/core/config/DruidDBConfig.java

@@ -1,102 +0,0 @@
-package com.uas.eis.core.config;
-
-import com.alibaba.druid.pool.DruidDataSource;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-
-import javax.sql.DataSource;
-import java.sql.SQLException;
-
-
-@Configuration
-public class DruidDBConfig {
-
-    @Value("${spring.datasource.url}")
-    private String dbUrl;
-
-    @Value("${spring.datasource.username}")
-    private String username;
-
-    @Value("${spring.datasource.password}")
-    private String password;
-
-    @Value("${spring.datasource.driverClassName}")
-    private String driverClassName;
-
-    @Value("${spring.datasource.initialSize}")
-    private int initialSize;
-
-    @Value("${spring.datasource.minIdle}")
-    private int minIdle;
-
-    @Value("${spring.datasource.maxActive}")
-    private int maxActive;
-
-    @Value("${spring.datasource.maxWait}")
-    private int maxWait;
-
-    @Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
-    private int timeBetweenEvictionRunsMillis;
-
-    @Value("${spring.datasource.minEvictableIdleTimeMillis}")
-    private int minEvictableIdleTimeMillis;
-
-    @Value("${spring.datasource.validationQuery}")
-    private String validationQuery;
-
-    @Value("${spring.datasource.testWhileIdle}")
-    private boolean testWhileIdle;
-
-    @Value("${spring.datasource.testOnBorrow}")
-    private boolean testOnBorrow;
-
-    @Value("${spring.datasource.testOnReturn}")
-    private boolean testOnReturn;
-
-    @Value("${spring.datasource.poolPreparedStatements}")
-    private boolean poolPreparedStatements;
-
-    @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
-    private int maxPoolPreparedStatementPerConnectionSize;
-
-    @Value("${spring.datasource.filters}")
-    private String filters;
-
-    @Value("{spring.datasource.connectionProperties}")
-    private String connectionProperties;
-
-    @Bean     //声明其为Bean实例
-    @Primary  //在同样的DataSource中,首先使用被标注的DataSource
-    public DataSource dataSource(){
-        DruidDataSource datasource = new DruidDataSource();
-
-        datasource.setUrl(this.dbUrl);
-        datasource.setUsername(username);
-        datasource.setPassword(password);
-        datasource.setDriverClassName(driverClassName);
-
-        //configuration
-        datasource.setInitialSize(initialSize);
-        datasource.setMinIdle(minIdle);
-        datasource.setMaxActive(maxActive);
-        datasource.setMaxWait(maxWait);
-        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
-        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
-        datasource.setValidationQuery(validationQuery);
-        datasource.setTestWhileIdle(testWhileIdle);
-        datasource.setTestOnBorrow(testOnBorrow);
-        datasource.setTestOnReturn(testOnReturn);
-        datasource.setPoolPreparedStatements(poolPreparedStatements);
-        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
-        try {
-            datasource.setFilters(filters);
-        } catch (SQLException e) {
-            e.printStackTrace();
-        }
-        datasource.setConnectionProperties(connectionProperties);
-
-        return datasource;
-    }
-}

+ 13 - 10
src/main/java/com/uas/eis/core/config/DynamicDataSource.java

@@ -1,5 +1,7 @@
 package com.uas.eis.core.config;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
 
 /**
@@ -7,19 +9,20 @@ import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
  *
  */
 public class DynamicDataSource extends AbstractRoutingDataSource{
+
+	private static final Logger logger = LoggerFactory.getLogger(DynamicDataSource.class);
 	/**
-     * 代码中的determineCurrentLookupKey方法取得一个字符串,
-     * 该字符串将与配置文件中的相应字符串进行匹配以定位数据源,配置文件,即applicationContext.xml文件中需要要如下代码:(non-Javadoc)
-     * @see org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource#determineCurrentLookupKey()
-     */
+	 * 根据SpObserver中设置的数据源key来路由到具体数据源
+	 */
 	@Override
 	protected Object determineCurrentLookupKey() {
-		 /*
-	      * DynamicDataSourceManage代码中使用setDataSourceType
-	      * 设置当前的数据源,在路由类中使用getDataSourceType进行获取,
-	      *  交给AbstractRoutingDataSource进行注入使用。
-	      */
-		return SpObserver.getSp();
+		String dataSourceKey = SpObserver.getSp();
+		if (dataSourceKey != null && !dataSourceKey.isEmpty()) {
+			logger.info("使用数据源: {}", dataSourceKey);
+		} else {
+			logger.debug("使用默认数据源");
+		}
+		return dataSourceKey;
 	}
 
 }

+ 98 - 97
src/main/java/com/uas/eis/core/config/DynamicDataSourceRegister.java

@@ -7,12 +7,10 @@ import java.util.Map;
 import java.util.UUID;
 
 import javax.sql.DataSource;
- 
-
-
-
 
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.PropertyValues;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,151 +31,154 @@ import org.springframework.jdbc.core.JdbcTemplate;
  * 动态数据源注册;
  */
 public class DynamicDataSourceRegister  implements ImportBeanDefinitionRegistrar, EnvironmentAware {
-   
-	@Autowired
-	JdbcTemplate jdbcTemplate;
-	
-    //如配置文件中未指定数据源类型,使用该默认值
-    private static final Object DATASOURCE_TYPE_DEFAULT = "com.alibaba.druid.pool.DruidDataSource";
+
+    private static final Logger logger = LoggerFactory.getLogger(DynamicDataSourceRegister.class);
+
+    // 如配置文件中未指定数据源类型,使用该默认值
+    private static final String DATASOURCE_TYPE_DEFAULT = "com.alibaba.druid.pool.DruidDataSource";
     private ConversionService conversionService = new DefaultConversionService();
     private PropertyValues dataSourcePropertyValues;
-   
+
     // 默认数据源
     private DataSource defaultDataSource;
-   
-    private Map<String, DataSource> customDataSources = new HashMap<String, DataSource>();
-   
+
+    // 自定义数据源集合
+    private Map<String, DataSource> customDataSources = new HashMap<>();
+
     /**
      * 加载多数据源配置
      */
     @Override
     public void setEnvironment(Environment environment) {
-    	initDefaultDataSource(environment);
-    	initCustomDataSources(environment);
+        initDefaultDataSource(environment);
+        initCustomDataSources(environment);
     }
-   
+
     /**
-     * 加载主数据源配置.
-     * @param env
+     * 初始化主数据源配置
      */
-    private void initDefaultDataSource(Environment env){
-    	// 读取主数据源
-    	RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
-       
-        Map<String, Object> dsMap = new HashMap<String, Object>();
+    private void initDefaultDataSource(Environment env) {
+        logger.info("开始初始化默认数据源...");
+        RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
+
+        Map<String, Object> dsMap = new HashMap<>();
         dsMap.put("type", propertyResolver.getProperty("type"));
         dsMap.put("driverClassName", propertyResolver.getProperty("driverClassName"));
         dsMap.put("url", propertyResolver.getProperty("url"));
         dsMap.put("username", propertyResolver.getProperty("username"));
         dsMap.put("password", propertyResolver.getProperty("password"));
-        
-        //创建数据源;
         defaultDataSource = buildDataSource(dsMap);
         dataBinder(defaultDataSource, env);
-        customDataSources.put(propertyResolver.getProperty("username"), defaultDataSource);
+        logger.info("默认数据源初始化完成: {}", propertyResolver.getProperty("url"));
     }
-   
+
     /**
-     * 初始化更多数据源
-     *
+     * 初始化自定义数据源
      */
     private void initCustomDataSources(Environment env) {
-        // 读取配置文件获取更多数据源,也可以通过defaultDataSource读取数据库获取更多数据源
-    	/*DynamicDataSourceManage.setDataSourceType("UAS_DEV");
-    	List<Map<String , Object>> master = jdbcTemplate.queryForList("select MA_USER,MA_PWD from master");
-    	System.out.println(master);*/
-    	JdbcTemplate jdbcTemplate = new JdbcTemplate(defaultDataSource);  
-    	List<Map<String , Object>> master = jdbcTemplate.queryForList("select MA_USER,MS_PWD from master");
-    	// 读取主数据源
-        RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
-    	for(Map<String , Object> map : master){
-    		String ma_user = (String)map.get("MA_USER");
-    		Map<String, Object> dsMap = new HashMap<>();
-    		dsMap.put("type", propertyResolver.getProperty("type"));
-            dsMap.put("driverClassName", propertyResolver.getProperty("driverClassName"));
-            dsMap.put("url", propertyResolver.getProperty("url"));
-            dsMap.put("password", propertyResolver.getProperty("password"));
-            dsMap.put("username", ma_user);
-            DataSource ds = buildDataSource(dsMap);
-            customDataSources.put(ma_user, ds);
-            dataBinder(ds, env);
-    	}
-        /*RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "custom.datasource.");
+        logger.info("开始初始化自定义数据源...");
+        RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "custom.datasource.");
         String dsPrefixs = propertyResolver.getProperty("names");
-        for (String dsPrefix : dsPrefixs.split(",")) {// 多个数据源
-            Map<String, Object> dsMap = propertyResolver.getSubProperties(dsPrefix + ".");
-            DataSource ds = buildDataSource(dsMap);
-            customDataSources.put(dsPrefix, ds);
-            dataBinder(ds, env);
-        }*/
+
+        if (dsPrefixs != null && !dsPrefixs.isEmpty()) {
+            logger.info("检测到自定义数据源配置: {}", dsPrefixs);
+            for (String dsPrefix : dsPrefixs.split(",")) {
+                Map<String, Object> dsMap = propertyResolver.getSubProperties(dsPrefix + ".");
+                if (!dsMap.isEmpty()) {
+                    logger.info("正在初始化数据源: {}", dsPrefix);
+                    DataSource ds = buildDataSource(dsMap);
+                    if (ds != null) {
+                        customDataSources.put(dsPrefix, ds);
+                        dataBinder(ds, env);
+                        logger.info("数据源 [{}] 初始化完成: {}", dsPrefix, dsMap.get("url"));
+                    }
+                }
+            }
+        } else {
+            logger.warn("未检测到自定义数据源配置");
+        }
     }
-   
+
     /**
-     * 创建datasource.
-     * @param dsMap
-     * @return
+     * 创建数据源实例
      */
     @SuppressWarnings("unchecked")
     public DataSource buildDataSource(Map<String, Object> dsMap) {
-    	Object type = dsMap.get("type");
-        if (type == null){
-            type = DATASOURCE_TYPE_DEFAULT;// 默认DataSource
+        Object type = dsMap.get("type");
+        if (type == null) {
+            type = DATASOURCE_TYPE_DEFAULT;
         }
-        Class<? extends DataSource> dataSourceType;
-       
-       try {
-           	dataSourceType = (Class<? extends DataSource>) Class.forName((String) type);
-           	String driverClassName = dsMap.get("driverClassName").toString();
+
+        try {
+            Class<? extends DataSource> dataSourceType = (Class<? extends DataSource>) Class.forName((String) type);
+            String driverClassName = dsMap.get("driverClassName").toString();
             String url = dsMap.get("url").toString();
             String username = dsMap.get("username").toString();
             String password = dsMap.get("password").toString();
-            DataSourceBuilder factory =   DataSourceBuilder.create().driverClassName(driverClassName).url(url).username(username).password(password).type(dataSourceType);
+
+            DataSourceBuilder factory = DataSourceBuilder.create()
+                    .driverClassName(driverClassName)
+                    .url(url)
+                    .username(username)
+                    .password(password)
+                    .type(dataSourceType);
+
             return factory.build();
-       } catch (ClassNotFoundException e) {
-           e.printStackTrace();
-       }
-       return null;
+        } catch (ClassNotFoundException e) {
+            logger.error("数据源类型类未找到: {}", dsMap.get("type"), e);
+        } catch (Exception e) {
+            logger.error("创建数据源失败", e);
+        }
+        return null;
     }
-   
+
     /**
-     * 为DataSource绑定更多数据
-     * @param dataSource
-     * @param env
+     * 为DataSource绑定更多配置属性
      */
-    private void dataBinder(DataSource dataSource, Environment env){
-    	RelaxedDataBinder dataBinder = new RelaxedDataBinder(dataSource);
-    	dataBinder.setConversionService(conversionService);
-    	dataBinder.setIgnoreNestedProperties(false);//false
-        dataBinder.setIgnoreInvalidFields(false);//false
-        dataBinder.setIgnoreUnknownFields(true);//true
-       
-        if(dataSourcePropertyValues == null){
+    private void dataBinder(DataSource dataSource, Environment env) {
+        RelaxedDataBinder dataBinder = new RelaxedDataBinder(dataSource);
+        dataBinder.setConversionService(conversionService);
+        dataBinder.setIgnoreNestedProperties(false);
+        dataBinder.setIgnoreInvalidFields(false);
+        dataBinder.setIgnoreUnknownFields(true);
+
+        if (dataSourcePropertyValues == null) {
             Map<String, Object> values = new HashMap<>();
             dataSourcePropertyValues = new MutablePropertyValues(values);
         }
         dataBinder.bind(dataSourcePropertyValues);
-       
     }
-   
- 
+
+    /**
+     * 注册动态数据源Bean
+     */
     @Override
     public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
-       	Map<Object, Object> targetDataSources = new HashMap<Object, Object>();
-       	// 将主数据源添加到更多数据源中
-        /*targetDataSources.put("dataSource", defaultDataSource);
-        DynamicDataSourceManage.dataSourceIds.add("dataSource");*/
-        // 添加更多数据源
+        logger.info("========== 开始注册动态数据源 ==========");
+
+        Map<Object, Object> targetDataSources = new HashMap<>();
+
+        // 将所有自定义数据源添加到目标数据源映射中
         targetDataSources.putAll(customDataSources);
-        // 创建DynamicDataSource
+
+        logger.info("已注册的数据源列表: {}", targetDataSources.keySet());
+        logger.info("默认数据源将作为 fallback 使用");
+
+        // 创建DynamicDataSource Bean定义
         GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
         beanDefinition.setBeanClass(DynamicDataSource.class);
-       
         beanDefinition.setSynthetic(true);
+
         MutablePropertyValues mpv = beanDefinition.getPropertyValues();
-        //添加属性:AbstractRoutingDataSource.defaultTargetDataSource
+        // 设置默认目标数据源(当SpObserver中没有设置数据源时使用)
         mpv.addPropertyValue("defaultTargetDataSource", defaultDataSource);
+        // 设置所有可用的目标数据源
         mpv.addPropertyValue("targetDataSources", targetDataSources);
+
+        // 注册名为"dataSource"的Bean
         registry.registerBeanDefinition("dataSource", beanDefinition);
+        logger.info("========== 动态数据源注册完成 ==========");
+        logger.info("可用数据源: {}", targetDataSources.keySet());
     }
  
 }

+ 24 - 11
src/main/java/com/uas/eis/core/config/SpObserver.java

@@ -1,38 +1,51 @@
 package com.uas.eis.core.config;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * 
  */
 public class SpObserver {
+	private static final Logger logger = LoggerFactory.getLogger(SpObserver.class);
 
-	private static ThreadLocal<String> prev = new InheritableThreadLocal<String>();
-	private static ThreadLocal<String> local = new InheritableThreadLocal<String>();
+	private static ThreadLocal<String> prev = new InheritableThreadLocal<>();
+	private static ThreadLocal<String> local = new InheritableThreadLocal<>();
 
 	/**
 	 * 切换数据源
-	 * 
-	 * @param sp
-	 *            dbsource name
+	 * @param sp 数据源名称
 	 */
 	public static void putSp(String sp) {
-		prev.set(getSp());
+		String currentSp = getSp();
+		prev.set(currentSp);
 		local.set(sp);
+		logger.debug("切换数据源: {} -> {}", currentSp, sp);
 	}
 
+	/**
+	 * 获取当前数据源
+	 * @return 数据源名称
+	 */
 	public static String getSp() {
-		return (String) local.get();
+		return local.get();
 	}
 
+	/**
+	 * 清除数据源设置
+	 */
 	public static void clear() {
-		prev.set(null);
-		local.set(null);
+		prev.remove();
+		local.remove();
 	}
 
 	/**
 	 * 切换回之前数据源
 	 */
 	public static void back() {
-		local.set(prev.get());
-		prev.set(null);
+		String prevSp = prev.get();
+		local.set(prevSp);
+		prev.remove();
+		logger.debug("恢复数据源: {}", prevSp);
 	}
 }

+ 98 - 0
src/main/java/com/uas/eis/core/support/FTPConnectionPool.java

@@ -0,0 +1,98 @@
+package com.uas.eis.core.support;
+
+import com.uas.eis.utils.FTPUtil;
+import org.apache.commons.net.ftp.FTPClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class FTPConnectionPool {
+    private static final Logger logger = LoggerFactory.getLogger(FTPConnectionPool.class);
+
+    private final BlockingQueue<FTPClient> connectionPool;
+    private final int poolSize;
+
+    public FTPConnectionPool(int poolSize) {
+        this.poolSize = poolSize;
+        this.connectionPool = new LinkedBlockingQueue<>(poolSize);
+        // 初始化连接池
+        initializePool();
+    }
+
+    private void initializePool() {
+        for (int i = 0; i < poolSize; i++) {
+            try {
+                FTPClient ftpClient = FTPUtil.getFTPClient();
+                if (ftpClient != null) {
+                    connectionPool.offer(ftpClient);
+                    logger.info("FTP连接池初始化连接 {}/{}", i + 1, poolSize);
+                }
+            } catch (Exception e) {
+                logger.error("FTP连接池初始化连接失败", e);
+            }
+        }
+    }
+
+    /**
+     * 从连接池获取连接
+     */
+    public FTPClient borrowConnection() {
+        try {
+            FTPClient ftpClient = connectionPool.take();
+            if (ftpClient != null && ftpClient.isConnected()) {
+                logger.debug("从连接池获取连接,剩余连接数: {}", connectionPool.size());
+                return ftpClient;
+            } else {
+                // 连接已断开,重新创建
+                logger.warn("连接已断开,重新创建连接");
+                return FTPUtil.getFTPClient();
+            }
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            logger.error("获取FTP连接被中断", e);
+            return null;
+        }
+    }
+
+    /**
+     * 归还连接到连接池
+     */
+    public void returnConnection(FTPClient ftpClient) {
+        if (ftpClient != null && ftpClient.isConnected()) {
+            try {
+                // 检查连接是否可用
+                if (ftpClient.sendNoOp()) {
+                    boolean offered = connectionPool.offer(ftpClient);
+                    if (!offered) {
+                        // 连接池已满,关闭连接
+                        FTPUtil.closeFTPClient(ftpClient);
+                    }
+                    logger.debug("归还连接到连接池,当前连接数: {}", connectionPool.size());
+                } else {
+                    FTPUtil.closeFTPClient(ftpClient);
+                    logger.warn("连接不可用,已关闭");
+                }
+            } catch (Exception e) {
+                logger.error("归还连接异常", e);
+                FTPUtil.closeFTPClient(ftpClient);
+            }
+        }
+    }
+
+    /**
+     * 关闭连接池
+     */
+    public void closePool() {
+        FTPClient ftpClient;
+        while ((ftpClient = connectionPool.poll()) != null) {
+            FTPUtil.closeFTPClient(ftpClient);
+        }
+        logger.info("FTP连接池已关闭");
+    }
+
+    public int getAvailableConnections() {
+        return connectionPool.size();
+    }
+}

+ 51 - 0
src/main/java/com/uas/eis/entity/DataChipTestLog.java

@@ -0,0 +1,51 @@
+package com.uas.eis.entity;
+
+import java.io.Serializable;
+
+public class DataChipTestLog implements Serializable {
+    private String wafer_id;
+    private String lot_id;
+    private String status;
+    private String data_path;
+    private String counter_path;
+
+    public String getWafer_id() {
+        return wafer_id;
+    }
+
+    public void setWafer_id(String wafer_id) {
+        this.wafer_id = wafer_id;
+    }
+
+    public String getLot_id() {
+        return lot_id;
+    }
+
+    public void setLot_id(String lot_id) {
+        this.lot_id = lot_id;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getData_path() {
+        return data_path;
+    }
+
+    public void setData_path(String data_path) {
+        this.data_path = data_path;
+    }
+
+    public String getCounter_path() {
+        return counter_path;
+    }
+
+    public void setCounter_path(String counter_path) {
+        this.counter_path = counter_path;
+    }
+}

+ 14 - 0
src/main/java/com/uas/eis/service/FileParseService.java

@@ -0,0 +1,14 @@
+package com.uas.eis.service;
+
+import com.uas.eis.entity.DataChip;
+import com.uas.eis.entity.DataChipTestLog;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+public interface FileParseService {
+    //Data文件解析
+    void EDCDataDeal(DataChipTestLog dataChipTestLog, CountDownLatch countDownLatch);
+    //Counter文件批量解析
+    void EDCCounterDeal(List<String> codes);
+}

+ 143 - 0
src/main/java/com/uas/eis/serviceImpl/FileParseServiceImpl.java

@@ -0,0 +1,143 @@
+package com.uas.eis.serviceImpl;
+
+import com.uas.eis.dao.BaseDao;
+import com.uas.eis.entity.DataChipTestLog;
+import com.uas.eis.service.FileParseService;
+import com.uas.eis.utils.FTPUtil;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+@Service
+public class FileParseServiceImpl implements FileParseService {
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+    @Autowired
+    private BaseDao baseDao;
+    @Override
+    @Async("taskExecutor")
+    public void EDCDataDeal(DataChipTestLog dataChipTestLog, CountDownLatch countDownLatch) {
+        //可以
+        String TableName = "DATA$" + dataChipTestLog.getLot_id();
+        try {
+            this.logger.info(new StringBuilder().append(dataChipTestLog.getWafer_id()).append("Data文件解析开始").toString());
+            String FilePath = extractFilePath(dataChipTestLog.getData_path());
+            FTPClient ftpClient = FTPUtil.getFTPClient();
+            System.out.println("开始下载文件:" + FilePath+";文件是否存在:"+FTPUtil.exists(ftpClient, FilePath));
+            if (ftpClient != null && FTPUtil.exists(ftpClient, FilePath)) {
+                InputStream is = new BufferedInputStream(FTPUtil.readFileAsStream(ftpClient, FilePath));
+                Workbook book = WorkbookFactory.create(is);
+                Sheet st = book.getSheetAt(0);
+                int labelIndex = 13;
+                int mainBeginRow = 14;
+                int dataStart = 24;
+                Row labelRow = st.getRow(labelIndex);
+                List items = new ArrayList();
+                System.out.println(labelRow.getPhysicalNumberOfCells());
+                for (int i = 0; i < labelRow.getPhysicalNumberOfCells(); i++) {
+                    items.add(labelRow.getCell(i)!=null?labelRow.getCell(i).getStringCellValue(): "");
+                }
+                System.out.println(items.size());
+                System.out.println(labelRow.getCell(3));
+                StringBuffer mainBuffer = new StringBuffer();
+                List itemCols = new ArrayList();
+                for (int j = 0; j < items.size(); j++) {
+                    itemCols.add(new StringBuilder().append("ITEM").append(j + 1).toString());
+                }
+                List sqls = new ArrayList();
+                //sqls.add(new StringBuilder().append("BEGIN ").append(mainBuffer.toString()).append("  END;").toString());
+                sqls.add(new StringBuilder().append("DELETE FROM ").append(TableName).append("@SHENAI_EDCDATA  WHERE WAFER_ID='").append(dataChipTestLog.getWafer_id()).append("'").toString());
+                int allRow = st.getLastRowNum() - (dataStart - 1);
+                int a = allRow / 3000;
+                int b = allRow % 3000;
+                StringBuffer detailBuffer = new StringBuffer();
+                String dynamicCols = String.join(",", itemCols);
+                String ValueSql = "";
+                String cellValue = "";
+                Row dataRow = null;
+                if (a > 0) {
+                    for (int i = 0; i < a; i++) {
+                        detailBuffer.setLength(0);
+                        for (int k = i * 3000; k < (i + 1) * 3000; k++) {
+                            detailBuffer.append(new StringBuilder().append("INSERT INTO ").append(TableName).append("@SHENAI_EDCDATA (WAFER_ID,DETNO_,DATATYPE_,FLAG_,").append(String.join(",", new CharSequence[]{dynamicCols})).append(") VALUES ").append("('")
+                                    .append(dataChipTestLog.getWafer_id()).append("',").append(k + 1).append(",").append(1).append(",").append(1).toString());
+                            ValueSql = "";
+                            dataRow = st.getRow(k + dataStart);
+                            for (int m = 0; m < items.size(); m++) {
+                                cellValue = dataRow.getCell(m).getStringCellValue();
+                                ValueSql = new StringBuilder().append(ValueSql).append(cellValue != null ? new StringBuilder().append("'").append(cellValue.trim()).append("'").toString() : "''").toString();
+                                if (m < items.size() - 1) {
+                                    ValueSql = new StringBuilder().append(ValueSql).append(",").toString();
+                                }
+                            }
+                            detailBuffer.append(new StringBuilder().append(",").append(ValueSql).append(");").toString());
+                        }
+                        sqls.add(new StringBuilder().append(" BEGIN ").append(detailBuffer.toString()).append("  END;").toString());
+                    }
+                }
+                if (b > 0) {
+                    detailBuffer.setLength(0);
+                    for (int k = 0; k < b; k++) {
+                        detailBuffer.append(new StringBuilder().append("INSERT INTO ").append(TableName).append("@SHENAI_EDCDATA (WAFER_ID,DETNO_,DATATYPE_,FLAG_,").append(String.join(",", new CharSequence[]{dynamicCols})).append(") VALUES ").append("('")
+                               .append(dataChipTestLog.getWafer_id()).append("',").append(a * 3000 + k + 1).append(",").append(1).append(",").append(1).toString());
+                        ValueSql = "";
+                        dataRow = st.getRow(a * 3000 + k + dataStart);
+                        for (int m = 0; m < items.size(); m++) {
+                            cellValue = dataRow.getCell(m ).getStringCellValue();
+                            ValueSql = new StringBuilder().append(ValueSql).append(cellValue != null ? new StringBuilder().append("'").append(cellValue.trim()).append("'").toString() : "''").toString();
+                            if (m < items.size() - 1) {
+                                ValueSql = new StringBuilder().append(ValueSql).append(",").toString();
+                            }
+                        }
+                        detailBuffer.append(new StringBuilder().append(",").append(ValueSql).append(");").toString());
+                    }
+                    sqls.add(new StringBuilder().append("BEGIN ").append(detailBuffer.toString()).append("  END;").toString());
+                }
+                this.baseDao.getJdbcTemplate().batchUpdate((String[]) sqls.toArray(new String[sqls.size()]));
+            }
+        } catch (Exception e) {
+            this.logger.error(new StringBuilder().append("Exception:芯片号:").append(dataChipTestLog.getWafer_id()).toString(), e);
+            e.printStackTrace();
+           // this.baseDao.execute(new StringBuilder().append("UPDATE DATACENTER$CHIP SET READSTATUS_=-99 WHERE ID_=").append(dataChip.getId_()).toString());
+        } finally {
+            countDownLatch.countDown();
+        }
+    }
+
+    @Override
+    public void EDCCounterDeal(List<String> codes) {
+
+    }
+
+
+    private String extractFilePath(String ftpUrl) {
+        if (ftpUrl == null || ftpUrl.isEmpty()) {
+            return null;
+        }
+
+        // 查找 ftp:// 的位置
+        int protocolIndex = ftpUrl.indexOf("ftp://");
+        if (protocolIndex == -1) {
+            // 不是FTP URL,直接返回原路径
+            return ftpUrl;
+        }
+        int pathStartIndex = ftpUrl.indexOf("/", protocolIndex + 6);
+        if (pathStartIndex == -1) {
+            // 没有路径部分,返回根目录
+            return "/";
+        }
+        return "/home/mes"+ftpUrl.substring(pathStartIndex).trim();
+    }
+}

+ 61 - 0
src/main/java/com/uas/eis/task/FileParseTask.java

@@ -0,0 +1,61 @@
+package com.uas.eis.task;
+
+import com.uas.eis.core.TableCreator;
+import com.uas.eis.core.config.SpObserver;
+import com.uas.eis.dao.BaseDao;
+import com.uas.eis.dao.SqlRowList;
+import com.uas.eis.entity.DataChip;
+import com.uas.eis.entity.DataChipTestLog;
+import com.uas.eis.service.FileParseService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.stream.Collectors;
+
+/**
+ * 赛美特文件对接解析
+ * */
+@Component
+public class FileParseTask {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+    @Autowired
+    private BaseDao baseDao;
+    @Autowired
+    private FileParseService fileParseService;
+    @Autowired
+    private TableCreator tableCreator;
+    public void dataDeal(){
+        //wafer_id='BF241002603#01' AND
+        List<DataChipTestLog> dataChipTestLogs = baseDao.getJdbcTemplate().query("select wafer_id,lot_id,status,data_path,counter_path from (select wafer_id,lot_id,status,data_path,counter_path from " +
+                        " DATACENTER$MESFILE WHERE DEALSTATE_=0 ORDER BY DBID_ ASC ) where " +
+                " rownum<=100", new BeanPropertyRowMapper<>(DataChipTestLog.class));
+        List<String> distinctLotIds = dataChipTestLogs.stream().map(DataChipTestLog::getLot_id).distinct()
+                .collect(Collectors.toList());
+        SpObserver.putSp("datacenter");
+        for (String lotId : distinctLotIds){
+            tableCreator.createTable("DATA$"+lotId);
+        }
+        SpObserver.back();
+        logger.info("Data文件解析执行开始:文件数"+dataChipTestLogs.size());
+        Date date = new Date();
+        if(!dataChipTestLogs.isEmpty()){
+            final CountDownLatch countDownLatch = new CountDownLatch(dataChipTestLogs.size());
+            try {
+                dataChipTestLogs.stream().forEach(dataChipTestLog -> {
+                    fileParseService.EDCDataDeal(dataChipTestLog,countDownLatch);
+                });
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+      //  baseDao.execute("INSERT INTO DATACENTER$TASKLOG(NAME_,DURATION_) VALUES ('Data文件解析',"+(new Date().getTime()-date.getTime())/1000+")");
+        logger.info("Data文件解析执行结束:用时"+((new Date().getTime()-date.getTime())/1000));
+    }
+}

+ 356 - 0
src/main/java/com/uas/eis/utils/FTPUtil.java

@@ -0,0 +1,356 @@
+package com.uas.eis.utils;
+
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.FTPReply;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * FTP工具类 - 实现文件流的读取
+ */
+public class FTPUtil {
+
+    private static final Logger logger = LoggerFactory.getLogger(FTPUtil.class);
+
+    private static final String DEFAULT_CHARSET = "UTF-8";
+    private static final int DEFAULT_TIMEOUT = 30000;
+    private static final int DEFAULT_BUFFER_SIZE = 1024 * 1024; // 1MB
+    private static String USER = "mes"; //用户名
+    private static String PWD = "plantuftp123"; //密码
+    public static String IP = "172.16.0.118";
+    public static String currentDir ="/home/mes";
+    public static FTPClient getFTPClient() {
+        FTPClient ftpClient = new FTPClient();
+        try {
+            ftpClient.setConnectTimeout(DEFAULT_TIMEOUT);
+            ftpClient.connect(IP, 21);
+
+            int reply = ftpClient.getReplyCode();
+            if (!FTPReply.isPositiveCompletion(reply)) {
+                logger.error("FTP服务器拒绝连接,响应码: {}", reply);
+                ftpClient.disconnect();
+                return null;
+            }
+
+            boolean loginResult = ftpClient.login(USER, PWD);
+            if (!loginResult) {
+                logger.error("FTP登录失败");
+                ftpClient.disconnect();
+                return null;
+            }
+
+            ftpClient.setControlEncoding(DEFAULT_CHARSET);
+            ftpClient.setBufferSize(DEFAULT_BUFFER_SIZE);
+            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
+            ftpClient.enterLocalPassiveMode();
+            logger.info("FTP连接成功: {}", IP);
+        } catch (IOException e) {
+            logger.error("FTP连接异常", e);
+            closeFTPClient(ftpClient);
+            return null;
+        }
+
+        return ftpClient;
+    }
+
+    /**
+     * 关闭FTP连接
+     *
+     * @param ftpClient FTP客户端
+     */
+    public static void closeFTPClient(FTPClient ftpClient) {
+        if (ftpClient != null && ftpClient.isConnected()) {
+            try {
+                ftpClient.logout();
+                ftpClient.disconnect();
+                logger.info("FTP连接已关闭");
+            } catch (IOException e) {
+                logger.error("关闭FTP连接异常", e);
+            }
+        }
+    }
+
+    /**
+     * 读取FTP文件为输入流
+     *
+     * @param ftpClient FTP客户端
+     * @param remotePath 远程文件路径
+     * @return InputStream
+     */
+    public static InputStream readFileAsStream(FTPClient ftpClient, String remotePath) {
+        try {
+            InputStream inputStream = ftpClient.retrieveFileStream(remotePath);
+            if (inputStream == null) {
+                logger.error("读取文件失败: {}", remotePath);
+                return null;
+            }
+            logger.info("成功读取文件流: {}", remotePath);
+            return inputStream;
+        } catch (IOException e) {
+            logger.error("读取文件流异常: {}", remotePath, e);
+            return null;
+        }
+    }
+
+    /**
+     * 读取FTP文件到本地
+     *
+     * @param ftpClient  FTP客户端
+     * @param remotePath 远程文件路径
+     * @param localPath  本地文件路径
+     * @return 是否成功
+     */
+    public static boolean downloadFile(FTPClient ftpClient, String remotePath, String localPath) {
+        File localFile = new File(localPath);
+        File parentDir = localFile.getParentFile();
+        if (parentDir != null && !parentDir.exists()) {
+            parentDir.mkdirs();
+        }
+
+        try (OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(localFile))) {
+            boolean success = ftpClient.retrieveFile(remotePath, outputStream);
+            if (success) {
+                logger.info("文件下载成功: {} -> {}", remotePath, localPath);
+            } else {
+                logger.error("文件下载失败: {}", remotePath);
+            }
+            return success;
+        } catch (IOException e) {
+            logger.error("文件下载异常: {}", remotePath, e);
+            return false;
+        }
+    }
+
+    /**
+     * 上传本地文件到FTP
+     *
+     * @param ftpClient  FTP客户端
+     * @param localPath  本地文件路径
+     * @param remotePath 远程文件路径
+     * @return 是否成功
+     */
+    public static boolean uploadFile(FTPClient ftpClient, String localPath, String remotePath) {
+        File localFile = new File(localPath);
+        if (!localFile.exists() || !localFile.isFile()) {
+            logger.error("本地文件不存在: {}", localPath);
+            return false;
+        }
+
+        try (InputStream inputStream = new BufferedInputStream(new FileInputStream(localFile))) {
+            String remoteDir = remotePath.substring(0, remotePath.lastIndexOf("/"));
+            createDirectories(ftpClient, remoteDir);
+
+            boolean success = ftpClient.storeFile(remotePath, inputStream);
+            if (success) {
+                logger.info("文件上传成功: {} -> {}", localPath, remotePath);
+            } else {
+                logger.error("文件上传失败: {}", remotePath);
+            }
+            return success;
+        } catch (IOException e) {
+            logger.error("文件上传异常: {}", remotePath, e);
+            return false;
+        }
+    }
+
+    /**
+     * 上传输入流到FTP
+     *
+     * @param ftpClient  FTP客户端
+     * @param inputStream 输入流
+     * @param remotePath 远程文件路径
+     * @return 是否成功
+     */
+    public static boolean uploadStream(FTPClient ftpClient, InputStream inputStream, String remotePath) {
+        try {
+            String remoteDir = remotePath.substring(0, remotePath.lastIndexOf("/"));
+            createDirectories(ftpClient, remoteDir);
+
+            boolean success = ftpClient.storeFile(remotePath, inputStream);
+            if (success) {
+                logger.info("流上传成功: {}", remotePath);
+            } else {
+                logger.error("流上传失败: {}", remotePath);
+            }
+            return success;
+        } catch (IOException e) {
+            logger.error("流上传异常: {}", remotePath, e);
+            return false;
+        }
+    }
+
+    /**
+     * 列出目录下的文件
+     *
+     * @param ftpClient FTP客户端
+     * @param remotePath 远程目录路径
+     * @return 文件列表
+     */
+    public static List<FTPFile> listFiles(FTPClient ftpClient, String remotePath) {
+        List<FTPFile> fileList = new ArrayList<>();
+        try {
+            FTPFile[] files = ftpClient.listFiles(remotePath);
+            if (files != null) {
+                for (FTPFile file : files) {
+                    fileList.add(file);
+                }
+                logger.info("列出目录文件成功: {}, 文件数: {}", remotePath, fileList.size());
+            }
+        } catch (IOException e) {
+            logger.error("列出目录文件异常: {}", remotePath, e);
+        }
+        return fileList;
+    }
+
+    /**
+     * 列出目录下指定类型的文件
+     *
+     * @param ftpClient  FTP客户端
+     * @param remotePath 远程目录路径
+     * @param suffix     文件后缀(如 ".txt")
+     * @return 文件列表
+     */
+    public static List<FTPFile> listFilesBySuffix(FTPClient ftpClient, String remotePath, String suffix) {
+        List<FTPFile> fileList = new ArrayList<>();
+        try {
+            FTPFile[] files = ftpClient.listFiles(remotePath);
+            if (files != null) {
+                for (FTPFile file : files) {
+                    if (file.isFile() && file.getName().toLowerCase().endsWith(suffix.toLowerCase())) {
+                        fileList.add(file);
+                    }
+                }
+                logger.info("列出目录文件成功: {}, 匹配文件数: {}", remotePath, fileList.size());
+            }
+        } catch (IOException e) {
+            logger.error("列出目录文件异常: {}", remotePath, e);
+        }
+        return fileList;
+    }
+
+    /**
+     * 删除FTP文件
+     *
+     * @param ftpClient  FTP客户端
+     * @param remotePath 远程文件路径
+     * @return 是否成功
+     */
+    public static boolean deleteFile(FTPClient ftpClient, String remotePath) {
+        try {
+            boolean success = ftpClient.deleteFile(remotePath);
+            if (success) {
+                logger.info("文件删除成功: {}", remotePath);
+            } else {
+                logger.error("文件删除失败: {}", remotePath);
+            }
+            return success;
+        } catch (IOException e) {
+            logger.error("文件删除异常: {}", remotePath, e);
+            return false;
+        }
+    }
+
+    /**
+     * 检查文件或目录是否存在
+     *
+     * @param ftpClient  FTP客户端
+     * @param remotePath 远程路径
+     * @return 是否存在
+     */
+    public static boolean exists(FTPClient ftpClient, String remotePath) {
+        if (remotePath == null || remotePath.isEmpty()) {
+            return false;
+        }
+        try {
+            FTPFile[] files = ftpClient.listFiles(remotePath);
+            return files != null && files.length > 0;
+        } catch (IOException e) {
+            logger.error("检查文件存在性异常: {}", remotePath, e);
+            return false;
+        }
+    }
+
+    /**
+     * 创建目录(递归创建)
+     *
+     * @param ftpClient FTP客户端
+     * @param remoteDir 远程目录路径
+     * @return 是否成功
+     */
+    public static boolean createDirectories(FTPClient ftpClient, String remoteDir) {
+        if (remoteDir == null || remoteDir.isEmpty()) {
+            return true;
+        }
+
+        try {
+            String[] dirs = remoteDir.split("/");
+            StringBuilder currentPath = new StringBuilder();
+
+            for (String dir : dirs) {
+                if (dir == null || dir.isEmpty()) {
+                    continue;
+                }
+                currentPath.append("/").append(dir);
+
+                if (!exists(ftpClient, currentPath.toString())) {
+                    boolean success = ftpClient.makeDirectory(currentPath.toString());
+                    if (!success) {
+                        logger.warn("创建目录失败: {}", currentPath);
+                        return false;
+                    }
+                }
+            }
+            return true;
+        } catch (IOException e) {
+            logger.error("创建目录异常: {}", remoteDir, e);
+            return false;
+        }
+    }
+
+    /**
+     * 切换工作目录
+     *
+     * @param ftpClient FTP客户端
+     * @param remotePath 远程目录路径
+     * @return 是否成功
+     */
+    public static boolean changeWorkingDirectory(FTPClient ftpClient, String remotePath) {
+        try {
+            boolean success = ftpClient.changeWorkingDirectory(remotePath);
+            if (success) {
+                logger.info("切换工作目录成功: {}", remotePath);
+            } else {
+                logger.error("切换工作目录失败: {}", remotePath);
+            }
+            return success;
+        } catch (IOException e) {
+            logger.error("切换工作目录异常: {}", remotePath, e);
+            return false;
+        }
+    }
+
+    /**
+     * 获取文件大小
+     *
+     * @param ftpClient  FTP客户端
+     * @param remotePath 远程文件路径
+     * @return 文件大小(字节)
+     */
+    public static long getFileSize(FTPClient ftpClient, String remotePath) {
+        try {
+            FTPFile[] files = ftpClient.listFiles(remotePath);
+            if (files != null && files.length > 0) {
+                return files[0].getSize();
+            }
+        } catch (IOException e) {
+            logger.error("获取文件大小异常: {}", remotePath, e);
+        }
+        return -1;
+    }
+}

+ 27 - 4
src/main/resources/application.yml

@@ -4,9 +4,9 @@ spring:
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: oracle.jdbc.OracleDriver
-        username: SZSI_P
-        password: select!#%*(
-        url: jdbc:oracle:thin:@172.16.0.22:1521:orcl
+        username: sisemimid_prod
+        password: sisemi
+        url: jdbc:oracle:thin:@172.16.0.50:1521:orcl
         initialSize: 10
         maxActive: 80
         minIdle: 10
@@ -48,7 +48,30 @@ logging:
     org:
       hibernate:
         type: trace
-
+custom:
+    datasource:
+        names: datacenter
+        datacenter:
+            type: com.alibaba.druid.pool.DruidDataSource
+            driverClassName: oracle.jdbc.OracleDriver
+            username: SHENAI_DATA
+            password: select!#%*(
+            url: jdbc:oracle:thin:@172.16.0.40:1521:orcl
+            initialSize: 5
+            maxActive: 50
+            minIdle: 5
+            maxWait: 60000
+            testOnBorrow: true
+            testOnReturn: false
+            testWhileIdle: true
+            validationQuery: SELECT 1 FROM DUAL
+            timeBetweenEvictionRunsMillis: 60000
+            minEvictableIdleTimeMillis: 300000
+            poolPreparedStatements: true
+            maxPoolPreparedStatementPerConnectionSize: 50
+            filters: stat
+            removeAbandoned: true
+            removeAbandonedTimeout: 1800
 SECURITY_KEY: 435aMe9L5itTrckY35kfcOQvPkBGZtGo
 KEEP: 86400000
 

+ 7 - 0
src/test/java/com/uas/eis/UasEisApplicationTests.java

@@ -5,6 +5,7 @@ import com.uas.eis.dao.BaseDao;
 import com.uas.eis.entity.EquipConfig;
 import com.uas.eis.service.DataDealService;
 import com.uas.eis.service.EDCBakService;
+import com.uas.eis.task.FileParseTask;
 import com.uas.eis.utils.CollectionUtil;
 import com.uas.eis.utils.SmbUtil;
 import com.uas.eis.utils.SmbUtilSmb1;
@@ -44,6 +45,12 @@ public class UasEisApplicationTests {
 
 	@Autowired
 	private BaseDao baseDao;
+	@Autowired
+	private FileParseTask fileParseTask;
+	@Test
+	public void contextLoads() {
+		fileParseTask.dataDeal();
+	}
 	//@Test
 /*	public void contextLoads() {
 		Date date = new Date();