|
@@ -16,6 +16,7 @@ import com.fdkankan.job.service.IScenePlusExtService;
|
|
|
import com.fdkankan.job.service.IScenePlusService;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.utils.SceneUtil;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -43,6 +44,8 @@ public class UploadResultDataHandler {
|
|
|
private IScenePlusExtService scenePlusExtService;
|
|
|
@Autowired
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
|
@XxlJob("uploadResultData")
|
|
|
private void repairModelKind(){
|
|
@@ -68,100 +71,105 @@ public class UploadResultDataHandler {
|
|
|
if(CollUtil.isNotEmpty(list)){
|
|
|
list.parallelStream().forEach(plus->{
|
|
|
try {
|
|
|
- String ossResultPath = String.format(UploadFilePath.scene_result_data_path, plus.getNum());
|
|
|
- Map<String, String> uploadMap = new HashMap<>();
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(plus.getId());
|
|
|
- String dataSource = scenePlusExt.getDataSource();
|
|
|
- if(StrUtil.isNotEmpty(dataSource)){
|
|
|
-
|
|
|
- //上传caches/images
|
|
|
- String localCachesImagePath = dataSource + "/caches/images/";
|
|
|
- String ossCachesImagePath = ossResultPath + "caches/images/";
|
|
|
- //先清除旧的全景图
|
|
|
- if(FileUtil.exist(localCachesImagePath)){
|
|
|
- fYunFileService.uploadFileByCommand(localCachesImagePath, ossCachesImagePath);
|
|
|
- }
|
|
|
-
|
|
|
- //上传vision.txt
|
|
|
- String localVisionPath = dataSource + "/results/vision.txt";
|
|
|
- String ossVisionJsonPath = String.format(UploadFilePath.IMG_VIEW_PATH, plus.getNum()) + "vision.txt";
|
|
|
- if(FileUtil.exist(localVisionPath)){
|
|
|
- uploadMap.put(localVisionPath, ossVisionJsonPath);
|
|
|
- }
|
|
|
-
|
|
|
- //上传project.json
|
|
|
- String localProjectJsonPath = dataSource + "/project.json";
|
|
|
- String ossProjectJsonPath = ossResultPath + "project.json";
|
|
|
- if(FileUtil.exist(localProjectJsonPath)){
|
|
|
- uploadMap.put(localProjectJsonPath, ossProjectJsonPath);
|
|
|
- }
|
|
|
-
|
|
|
- //上传data.json
|
|
|
- String localDataJsonPath = dataSource + "/data.json";
|
|
|
- String ossDataJsonPath = ossResultPath + "data.json";
|
|
|
- if(FileUtil.exist(localDataJsonPath)){
|
|
|
- uploadMap.put(localDataJsonPath, ossDataJsonPath);
|
|
|
- }
|
|
|
-
|
|
|
- //户型图上传
|
|
|
- String floorCadPath = dataSource + "/results/floorplan_cad";
|
|
|
- String dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
|
|
|
- //清除原有旧的cad图
|
|
|
- List<String> floorCadList = FileUtils.getFileList(floorCadPath);
|
|
|
- if(CollUtil.isNotEmpty(floorCadList)){
|
|
|
- floorCadList.stream().forEach(str->{
|
|
|
- String substring = str.substring(str.lastIndexOf(File.separator) + 1);
|
|
|
- String[] arr = substring.split("floor");
|
|
|
- String[] arr2 = arr[1].split("\\.");
|
|
|
- //上传到用户编辑目录
|
|
|
- uploadMap.put(str, String.format(dataViewPath, plus.getNum(), arr2[0], arr2[1]));
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
- //上传深时场景生成obj需要的文件
|
|
|
- String localReconstruction = dataSource + "/caches/reconstruction/";
|
|
|
- String ossReconstruction = ossResultPath + "caches/reconstruction/";
|
|
|
- if(FileUtil.exist(localReconstruction)){
|
|
|
- fYunFileService.uploadFileByCommand(localReconstruction, ossReconstruction);
|
|
|
+ String test = redisUtil.get("scene:result:upload:num:" + plus.getNum());
|
|
|
+ if(StrUtil.isEmpty(test)){
|
|
|
+
|
|
|
+ String ossResultPath = String.format(UploadFilePath.scene_result_data_path, plus.getNum());
|
|
|
+ Map<String, String> uploadMap = new HashMap<>();
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(plus.getId());
|
|
|
+ String dataSource = scenePlusExt.getDataSource();
|
|
|
+ if(StrUtil.isNotEmpty(dataSource)){
|
|
|
+
|
|
|
+ //上传caches/images
|
|
|
+ String localCachesImagePath = dataSource + "/caches/images/";
|
|
|
+ String ossCachesImagePath = ossResultPath + "caches/images/";
|
|
|
+ //先清除旧的全景图
|
|
|
+ if(FileUtil.exist(localCachesImagePath)){
|
|
|
+ fYunFileService.uploadFileByCommand(localCachesImagePath, ossCachesImagePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ //上传vision.txt
|
|
|
+ String localVisionPath = dataSource + "/results/vision.txt";
|
|
|
+ String ossVisionJsonPath = String.format(UploadFilePath.IMG_VIEW_PATH, plus.getNum()) + "vision.txt";
|
|
|
+ if(FileUtil.exist(localVisionPath)){
|
|
|
+ uploadMap.put(localVisionPath, ossVisionJsonPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ //上传project.json
|
|
|
+ String localProjectJsonPath = dataSource + "/project.json";
|
|
|
+ String ossProjectJsonPath = ossResultPath + "project.json";
|
|
|
+ if(FileUtil.exist(localProjectJsonPath)){
|
|
|
+ uploadMap.put(localProjectJsonPath, ossProjectJsonPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ //上传data.json
|
|
|
+ String localDataJsonPath = dataSource + "/data.json";
|
|
|
+ String ossDataJsonPath = ossResultPath + "data.json";
|
|
|
+ if(FileUtil.exist(localDataJsonPath)){
|
|
|
+ uploadMap.put(localDataJsonPath, ossDataJsonPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ //户型图上传
|
|
|
+ String floorCadPath = dataSource + "/results/floorplan_cad";
|
|
|
+ String dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
|
|
|
+ //清除原有旧的cad图
|
|
|
+ List<String> floorCadList = FileUtils.getFileList(floorCadPath);
|
|
|
+ if(CollUtil.isNotEmpty(floorCadList)){
|
|
|
+ floorCadList.stream().forEach(str->{
|
|
|
+ String substring = str.substring(str.lastIndexOf(File.separator) + 1);
|
|
|
+ String[] arr = substring.split("floor");
|
|
|
+ String[] arr2 = arr[1].split("\\.");
|
|
|
+ //上传到用户编辑目录
|
|
|
+ uploadMap.put(str, String.format(dataViewPath, plus.getNum(), arr2[0], arr2[1]));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //上传深时场景生成obj需要的文件
|
|
|
+ String localReconstruction = dataSource + "/caches/reconstruction/";
|
|
|
+ String ossReconstruction = ossResultPath + "caches/reconstruction/";
|
|
|
+ if(FileUtil.exist(localReconstruction)){
|
|
|
+ fYunFileService.uploadFileByCommand(localReconstruction, ossReconstruction);
|
|
|
+ }
|
|
|
+ String localDepthmap = dataSource + "/caches/depthmap/";
|
|
|
+ String ossDepthmap = ossResultPath + "caches/depthmap/";
|
|
|
+ if(FileUtil.exist(localDepthmap)){
|
|
|
+ fYunFileService.uploadFileByCommand(localDepthmap, ossDepthmap);
|
|
|
+ }
|
|
|
+ String localDepthmapAsc = dataSource + "/caches/depthmap_csc/";
|
|
|
+ String ossDepthmapAsc = ossResultPath + "caches/depthmap_csc/";
|
|
|
+ if(FileUtil.exist(localDepthmapAsc)){
|
|
|
+ fYunFileService.uploadFileByCommand(localDepthmapAsc, ossDepthmapAsc);
|
|
|
+ }
|
|
|
+ String localPanoramaJson = dataSource + "/caches/panorama.json";
|
|
|
+ String ossPanoramaJson = ossResultPath + "caches/panorama.json";
|
|
|
+ if(FileUtil.exist(localPanoramaJson)){
|
|
|
+ fYunFileService.uploadFile(localPanoramaJson, ossPanoramaJson);
|
|
|
+ }
|
|
|
+ String localLaserPly = dataSource + "/results/laserData/laser.ply";
|
|
|
+ String ossLaserPly = ossResultPath + "results/laserData/laser.ply";
|
|
|
+ if(FileUtil.exist(localLaserPly)){
|
|
|
+ fYunFileService.uploadFile(localLaserPly, ossLaserPly);
|
|
|
+ }
|
|
|
+ String localFloorGroupFixJson = dataSource + "/caches/floor_group_fix.json";
|
|
|
+ String ossFloorGroupFixJson = ossResultPath + "caches/floor_group_fix.json";
|
|
|
+ if(FileUtil.exist(localFloorGroupFixJson)){
|
|
|
+ fYunFileService.uploadFile(localFloorGroupFixJson, ossFloorGroupFixJson);
|
|
|
+ }
|
|
|
+ String localDepthmapVis = dataSource + "/caches/depthmap_vis";
|
|
|
+ String ossDepthmapVis = ossResultPath + "caches/depthmap_vis";
|
|
|
+ if(FileUtil.exist(localDepthmapVis)){
|
|
|
+ fYunFileService.uploadFileByCommand(localDepthmapVis, ossDepthmapVis);
|
|
|
+ }
|
|
|
+
|
|
|
+ //开始上传
|
|
|
+ fYunFileService.uploadMulFiles(uploadMap);
|
|
|
+
|
|
|
+ if(active.contains("test")){
|
|
|
+ FileUtil.rename(FileUtil.file(dataSource), dataSource + "_back", true);
|
|
|
+ }
|
|
|
}
|
|
|
- String localDepthmap = dataSource + "/caches/depthmap/";
|
|
|
- String ossDepthmap = ossResultPath + "caches/depthmap/";
|
|
|
- if(FileUtil.exist(localDepthmap)){
|
|
|
- fYunFileService.uploadFileByCommand(localDepthmap, ossDepthmap);
|
|
|
- }
|
|
|
- String localDepthmapAsc = dataSource + "/caches/depthmap_csc/";
|
|
|
- String ossDepthmapAsc = ossResultPath + "caches/depthmap_csc/";
|
|
|
- if(FileUtil.exist(localDepthmapAsc)){
|
|
|
- fYunFileService.uploadFileByCommand(localDepthmapAsc, ossDepthmapAsc);
|
|
|
- }
|
|
|
- String localPanoramaJson = dataSource + "/caches/panorama.json";
|
|
|
- String ossPanoramaJson = ossResultPath + "caches/panorama.json";
|
|
|
- if(FileUtil.exist(localPanoramaJson)){
|
|
|
- fYunFileService.uploadFile(localPanoramaJson, ossPanoramaJson);
|
|
|
- }
|
|
|
- String localLaserPly = dataSource + "/results/laserData/laser.ply";
|
|
|
- String ossLaserPly = ossResultPath + "results/laserData/laser.ply";
|
|
|
- if(FileUtil.exist(localLaserPly)){
|
|
|
- fYunFileService.uploadFile(localLaserPly, ossLaserPly);
|
|
|
- }
|
|
|
- String localFloorGroupFixJson = dataSource + "/caches/floor_group_fix.json";
|
|
|
- String ossFloorGroupFixJson = ossResultPath + "caches/floor_group_fix.json";
|
|
|
- if(FileUtil.exist(localFloorGroupFixJson)){
|
|
|
- fYunFileService.uploadFile(localFloorGroupFixJson, ossFloorGroupFixJson);
|
|
|
- }
|
|
|
- String localDepthmapVis = dataSource + "/caches/depthmap_vis";
|
|
|
- String ossDepthmapVis = ossResultPath + "caches/depthmap_vis";
|
|
|
- if(FileUtil.exist(localDepthmapVis)){
|
|
|
- fYunFileService.uploadFileByCommand(localDepthmapVis, ossDepthmapVis);
|
|
|
- }
|
|
|
-
|
|
|
- //开始上传
|
|
|
- fYunFileService.uploadMulFiles(uploadMap);
|
|
|
-
|
|
|
- if(active.contains("test")){
|
|
|
- FileUtil.rename(FileUtil.file(dataSource), dataSource + "_back", true);
|
|
|
- }
|
|
|
-
|
|
|
+ redisUtil.set("scene:result:upload:num:" + plus.getNum(), "1");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
log.error("上传结算结果失败,num=" + plus.getNum(), e);
|