Browse Source

数据中心JAR包升级

zhouy 1 year ago
parent
commit
5ba58c827b

+ 2 - 1
src/main/java/com/uas/eis/service/EDCBakService.java

@@ -1,6 +1,7 @@
 package com.uas.eis.service;
 
 import com.uas.eis.entity.EquipConfig;
+import jcifs.CIFSContext;
 
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -11,5 +12,5 @@ import java.util.concurrent.CountDownLatch;
  */
 public interface EDCBakService {
     void EDCBak(List<EquipConfig> configs, CountDownLatch countDownLatch);
-    Object AnalysisCounterData(String chipcode);
+    Object AnalysisCounterData(String chipcode, CIFSContext centerContext);
 }

+ 56 - 37
src/main/java/com/uas/eis/serviceImpl/EDCBakServiceImpl.java

@@ -7,6 +7,8 @@ import com.uas.eis.service.EDCBakService;
 import com.uas.eis.utils.Constant;
 import com.uas.eis.utils.DateUtil;
 import com.uas.eis.utils.SmbUtil;
+import jcifs.CIFSContext;
+import jcifs.CIFSException;
 import jcifs.smb.SmbFile;
 import jcifs.smb.SmbFileInputStream;
 import org.apache.commons.lang.StringUtils;
@@ -63,27 +65,39 @@ public class EDCBakServiceImpl implements EDCBakService {
             countDownLatch.countDown();
         }*/
         String counterpath = "";
