|
@@ -2,10 +2,8 @@ package com.example.demo.listener;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
-import com.example.demo.constant.CodeConstant;
|
|
|
|
import com.example.demo.constant.ConstantFileName;
|
|
import com.example.demo.constant.ConstantFileName;
|
|
import com.example.demo.constant.ConstantFilePath;
|
|
import com.example.demo.constant.ConstantFilePath;
|
|
-import com.example.demo.constant.Variable;
|
|
|
|
import com.example.demo.entity.ModelUploadEntity;
|
|
import com.example.demo.entity.ModelUploadEntity;
|
|
import com.example.demo.entity.SceneLightEntity;
|
|
import com.example.demo.entity.SceneLightEntity;
|
|
import com.example.demo.entity.SceneStyleEntity;
|
|
import com.example.demo.entity.SceneStyleEntity;
|
|
@@ -23,7 +21,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import tk.mybatis.mapper.entity.Condition;
|
|
import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
-import javax.annotation.PostConstruct;
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -143,6 +140,8 @@ public class RunBuild {
|
|
String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
|
|
String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
|
|
JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
|
|
|
|
|
+ log.info("请求3d场景渲染接口获取接口数据-{}", buildJson);
|
|
|
|
+
|
|
if("isBusy".equals(buildJson.getString("msg"))){
|
|
if("isBusy".equals(buildJson.getString("msg"))){
|
|
Thread.sleep(2000L);
|
|
Thread.sleep(2000L);
|
|
continue;
|
|
continue;
|
|
@@ -167,10 +166,13 @@ public class RunBuild {
|
|
jsonObject = new JSONObject();
|
|
jsonObject = new JSONObject();
|
|
jsonObject.put("name", vrNum);
|
|
jsonObject.put("name", vrNum);
|
|
jsonObject.put("taskType", "all");
|
|
jsonObject.put("taskType", "all");
|
|
|
|
+ int times = 0;
|
|
while (true){
|
|
while (true){
|
|
String checkResult = OkHttpUtils.httpPostJson(buildUrl + "check", jsonObject.toJSONString());
|
|
String checkResult = OkHttpUtils.httpPostJson(buildUrl + "check", jsonObject.toJSONString());
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
|
|
+ log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
|
+
|
|
JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
|
|
|
if(checkArray.size() == 0){
|
|
if(checkArray.size() == 0){
|
|
@@ -197,7 +199,9 @@ public class RunBuild {
|
|
}
|
|
}
|
|
|
|
|
|
if(objectJson.containsKey("progress")){
|
|
if(objectJson.containsKey("progress")){
|
|
- updateSceneStyleEntity.setProgress(objectJson.getInteger("progress"));
|
|
|
|
|
|
+ Integer progress = objectJson.getInteger("progress");
|
|
|
|
+ log.info("第{}次获取上传进度,进度为{}%", times++, progress);
|
|
|
|
+ updateSceneStyleEntity.setProgress(progress);
|
|
updateSceneStyleEntity.setUpdateTime(new Date());
|
|
updateSceneStyleEntity.setUpdateTime(new Date());
|
|
sceneStyleService.update(updateSceneStyleEntity);
|
|
sceneStyleService.update(updateSceneStyleEntity);
|
|
}
|
|
}
|
|
@@ -268,9 +272,9 @@ public class RunBuild {
|
|
HttpRequestorUtil.doPost(mainUrl + "api/scene/updateStatusByScene", map1);
|
|
HttpRequestorUtil.doPost(mainUrl + "api/scene/updateStatusByScene", map1);
|
|
log.info("计算失败--修改场景状态完成");
|
|
log.info("计算失败--修改场景状态完成");
|
|
}catch (Exception ex){
|
|
}catch (Exception ex){
|
|
- ex.printStackTrace();
|
|
|
|
|
|
+ log.error("渲染失败-{}", e);
|
|
}
|
|
}
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error("渲染失败-{}", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -464,6 +468,7 @@ public class RunBuild {
|
|
jsonObject.put("taskType", buildType);
|
|
jsonObject.put("taskType", buildType);
|
|
jsonObject.put("taskId", taskId);
|
|
jsonObject.put("taskId", taskId);
|
|
jsonObject.put("ratio", ratio);
|
|
jsonObject.put("ratio", ratio);
|
|
|
|
+ int times = 0;
|
|
while (true){
|
|
while (true){
|
|
String checkResult = OkHttpUtils.httpPostJson(lightBuildUrl + "check", jsonObject.toJSONString());
|
|
String checkResult = OkHttpUtils.httpPostJson(lightBuildUrl + "check", jsonObject.toJSONString());
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
@@ -496,9 +501,11 @@ public class RunBuild {
|
|
}
|
|
}
|
|
|
|
|
|
if(objectJson.containsKey("progress")){
|
|
if(objectJson.containsKey("progress")){
|
|
|
|
+ Integer progress = objectJson.getInteger("progress");
|
|
|
|
+ log.info("第{}次获取上传进度,进度为{}%", times++, progress);
|
|
SceneLightEntity sceneLightEntity = new SceneLightEntity();
|
|
SceneLightEntity sceneLightEntity = new SceneLightEntity();
|
|
sceneLightEntity.setId(Long.valueOf(taskId));
|
|
sceneLightEntity.setId(Long.valueOf(taskId));
|
|
- sceneLightEntity.setProgress(objectJson.getInteger("progress"));
|
|
|
|
|
|
+ sceneLightEntity.setProgress(progress);
|
|
sceneLightService.update(sceneLightEntity);
|
|
sceneLightService.update(sceneLightEntity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -574,7 +581,6 @@ public class RunBuild {
|
|
uploadToOssUtil.download("images/images" + vrNum + "/tiles/pano/" + taskId +"/pano_sphere.jpg", panoPath + "/pano_sphere.jpg");
|
|
uploadToOssUtil.download("images/images" + vrNum + "/tiles/pano/" + taskId +"/pano_sphere.jpg", panoPath + "/pano_sphere.jpg");
|
|
CreateObjUtil.panoCutaway(panoPath + "/pano_sphere.jpg");
|
|
CreateObjUtil.panoCutaway(panoPath + "/pano_sphere.jpg");
|
|
|
|
|
|
-
|
|
|
|
if(new File(panoPath + "/vtour").exists()){
|
|
if(new File(panoPath + "/vtour").exists()){
|
|
CreateObjUtil.ossUploadCommon(panoPath + "/vtour", "4dkankan/images/images" + vrNum + "/tiles/pano/" + taskId + "/vtour");
|
|
CreateObjUtil.ossUploadCommon(panoPath + "/vtour", "4dkankan/images/images" + vrNum + "/tiles/pano/" + taskId + "/vtour");
|
|
sceneLightEntity.setFilePath("https://4dkk.4dage.com/images/images" + vrNum + "/tiles/pano/" + taskId + "/vtour/tour.html");
|
|
sceneLightEntity.setFilePath("https://4dkk.4dage.com/images/images" + vrNum + "/tiles/pano/" + taskId + "/vtour/tour.html");
|