|
@@ -24,6 +24,7 @@ import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
import com.fdkankan.scene.service.IScenePlusService;
|
|
|
import com.fdkankan.scene.vo.UploadPanoramaVO;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -33,6 +34,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class RemovePortraitServiceImpl implements IRemovePortraitService {
|
|
|
|
|
@@ -50,72 +52,69 @@ public class RemovePortraitServiceImpl implements IRemovePortraitService {
|
|
|
String num = param.getString("num");
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+ if(scenePlus.getRemovePortrait() == CommonOperStatus.WAITING.code()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
|
-
|
|
|
//原始计算根目录
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
//全景图计算根目录
|
|
|
String target = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + uuid;
|
|
|
//解压缩文件存放目录
|
|
|
String targetImagesPath = target + "/extras/images/";
|
|
|
- //下载文件
|
|
|
- String cacheImagesPath = String.format(UploadFilePath.scene_result_data_path, num) + "caches/images/";
|
|
|
- List<String> imagesList = fileServiceInterface.listRemoteFiles(cacheImagesPath);
|
|
|
- if(CollUtil.isEmpty(imagesList)){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- imagesList.stream().forEach(key->{
|
|
|
- if(key.endsWith(".jpg")){
|
|
|
- fileServiceInterface.downloadFile(key, targetImagesPath + FileUtil.getName(key));
|
|
|
+ //更新状态为进行中
|
|
|
+ scenePlus.setRemovePortrait(CommonOperStatus.WAITING.code());
|
|
|
+ scenePlusService.updateById(scenePlus);
|
|
|
+ try {
|
|
|
+ //下载文件
|
|
|
+ String cacheImagesPath = String.format(UploadFilePath.scene_result_data_path, num) + "caches/images/";
|
|
|
+ List<String> imagesList = fileServiceInterface.listRemoteFiles(cacheImagesPath);
|
|
|
+ if(CollUtil.isEmpty(imagesList)){
|
|
|
+ return;
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
-// fYunFileService.downloadFile(bucket, imgViewPath + "vision.modeldata", target + File.separator + "extras" + File.separator + "vision.modeldata");
|
|
|
-// CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
|
-// target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
-//
|
|
|
-// String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
|
|
|
-// fYunFileService.downloadFile(bucket, ossResultPath + "data.json", target + File.separator+"data.json");
|
|
|
-// fYunFileService.downloadFile(bucket, ossResultPath + "project.json", target + File.separator+"project.json");
|
|
|
-
|
|
|
- fileServiceInterface.downloadFile(imgViewPath + "vision.txt", target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
|
|
|
- //data.json增加extras为执行重建算法
|
|
|
- JSONObject floorplanJson = new JSONObject();
|
|
|
- floorplanJson.put("has_source_images", true);
|
|
|
- floorplanJson.put("has_vision_txt", true);
|
|
|
-
|
|
|
- JSONObject dataJson = new JSONObject();
|
|
|
- dataJson.put("extras", floorplanJson);
|
|
|
- dataJson.put("split_type", "SPLIT_V28");
|
|
|
- //V5表示不需要生成high,low文件
|
|
|
- String skyboxType = "SKYBOX_V6";
|
|
|
- if(scenePlusExt.getSceneScheme() == 11){
|
|
|
- skyboxType = "SKYBOX_V7";
|
|
|
- }
|
|
|
- //sceneScheme为3切成瓦片图
|
|
|
- if(scenePlusExt.getSceneScheme() == 3){
|
|
|
- if("4k".equals(scenePlusExt.getSceneResolution())){
|
|
|
- skyboxType = "SKYBOX_V14";
|
|
|
- }else{
|
|
|
- skyboxType = "SKYBOX_V13";
|
|
|
+ imagesList.stream().forEach(key->{
|
|
|
+ if(key.endsWith(".jpg")){
|
|
|
+ fileServiceInterface.downloadFile(key, targetImagesPath + FileUtil.getName(key));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
+ fileServiceInterface.downloadFile(imgViewPath + "vision.txt", target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
+
|
|
|
+ //data.json增加extras为执行重建算法
|
|
|
+ JSONObject floorplanJson = new JSONObject();
|
|
|
+ floorplanJson.put("has_source_images", true);
|
|
|
+ floorplanJson.put("has_vision_txt", true);
|
|
|
+
|
|
|
+ JSONObject dataJson = new JSONObject();
|
|
|
+ dataJson.put("extras", floorplanJson);
|
|
|
+ dataJson.put("split_type", "SPLIT_V28");
|
|
|
+ //V5表示不需要生成high,low文件
|
|
|
+ String skyboxType = "SKYBOX_V6";
|
|
|
+ if(scenePlusExt.getSceneScheme() == 11){
|
|
|
+ skyboxType = "SKYBOX_V7";
|
|
|
}
|
|
|
+ //sceneScheme为3切成瓦片图
|
|
|
+ if(scenePlusExt.getSceneScheme() == 3){
|
|
|
+ if("4k".equals(scenePlusExt.getSceneResolution())){
|
|
|
+ skyboxType = "SKYBOX_V14";
|
|
|
+ }else{
|
|
|
+ skyboxType = "SKYBOX_V13";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataJson.put("skybox_type", skyboxType);
|
|
|
+ FileUtil.writeUtf8String(dataJson.toJSONString(), target + File.separator+"data.json");
|
|
|
+
|
|
|
+ sceneEditInfoService.uploadPanoramaHandler(num,bucket,target,imgViewPath,new ArrayList<>(),targetImagesPath);
|
|
|
+ scenePlus.setRemovePortrait(CommonOperStatus.SUCCESS.code());
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("抹除人像失败,num:{}", num, e);
|
|
|
+ scenePlus.setRemovePortrait(CommonOperStatus.FAILD.code());
|
|
|
+ }finally {
|
|
|
+ FileUtil.del(target);
|
|
|
+ scenePlusService.updateById(scenePlus);
|
|
|
}
|
|
|
- dataJson.put("skybox_type", skyboxType);
|
|
|
- FileUtil.writeUtf8String(dataJson.toJSONString(), target + File.separator+"data.json");
|
|
|
-
|
|
|
- if(new File(target + File.separator + "capture").exists()){
|
|
|
- new File(target + File.separator + "capture").delete();
|
|
|
- }
|
|
|
- if(new File(target + File.separator + "results").exists()){
|
|
|
- FileUtils.delAllFile(target + File.separator + "results");
|
|
|
- }
|
|
|
-
|
|
|
- sceneEditInfoService.uploadPanoramaHandler(num,bucket,target,imgViewPath,new ArrayList<>(),targetImagesPath);
|
|
|
-
|
|
|
}
|
|
|
}
|