|
@@ -63,7 +63,12 @@ public class Model3dBuild {
|
|
|
ModelUploadOfflineEntity modelUploadOfflineEntity = modelUploadOfflineService.findById(message.getPayload().getEntityId());
|
|
|
try {
|
|
|
if (token != null) {
|
|
|
- modelBiz3dHandler(message.getPayload(), modelUploadOfflineEntity);
|
|
|
+ RequestQueue payload = message.getPayload();
|
|
|
+ if (payload.getTaskType().equalsIgnoreCase("localDataUpload")){
|
|
|
+ modelBiz3dUploadHandler(message.getPayload(), modelUploadOfflineEntity);
|
|
|
+ }else if(payload.getTaskType().equalsIgnoreCase("exportMiniModel")) {
|
|
|
+ modelBiz3dHandler(message.getPayload(), modelUploadOfflineEntity);
|
|
|
+ }
|
|
|
}
|
|
|
} catch (InterruptedException e) {
|
|
|
modelUploadOfflineEntity.setStatus(-1);
|
|
@@ -75,7 +80,6 @@ public class Model3dBuild {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
public void modelBiz3dHandler(RequestQueue str, ModelUploadOfflineEntity modelUploadOfflineEntity) throws InterruptedException {
|
|
|
|
|
|
while (true) {
|
|
@@ -101,6 +105,89 @@ public class Model3dBuild {
|
|
|
final TimeInterval timer = new TimeInterval();
|
|
|
timer.start(str.getName());
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("name", str.getName());
|
|
|
+ jsonObject.put("taskType", "localDataUpload");
|
|
|
+ while (true) {
|
|
|
+ long l = timer.intervalMinute(str.getName());
|
|
|
+ if (l>1){
|
|
|
+ log.info("渲染超时--{},={}",str.getName(),l);
|
|
|
+ over = true;
|
|
|
+ modelUploadOfflineEntity.setStatus(-1);
|
|
|
+ modelUploadOfflineService.updateById(modelUploadOfflineEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ String checkResult = OkHttpUtils.httpPostJson(buildUrl + "check", jsonObject.toJSONString());
|
|
|
+ Thread.sleep(2000L);
|
|
|
+ JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
+
|
|
|
+ Model3dBuild.log.info("str.getName()-{}, 请求检查3d场景渲染接口获取接口数据-{}", str.getName(), checkJson);
|
|
|
+
|
|
|
+ JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
+
|
|
|
+ if (checkArray.size() == 0) {
|
|
|
+ throw new RuntimeException(str.getName() + ":build方式pro接口返回error错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0, len = checkArray.size(); i < len; i++) {
|
|
|
+ JSONObject objectJson = checkArray.getJSONObject(i);
|
|
|
+
|
|
|
+ if ("error".equals(objectJson.getString("state"))) {
|
|
|
+ modelUploadOfflineEntity.setStatus(-1);
|
|
|
+ modelUploadOfflineService.updateById(modelUploadOfflineEntity);
|
|
|
+ throw new RuntimeException(str.getName() + ":build方式pro接口返回error错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (objectJson.containsKey("state") && ("".equals(objectJson.getString("state")) ||
|
|
|
+ "done".equals(objectJson.getString("state")) || "error".equals(objectJson.getString("state")))) {
|
|
|
+ over = true;
|
|
|
+ //完成 存库。。。。。name: XXXXX 完成状态 进度
|
|
|
+ //id ,name status 1完成-2未完成 3-错误 progress
|
|
|
+ modelUploadOfflineEntity.setStatus(1);
|
|
|
+ modelUploadOfflineService.updateById(modelUploadOfflineEntity);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (objectJson.containsKey("progress")) {
|
|
|
+ Integer progress = objectJson.getInteger("progress");
|
|
|
+ modelUploadOfflineEntity.setProgress(progress);
|
|
|
+ modelUploadOfflineService.updateById(modelUploadOfflineEntity);
|
|
|
+ Model3dBuild.log.info("str.getName()-{}, 第{}次获取渲染进度,进度为{}%", str.getName(), times++, progress);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (over) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Thread.sleep(2000L);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ public void modelBiz3dUploadHandler(RequestQueue str, ModelUploadOfflineEntity modelUploadOfflineEntity) throws InterruptedException {
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", JSON.toJSONString(str));
|
|
|
+ JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
+
|
|
|
+ Model3dBuild.log.info("str.getName()-{}, 请求3d场景渲染接口获取接口数据-{}", str.getName(), buildJson);
|
|
|
+
|
|
|
+ if ("isBusy".equals(buildJson.getString("msg"))) {
|
|
|
+ Thread.sleep(2000L);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("error".equals(buildJson.getString("state"))) {
|
|
|
+ throw new RuntimeException(str.getName() + ":build方式pro接口返回error错误");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean over = false;
|
|
|
+ int times = 0;
|
|
|
+ //是否处理obj文件
|
|
|
+ final TimeInterval timer = new TimeInterval();
|
|
|
+ timer.start(str.getName());
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
// jsonObject.put("name", str.getName());
|
|
|
// jsonObject.put("taskType", "localDataUpload");
|
|
|
jsonObject.put("furnitureIDs", Arrays.asList(str.getName()));
|
|
@@ -118,12 +205,12 @@ public class Model3dBuild {
|
|
|
Thread.sleep(2000L);
|
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
- Model3dBuild.log.info("str.getName()-{}, 请求检查3d场景渲染接口获取接口数据-{}", str.getName(), checkJson);
|
|
|
+ Model3dBuild.log.info("str.getName()-{}, 请求检查3d场景上传检测接口获取接口数据-{}", str.getName(), checkJson);
|
|
|
|
|
|
Integer code = checkJson.getInteger("code");
|
|
|
|
|
|
if (code != 1) {
|
|
|
- throw new RuntimeException(str.getName() + ":build方式pro接口返回error错误");
|
|
|
+ throw new RuntimeException(str.getName() + ":build方式GetUploadFur接口返回error错误");
|
|
|
}
|
|
|
JSONObject data = checkJson.getJSONObject("data");
|
|
|
|
|
@@ -135,7 +222,7 @@ public class Model3dBuild {
|
|
|
if ("error".equals(objectJson.getString("state"))) {
|
|
|
modelUploadOfflineEntity.setStatus(-1);
|
|
|
modelUploadOfflineService.updateById(modelUploadOfflineEntity);
|
|
|
- throw new RuntimeException(str.getName() + ":build方式pro接口返回error错误");
|
|
|
+ throw new RuntimeException(str.getName() + ":build方式GetUploadFur接口返回error错误");
|
|
|
}
|
|
|
|
|
|
if (objectJson.containsKey("state") && ("".equals(objectJson.getString("state")) ||
|
|
@@ -152,7 +239,7 @@ public class Model3dBuild {
|
|
|
Integer progress = objectJson.getInteger("progress");
|
|
|
modelUploadOfflineEntity.setProgress(progress);
|
|
|
modelUploadOfflineService.updateById(modelUploadOfflineEntity);
|
|
|
- Model3dBuild.log.info("str.getName()-{}, 第{}次获取渲染进度,进度为{}%", str.getName(), times++, progress);
|
|
|
+ Model3dBuild.log.info("str.getName()-{}, 第{}次获取上传进度,进度为{}%", str.getName(), times++, progress);
|
|
|
}
|
|
|
}
|
|
|
if (over) {
|