+        //开启连接
+        CIFSContext currentContext = SmbUtil.initContextByIP(IP);
+        if(currentContext == null ){
+            logger.info(IP+" 获取上下文连接失败");
+            return;
+        }
+        CIFSContext centerContext = SmbUtil.initContextByIP(SmbUtil.centerIP);
+        if(centerContext == null ){
+            logger.info(SmbUtil.centerIP+" 获取上下文连接失败");
+            return;
+        }
         try {
             for(EquipConfig config : configs){
                 String testStep =  config.getEd_teststep();
                 String devcode = config.getEd_devcode();
-                List<Map<String, Object>> lists=baseDao.getJdbcTemplate().queryForList("SELECT * FROM (SELECT * FROM DATACENTER$MESTEMP WHERE EQPCODE_='"+devcode+"' AND TAB_ ='"+testStep+"' and turn_=0 AND nvl(fail,0)=0 ORDER BY CHIPCODE_,OBJECT_RRN ASC  )  WHERE ROWNUM <= 50");
+                List<Map<String, Object>> lists=baseDao.getJdbcTemplate().queryForList("SELECT * FROM (SELECT * FROM DATACENTER$MESTEMP WHERE EQPCODE_='"+devcode+"' AND TAB_ ='"+testStep+"' and turn_=0 AND nvl(fail,0)=0 ORDER BY CHIPCODE_,OBJECT_RRN ASC  )  WHERE ROWNUM <= 1000");
                 logger.info(" matchIP:"+IP+","+testStep+" start;");
                 logger.info(" matchIP:"+IP+","+testStep+" 待归档数:"+lists.size());
+                SmbFile dataFile = SmbUtil.getCurrentFile(IP, dataRootPath, currentContext );
+                List <SmbFile> files = SmbUtil.getChildFiles(dataFile, testStep, "xls");
+                List <SmbFile> files1 = SmbUtil.getChildFiles(dataFile, testStep, "jdf");
+                List <SmbFile> files2 = SmbUtil.getChildFiles(dataFile, testStep, "njdf");
                 if(lists.size()>0){
                     try {
                         /**相关路径匹配*/
+                        System.out.println(smbFile);
                         if(smbFile !=null) {
-                            SmbFile dataFile = SmbUtil.getCurrentFile(IP,dataRootPath);
                             logger.info(" matchIP:"+IP+","+testStep+" :dataPath:"+ dataFile.getPath());
-                            List <SmbFile> files = SmbUtil.getChildFiles(dataFile, testStep, "xls");
-                            List <SmbFile> files1 = SmbUtil.getChildFiles(dataFile, testStep, "jdf");
-                            List <SmbFile> files2 = SmbUtil.getChildFiles(dataFile, testStep, "njdf");
                             for(Map<String, Object> map : lists) {
                                 //Counter文件匹配
                                 counterpath = String.valueOf(map.get("COUNTERPATH_"));
                                 final String filename = counterpath.substring(counterpath.lastIndexOf("\\")+1);
-                                smbFile = SmbUtil.getCurrentFile(IP,counterbakRootPath+filename);
+                                smbFile = SmbUtil.getCurrentFile(IP,counterbakRootPath+filename ,currentContext);
                                 map.put("COUNTERPATH_", smbFile.getPath());
                                 Optional<SmbFile> optional = files.stream().filter(file -> mappingSuccess(filename,file)).findFirst();
                                 //遍历到了对应的Data文件存在
@@ -146,7 +160,7 @@ public class EDCBakServiceImpl implements EDCBakService {
                 String currentUploadPath = getUploadPath(uploadRootPath+"/");
                 String centerUploadPath =  getUploadPath(SmbUtil.centerPath+devcode+"/");
                 SmbFile counterFile = null;
-                SmbFile dataFile = null;
+                dataFile = null;
                 SmbFile jdfFile = null;
                 String currentKind = null;
                 SmbFile counterBaKFile = null;
@@ -172,32 +186,31 @@ public class EDCBakServiceImpl implements EDCBakService {
                         String path6=""; //本地JDF文件
 
                         //判断本机文件夹是否存在,不存在创建
-                        if(!SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/").exists()){
-                            SmbUtil.getCurrentFile(IP,currentUploadPath+(currentKind+"/SJ/")).mkdirs();
-                            SmbUtil.getCurrentFile(IP,currentUploadPath+(currentKind+"/FP/")).mkdirs();
+                        System.out.println(SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/", currentContext).getPath());
+                        if(!SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/", currentContext).exists()){
+                            SmbUtil.getCurrentFile(IP,currentUploadPath+(currentKind+"/SJ/"), currentContext).mkdirs();
+                            SmbUtil.getCurrentFile(IP,currentUploadPath+(currentKind+"/FP/"), currentContext).mkdirs();
                         }
-                        //判断文件服务器文件夹是否存在,不存在创建
-                        if(!SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/").exists()){
-                            SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+(currentKind+"/SJ/")).mkdirs();
-                            SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+(currentKind+"/FP/")).mkdirs();
+                        //判断文件中心服务器文件夹是否存在,不存在创建
+                        if(!SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/" , centerContext).exists()){
+                            SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+(currentKind+"/SJ/") , centerContext).mkdirs();
+                            SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+(currentKind+"/FP/"), centerContext).mkdirs();
                         }
 
                         //处理Counter文件
-                        counterFile = SmbUtil.getCurrentFile(counterPath_);
-                        counterCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/FP/"+map.get("CHIPCODE_")+".xls");
-                        /**
-                         * counter文件 文件服务器归档
-                         * */
+                        counterFile = SmbUtil.getCurrentFileBySmbPath(counterPath_ , currentContext);
+                        counterCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP, centerUploadPath+currentKind+"/FP/"+map.get("CHIPCODE_")+".xls", centerContext);
+                        System.out.println(counterFile.getPath());
+                        System.out.println(counterCenterFile.getPath());
                         counterFile.copyTo(counterCenterFile);
-
-                        counterBaKFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/FP/"+map.get("CHIPCODE_")+".xls");
+                        counterBaKFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/FP/"+map.get("CHIPCODE_")+".xls", currentContext);
 
                         int Count=1;
                         while (counterBaKFile.exists()){
                             String filename= counterBaKFile.getName();
                             String name = filename.substring(0,filename.indexOf("."));
                             String newFilename = name+"("+Count+")";
-                            counterBaKFile= SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/FP/"+newFilename+".xls");
+                            counterBaKFile= SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/FP/"+newFilename+".xls", currentContext);
                         }
                         path1=counterCenterFile.getPath();
                         path3=counterBaKFile.getPath();
@@ -210,18 +223,18 @@ public class EDCBakServiceImpl implements EDCBakService {
                         //存在Data文件
                         if(map.get("DATAPATH_")!=null){
 
-                            dataFile = SmbUtil.getCurrentFile(dataPath_);
-                            dataCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls");
+                            dataFile = SmbUtil.getCurrentFileBySmbPath(dataPath_, currentContext);
+                            dataCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls" , centerContext);
                             /**
                              * data文件 文件服务器归档
                              * */
                             dataFile.copyTo(dataCenterFile);
-                            dataBakFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls");
+                            dataBakFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls", currentContext);
                             while (dataBakFile.exists()){
                                 String filename= dataBakFile.getName();
                                 String name = filename.substring(0,filename.indexOf("."));
                                 String newFilename = name+"("+Count+")";
-                                dataBakFile= SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+newFilename+".xls");
+                                dataBakFile= SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+newFilename+".xls", currentContext);
                             }
                             path2=dataCenterFile.getPath();
                             path4=dataBakFile.getPath();
@@ -231,8 +244,8 @@ public class EDCBakServiceImpl implements EDCBakService {
                             dataFile.copyTo(dataBakFile);
                             dataFile.delete();
                         }else{
-                            dataCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls");
-                            dataBakFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls");
+                            dataCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls", centerContext);
+                            dataBakFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+".xls", currentContext);
                             path2=dataCenterFile.getPath();
                             path4=dataBakFile.getPath();
                         }
@@ -243,16 +256,16 @@ public class EDCBakServiceImpl implements EDCBakService {
                             if(map.get("JDFPATH_").toString().contains("njdf")){
                                 filesuffix=".njdf";
                             }
-                            jdfFile = SmbUtil.getCurrentFile(jdfPath_);
-                            jdfCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+filesuffix);
+                            jdfFile = SmbUtil.getCurrentFileBySmbPath(jdfPath_ ,currentContext);
+                            jdfCenterFile = SmbUtil.getCurrentFile(SmbUtil.centerIP,centerUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+filesuffix, centerContext);
                             jdfFile.copyTo(jdfCenterFile);
-                            jdfBakFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+filesuffix);
+                            jdfBakFile = SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+map.get("CHIPCODE_")+filesuffix, currentContext);
                             while (jdfBakFile.exists()){
                                 String filename= jdfBakFile.getName();
                                 String name = filename.substring(0,filename.indexOf("."));
                                 String suffix = filename.substring(filename.lastIndexOf("."));
                                 String newFilename = name+"("+Count+")";
-                                jdfBakFile= SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+newFilename+filesuffix);
+                                jdfBakFile= SmbUtil.getCurrentFile(IP,currentUploadPath+currentKind+"/SJ/"+newFilename+filesuffix, currentContext);
                             }
                             path5=jdfCenterFile.getPath();
                             path6=jdfBakFile.getPath();
@@ -279,11 +292,11 @@ public class EDCBakServiceImpl implements EDCBakService {
                     Sqls.add("UPDATE DATACENTER$MESTEMP SET TURN_=-1 WHERE OBJECT_RRN IN ("+ StringUtils.join(IDS,",") +")");
                     baseDao.execute(Sqls);
                 }
-                //同步做COUNTER文件解析
+              /*  //同步做COUNTER文件解析
                 SqlRowList rs1=baseDao.queryForRowSet("select chipcode_ from DATACENTER$CHIP left join  CHIP_EDC_RECORD on DATACENTER$CHIP.CHIPCODE_=CHIP_EDC_RECORD.CER_CHIPCODE where CER_CHIPCODE is null");
                 while(rs1.next()){
-                    AnalysisCounterData(rs1.getString("chipcode_"));
-                }
+                    AnalysisCounterData(rs1.getString("chipcode_"), centerContext);
+                }*/
 
             }
 
@@ -292,6 +305,12 @@ public class EDCBakServiceImpl implements EDCBakService {
             logger.info(IP+" 操作失败;");
         }finally {
             countDownLatch.countDown();
+            try {
+                centerContext.close();
+                currentContext.close();
+            } catch (CIFSException e) {
+                e.printStackTrace();
+            }
         }
         logger.info(" matchIP:"+IP+" end;");
     }
