|
@@ -27,7 +27,7 @@ public class ComputerUtil {
|
|
|
|
|
|
private static Logger log = LoggerFactory.getLogger(ComputerUtil.class.getName());
|
|
private static Logger log = LoggerFactory.getLogger(ComputerUtil.class.getName());
|
|
|
|
|
|
- public static Map<String,String> computer(String projectNum, String path, String buildType) throws Exception{
|
|
|
|
|
|
+ public static void computer(String projectNum, String path, String buildType) throws Exception{
|
|
|
|
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
path = path.replace("//", "/");
|
|
path = path.replace("//", "/");
|
|
@@ -60,119 +60,6 @@ public class ComputerUtil {
|
|
FileUtils.writeFile(path + File.separator + "javaError.log", instanceId + ":计算错误!");
|
|
FileUtils.writeFile(path + File.separator + "javaError.log", instanceId + ":计算错误!");
|
|
throw new Exception("upload.json数据出错");
|
|
throw new Exception("upload.json数据出错");
|
|
}
|
|
}
|
|
- JSONObject fileJson = null;
|
|
|
|
- String fileName = "";
|
|
|
|
- for(int i = 0, len = array.size(); i < len; i++){
|
|
|
|
- fileJson = array.getJSONObject(i);
|
|
|
|
- fileName = fileJson.getString("file");
|
|
|
|
- //文件不存在抛出异常
|
|
|
|
- if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){
|
|
|
|
- throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //判断是否有vision2.txt
|
|
|
|
- if("vision2.txt".equals(fileName)){
|
|
|
|
- vision2 = true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //tex文件夹
|
|
|
|
- if(fileJson.getIntValue("clazz") == 2 ){
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+projectNum+"/"+ ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //high文件夹
|
|
|
|
- if(fileJson.getIntValue("clazz") == 3){
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+ projectNum+"/pan/high/"+ fileName.replace("high/", ""));
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- //low文件夹
|
|
|
|
- if(fileJson.getIntValue("clazz") == 4){
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+ projectNum+"/pan/low/"+ fileName.replace("low/", ""));
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(fileJson.getIntValue("clazz") == 5 ){
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+ projectNum+ File.separator + fileName);
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //tiles文件夹,亚马逊瓦片图
|
|
|
|
- if(fileJson.getIntValue("clazz") == 7 ){
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+ projectNum+ File.separator + fileName);
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //updown文件复制一份到ecs中并去掉换行符
|
|
|
|
- if(fileJson.getIntValue("clazz") == 10){
|
|
|
|
- // TODO: 2022/5/6 v3停机后需要删除-----------------------------------------------------------------------start
|
|
|
|
- String updown = FileUtils.readFile(path + File.separator + "results" +File.separator+ fileName);
|
|
|
|
- JSONObject updownJson = JSONObject.parseObject(updown);
|
|
|
|
- FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + projectNum +
|
|
|
|
- File.separator + fileName.replace("updown", "mapping"), updownJson.toString());
|
|
|
|
- // TODO: 2022/5/6 v3停机后需要删除-----------------------------------------------------------------------end
|
|
|
|
-
|
|
|
|
- String mappingOssPath = String.format(UploadFilePath.DATA_EDIT_PATH, projectNum) + fileName.replace("updown", "mapping");
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName, mappingOssPath);
|
|
|
|
-
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //video视频文件或封面图
|
|
|
|
- if(fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12){
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"video/video"+
|
|
|
|
- projectNum+ File.separator + fileName.replace("videos/", ""));
|
|
|
|
-
|
|
|
|
- if(fileName.contains(".mp4")){
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"),
|
|
|
|
- "video/video"+ projectNum+ File.separator + fileName.replace("videos/", "").replace("mp4", "flv"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //2048的模型和贴图
|
|
|
|
- if(fileJson.getIntValue("clazz") == 16){
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"data/data"+ projectNum+ File.separator + fileName);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(fileJson.getIntValue("clazz") == 18){
|
|
|
|
- map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+ projectNum+ File.separator + fileName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- CreateObjUtil.convertTxtToDam( path + File.separator + "results" + File.separator+"tex"+File.separator+"modeldata.txt", path + File.separator + "results" +File.separator+ ConstantFileName.modelUUID+"_50k.dam");
|
|
|
|
- CreateObjUtil.convertDamToLzma(path + File.separator + "results");
|
|
|
|
- CreateObjUtil.convertTxtToDam( path + File.separator + "results" +File.separator+"tex"+File.separator+"modeldata.txt", path + File.separator + "results" + File.separator+ConstantFileName.modelUUID+"_50k.dam");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
|
|
|
|
- map.put(path + File.separator + "results" +File.separator+"vision.txt","images/images"+projectNum+"/vision.txt");
|
|
|
|
- map.put(path + File.separator + "results" + File.separator + "vision.modeldata", "images/images" + projectNum + "/vision.modeldata");
|
|
|
|
-
|
|
|
|
- //8目相机有两个vision.txt因此第二个叫vision2.txt
|
|
|
|
- if(vision2){
|
|
|
|
- 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.txt","images/images"+projectNum+"/vision2.txt");
|
|
|
|
- }
|
|
|
|
- log.info("数据转换完成:"+projectNum);
|
|
|
|
-
|
|
|
|
- File file = new File(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma");
|
|
|
|
- while(!file.exists()){
|
|
|
|
- Thread.sleep(60000);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- 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");
|
|
|
|
-
|
|
|
|
- FileUtil.touch(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum);
|
|
|
|
-
|
|
|
|
- FileUtils.copyFile(path + File.separator + "results" +File.separator+"floorplan.json", ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum+File.separator+"floor.json", true);
|
|
|
|
- log.info("floor.json路径:"+ path + File.separator + "results" +File.separator+"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+"/floorplan_cad.json");
|
|
|
|
- log.info("准备上传文件到oss:"+projectNum);
|
|
|
|
- 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{
|