|
@@ -1113,59 +1113,54 @@ public class RunBuild {
|
|
|
* @throws InterruptedException
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- private void checkResultJson(String fileId, String filePath, JSONObject jsonObject, String modelUploadId) {
|
|
|
+ private void checkResultJson(String fileId, String filePath, JSONObject jsonObject, String modelUploadId) throws InterruptedException, IOException {
|
|
|
// 循环检查渲染结果的次数
|
|
|
int times = 0;
|
|
|
boolean over = false;
|
|
|
- try {
|
|
|
- while (true) {
|
|
|
- String checkResult = OkHttpUtils.httpPostJson(modelBuildUrl + "check", jsonObject.toJSONString());
|
|
|
- log.info("checkResult的长度为-{}", checkResult.length());
|
|
|
+ while (true) {
|
|
|
+ String checkResult = OkHttpUtils.httpPostJson(modelBuildUrl + "check", jsonObject.toJSONString());
|
|
|
+ log.info("checkResult的长度为-{}", checkResult.length());
|
|
|
|
|
|
- JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
+ JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
- JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
+ JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
|
|
|
- log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
+ log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
|
|
|
- if (checkArray.size() == 0) {
|
|
|
+ if (checkArray.size() == 0) {
|
|
|
+ FileUtils.writeFile(filePath + "/error-check-model.json", checkJson.toJSONString());
|
|
|
+ throw new RuntimeException(fileId + ":datafactory方式check接口返回error错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0, len = checkArray.size(); i < len; i++) {
|
|
|
+ JSONObject objectJson = checkArray.getJSONObject(i);
|
|
|
+
|
|
|
+ if ("error".equals(objectJson.getString("state"))) {
|
|
|
FileUtils.writeFile(filePath + "/error-check-model.json", checkJson.toJSONString());
|
|
|
throw new RuntimeException(fileId + ":datafactory方式check接口返回error错误");
|
|
|
}
|
|
|
|
|
|
- for (int i = 0, len = checkArray.size(); i < len; i++) {
|
|
|
- JSONObject objectJson = checkArray.getJSONObject(i);
|
|
|
-
|
|
|
- if ("error".equals(objectJson.getString("state"))) {
|
|
|
- FileUtils.writeFile(filePath + "/error-check-model.json", checkJson.toJSONString());
|
|
|
- throw new RuntimeException(fileId + ":datafactory方式check接口返回error错误");
|
|
|
- }
|
|
|
-
|
|
|
- if (objectJson.containsKey("state") && ("".equals(objectJson.getString("state")) ||
|
|
|
- "done".equals(objectJson.getString("state")))) {
|
|
|
- over = true;
|
|
|
- }
|
|
|
-
|
|
|
- if (objectJson.containsKey("progress")) {
|
|
|
- Integer progress = objectJson.getInteger("progress");
|
|
|
- log.info("第{}次获取上传进度,进度为{}%", times++, progress);
|
|
|
- ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
|
|
|
- modelUploadEntity.setId(Long.valueOf(modelUploadId));
|
|
|
- modelUploadEntity.setProgress(progress);
|
|
|
- modelUploadService.updateById(modelUploadEntity);
|
|
|
- }
|
|
|
-
|
|
|
+ if (objectJson.containsKey("state") && ("".equals(objectJson.getString("state")) ||
|
|
|
+ "done".equals(objectJson.getString("state")))) {
|
|
|
+ over = true;
|
|
|
}
|
|
|
- if (over) {
|
|
|
- break;
|
|
|
+
|
|
|
+ if (objectJson.containsKey("progress")) {
|
|
|
+ Integer progress = objectJson.getInteger("progress");
|
|
|
+ log.info("第{}次获取上传进度,进度为{}%", times++, progress);
|
|
|
+ ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
|
|
|
+ modelUploadEntity.setId(Long.valueOf(modelUploadId));
|
|
|
+ modelUploadEntity.setProgress(progress);
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
|
}
|
|
|
|
|
|
- Thread.sleep(1000L);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- log.info("循环检查3d渲染报错{}",e.getMessage());
|
|
|
|
|
|
+ if (over) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Thread.sleep(1000L);
|
|
|
}
|
|
|
}
|
|
|
|