@@ -323,14 +342,14 @@ public class EDCBakServiceImpl implements EDCBakService {
 
     //解析Counter文件
     @Override
-    public Object AnalysisCounterData(String chip_code){
+    public Object AnalysisCounterData(String chip_code ,CIFSContext centerContext){
         SqlRowList rs=baseDao.queryForRowSet("select counterpath_ from datacenter$chip where chipcode_='"+chip_code+"' order by id_ desc");
         Object cer_id=null;
         if(rs.next()){
             try{
                 String FilePath=rs.getString("counterpath_");
                 //打开文件流
-                SmbFile smbFile = SmbUtil.getCurrentFile(FilePath);
+                SmbFile smbFile = SmbUtil.getCurrentFileBySmbPath(FilePath ,centerContext);
                 InputStream is = new BufferedInputStream(new SmbFileInputStream(smbFile));
                 Workbook book = new HSSFWorkbook(is);
                 cer_id=baseDao.getSeqId("CHIP_EDC_RECORD_SEQ");

+ 15 - 0
src/main/java/com/uas/eis/task/EDCBakTask.java

@@ -1,10 +1,14 @@
 package com.uas.eis.task;
 
 import com.uas.eis.dao.BaseDao;
+import com.uas.eis.dao.SqlRowList;
 import com.uas.eis.entity.DataChip;
 import com.uas.eis.entity.EquipConfig;
 import com.uas.eis.service.EDCBakService;
 import com.uas.eis.utils.CollectionUtil;
+import com.uas.eis.utils.SmbUtil;
+import jcifs.CIFSContext;
+import jcifs.CIFSException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -52,6 +56,17 @@ public class EDCBakTask {
         }catch (Exception e){
             e.printStackTrace();
         }
+        //解析
+        try {
+            SqlRowList rs1=baseDao.queryForRowSet("select chipcode_ from DATACENTER$CHIP left join  CHIP_EDC_RECORD on DATACENTER$CHIP.CHIPCODE_=CHIP_EDC_RECORD.CER_CHIPCODE where CER_CHIPCODE is null");
+            CIFSContext context = SmbUtil.getContext();
+            while(rs1.next()){
+                edcBakService.AnalysisCounterData(rs1.getString("chipcode_"), context);
+            }
+            context.close();
+        } catch (CIFSException e) {
+            e.printStackTrace();
+        }
         baseDao.execute("INSERT INTO DATACENTER$TASKLOG(NAME_,DURATION_) VALUES ('文件归档',"+(System.currentTimeMillis()-date.getTime())/1000+")");
         logger.info("文件归档结束:用时"+((System.currentTimeMillis()-date.getTime())/1000));
     }

+ 40 - 2
src/main/java/com/uas/eis/utils/SmbUtil.java

@@ -26,7 +26,7 @@ public class SmbUtil {
     private static Logger logger = LoggerFactory.getLogger("SmbUtil");
     public static PropertyConfiguration getConfig(){
         Properties ps = new Properties();
-        ps.setProperty("jcifs.smb.client.domain", "");
+        ps.setProperty("jcifs.smb.client.domain", centerIP );
         ps.setProperty("jcifs.smb.client.username", user);
         ps.setProperty("jcifs.smb.client.password", pwd);
         // 这个 disable 属性默认为 false , 不设置为 true 的话读取共享文件会比较慢
@@ -61,7 +61,7 @@ public class SmbUtil {
         return smbFile;
 
     }
-
+   @Deprecated
     public static SmbFile getCurrentFile(String serverID, String path){
         SmbFile smbFile = null;
        try {
@@ -73,6 +73,27 @@ public class SmbUtil {
         return smbFile;
     }
 
+    public static SmbFile getCurrentFile(String serverID, String path ,CIFSContext cifsContext){
+        SmbFile smbFile = null;
+        try {
+            smbFile = new SmbFile(getSmbRootUrl(serverID,path),cifsContext);
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+            logger.info("getCurrentFile:{},{}",serverID, path);
+        }
+        return smbFile;
+    }
+    public static SmbFile getCurrentFileBySmbPath( String path ,CIFSContext cifsContext){
+        SmbFile smbFile = null;
+        try {
+            smbFile = new SmbFile(path,cifsContext);
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+            logger.info("getCurrentFile:{}", path);
+        }
+        return smbFile;
+    }
+    @Deprecated
     public static SmbFile getCurrentFile(String path){
         SmbFile smbFile = null;
         try {
@@ -130,5 +151,22 @@ public class SmbUtil {
         }
         return files;
     }
+
+    public static CIFSContext initContextByIP (String IP) {
+        Properties ps = new Properties();
+        ps.setProperty("jcifs.smb.client.domain", IP);
+        ps.setProperty("jcifs.smb.client.username", user);
+        ps.setProperty("jcifs.smb.client.password", pwd);
+        // 这个 disable 属性默认为 false , 不设置为 true 的话读取共享文件会比较慢
+        ps.setProperty("jcifs.smb.client.dfs.disabled", "true");
+        try {
+            return new BaseContext(new PropertyConfiguration(ps));
+        } catch (CIFSException e) {
+            e.printStackTrace();
+            logger.error("initContextByIP-Error", e);
+            return null;
+
+        }
+    }
 }
 

+ 1 - 1
src/main/resources/application-file.yml

@@ -49,6 +49,6 @@ logging:
   config: classpath:log/logback-file.xml
 Task:
     Method: edcBak
-    Cron: 0 0/5 1-23 * * ?
+    Cron: 0 0/10 1-23 * * ?
 
 

+ 67 - 17
src/test/java/com/uas/eis/UasEisApplicationTests.java

@@ -1,30 +1,42 @@
 package com.uas.eis;
 
 
+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.utils.CollectionUtil;
 import com.uas.eis.utils.SmbUtil;
 import com.uas.eis.utils.SmbUtilSmb1;
 import jcifs.CIFSContext;
 import jcifs.CIFSException;
 import jcifs.config.PropertyConfiguration;
 import jcifs.context.BaseContext;
+import jcifs.smb.SmbException;
 import jcifs.smb.SmbFile;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = {UasEisApplication.class})
 public class UasEisApplicationTests {
 	private final Logger logger = LoggerFactory.getLogger(this.getClass());
-/*
+
+
 	@Autowired
 	private DataDealService dataDealService;
 	@Autowired
@@ -33,7 +45,7 @@ public class UasEisApplicationTests {
 	@Autowired
 	private BaseDao baseDao;
 	//@Test
-	public void contextLoads() {
+/*	public void contextLoads() {
 		Date date = new Date();
 		List<DataChip> dataChips = baseDao.getJdbcTemplate().query("select id_,chipcode_,counterpath_,datapath_,testdate_ from (select id_,chipcode_,counterpath_,datapath_,testdate_ from datacenter$chip where chipcode_='F20025075#04' and  nvl(readstatus_,0)=0 and testdate_ is  not null order by testdate_  desc) where rownum<=50",
 				new BeanPropertyRowMapper<DataChip>(DataChip.class));
@@ -100,10 +112,10 @@ public class UasEisApplicationTests {
 			e.printStackTrace();
 		}
 	}*/
-	//@Test
+/*	//@Test
 	public void test3 (){
 		Properties ps = new Properties();
-		ps.setProperty("jcifs.smb.client.domain", "");
+		ps.setProperty("jcifs.smb.client.domain", "172.16.3.22");
 		ps.setProperty("jcifs.smb.client.username", "administrator");
 		ps.setProperty("jcifs.smb.client.password", "0DlbAdmin0");
 		// 这个 disable 属性默认为 false , 不设置为 true 的话读取共享文件会比较慢
@@ -114,24 +126,62 @@ public class UasEisApplicationTests {
 		} catch (CIFSException e) {
 			e.printStackTrace();
 		}
-		try {
-			SmbFile dir = new SmbFile(SmbUtilSmb1.getSmbRootUrl("172.16.3.15","c$"),  cifs );
-			dir.connect();
-		} catch (MalformedURLException e) {
-			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
+		for (int i =0 ;i<100;i++){
+			//SmbFile sb = SmbUtil.getCurrentFile("172.16.3.22","c$/c"+i);
+			SmbFile sb = null;
+			try {
+				//sb = SmbUtil.getCurrentFile("172.16.3.22","c$/c"+i);
+				sb = new SmbFile(SmbUtil.getSmbRootUrl("172.16.3.22","c$/c"+i),cifs);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+			try {
+				sb.exists();
+				System.out.println("-----"+i);
+
+			} catch (SmbException e) {
+				e.printStackTrace();
+			}
+		};
 	}
-	@Test
+	//@Test
 	public void test4(){
-		SmbFile dataFile = SmbUtil.getCurrentFile("172.16.3.18","c$/DTS/data/");
+		List<EquipConfig> EquipConfigs = baseDao.getJdbcTemplate().query("select ec_ip,ec_counterpath,ec_datapath,ec_counterbak,ec_databak,ed_devcode,ed_teststep from EQUIPCONFIGDETAIL LEFT JOIN EQUIPCONFIG ON ED_ECID=EC_ID where ec_databak is not null order by ec_ip",
+				new BeanPropertyRowMapper<EquipConfig>(EquipConfig.class));
+		for(EquipConfig ec : EquipConfigs ){
+			SmbFile dataFile = SmbUtil.getCurrentFile(ec.getEc_ip(),"c$");
+			try {
+				dataFile.connect();
+				System.out.println(ec.getEc_ip()+"连接通过");
+			} catch (Exception e) {
+				System.out.println(ec.getEc_ip()+"连接失败,"+e.getMessage());
+				e.printStackTrace();
+			}
+		}
+
+	}*/
+	@Test
+	public void EDCBak(){
+		logger.info("文件归档开始");
+		Date date = new Date();
+		//baseDao.callProcedure("DATACENTER_SYNC",new Object[]{""});
+		//所有设备
+		List<EquipConfig> EquipConfigs = baseDao.getJdbcTemplate().query("select ec_ip,ec_counterpath,ec_datapath,ec_counterbak,ec_databak,ed_devcode,ed_teststep from EQUIPCONFIGDETAIL LEFT JOIN EQUIPCONFIG ON ED_ECID=EC_ID where ec_databak is not null and ec_ip='172.16.3.32' order by ec_ip",
+				new BeanPropertyRowMapper<EquipConfig>(EquipConfig.class));
+		Map<String,List<EquipConfig>> ecMap = CollectionUtil.groupBy(EquipConfigs,EquipConfig::getEc_ip);
+		final CountDownLatch countDownLatch = new CountDownLatch(EquipConfigs.size());
 		try {
-			dataFile.connect();
-			List<SmbFile> files = SmbUtil.getChildFiles(dataFile, "B", "xls");
-		} catch (IOException e) {
+			for(String key : ecMap.keySet()){
+				edcBakService.EDCBak(ecMap.get(key),countDownLatch);
+			}
+			countDownLatch.await();
+		}catch (Exception e){
 			e.printStackTrace();
 		}
+		logger.info("文件归档结束:用时"+((new Date().getTime()-date.getTime())/1000));
 	}
+   //@Test
+	public void test123(){
 
+  }
 }