...
|
...
|
@@ -37,31 +37,33 @@ public class TaskAnalysis { |
|
|
@Scheduled(fixedDelay = 20000)
|
|
|
public void startTask(){
|
|
|
String today = DateUtil.getTodayBy_yyyyMMdd();
|
|
|
String readDir = receptDir + "\\" + today;
|
|
|
String readDir = receptDir + "/" + today;
|
|
|
|
|
|
log.info("回执读取目录:"+readDir);
|
|
|
String backdireByDay = bakupDir + "\\" + today;
|
|
|
String backdireByDay = bakupDir + "/" + today;
|
|
|
|
|
|
try{
|
|
|
List<File> files = FileTool.readDirectoryFiles(new File(readDir));
|
|
|
Iterator<File> it = files.iterator();
|
|
|
while(it.hasNext()){
|
|
|
File file = it.next();
|
|
|
try {
|
|
|
//解析
|
|
|
int i = new CustomXmlHandle().handelXmlDocument(file);
|
|
|
//操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份
|
|
|
if(i>0){
|
|
|
File bakupDirectory = new File(backdireByDay);
|
|
|
FileUtils.moveFileToDirectory(file,bakupDirectory,true);
|
|
|
}else {
|
|
|
File fileDirectory = new File(readDir);
|
|
|
List<File> files = FileTool.readDirectoryFiles(fileDirectory);
|
|
|
Iterator<File> it = files.iterator();
|
|
|
while(it.hasNext()){
|
|
|
File file = it.next();
|
|
|
try {
|
|
|
//解析
|
|
|
int i = new CustomXmlHandle().handelXmlDocument(file);
|
|
|
//操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份
|
|
|
if(i>0){
|
|
|
File bakupDirectory = new File(backdireByDay);
|
|
|
FileUtils.moveFileToDirectory(file,bakupDirectory,true);
|
|
|
}else {
|
|
|
errBak(file);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
log.error("解析回执出错",e);
|
|
|
errBak(file);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
log.error("解析回执出错",e);
|
|
|
errBak(file);
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
log.error("获取目录文件出错",e);
|
...
|
...
|
|