|
@@ -31,6 +31,7 @@ import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.enums.ModelTypeEnums;
|
|
import com.fdkankan.model.enums.ModelTypeEnums;
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
|
+import com.fdkankan.model.utils.SceneUtil;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
@@ -142,7 +143,13 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneColdStorageService sceneColdStorageService;
|
|
private ISceneColdStorageService sceneColdStorageService;
|
|
@Autowired
|
|
@Autowired
|
|
- private IOrigFileUploadBatchService
|
|
|
|
|
|
+ private IOrigFileUploadBatchService origFileUploadBatchService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IOrigFileUploadService origFileUploadService;
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ HttpUtil.downloadFile("https://4dkk.4dage.com/scene_view_data/KJ-00ZGf9jK3PT/data/scene.json", new File("D:\\test5\\aaa\\scene.json"));
|
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void buildScenePre(BuildSceneCallMessage message) throws Exception{
|
|
public void buildScenePre(BuildSceneCallMessage message) throws Exception{
|
|
@@ -151,9 +158,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
String batchId = (String) message.getExt().get("batchId");
|
|
String batchId = (String) message.getExt().get("batchId");
|
|
try {
|
|
try {
|
|
|
|
|
|
- if(StrUtil.isNotEmpty(batchId)){
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ //如果场景原始资源上传批次id不为空,则需要下载批次文件上传到oss目录
|
|
|
|
+ this.downloadOrigFile(batchId, message.getPath());
|
|
|
|
|
|
//开始计算前发送mq消息,监听project.json文件的变化以更新进度条
|
|
//开始计算前发送mq消息,监听project.json文件的变化以更新进度条
|
|
mqProducer.sendByWorkQueue(modelingProgressNotice, message);
|
|
mqProducer.sendByWorkQueue(modelingProgressNotice, message);
|
|
@@ -232,6 +238,36 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void downloadOrigFile(String batchId, String dataSource){
|
|
|
|
+ if(StrUtil.isEmpty(batchId)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<OrigFileUpload> fileList = origFileUploadService.getByBatchId(batchId);
|
|
|
|
+ if(CollUtil.isEmpty(fileList)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ String homePath = "/oss/4dkankan/" + SceneUtil.getHomePath(dataSource);
|
|
|
|
+ for (OrigFileUpload origFileUpload : fileList) {
|
|
|
|
+ int times = 0;
|
|
|
|
+ String filePath = homePath.concat(origFileUpload.getFileName());
|
|
|
|
+ do{
|
|
|
|
+ try {
|
|
|
|
+ ++times;
|
|
|
|
+ HttpUtil.downloadFile(origFileUpload.getFileUrl(), new File(filePath), 10 * 60 * 1000);
|
|
|
|
+ if(FileUtil.exist(filePath)){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.info("原始文件第{}次下载失败,fileUrl:{}, filePath:{}", origFileUpload.getFileUrl(), filePath);
|
|
|
|
+ }
|
|
|
|
+ }while (times < 4);
|
|
|
|
+
|
|
|
|
+ if(!FileUtil.exist(filePath)){
|
|
|
|
+ throw new RuntimeException("原始文件下载失败,fileUrl:" + origFileUpload.getFileUrl() + ", filePath:" + filePath);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private String getOssPath(String path) {
|
|
private String getOssPath(String path) {
|
|
String ossPath = ConstantFilePath.OSS_PREFIX
|
|
String ossPath = ConstantFilePath.OSS_PREFIX
|
|
+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|