|
@@ -28,6 +28,7 @@ import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 场景文件上传模块
|
|
* 场景文件上传模块
|
|
@@ -107,22 +108,34 @@ public class SceneFileController{
|
|
String dataSource = ConstantFilePath.BUILD_MODEL_PATH.concat(subFolder);
|
|
String dataSource = ConstantFilePath.BUILD_MODEL_PATH.concat(subFolder);
|
|
log.info("dataSource 为:{}", dataSource);
|
|
log.info("dataSource 为:{}", dataSource);
|
|
|
|
|
|
- // 解压资源文件上传
|
|
|
|
- ZipFile zipFile = new ZipFile(new File(filePath.concat(zipFileName)));
|
|
|
|
- if (zipFile.isEncrypted()) {
|
|
|
|
- String pwd = zipFileName.substring(0, 5).concat(zipFileName.substring(0, 5));
|
|
|
|
- zipFile.setPassword(pwd);
|
|
|
|
- zipFile.extractAll(filePath);
|
|
|
|
- } else {
|
|
|
|
- ZipUtil.unzip(filePath.concat(zipFileName), filePath);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 上传oaas
|
|
|
|
- fYunFileService.uploadFileByCommand(filePath.concat(folderName), ConstantFilePath.OSS_PREFIX.concat(subFolder));
|
|
|
|
-
|
|
|
|
- // 通知计算
|
|
|
|
- return sceneFileBuildService.copyDataAndBuild(null,dataSource ,"V4",user);
|
|
|
|
|
|
+ // 异步解压资源文件上传
|
|
|
|
+ String finalFilePath = filePath;
|
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
|
+ try {
|
|
|
|
+ log.info("开始异步解压文件");
|
|
|
|
+ ZipFile zipFile = new ZipFile(new File(finalFilePath.concat(zipFileName)));
|
|
|
|
+ if (zipFile.isEncrypted()) {
|
|
|
|
+ String pwd = zipFileName.substring(0, 5).concat(zipFileName.substring(0, 5));
|
|
|
|
+ zipFile.setPassword(pwd);
|
|
|
|
+ zipFile.extractAll(finalFilePath);
|
|
|
|
+ } else {
|
|
|
|
+ ZipUtil.unzip(finalFilePath.concat(zipFileName), finalFilePath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ log.info("异步开始上传文件");
|
|
|
|
+ // 上传oaas
|
|
|
|
+ fYunFileService.uploadFileByCommand(finalFilePath.concat(folderName), ConstantFilePath.OSS_PREFIX.concat(subFolder));
|
|
|
|
+
|
|
|
|
+ log.info("文件上传成功,开始通知计算");
|
|
|
|
+ // 通知计算
|
|
|
|
+ sceneFileBuildService.copyDataAndBuild(null, dataSource, "V4", user);
|
|
|
|
+ log.info("通知计算成功");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ log.error("上传失败", e);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|
|
private String getFileIdByFolderName(String folderName) {
|
|
private String getFileIdByFolderName(String folderName) {
|