|
@@ -69,9 +69,9 @@ public class OutProcessServiceImpl extends OutBaseService implements IOutProcess
|
|
long sort = Long.parseLong(file.getName().split("-")[1]);
|
|
long sort = Long.parseLong(file.getName().split("-")[1]);
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
FileDesc desc = mapper.readValue(file, FileDesc.class);
|
|
FileDesc desc = mapper.readValue(file, FileDesc.class);
|
|
-
|
|
|
|
- ZipFile zipFile = new ZipFile(syncDir + desc.getName());
|
|
|
|
- String md5 = DigestUtils.md5Hex(Files.newInputStream(zipFile.getFile().toPath()));
|
|
|
|
|
|
+ boolean isZip = desc.getName().indexOf(".zip") != -1;
|
|
|
|
+ File syncFile = new File(syncDir + desc.getName());
|
|
|
|
+ String md5 = DigestUtils.md5Hex(Files.newInputStream(syncFile.toPath()));
|
|
if (md5.equals(desc.getMd5())) {
|
|
if (md5.equals(desc.getMd5())) {
|
|
Date start = new Date();
|
|
Date start = new Date();
|
|
//上传json文件
|
|
//上传json文件
|
|
@@ -79,23 +79,28 @@ public class OutProcessServiceImpl extends OutBaseService implements IOutProcess
|
|
boolean flag1 = false;
|
|
boolean flag1 = false;
|
|
//上传zip文件
|
|
//上传zip文件
|
|
List<File> list = new ArrayList<>();
|
|
List<File> list = new ArrayList<>();
|
|
- if (zipFile.isSplitArchive()) {
|
|
|
|
- //如果是分卷压缩文件,则需要读取所有文件名上传
|
|
|
|
- list = zipFile.getSplitZipFiles();
|
|
|
|
- for (File f : list) {
|
|
|
|
- flag1 = flag && ftpUtil.upload(f);
|
|
|
|
|
|
+ if (isZip) {
|
|
|
|
+ ZipFile zipFile = new ZipFile(syncFile.getPath());
|
|
|
|
+ if (zipFile.isSplitArchive()) {
|
|
|
|
+ //如果是分卷压缩文件,则需要读取所有文件名上传
|
|
|
|
+ list = zipFile.getSplitZipFiles();
|
|
|
|
+ for (File f : list) {
|
|
|
|
+ flag1 = flag && ftpUtil.upload(f);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ flag1 = ftpUtil.upload(zipFile.getFile());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- flag1 = ftpUtil.upload(zipFile.getFile());
|
|
|
|
-
|
|
|
|
|
|
+ flag1 = ftpUtil.upload(syncFile);
|
|
}
|
|
}
|
|
|
|
+
|
|
Date end = new Date();
|
|
Date end = new Date();
|
|
|
|
|
|
String status = "N";
|
|
String status = "N";
|
|
if (flag && flag1) {
|
|
if (flag && flag1) {
|
|
//移动文件到备份目录
|
|
//移动文件到备份目录
|
|
Files.move(file.toPath(), Paths.get(bakDir + file.getName()), StandardCopyOption.REPLACE_EXISTING);
|
|
Files.move(file.toPath(), Paths.get(bakDir + file.getName()), StandardCopyOption.REPLACE_EXISTING);
|
|
- Files.move(zipFile.getFile().toPath(), Paths.get(bakDir + zipFile.getFile().getName()), StandardCopyOption.REPLACE_EXISTING);
|
|
|
|
|
|
+ Files.move(syncFile.toPath(), Paths.get(bakDir + syncFile.getName()), StandardCopyOption.REPLACE_EXISTING);
|
|
for (File f : list) {
|
|
for (File f : list) {
|
|
Files.move(f.toPath(), Paths.get(bakDir + f.getName()), StandardCopyOption.REPLACE_EXISTING);
|
|
Files.move(f.toPath(), Paths.get(bakDir + f.getName()), StandardCopyOption.REPLACE_EXISTING);
|
|
}
|
|
}
|