|
@@ -290,8 +290,8 @@ public class RunBuild {
|
|
|
|
|
|
FileUtils.copyFile(path + "/extras/mesh.obj", path + "/extras/copy-mesh.obj", true);
|
|
|
|
|
|
- OkHttpUtils.httpGet(maxObjUrl + "objToObj?inObj=" + path + "/extras/copy-mesh.obj" +
|
|
|
- "&outObj=" + path + "/extras/mesh.obj" + "&r=40");
|
|
|
+// OkHttpUtils.httpGet(maxObjUrl + "objToObj?inObj=" + path + "/extras/copy-mesh.obj" +
|
|
|
+// "&outObj=" + path + "/extras/mesh.obj" + "&r=40");
|
|
|
|
|
|
JSONObject dataJson = new JSONObject();
|
|
|
dataJson.put("obj2txt", true);
|
|
@@ -370,140 +370,140 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
private void lightBuild(String data){
|
|
|
- String[] datas = data.split(":;");
|
|
|
- String vrNum = datas[0];
|
|
|
- String sceneNum = datas[1];
|
|
|
- String type = datas[2];
|
|
|
- String dateType = "";
|
|
|
- String ratio = "";
|
|
|
- String taskId = "";
|
|
|
- String quality = "0";
|
|
|
- String buildType = "light";
|
|
|
- if(datas.length >= 4){
|
|
|
- dateType = datas[3];
|
|
|
- }
|
|
|
- if(datas.length >= 5){
|
|
|
- ratio = datas[4];
|
|
|
- }
|
|
|
- if(datas.length >= 6){
|
|
|
- taskId = datas[5];
|
|
|
- }
|
|
|
- if(datas.length >= 7){
|
|
|
- quality = datas[6];
|
|
|
- }
|
|
|
- if(datas.length >= 8){
|
|
|
- buildType = datas[7];
|
|
|
- }
|
|
|
+ String[] datas = data.split(":;");
|
|
|
+ String vrNum = datas[0];
|
|
|
+ String sceneNum = datas[1];
|
|
|
+ String type = datas[2];
|
|
|
+ String dateType = "";
|
|
|
+ String ratio = "";
|
|
|
+ String taskId = "";
|
|
|
+ String quality = "0";
|
|
|
+ String buildType = "light";
|
|
|
+ if(datas.length >= 4){
|
|
|
+ dateType = datas[3];
|
|
|
+ }
|
|
|
+ if(datas.length >= 5){
|
|
|
+ ratio = datas[4];
|
|
|
+ }
|
|
|
+ if(datas.length >= 6){
|
|
|
+ taskId = datas[5];
|
|
|
+ }
|
|
|
+ if(datas.length >= 7){
|
|
|
+ quality = datas[6];
|
|
|
+ }
|
|
|
+ if(datas.length >= 8){
|
|
|
+ buildType = datas[7];
|
|
|
+ }
|
|
|
|
|
|
- SceneStyleEntity sceneStyleEntity = null;
|
|
|
+ SceneStyleEntity sceneStyleEntity = null;
|
|
|
|
|
|
- Condition condition = new Condition(SceneStyleEntity.class);
|
|
|
- condition.and().andEqualTo("styleNum", vrNum);
|
|
|
- List<SceneStyleEntity> list = sceneStyleService.findAll(condition);
|
|
|
- if(list != null && list.size() > 0) {
|
|
|
- sceneStyleEntity = list.get(0);
|
|
|
- }else {
|
|
|
- log.info("场景不存在,出现异常");
|
|
|
- return;
|
|
|
- }
|
|
|
+ Condition condition = new Condition(SceneStyleEntity.class);
|
|
|
+ condition.and().andEqualTo("styleNum", vrNum);
|
|
|
+ List<SceneStyleEntity> list = sceneStyleService.findAll(condition);
|
|
|
+ if(list != null && list.size() > 0) {
|
|
|
+ sceneStyleEntity = list.get(0);
|
|
|
+ }else {
|
|
|
+ log.info("场景不存在,出现异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- SceneStyleEntity updateSceneStyleEntity = new SceneStyleEntity();
|
|
|
- updateSceneStyleEntity.setId(sceneStyleEntity.getId());
|
|
|
+ SceneStyleEntity updateSceneStyleEntity = new SceneStyleEntity();
|
|
|
+ updateSceneStyleEntity.setId(sceneStyleEntity.getId());
|
|
|
|
|
|
- try{
|
|
|
- // run方法具体重写
|
|
|
- log.info("查询计算服务器状态");
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
+ try{
|
|
|
+ // run方法具体重写
|
|
|
+ log.info("查询计算服务器状态");
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
// boolean ready = false;
|
|
|
- if("".equals(dateType)){
|
|
|
- dateType = "day";
|
|
|
- }
|
|
|
-
|
|
|
- log.info("调用计算api");
|
|
|
- jsonObject.put("name", vrNum);
|
|
|
- jsonObject.put("taskType", buildType);
|
|
|
- jsonObject.put("map", dateType);
|
|
|
- jsonObject.put("resolution", Integer.parseInt(type));
|
|
|
- jsonObject.put("ratio", ratio);
|
|
|
- jsonObject.put("taskId", taskId);
|
|
|
- jsonObject.put("quality", Integer.parseInt(quality));
|
|
|
- int num[] = new int[1];
|
|
|
- num[0] = -1;
|
|
|
- jsonObject.put("ids", num);
|
|
|
-
|
|
|
- //调用pro之前等待一秒,需要清理缓存
|
|
|
- Thread.sleep(1000L);
|
|
|
- while (true){
|
|
|
- String buildResult = OkHttpUtils.httpPostJson(lightBuildUrl + "pro", jsonObject.toJSONString());
|
|
|
- JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
-
|
|
|
- if("isBusy".equals(buildJson.getString("msg"))){
|
|
|
- Thread.sleep(2000L);
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- if("error".equals(buildJson.getString("state"))){
|
|
|
- FileUtils.writeFile(buildPath + "Input/" + vrNum + buildType + "/error-pro.json", buildJson.toJSONString());
|
|
|
- throw new RuntimeException(vrNum + ":light方式pro接口返回error错误");
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- //等待3秒后请求check
|
|
|
- Thread.sleep(3000L);
|
|
|
+ if("".equals(dateType)){
|
|
|
+ dateType = "day";
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("调用计算api");
|
|
|
+ jsonObject.put("name", vrNum);
|
|
|
+ jsonObject.put("taskType", buildType);
|
|
|
+ jsonObject.put("map", dateType);
|
|
|
+ jsonObject.put("resolution", Integer.parseInt(type));
|
|
|
+ jsonObject.put("ratio", ratio);
|
|
|
+ jsonObject.put("taskId", taskId);
|
|
|
+ jsonObject.put("quality", Integer.parseInt(quality));
|
|
|
+ int num[] = new int[1];
|
|
|
+ num[0] = -1;
|
|
|
+ jsonObject.put("ids", num);
|
|
|
+
|
|
|
+ //调用pro之前等待一秒,需要清理缓存
|
|
|
+ Thread.sleep(1000L);
|
|
|
+ while (true){
|
|
|
+ String buildResult = OkHttpUtils.httpPostJson(lightBuildUrl + "pro", jsonObject.toJSONString());
|
|
|
+ JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
+
|
|
|
+ if("isBusy".equals(buildJson.getString("msg"))){
|
|
|
+ Thread.sleep(2000L);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if("error".equals(buildJson.getString("state"))){
|
|
|
+ FileUtils.writeFile(buildPath + "Input/" + vrNum + buildType + "/error-pro.json", buildJson.toJSONString());
|
|
|
+ throw new RuntimeException(vrNum + ":light方式pro接口返回error错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //等待3秒后请求check
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
|
|
// boolean uploadObj = true;
|
|
|
- //是否计算结束
|
|
|
- boolean over = false;
|
|
|
+ //是否计算结束
|
|
|
+ boolean over = false;
|
|
|
|
|
|
- jsonObject = new JSONObject();
|
|
|
- jsonObject.put("name", vrNum);
|
|
|
- jsonObject.put("taskType", buildType);
|
|
|
- jsonObject.put("taskId", taskId);
|
|
|
- jsonObject.put("ratio", ratio);
|
|
|
- while (true){
|
|
|
- String checkResult = OkHttpUtils.httpPostJson(lightBuildUrl + "check", jsonObject.toJSONString());
|
|
|
- JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
+ jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("name", vrNum);
|
|
|
+ jsonObject.put("taskType", buildType);
|
|
|
+ jsonObject.put("taskId", taskId);
|
|
|
+ jsonObject.put("ratio", ratio);
|
|
|
+ while (true){
|
|
|
+ String checkResult = OkHttpUtils.httpPostJson(lightBuildUrl + "check", jsonObject.toJSONString());
|
|
|
+ JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
- JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
+ JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
|
|
|
- if(checkArray.size() == 0){
|
|
|
- FileUtils.writeFile(buildPath + "Input/" + vrNum + buildType + "/error-check.json", checkJson.toJSONString());
|
|
|
- throw new RuntimeException(vrNum + ":light方式check接口返回error错误");
|
|
|
- }
|
|
|
+ if(checkArray.size() == 0){
|
|
|
+ FileUtils.writeFile(buildPath + "Input/" + vrNum + buildType + "/error-check.json", checkJson.toJSONString());
|
|
|
+ throw new RuntimeException(vrNum + ":light方式check接口返回error错误");
|
|
|
+ }
|
|
|
|
|
|
- for(int i = 0, len = checkArray.size(); i < len; i++){
|
|
|
- JSONObject objectJson = checkArray.getJSONObject(i);
|
|
|
+ for(int i = 0, len = checkArray.size(); i < len; i++){
|
|
|
+ JSONObject objectJson = checkArray.getJSONObject(i);
|
|
|
|
|
|
// if(uploadObj && objectJson.containsKey("simpleModel") && "done".equals(objectJson.getString("simpleModel"))){
|
|
|
// uploadObjData(vrNum, sceneNum);
|
|
|
// uploadObj = false;
|
|
|
// }
|
|
|
|
|
|
- if("error".equals(objectJson.getString("state"))){
|
|
|
- FileUtils.writeFile(buildPath + "Input/" + vrNum + buildType + "/error-check.json", checkJson.toJSONString());
|
|
|
- throw new RuntimeException(vrNum + ":light方式check接口返回error错误");
|
|
|
- }
|
|
|
-
|
|
|
- if(objectJson.containsKey("state") && ("".equals(objectJson.getString("state")) ||
|
|
|
- "done".equals(objectJson.getString("state")) )){
|
|
|
- over = true;
|
|
|
- }
|
|
|
-
|
|
|
- if(objectJson.containsKey("progress")){
|
|
|
- SceneLightEntity sceneLightEntity = new SceneLightEntity();
|
|
|
- sceneLightEntity.setId(Long.valueOf(taskId));
|
|
|
- sceneLightEntity.setProgress(objectJson.getInteger("progress"));
|
|
|
- sceneLightService.update(sceneLightEntity);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(over){
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- Thread.sleep(500L);
|
|
|
+ if("error".equals(objectJson.getString("state"))){
|
|
|
+ FileUtils.writeFile(buildPath + "Input/" + vrNum + buildType + "/error-check.json", checkJson.toJSONString());
|
|
|
+ throw new RuntimeException(vrNum + ":light方式check接口返回error错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(objectJson.containsKey("state") && ("".equals(objectJson.getString("state")) ||
|
|
|
+ "done".equals(objectJson.getString("state")) )){
|
|
|
+ over = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(objectJson.containsKey("progress")){
|
|
|
+ SceneLightEntity sceneLightEntity = new SceneLightEntity();
|
|
|
+ sceneLightEntity.setId(Long.valueOf(taskId));
|
|
|
+ sceneLightEntity.setProgress(objectJson.getInteger("progress"));
|
|
|
+ sceneLightService.update(sceneLightEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(over){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Thread.sleep(500L);
|
|
|
}
|
|
|
|
|
|
// File outFiles = new File(buildPath.replace("Input", "Output") + vrNum + File.separator);
|