|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fdkankan.common.constant.ConstantFileName;
|
|
import com.fdkankan.common.constant.ConstantFileName;
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
|
|
+import com.fdkankan.common.constant.UploadFilePath;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -20,9 +21,13 @@ public class ComputerUtil {
|
|
|
|
|
|
|
|
|
|
public static Map<String,String> computer(String projectNum, String path, String buildType) throws Exception{
|
|
public static Map<String,String> computer(String projectNum, String path, String buildType) throws Exception{
|
|
|
|
+
|
|
|
|
+ String imgPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum); //新版本文件路径
|
|
|
|
+ String dataPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum); //新版本文件路径
|
|
|
|
+ String videosPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum); //新版本文件路径
|
|
|
|
+
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
path = path.replace("//", "/");
|
|
path = path.replace("//", "/");
|
|
-
|
|
|
|
log.info("开始建模:"+projectNum);
|
|
log.info("开始建模:"+projectNum);
|
|
//构建算法isModel去掉,因此改成空字符串
|
|
//构建算法isModel去掉,因此改成空字符串
|
|
if("V2".equals(buildType)){
|
|
if("V2".equals(buildType)){
|
|
@@ -72,22 +77,31 @@ public class ComputerUtil {
|
|
if(fileName.contains("meshfix.txt")){
|
|
if(fileName.contains("meshfix.txt")){
|
|
meshfix = fileName;
|
|
meshfix = fileName;
|
|
}else {
|
|
}else {
|
|
- map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
|
- projectNum+"/"+ ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
|
|
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ fileName,
|
|
|
|
+ "images/images"+projectNum+"/"+ ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ fileName,
|
|
|
|
+ imgPath + ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
//high文件夹
|
|
//high文件夹
|
|
if(fileJson.getIntValue("clazz") == 3){
|
|
if(fileJson.getIntValue("clazz") == 3){
|
|
- map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
|
- projectNum+"/pan/high/"+ fileName.replace("high/", ""));
|
|
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ fileName,
|
|
|
|
+ "images/images"+ projectNum+"/pan/high/"+ fileName.replace("high/", ""));
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ fileName,
|
|
|
|
+ imgPath+"/pan/high/"+ fileName.replace("high/", ""));
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
//low文件夹
|
|
//low文件夹
|
|
if(fileJson.getIntValue("clazz") == 4){
|
|
if(fileJson.getIntValue("clazz") == 4){
|
|
- map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
|
- projectNum+"/pan/low/"+ fileName.replace("low/", ""));
|
|
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ fileName,
|
|
|
|
+ "images/images"+ projectNum+"/pan/low/"+ fileName.replace("low/", ""));
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ fileName,
|
|
|
|
+ imgPath+"/pan/low/"+ fileName.replace("low/", ""));
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -98,8 +112,11 @@ public class ComputerUtil {
|
|
// continue;
|
|
// continue;
|
|
// }
|
|
// }
|
|
if(fileJson.getIntValue("clazz") == 5 ){
|
|
if(fileJson.getIntValue("clazz") == 5 ){
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
|
- projectNum+ File.separator + fileName);
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ "images/images"+ projectNum+ File.separator + fileName);
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ imgPath+ fileName);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -108,8 +125,11 @@ public class ComputerUtil {
|
|
if(fileName.contains("/4k_")){
|
|
if(fileName.contains("/4k_")){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
|
- projectNum+ File.separator + fileName);
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ "images/images"+ projectNum+ File.separator + fileName);
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ imgPath + fileName);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -127,25 +147,37 @@ public class ComputerUtil {
|
|
"azz") == 12){
|
|
"azz") == 12){
|
|
map.put(path + File.separator + "results" + File.separator+ fileName,"video/video"+
|
|
map.put(path + File.separator + "results" + File.separator+ fileName,"video/video"+
|
|
projectNum+ File.separator + fileName.replace("videos/", ""));
|
|
projectNum+ File.separator + fileName.replace("videos/", ""));
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ videosPath+ fileName.replace("videos/", ""));
|
|
|
|
|
|
if(fileName.contains(".mp4")){
|
|
if(fileName.contains(".mp4")){
|
|
// CreateObjUtil.mp4ToFlv(path + File.separator + "results" + File.separator+ fileName,
|
|
// CreateObjUtil.mp4ToFlv(path + File.separator + "results" + File.separator+ fileName,
|
|
// path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"));
|
|
// path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"));
|
|
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"),"video/video"+
|
|
|
|
- projectNum+ File.separator + fileName.replace("videos/", "").replace("mp4", "flv"));
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"),
|
|
|
|
+ "video/video"+ projectNum+ File.separator + fileName.replace("videos/", "").replace("mp4", "flv"));
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"),
|
|
|
|
+ videosPath+ fileName.replace("videos/", "").replace("mp4", "flv"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//2048的模型和贴图
|
|
//2048的模型和贴图
|
|
if(fileJson.getIntValue("clazz") == 16){
|
|
if(fileJson.getIntValue("clazz") == 16){
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"data/data"+
|
|
|
|
- projectNum+ File.separator + fileName);
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ "data/data"+ projectNum+ File.separator + fileName);
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ dataPath + fileName);
|
|
}
|
|
}
|
|
|
|
|
|
if(fileJson.getIntValue("clazz") == 18){
|
|
if(fileJson.getIntValue("clazz") == 18){
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
|
- projectNum+ File.separator + fileName);
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ "images/images"+ projectNum+ File.separator + fileName);
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator+ fileName,
|
|
|
|
+ imgPath + fileName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -157,14 +189,25 @@ public class ComputerUtil {
|
|
CreateObjUtil.convertTxtToDam( path + File.separator + "results" + File.separator+meshfix, path + File.separator + "results" +File.separator+ ConstantFileName.modelUUID+"_50k2.dam");
|
|
CreateObjUtil.convertTxtToDam( path + File.separator + "results" + File.separator+meshfix, path + File.separator + "results" +File.separator+ ConstantFileName.modelUUID+"_50k2.dam");
|
|
CreateObjUtil.convertDamToLzma2(path + File.separator + "results");
|
|
CreateObjUtil.convertDamToLzma2(path + File.separator + "results");
|
|
CreateObjUtil.convertTxtToDam( path + File.separator + "results" +File.separator+meshfix, path + File.separator + "results" + File.separator+ConstantFileName.modelUUID+"_50k2.dam");
|
|
CreateObjUtil.convertTxtToDam( path + File.separator + "results" +File.separator+meshfix, path + File.separator + "results" + File.separator+ConstantFileName.modelUUID+"_50k2.dam");
|
|
- map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam.lzma", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k2.dam.lzma");
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k2.dam");
|
|
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam.lzma",
|
|
|
|
+ "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k2.dam.lzma");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam",
|
|
|
|
+ "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k2.dam");
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam.lzma",
|
|
|
|
+ imgPath+ConstantFileName.modelUUID+"_50k2.dam.lzma");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam",
|
|
|
|
+ imgPath+ConstantFileName.modelUUID+"_50k2.dam");
|
|
}
|
|
}
|
|
//8目相机有两个vision.txt因此第二个叫vision2.txt
|
|
//8目相机有两个vision.txt因此第二个叫vision2.txt
|
|
CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
|
|
CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
|
|
if(vision2){
|
|
if(vision2){
|
|
CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision2.txt",path + File.separator + "results" +File.separator+"vision2.modeldata");
|
|
CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision2.txt",path + File.separator + "results" +File.separator+"vision2.modeldata");
|
|
- map.put(path + File.separator + "results" +File.separator+"vision2.modeldata", "images/images"+projectNum+"/"+"vision2.modeldata");
|
|
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"vision2.modeldata",
|
|
|
|
+ "images/images"+projectNum+"/"+"vision2.modeldata");
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"vision2.modeldata",
|
|
|
|
+ imgPath+"vision2.modeldata");
|
|
}else {
|
|
}else {
|
|
CreateObjUtil.convertTxtToVisionmodeldataCommon(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
|
|
CreateObjUtil.convertTxtToVisionmodeldataCommon(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
|
|
}
|
|
}
|
|
@@ -176,9 +219,19 @@ public class ComputerUtil {
|
|
Thread.sleep(60000);
|
|
Thread.sleep(60000);
|
|
}
|
|
}
|
|
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+"vision.modeldata", "images/images"+projectNum+"/"+"vision.modeldata");
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam.lzma");
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam");
|
|
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"vision.modeldata",
|
|
|
|
+ "images/images"+projectNum+"/"+"vision.modeldata");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma",
|
|
|
|
+ "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam.lzma");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam",
|
|
|
|
+ "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam");
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"vision.modeldata",
|
|
|
|
+ imgPath+"vision.modeldata");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma",
|
|
|
|
+ imgPath+ConstantFileName.modelUUID+"_50k.dam.lzma");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam",
|
|
|
|
+ imgPath+ConstantFileName.modelUUID+"_50k.dam");
|
|
|
|
|
|
file = new File(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum);
|
|
file = new File(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum);
|
|
if(!file.exists())
|
|
if(!file.exists())
|
|
@@ -193,12 +246,22 @@ public class ComputerUtil {
|
|
map.put(path + File.separator + "results" +File.separator+"floorplan.json","data/data"+projectNum+"/floor.json");
|
|
map.put(path + File.separator + "results" +File.separator+"floorplan.json","data/data"+projectNum+"/floor.json");
|
|
// map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json","data/data"+projectNum+"/house_floor.json");
|
|
// map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json","data/data"+projectNum+"/house_floor.json");
|
|
map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json","data/data"+projectNum+"/floorplan_cad.json");
|
|
map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json","data/data"+projectNum+"/floorplan_cad.json");
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"floor.json",
|
|
|
|
+ dataPath+"floor.json");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"floorplan.json",
|
|
|
|
+ dataPath+"floor.json");
|
|
|
|
+ map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json",
|
|
|
|
+ dataPath+"floorplan_cad.json");
|
|
log.info("准备上传文件到oss:"+projectNum);
|
|
log.info("准备上传文件到oss:"+projectNum);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Map<String,String> computerRebuildVideo(String projectNum, String path) throws Exception{
|
|
public static Map<String,String> computerRebuildVideo(String projectNum, String path) throws Exception{
|
|
|
|
+
|
|
|
|
+ String videosPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum); //新版本文件路径
|
|
|
|
+
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
path = path.replace("//", "/");
|
|
path = path.replace("//", "/");
|
|
|
|
|
|
@@ -239,13 +302,19 @@ public class ComputerUtil {
|
|
//video视频文件或封面图
|
|
//video视频文件或封面图
|
|
if (fileJson.getIntValue("clazz") == 20) {
|
|
if (fileJson.getIntValue("clazz") == 20) {
|
|
if (fileName.contains(".flv")) {
|
|
if (fileName.contains(".flv")) {
|
|
- map.put(path + File.separator + "results" + File.separator + fileName, "video/video" +
|
|
|
|
- projectNum + File.separator + fileName.replace("videos/", ""));
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator + fileName,
|
|
|
|
+ "video/video" + projectNum + File.separator + fileName.replace("videos/", ""));
|
|
|
|
+ //todo 待删除oldPath
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator + fileName,
|
|
|
|
+ videosPath + fileName.replace("videos/", ""));
|
|
}
|
|
}
|
|
|
|
|
|
if (fileName.contains(".mp4")) {
|
|
if (fileName.contains(".mp4")) {
|
|
- map.put(path + File.separator + "results" + File.separator + fileName, "video/video" +
|
|
|
|
- projectNum + File.separator + fileName.replace("videos/", ""));
|
|
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator + fileName,
|
|
|
|
+ "video/video" + projectNum + File.separator + fileName.replace("videos/", ""));
|
|
|
|
+
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator + fileName,
|
|
|
|
+ videosPath+ fileName.replace("videos/", ""));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|