|
|
@@ -9,7 +9,6 @@ import com.uas.eis.utils.DateUtil;
|
|
|
import com.uas.eis.utils.SmbUtil;
|
|
|
import jcifs.smb.SmbFile;
|
|
|
import jcifs.smb.SmbFileInputStream;
|
|
|
-import jcifs.smb.SmbSession;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
@@ -22,7 +21,6 @@ import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.BufferedInputStream;
|
|
|
-import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
@@ -77,6 +75,7 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
/**相关路径匹配*/
|
|
|
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");
|
|
|
@@ -85,19 +84,18 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
counterpath = String.valueOf(map.get("COUNTERPATH_"));
|
|
|
final String filename = counterpath.substring(counterpath.lastIndexOf("\\")+1);
|
|
|
smbFile = SmbUtil.getCurrentFile(IP,counterbakRootPath+filename);
|
|
|
-
|
|
|
map.put("COUNTERPATH_", smbFile.getPath());
|
|
|
- Optional<SmbFile> optional = files.stream().filter(file -> mappingSuccess(filename,file.getDate())).findFirst();
|
|
|
+ Optional<SmbFile> optional = files.stream().filter(file -> mappingSuccess(filename,file)).findFirst();
|
|
|
//遍历到了对应的Data文件存在
|
|
|
if (optional.isPresent()){
|
|
|
map.put("DATAPATH_", optional.get().getPath());
|
|
|
}
|
|
|
- optional = files1.stream().filter(file -> mappingSuccess(filename,file.getDate())).findFirst();
|
|
|
+ optional = files1.stream().filter(file -> mappingSuccess(filename,file)).findFirst();
|
|
|
//遍历到了对应的Data文件存在
|
|
|
if (optional.isPresent()){
|
|
|
map.put("JDFPATH_", optional.get().getPath());
|
|
|
}
|
|
|
- optional = files2.stream().filter(file -> mappingSuccess(filename,file.getDate())).findFirst();
|
|
|
+ optional = files2.stream().filter(file -> mappingSuccess(filename,file)).findFirst();
|
|
|
if (optional.isPresent()){
|
|
|
map.put("JDFPATH_", optional.get().getPath());
|
|
|
}
|
|
|
@@ -126,7 +124,7 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
}else {
|
|
|
String chipcode=map.get("CHIPCODE_").toString();
|
|
|
String ID=map.get("OBJECT_RRN").toString();
|
|
|
- baseDao.execute("insert into EDCsyscfaillog(el_id,el_ip,el_devcode,el_teststep,el_synctime,el_chipcode,el_reason) values(EDCsyscfaillog_seq.nextval,'"+IP+"','"+devcode+"','"+testStep+"',sysdate,'"+chipcode+"','未匹配到对应JDF文件,无法归档')");
|
|
|
+ baseDao.execute("insert into EDCsyscfaillog(el_id,el_ip,el_devcode,el_teststep,el_synctime,el_chipcode,el_reason) values(EDCsyscfaillog_seq.nextval,'"+IP+"','"+devcode+"','"+testStep+"',sysdate,'"+chipcode+"','未匹配到对应JDF文件,无法归档"+map.get("COUNTERPATH_")+"')");
|
|
|
baseDao.execute("update datacenter$mestemp set fail=-1 where OBJECT_RRN="+ID);
|
|
|
}
|
|
|
}
|
|
|
@@ -199,7 +197,7 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
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");
|
|
|
}
|
|
|
path1=counterCenterFile.getPath();
|
|
|
path3=counterBaKFile.getPath();
|
|
|
@@ -223,7 +221,7 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
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");
|
|
|
}
|
|
|
path2=dataCenterFile.getPath();
|
|
|
path4=dataBakFile.getPath();
|
|
|
@@ -254,7 +252,7 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
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);
|
|
|
}
|
|
|
path5=jdfCenterFile.getPath();
|
|
|
path6=jdfBakFile.getPath();
|
|
|
@@ -297,8 +295,9 @@ public class EDCBakServiceImpl implements EDCBakService {
|
|
|
}
|
|
|
logger.info(" matchIP:"+IP+" end;");
|
|
|
}
|
|
|
- private boolean mappingSuccess(String fileName , Long time) {
|
|
|
+ private boolean mappingSuccess(String fileName , SmbFile file) {
|
|
|
boolean match=false;
|
|
|
+ Long time = file.getDate();
|
|
|
//时间在同一分钟改的可以匹配
|
|
|
if(fileName.substring(2).startsWith(DateUtil.format(new Date(time), Constant.YMDHM))){
|
|
|
match=true;
|