Quellcode durchsuchen

Merge branch 'release-swsx' into test

# Conflicts:
#	src/main/java/com/fdkankan/modeling/receiver/RabbitMqListener.java
dengsixing vor 4 Wochen
Ursprung
Commit
aeee8306ff
1 geänderte Dateien mit 26 neuen und 0 gelöschten Zeilen
  1. 26 0
      src/main/java/com/fdkankan/modeling/receiver/RabbitMqListener.java

+ 26 - 0
src/main/java/com/fdkankan/modeling/receiver/RabbitMqListener.java

@@ -328,6 +328,32 @@ public class RabbitMqListener {
         }
     }
 
+    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 ModelingBuildStatus buildScene4E57(BuildSceneCallMessage message, BuildSceneResultBean buildSceneResult) throws Exception{
         //如果mq生产者在消息体中设置了结算结果mq队列名,就发到这个队列,否则就发送到默认队列
         String path = message.getPath();