|
@@ -9,6 +9,7 @@ import com.kexun.model.Request;
|
|
|
import com.kexun.service.ReportInfoService;
|
|
|
import com.kexun.service.XmlFileHandlerService;
|
|
|
import lombok.extern.log4j.Log4j;
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
import org.dom4j.*;
|
|
|
import org.dom4j.io.SAXReader;
|
|
|
import org.omg.CORBA.IRObject;
|
|
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -53,7 +55,7 @@ public class XmlFileHandlerServiceImpl implements XmlFileHandlerService {
|
|
|
File[] fileLists = files.listFiles();
|
|
|
if (fileLists != null) {
|
|
|
//创建目录文件路径
|
|
|
- File targetFile = new File(xmlBackPath);
|
|
|
+
|
|
|
for (File fileList : fileLists) {
|
|
|
//只处理xml文件
|
|
|
if (fileList.isFile() && fileList.getName().endsWith(".xml")) {
|
|
@@ -69,7 +71,12 @@ public class XmlFileHandlerServiceImpl implements XmlFileHandlerService {
|
|
|
reportStruct = JSON.parseObject(xmlJson, ReportStruct.class);
|
|
|
saveReportInfo(reportStruct);
|
|
|
//将该目录下的文件进行移动,移动到指定的备份目录
|
|
|
- file.renameTo(targetFile);
|
|
|
+ File targetFile = new File(xmlBackPath+name);
|
|
|
+ try {
|
|
|
+ FileUtils.moveFile(file,targetFile);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|