|
@@ -256,7 +256,12 @@ public class RabbitMqListener {
|
|
buildSceneResult.setPath(path);
|
|
buildSceneResult.setPath(path);
|
|
|
|
|
|
//调用算法
|
|
//调用算法
|
|
- ComputerUtil.computer(num, path, buildType);
|
|
|
|
|
|
+ //todo 算法部调试用,完善后去掉
|
|
|
|
+ if(num.startsWith("SX-")){
|
|
|
|
+ this.computer(num, path);
|
|
|
|
+ }else{
|
|
|
|
+ ComputerUtil.computer(num, path, buildType);
|
|
|
|
+ }
|
|
|
|
|
|
// 检测计算结果文件是否有生成
|
|
// 检测计算结果文件是否有生成
|
|
String resultsPath = path + File.separator + "results" + File.separator;
|
|
String resultsPath = path + File.separator + "results" + File.separator;
|
|
@@ -297,6 +302,32 @@ public class RabbitMqListener {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ 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{
|
|
private ModelingBuildStatus buildScene4E57(BuildSceneCallMessage message, BuildSceneResultBean buildSceneResult) throws Exception{
|
|
//如果mq生产者在消息体中设置了结算结果mq队列名,就发到这个队列,否则就发送到默认队列
|
|
//如果mq生产者在消息体中设置了结算结果mq队列名,就发到这个队列,否则就发送到默认队列
|
|
String path = message.getPath();
|
|
String path = message.getPath();
|