Explorar o código

深巡格式e57下载

dengsixing hai 3 semanas
pai
achega
541a4df3b5

+ 37 - 2
src/main/java/com/fdkankan/modeling/receiver/RabbitMqListener.java

@@ -328,10 +328,19 @@ public class RabbitMqListener {
 
         String splitType = "SPLIT_V27";
         String skyboxType = "SKYBOX_V11";
+        if(message.getExt().get("splitType") != null){
+            splitType = (String)message.getExt().get("splitType");
+        }
 
         ComputerUtil.createProjectAndDataFile(path,num, splitType, skyboxType,null,null);
-        //计算模型并返回需要上传oss的文件集合
-        ComputerUtil.computer(num, path, "V3");
+
+        //调用算法
+        //todo 算法部调试用,完善后去掉
+        if(num.startsWith("SX-")){
+            this.computer(num, path);
+        }else{
+            ComputerUtil.computer(num, path, "V3");
+        }
 
         // 检测计算结果文件是否有生成
         String resultsPath = path + File.separator + "results" + File.separator;
@@ -344,6 +353,32 @@ public class RabbitMqListener {
         return ModelingBuildStatus.SUCCESS;
     }
 
+    public void computer(String projectNum, String path) throws Exception {
+        new HashMap();
+        path = path.replace("//", "/");
+        log.info("开始建模:" + projectNum);
+        String command = "sudo bash /home/ubuntu/bin_sx/Launcher.sh " + path;
+        CreateObjUtil.callshell(command);
+        log.info("计算完毕:" + command);
+        String uploadJsonPath = path + File.separator + "results" + File.separator + "upload.json";
+        String uploadData = FileUtils.readFile(uploadJsonPath);
+        log.info("upload.json 文件路径:{}, 内容:{}", uploadJsonPath, uploadData);
+        JSONObject uploadJson = null;
+        JSONArray array = null;
+        if (uploadData != null) {
+            uploadJson = JSONObject.parseObject(uploadData);
+            array = uploadJson.getJSONArray("upload");
+        }
+
+        if (array == null) {
+            String instanceId = FileUtils.readFile("/opt/hosts/hosts.txt");
+            FileUtils.writeFile(path + File.separator + "javaErrorNow.log", instanceId + ":计算错误!");
+            Thread.sleep(10000L);
+            FileUtils.writeFile(path + File.separator + "javaError.log", instanceId + ":计算错误!");
+            throw new Exception("upload.json数据出错");
+        }
+    }
+
     private LinkedHashMap<Integer, Boolean> detFloorplan(String path) throws Exception {
         LinkedHashMap<Integer, Boolean> result = new LinkedHashMap<>();
         String workDir = path + "/detFloorplan/";