|
@@ -3,8 +3,6 @@ package com.fdkk.sxz.other.listener;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.file.FileReader;
|
|
|
-import cn.hutool.core.io.file.FileWriter;
|
|
|
-import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -15,10 +13,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fdkk.sxz.constant.ConstantFileName;
|
|
|
import com.fdkk.sxz.constant.ConstantFilePath;
|
|
|
import com.fdkk.sxz.entity.*;
|
|
|
-import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
|
|
|
import com.fdkk.sxz.other.mq.TopicRabbitConfig;
|
|
|
-import com.fdkk.sxz.webApi.service.*;
|
|
|
import com.fdkk.sxz.util.*;
|
|
|
+import com.fdkk.sxz.webApi.service.*;
|
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
@@ -30,9 +27,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.net.URI;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Created by Hb_zzZ on 2020/7/3.
|
|
@@ -86,18 +81,18 @@ public class RunBuild {
|
|
|
@RabbitHandler
|
|
|
@RabbitListener(queues = TopicRabbitConfig.CHANGE)
|
|
|
public void change(String str) {
|
|
|
- log.info("场景:" + str + ",开始计算");
|
|
|
+ RunBuild.log.info("场景:" + str + ",开始计算");
|
|
|
buildCopy(str);
|
|
|
}
|
|
|
|
|
|
@RabbitHandler
|
|
|
@RabbitListener(queues = TopicRabbitConfig.LIGHT)
|
|
|
public void light(String str) {
|
|
|
- if (str.contains("modelPreview")||str.contains("customFurniturePreview")) {
|
|
|
- log.info("模型:" + str + ",开始生成封面图");
|
|
|
+ if (str.contains("modelPreview") || str.contains("customFurniturePreview")) {
|
|
|
+ RunBuild.log.info("模型:" + str + ",开始生成封面图");
|
|
|
modelCreatThum(str);
|
|
|
} else {
|
|
|
- log.info("场景:" + str + ",开始灯光预览");
|
|
|
+ RunBuild.log.info("场景:" + str + ",开始灯光预览");
|
|
|
lightBuild(str);
|
|
|
}
|
|
|
}
|
|
@@ -105,7 +100,7 @@ public class RunBuild {
|
|
|
@RabbitHandler
|
|
|
@RabbitListener(queues = TopicRabbitConfig.MODEL)
|
|
|
public void model(String str) {
|
|
|
- log.info("模型转换:" + str);
|
|
|
+ RunBuild.log.info("模型转换:" + str);
|
|
|
modelBuild(str);
|
|
|
}
|
|
|
|
|
@@ -134,7 +129,7 @@ public class RunBuild {
|
|
|
if (list != null && list.size() > 0) {
|
|
|
sceneStyleEntity = list.get(0);
|
|
|
} else {
|
|
|
- log.info("场景不存在,出现异常");
|
|
|
+ RunBuild.log.info("场景不存在,出现异常");
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -142,14 +137,14 @@ public class RunBuild {
|
|
|
updateSceneStyleEntity.setId(sceneStyleEntity.getId());
|
|
|
try {
|
|
|
// run方法具体重写
|
|
|
- log.info("查询计算服务器状态");
|
|
|
+ RunBuild.log.info("查询计算服务器状态");
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
// boolean ready = false;
|
|
|
if ("".equals(dateType)) {
|
|
|
dateType = "day";
|
|
|
}
|
|
|
|
|
|
- log.info("调用计算api");
|
|
|
+ RunBuild.log.info("调用计算api");
|
|
|
jsonObject.put("name", vrNum);
|
|
|
jsonObject.put("taskType", "all");
|
|
|
jsonObject.put("map", dateType);
|
|
@@ -160,12 +155,12 @@ public class RunBuild {
|
|
|
|
|
|
//调用pro之前等待一秒,需要清理缓存
|
|
|
Thread.sleep(1000L);
|
|
|
- log.info("vrnum是-{}", vrNum);
|
|
|
+ RunBuild.log.info("vrnum是-{}", vrNum);
|
|
|
while (true) {
|
|
|
String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
|
|
|
JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
|
|
|
- log.info("vrNum-{}, 请求3d场景渲染接口获取接口数据-{}", vrNum, buildJson);
|
|
|
+ RunBuild.log.info("vrNum-{}, 请求3d场景渲染接口获取接口数据-{}", vrNum, buildJson);
|
|
|
|
|
|
if ("isBusy".equals(buildJson.getString("msg"))) {
|
|
|
Thread.sleep(2000L);
|
|
@@ -196,7 +191,7 @@ public class RunBuild {
|
|
|
String checkResult = OkHttpUtils.httpPostJson(buildUrl + "check", jsonObject.toJSONString());
|
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
- log.info("vrnum-{}, 请求检查3d场景渲染接口获取接口数据-{}", vrNum, checkJson);
|
|
|
+ RunBuild.log.info("vrnum-{}, 请求检查3d场景渲染接口获取接口数据-{}", vrNum, checkJson);
|
|
|
|
|
|
JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
|
|
@@ -210,13 +205,13 @@ public class RunBuild {
|
|
|
|
|
|
if (isCanDownLoad(uploadObj, objectJson, vrNum)) {
|
|
|
|
|
|
- log.info("在下载前先睡眠5秒-{}", vrNum);
|
|
|
+ RunBuild.log.info("在下载前先睡眠5秒-{}", vrNum);
|
|
|
// 由于阿里云资源上传有延时问题,所以需要延时一点时间再下载
|
|
|
Thread.sleep(5000L);
|
|
|
|
|
|
- log.info("上传obj文件,vrnum-{}, 开始时间-{}", vrNum, new Date());
|
|
|
+ RunBuild.log.info("上传obj文件,vrnum-{}, 开始时间-{}", vrNum, new Date());
|
|
|
uploadObjData(vrNum, sceneNum);
|
|
|
- log.info("上传obj文件,vrnum-{}, 结束时间-{}", vrNum, new Date());
|
|
|
+ RunBuild.log.info("上传obj文件,vrnum-{}, 结束时间-{}", vrNum, new Date());
|
|
|
uploadObj = false;
|
|
|
}
|
|
|
|
|
@@ -232,7 +227,7 @@ public class RunBuild {
|
|
|
|
|
|
if (objectJson.containsKey("progress")) {
|
|
|
Integer progress = objectJson.getInteger("progress");
|
|
|
- log.info("vrNum-{}, 第{}次获取渲染进度,进度为{}%", vrNum, times++, progress);
|
|
|
+ RunBuild.log.info("vrNum-{}, 第{}次获取渲染进度,进度为{}%", vrNum, times++, progress);
|
|
|
updateSceneStyleEntity.setProgress(progress);
|
|
|
updateSceneStyleEntity.setUpdateTime(new Date());
|
|
|
sceneStyleService.updateById(updateSceneStyleEntity);
|
|
@@ -247,7 +242,7 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
// File outFiles = new File(buildPath.replace("Input", "Output") + vrNum + File.separator);
|
|
|
- log.info("计算完成:" + buildPath + "Output/" + vrNum);
|
|
|
+ RunBuild.log.info("计算完成:" + buildPath + "Output/" + vrNum);
|
|
|
// for(File outFile : outFiles.listFiles()){
|
|
|
// if(outFile.isDirectory()){
|
|
|
// for(File out : outFile.listFiles()){
|
|
@@ -264,7 +259,7 @@ public class RunBuild {
|
|
|
map1.put("status", "-2");
|
|
|
map1.put("num", vrNum);
|
|
|
OkHttpUtils.httpPostForm(mainUrl + "api/scene/updateStatusByScene", map1);
|
|
|
- log.info("修改场景状态完成");
|
|
|
+ RunBuild.log.info("修改场景状态完成");
|
|
|
|
|
|
|
|
|
String finalPath = "https://4dkk.4dage.com/images/images" +
|
|
@@ -295,6 +290,8 @@ public class RunBuild {
|
|
|
statisticsEntity.setStatisticsDate(DateUtil.date2String(new Date(), DateUtil.YYYY_MM_DD_DATE_FORMAT));
|
|
|
statisticsService.save(statisticsEntity);
|
|
|
}
|
|
|
+ //将所有该场景码的图片设置为不是封面图
|
|
|
+ sceneLightService.updateIsCoverBySceneStyleId(sceneStyleEntity.getId());
|
|
|
} catch (Exception e) {
|
|
|
updateSceneStyleEntity.setStatus(-1);
|
|
|
updateSceneStyleEntity.setUpdateTime(new Date());
|
|
@@ -305,11 +302,11 @@ public class RunBuild {
|
|
|
map1.put("status", "-1");
|
|
|
map1.put("num", vrNum);
|
|
|
OkHttpUtils.httpPostForm(mainUrl + "api/scene/updateStatusByScene", map1);
|
|
|
- log.info("计算失败--修改场景状态完成");
|
|
|
+ RunBuild.log.info("计算失败--修改场景状态完成");
|
|
|
} catch (Exception ex) {
|
|
|
- log.error("渲染失败-{}", e);
|
|
|
+ RunBuild.log.error("渲染失败-{}", e);
|
|
|
}
|
|
|
- log.error("渲染失败-{}", e);
|
|
|
+ RunBuild.log.error("渲染失败-{}", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -353,14 +350,14 @@ public class RunBuild {
|
|
|
String path = buildPath + "Output/" + vrNum + File.separator + "obj";
|
|
|
CreateObjUtil.ossUtilCp("images/images" + vrNum + "/obj/", path);
|
|
|
|
|
|
- log.info("vrNum-{},删除文件开始");
|
|
|
+ RunBuild.log.info("vrNum-{},删除文件开始");
|
|
|
FileUtils.deleteDirectory(path + File.separator + "results");
|
|
|
FileUtils.deleteDirectory(path + File.separator + "caches");
|
|
|
- log.info("vrNum-{},删除文件结束");
|
|
|
+ RunBuild.log.info("vrNum-{},删除文件结束");
|
|
|
|
|
|
- log.info("vrNum-{},拷贝obj文件开始");
|
|
|
+ RunBuild.log.info("vrNum-{},拷贝obj文件开始");
|
|
|
FileUtils.copyFile(path + "/extras/mesh.obj", path + "/extras/copy-mesh.obj", true);
|
|
|
- log.info("vrNum-{},拷贝obj文件结束");
|
|
|
+ RunBuild.log.info("vrNum-{},拷贝obj文件结束");
|
|
|
|
|
|
// OkHttpUtils.httpGet(maxObjUrl + "objToObj?inObj=" + path + "/extras/copy-mesh.obj" +
|
|
|
// "&outObj=" + path + "/extras/mesh.obj" + "&r=40");
|
|
@@ -383,9 +380,9 @@ public class RunBuild {
|
|
|
projectJson.put("status", null);
|
|
|
FileUtils.writeFile(path + "/project.json", projectJson.toString());
|
|
|
|
|
|
- log.info("vrNum-{},计算模型", vrNum);
|
|
|
+ RunBuild.log.info("vrNum-{},计算模型", vrNum);
|
|
|
CreateObjUtil.build3dModel(path, "");
|
|
|
- log.info("vrNum-{},计算模型完毕", vrNum);
|
|
|
+ RunBuild.log.info("vrNum-{},计算模型完毕", vrNum);
|
|
|
|
|
|
String uploadData = FileUtils.readFile(path + File.separator + "results" + File.separator + "upload.json");
|
|
|
JSONObject uploadJson = null;
|
|
@@ -394,9 +391,9 @@ public class RunBuild {
|
|
|
uploadJson = JSONObject.parseObject(uploadData);
|
|
|
array = uploadJson.getJSONArray("upload");
|
|
|
}
|
|
|
- log.info("uploadJson-{}", uploadJson);
|
|
|
+ RunBuild.log.info("uploadJson-{}", uploadJson);
|
|
|
if (array == null) {
|
|
|
- log.error("upload.json数据出错");
|
|
|
+ RunBuild.log.error("upload.json数据出错");
|
|
|
throw new RuntimeException("upload.json数据出错");
|
|
|
}
|
|
|
|
|
@@ -431,23 +428,23 @@ public class RunBuild {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- log.info("vrnum-{}, txt转换dam,开始时间-{}", vrNum, new Date());
|
|
|
+ RunBuild.log.info("vrnum-{}, txt转换dam,开始时间-{}", vrNum, new Date());
|
|
|
CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k" +
|
|
|
".dam");
|
|
|
- log.info("vrnum-{}, txt转换dam,结束时间-{}", vrNum, new Date());
|
|
|
+ RunBuild.log.info("vrnum-{}, txt转换dam,结束时间-{}", vrNum, new Date());
|
|
|
|
|
|
map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", "images/images" + vrNum + "/" + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", "images/images" + vrNum + "/" + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
|
|
//下载源场景vision.modeldata上传到新风格场景
|
|
|
- log.info("vrnum-{}, 下载源场景vision.modeldata上传到新风格场景,开始时间-{}", vrNum, new Date());
|
|
|
+ RunBuild.log.info("vrnum-{}, 下载源场景vision.modeldata上传到新风格场景,开始时间-{}", vrNum, new Date());
|
|
|
FileUtils.downLoadFromUrl("https://4dkk.4dage.com/images/images" + sceneNum + "/vision.modeldata",
|
|
|
"vision.modeldata", path);
|
|
|
- log.info("vrnum-{}, 下载源场景vision.modeldata上传到新风格场景,结束时间-{}", vrNum, new Date());
|
|
|
+ RunBuild.log.info("vrnum-{}, 下载源场景vision.modeldata上传到新风格场景,结束时间-{}", vrNum, new Date());
|
|
|
map.put(path + File.separator + "vision.modeldata", "images/images" + vrNum + "/" + "vision.modeldata");
|
|
|
- log.info("vrNum-{},上传文件", vrNum);
|
|
|
+ RunBuild.log.info("vrNum-{},上传文件", vrNum);
|
|
|
uploadToOssUtil.uploadMulFiles(map);
|
|
|
- log.info("vrNum执行完uploadObjData方法-{}", vrNum);
|
|
|
+ RunBuild.log.info("vrNum执行完uploadObjData方法-{}", vrNum);
|
|
|
}
|
|
|
|
|
|
private void lightBuild(String data) {
|
|
@@ -487,7 +484,7 @@ public class RunBuild {
|
|
|
if (list != null && list.size() > 0) {
|
|
|
sceneStyleEntity = list.get(0);
|
|
|
} else {
|
|
|
- log.info("场景不存在,出现异常");
|
|
|
+ RunBuild.log.info("场景不存在,出现异常");
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -496,14 +493,14 @@ public class RunBuild {
|
|
|
|
|
|
try {
|
|
|
// run方法具体重写
|
|
|
- log.info("查询计算服务器状态");
|
|
|
+ RunBuild.log.info("查询计算服务器状态");
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
// boolean ready = false;
|
|
|
if ("".equals(dateType)) {
|
|
|
dateType = "day";
|
|
|
}
|
|
|
|
|
|
- log.info("调用计算api");
|
|
|
+ RunBuild.log.info("调用计算api");
|
|
|
jsonObject.put("name", vrNum);
|
|
|
jsonObject.put("taskType", buildType);
|
|
|
jsonObject.put("map", dateType);
|
|
@@ -521,7 +518,7 @@ public class RunBuild {
|
|
|
String buildResult = OkHttpUtils.httpPostJson(lightBuildUrl + "pro", jsonObject.toJSONString());
|
|
|
JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
|
|
|
- log.info("请求3d场景渲染接口获取接口数据-{}", buildJson);
|
|
|
+ RunBuild.log.info("请求3d场景渲染接口获取接口数据-{}", buildJson);
|
|
|
|
|
|
if ("isBusy".equals(buildJson.getString("msg"))) {
|
|
|
Thread.sleep(2000L);
|
|
@@ -553,7 +550,7 @@ public class RunBuild {
|
|
|
String checkResult = OkHttpUtils.httpPostJson(lightBuildUrl + "check", jsonObject.toJSONString());
|
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
- log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
+ RunBuild.log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
|
|
|
JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
|
|
@@ -577,7 +574,7 @@ public class RunBuild {
|
|
|
|
|
|
if (objectJson.containsKey("progress")) {
|
|
|
Integer progress = objectJson.getInteger("progress");
|
|
|
- log.info("第{}次获取渲染进度,进度为{}%", times++, progress);
|
|
|
+ RunBuild.log.info("第{}次获取渲染进度,进度为{}%", times++, progress);
|
|
|
SceneLightEntity sceneLightEntity = new SceneLightEntity();
|
|
|
sceneLightEntity.setId(Long.valueOf(taskId));
|
|
|
sceneLightEntity.setProgress(progress);
|
|
@@ -592,7 +589,7 @@ public class RunBuild {
|
|
|
Thread.sleep(500L);
|
|
|
}
|
|
|
|
|
|
- log.info("计算完成:" + buildPath + "Output/" + vrNum);
|
|
|
+ RunBuild.log.info("计算完成:" + buildPath + "Output/" + vrNum);
|
|
|
|
|
|
if ("light".equals(buildType)) {
|
|
|
updateSceneStyleEntity.setLightStatus(1);
|
|
@@ -672,7 +669,7 @@ public class RunBuild {
|
|
|
sceneLightEntity.setUpdateTime(new Date());
|
|
|
sceneLightService.updateById(sceneLightEntity);
|
|
|
|
|
|
- log.error("渲染失败-{}", e);
|
|
|
+ RunBuild.log.error("渲染失败-{}", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -692,16 +689,16 @@ public class RunBuild {
|
|
|
//1 成品 2 定制 3 组件
|
|
|
String UploadType = datas[5];
|
|
|
|
|
|
- ModelUploadEntity modelUploadEntity =null;
|
|
|
+ ModelUploadEntity modelUploadEntity = null;
|
|
|
|
|
|
|
|
|
- ComponentModelUploadEntity componentModelUploadEntity=null;
|
|
|
+ ComponentModelUploadEntity componentModelUploadEntity = null;
|
|
|
|
|
|
//上锁保证只有一个在消费,加锁一个钟,成功消费就解锁了
|
|
|
- String token = RedisUtil.tryLock(fileId, 60*60*1000);
|
|
|
- if (token != null ){
|
|
|
- log.info("已有同样的fileId:"+fileId+",正在消费了");
|
|
|
- log.info("暂无的fileId:"+fileId+"消费,继续执行处理逻辑");
|
|
|
+ String token = RedisUtil.tryLock(fileId, 60 * 60 * 1000);
|
|
|
+ if (token != null) {
|
|
|
+ RunBuild.log.info("已有同样的fileId:" + fileId + ",正在消费了");
|
|
|
+ RunBuild.log.info("暂无的fileId:" + fileId + "消费,继续执行处理逻辑");
|
|
|
try {
|
|
|
String path = buildPath + "upload";
|
|
|
String filePath = path + File.separator + fileId + File.separator;
|
|
@@ -721,15 +718,15 @@ public class RunBuild {
|
|
|
|
|
|
String max = new File(maxPath).getName();
|
|
|
Thread.sleep(1000);
|
|
|
- log.info("开始运行maxToDatasmith");
|
|
|
+ RunBuild.log.info("开始运行maxToDatasmith");
|
|
|
String maxUrl = maxObjUrl + "maxToDatasmith?uuid=" + fileId + "&max=" + maxName + "&flag=" + flag;
|
|
|
- log.info("请求maxToDatasmith地址-{}", maxUrl);
|
|
|
+ RunBuild.log.info("请求maxToDatasmith地址-{}", maxUrl);
|
|
|
OkHttpUtils.httpGet(maxUrl);
|
|
|
- log.info("运行maxToDatasmith结束-{}", fileId);
|
|
|
+ RunBuild.log.info("运行maxToDatasmith结束-{}", fileId);
|
|
|
|
|
|
String filesTxt = filePath + max.replace(".max", "") + "/files.txt";
|
|
|
if (!new File(filesTxt).exists()) {
|
|
|
- log.info("运行maxToDatasmith失败,没有files.txt文件:" + filesTxt);
|
|
|
+ RunBuild.log.info("运行maxToDatasmith失败,没有files.txt文件:" + filesTxt);
|
|
|
throw new RuntimeException(fileId + ":运行maxToDatasmith失败,没有files.txt文件");
|
|
|
}
|
|
|
|
|
@@ -757,12 +754,10 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
String objPath = filePath + fileId + ".obj";
|
|
|
File target = null;
|
|
|
|
|
|
- switch (UploadType){
|
|
|
+ switch (UploadType) {
|
|
|
case "1":
|
|
|
modelUploadEntity = modelUploadService.findById(Long.valueOf(modelUploadId));
|
|
|
|
|
@@ -781,8 +776,6 @@ public class RunBuild {
|
|
|
Thread.sleep(2000L);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("name", fileId);
|
|
|
jsonObject.put("taskType", "datafactory");
|
|
@@ -801,19 +794,19 @@ public class RunBuild {
|
|
|
String ossUrl = "domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg";
|
|
|
String localUrl = filePath + fileId + "_preview.jpg";
|
|
|
uploadToOssUtil.downloadFileTo4dTjw(ossUrl, localUrl);
|
|
|
- log.info("ossUrl-{}", ossUrl);
|
|
|
- log.info("本地Url-{}", localUrl);
|
|
|
+ RunBuild.log.info("ossUrl-{}", ossUrl);
|
|
|
+ RunBuild.log.info("本地Url-{}", localUrl);
|
|
|
|
|
|
String maxObjUrlGet = maxObjUrl + "fbxToObj?uuid=" + fileId + "&fbx=" + fileId +
|
|
|
".fbx&obj=" + fileId + ".obj&jpg=" + fileId + ".jpg&r=30";
|
|
|
OkHttpUtils.httpGet(maxObjUrlGet);
|
|
|
- log.info("请求maxObj地址-{}", maxObjUrlGet);
|
|
|
+ RunBuild.log.info("请求maxObj地址-{}", maxObjUrlGet);
|
|
|
}
|
|
|
|
|
|
if ("datasmith".equals(modelType)) {
|
|
|
String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
|
|
|
CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
|
|
|
- log.info("oss下载datasmith-{}", ossDownlUrl);
|
|
|
+ RunBuild.log.info("oss下载datasmith-{}", ossDownlUrl);
|
|
|
|
|
|
if (new File(filePath + fileId + "-base.obj").exists()) {
|
|
|
facesNum = ObjProcess.findFacesNum(filePath + fileId + "-base.obj");
|
|
@@ -821,13 +814,13 @@ public class RunBuild {
|
|
|
String maxObjUrlGet = maxObjUrl + "objToObj?uuid=" + fileId + "&inObj=" + fileId +
|
|
|
"-base.obj&outObj=" + fileId + ".obj&r=3000";
|
|
|
OkHttpUtils.httpGet(maxObjUrlGet);
|
|
|
- log.info("请求maxObj地址-{}", maxObjUrlGet);
|
|
|
+ RunBuild.log.info("请求maxObj地址-{}", maxObjUrlGet);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- log.info("obj路径-{}", objPath);
|
|
|
+ RunBuild.log.info("obj路径-{}", objPath);
|
|
|
if (!new File(objPath).exists()) {
|
|
|
- log.info("obj文件生成失败:" + objPath);
|
|
|
+ RunBuild.log.info("obj文件生成失败:" + objPath);
|
|
|
throw new RuntimeException("obj文件生成失败");
|
|
|
}
|
|
|
|
|
@@ -869,14 +862,14 @@ public class RunBuild {
|
|
|
JSONObject uploadModelJson = JSON.parseObject(JSON.toJSONString(furnitureJson.get(0)));
|
|
|
JSONArray componentSlots = uploadModelJson.getJSONArray("componentSlots");
|
|
|
|
|
|
- log.info("furnitureJson.json-componentSlots长度:" + componentSlots.size());
|
|
|
+ RunBuild.log.info("furnitureJson.json-componentSlots长度:" + componentSlots.size());
|
|
|
|
|
|
- JSONObject jsonObj =new JSONObject();
|
|
|
- jsonObj.put("width",uploadModelJson.get("width"));
|
|
|
- jsonObj.put("height",uploadModelJson.get("height"));
|
|
|
- jsonObj.put("depth",uploadModelJson.get("depth"));
|
|
|
+ JSONObject jsonObj = new JSONObject();
|
|
|
+ jsonObj.put("width", uploadModelJson.get("width"));
|
|
|
+ jsonObj.put("height", uploadModelJson.get("height"));
|
|
|
+ jsonObj.put("depth", uploadModelJson.get("depth"));
|
|
|
modelUploadEntity.setCacheData(jsonObj.toJSONString());
|
|
|
- JSONArray saveJsonArray=new JSONArray();
|
|
|
+ JSONArray saveJsonArray = new JSONArray();
|
|
|
|
|
|
for (Object componentSlot : componentSlots) {
|
|
|
JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("component");
|
|
@@ -885,7 +878,7 @@ public class RunBuild {
|
|
|
String objFileRealPath = "";
|
|
|
String udatasmitFileRealPath = "";
|
|
|
String udsmeshFileRealPath = "";
|
|
|
- String mtlPathFileRealPath= "";
|
|
|
+ String mtlPathFileRealPath = "";
|
|
|
String keyPath = "domain/eHome/furniture/InitialData/" + modelType + "/" + filesId + "/";
|
|
|
|
|
|
if (StrUtil.isNotEmpty(component.getString("template"))) {
|
|
@@ -924,7 +917,7 @@ public class RunBuild {
|
|
|
params1.add(filesId);
|
|
|
|
|
|
|
|
|
- log.info("处理配件,大小为{}", component.toJSONString());
|
|
|
+ RunBuild.log.info("处理配件,大小为{}", component.toJSONString());
|
|
|
componentModelUploadEntity = new ComponentModelUploadEntity();
|
|
|
|
|
|
BeanUtil.copyProperties(modelUploadEntity, componentModelUploadEntity, false);
|
|
@@ -935,20 +928,20 @@ public class RunBuild {
|
|
|
componentModelUploadEntity.setProgress(0);
|
|
|
componentModelUploadEntity.setMtlPath(mtlPathFileRealPath);
|
|
|
if (JSON.parseObject(JSONObject.toJSONString(componentSlot)).containsKey("origin")) {
|
|
|
- JSONObject cache=new JSONObject();
|
|
|
- cache.put("origin",JSON.parseObject(JSONObject.toJSONString(componentSlot)).get("origin"));
|
|
|
- JSONObject deploy=new JSONObject();
|
|
|
- deploy.put("width",component.getFloat("width"));
|
|
|
- deploy.put("depth",component.getFloat("depth"));
|
|
|
- deploy.put("height",component.getFloat("height"));
|
|
|
- cache.put("deploy",deploy);
|
|
|
+ JSONObject cache = new JSONObject();
|
|
|
+ cache.put("origin", JSON.parseObject(JSONObject.toJSONString(componentSlot)).get("origin"));
|
|
|
+ JSONObject deploy = new JSONObject();
|
|
|
+ deploy.put("width", component.getFloat("width"));
|
|
|
+ deploy.put("depth", component.getFloat("depth"));
|
|
|
+ deploy.put("height", component.getFloat("height"));
|
|
|
+ cache.put("deploy", deploy);
|
|
|
componentModelUploadEntity.setCacheData(cache.toJSONString());
|
|
|
}
|
|
|
componentModelUploadEntity.setPartsModelUploadId(modelUploadEntity.getId());
|
|
|
componentModelUploadService.save(componentModelUploadEntity);
|
|
|
//保存id,方便后续拿预览图
|
|
|
- component.put("id",componentModelUploadEntity.getId());
|
|
|
- log.info("处理配件集合,完成保存配件,ID:{}", componentModelUploadEntity);
|
|
|
+ component.put("id", componentModelUploadEntity.getId());
|
|
|
+ RunBuild.log.info("处理配件集合,完成保存配件,ID:{}", componentModelUploadEntity);
|
|
|
saveJsonArray.add(component);
|
|
|
}
|
|
|
|
|
@@ -968,14 +961,14 @@ public class RunBuild {
|
|
|
postJsonObj.remove("params1");
|
|
|
checkResultJson(fileId, filePath, postJsonObj, modelUploadId);
|
|
|
|
|
|
- String productName ="";
|
|
|
+ String productName = "";
|
|
|
//拿预览图+obj 成品+组件
|
|
|
if (uploadModelJson.containsKey("name")) {
|
|
|
productName = uploadModelJson.getString("name");
|
|
|
uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + productName + "_preview.jpg", filePath + productName + "_preview.jpg");
|
|
|
- modelUploadEntity.setThumPath(filePath.replace(buildPath, "") + productName + "_preview.jpg");
|
|
|
+ modelUploadEntity.setThumPath(filePath.replace(buildPath, "") + productName + "_preview.jpg");
|
|
|
Thread.sleep(1000L);
|
|
|
- log.info("处理成品生成后的预览图"+modelUploadEntity.getThumPath());
|
|
|
+ RunBuild.log.info("处理成品生成后的预览图" + modelUploadEntity.getThumPath());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -984,16 +977,17 @@ public class RunBuild {
|
|
|
if (component.containsKey("name")) {
|
|
|
|
|
|
String componentName = component.getString("name");
|
|
|
- String uploadPath=filePath +componentName+"/" ;
|
|
|
- if (!FileUtil.exist(uploadPath)){
|
|
|
+ String uploadPath = filePath + componentName + "/";
|
|
|
+ if (!FileUtil.exist(uploadPath)) {
|
|
|
FileUtil.mkdir(uploadPath);
|
|
|
}
|
|
|
- uploadPath=uploadPath+componentName;
|
|
|
- uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + "_preview.jpg",uploadPath+"_preview.jpg" );
|
|
|
- uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + "-base.obj", uploadPath+ ".obj");
|
|
|
- uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + ".mtl", uploadPath+ ".mtl");
|
|
|
- uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+productName+"/" + componentName + "/" + componentName + ".jpg", uploadPath+ ".jpg");
|
|
|
- ComponentModelUploadEntity componentEntity =componentModelUploadService.findById(component.getLong("id"));
|
|
|
+ uploadPath = uploadPath + componentName;
|
|
|
+ uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + componentName + "/" + componentName + "_preview.jpg", uploadPath +
|
|
|
+ "_preview.jpg");
|
|
|
+ uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + componentName + "/" + componentName + "-base.obj", uploadPath + ".obj");
|
|
|
+ uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + componentName + "/" + componentName + ".mtl", uploadPath + ".mtl");
|
|
|
+ uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + componentName + "/" + componentName + ".jpg", uploadPath + ".jpg");
|
|
|
+ ComponentModelUploadEntity componentEntity = componentModelUploadService.findById(component.getLong("id"));
|
|
|
if (componentEntity != null) {
|
|
|
componentEntity.setThumPath(uploadPath.replace(buildPath, "") + "_preview.jpg");
|
|
|
componentEntity.setObjPath(uploadPath.replace(buildPath, "") + ".obj");
|
|
@@ -1005,7 +999,7 @@ public class RunBuild {
|
|
|
componentEntity.setThumStatus(1);
|
|
|
componentEntity.setThumProgress(100);
|
|
|
componentModelUploadService.updateById(componentEntity);
|
|
|
- log.info("处理配件生成后的预览图"+componentEntity.getThumPath()+"|obj"+componentEntity.getObjPath()+"|mtl"+componentEntity.getMtlPath());
|
|
|
+ RunBuild.log.info("处理配件生成后的预览图" + componentEntity.getThumPath() + "|obj" + componentEntity.getObjPath() + "|mtl" + componentEntity.getMtlPath());
|
|
|
Thread.sleep(1000L);
|
|
|
}
|
|
|
}
|
|
@@ -1015,11 +1009,11 @@ public class RunBuild {
|
|
|
modelUploadEntity.setStatus(1);
|
|
|
modelUploadEntity.setProgress(100);
|
|
|
modelUploadService.updateById(modelUploadEntity);
|
|
|
- log.info("配件逻处理完毕");
|
|
|
+ RunBuild.log.info("配件逻处理完毕");
|
|
|
break;
|
|
|
|
|
|
case "3":
|
|
|
- componentModelUploadEntity=componentModelUploadService.findById(Long.valueOf(modelUploadId));
|
|
|
+ componentModelUploadEntity = componentModelUploadService.findById(Long.valueOf(modelUploadId));
|
|
|
|
|
|
for (String file : files) {
|
|
|
target = new File(filePath + max.replace(".max", "") + file);
|
|
@@ -1029,7 +1023,6 @@ public class RunBuild {
|
|
|
Thread.sleep(2000L);
|
|
|
|
|
|
|
|
|
-
|
|
|
JSONObject componetJsonObject = new JSONObject();
|
|
|
componetJsonObject.put("name", fileId);
|
|
|
componetJsonObject.put("taskType", "datafactory");
|
|
@@ -1046,14 +1039,14 @@ public class RunBuild {
|
|
|
if ("datasmith".equals(modelType)) {
|
|
|
String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
|
|
|
CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
|
|
|
- log.info("oss下载datasmith-{}", ossDownlUrl);
|
|
|
+ RunBuild.log.info("oss下载datasmith-{}", ossDownlUrl);
|
|
|
if (FileUtil.exist(filePath + fileId + "-base.obj")) {
|
|
|
- FileUtil.copyFile( filePath + fileId + "-base.obj" ,filePath + fileId + ".obj");
|
|
|
+ FileUtil.copyFile(filePath + fileId + "-base.obj", filePath + fileId + ".obj");
|
|
|
}
|
|
|
}
|
|
|
- log.info("obj路径-{}", objPath);
|
|
|
+ RunBuild.log.info("obj路径-{}", objPath);
|
|
|
if (!new File(objPath).exists()) {
|
|
|
- log.info("obj文件生成失败:" + objPath);
|
|
|
+ RunBuild.log.info("obj文件生成失败:" + objPath);
|
|
|
throw new RuntimeException("obj文件生成失败");
|
|
|
}
|
|
|
|
|
@@ -1076,24 +1069,20 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("修改模型报错-{}", e.getMessage());
|
|
|
- if (ObjectUtil.isNotNull(modelUploadEntity)){
|
|
|
+ RunBuild.log.error("修改模型报错-{}", e.getMessage());
|
|
|
+ if (ObjectUtil.isNotNull(modelUploadEntity)) {
|
|
|
modelUploadEntity.setStatus(-1);
|
|
|
modelUploadService.updateById(modelUploadEntity);
|
|
|
- }else if (ObjectUtil.isNotNull(componentModelUploadEntity)){
|
|
|
+ } else if (ObjectUtil.isNotNull(componentModelUploadEntity)) {
|
|
|
componentModelUploadEntity.setStatus(-1);
|
|
|
componentModelUploadService.findById(Long.valueOf(modelUploadId));
|
|
|
}
|
|
|
|
|
|
|
|
|
- }finally {
|
|
|
- if (token!=null){
|
|
|
+ } finally {
|
|
|
+ if (token != null) {
|
|
|
RedisUtil.unlock(fileId, token);
|
|
|
}
|
|
|
}
|
|
@@ -1119,13 +1108,13 @@ public class RunBuild {
|
|
|
boolean over = false;
|
|
|
while (true) {
|
|
|
String checkResult = OkHttpUtils.httpPostJson(modelBuildUrl + "check", jsonObject.toJSONString());
|
|
|
- log.info("checkResult的长度为-{}", checkResult.length());
|
|
|
+ RunBuild.log.info("checkResult的长度为-{}", checkResult.length());
|
|
|
|
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
|
|
|
|
JSONArray checkArray = checkJson.getJSONArray("msg");
|
|
|
|
|
|
- log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
+ RunBuild.log.info("请求检查3d场景渲染接口获取接口数据-{}", checkJson);
|
|
|
|
|
|
if (checkArray.size() == 0) {
|
|
|
FileUtils.writeFile(filePath + "/error-check-model.json", checkJson.toJSONString());
|
|
@@ -1147,7 +1136,7 @@ public class RunBuild {
|
|
|
|
|
|
if (objectJson.containsKey("progress")) {
|
|
|
Integer progress = objectJson.getInteger("progress");
|
|
|
- log.info("第{}次获取上传进度,进度为{}%", times++, progress);
|
|
|
+ RunBuild.log.info("第{}次获取上传进度,进度为{}%", times++, progress);
|
|
|
ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
|
|
|
modelUploadEntity.setId(Long.valueOf(modelUploadId));
|
|
|
modelUploadEntity.setProgress(progress);
|
|
@@ -1180,7 +1169,7 @@ public class RunBuild {
|
|
|
String buildResult = OkHttpUtils.httpPostJson(modelBuildUrl + "pro", jsonObject.toJSONString());
|
|
|
JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
|
|
|
- log.info("请求3d场景渲染接口获取接口数据-{}", buildJson);
|
|
|
+ RunBuild.log.info("请求3d场景渲染接口获取接口数据-{}", buildJson);
|
|
|
|
|
|
if ("isBusy".equals(buildJson.getString("msg"))) {
|
|
|
Thread.sleep(2000L);
|
|
@@ -1214,7 +1203,7 @@ public class RunBuild {
|
|
|
String path = buildPath + "upload";
|
|
|
String filePath = path + File.separator + fileId + File.separator;
|
|
|
|
|
|
- switch (uploadType){
|
|
|
+ switch (uploadType) {
|
|
|
case "1":
|
|
|
endProductHandler(fileId, userId, modelId, dataJson, taskType, uploadType, filePath);
|
|
|
break;
|
|
@@ -1232,18 +1221,18 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
private void componentHandler(String fileId, String userId, String modelId, String dataJson, String taskType, String uploadType, String filePath) {
|
|
|
- ComponentModelUploadEntity componentModelUploadEntity=null;
|
|
|
+ ComponentModelUploadEntity componentModelUploadEntity = null;
|
|
|
JSONObject jsonObject = null;
|
|
|
- ModelUploadEntity uploadEntity=null;
|
|
|
+ ModelUploadEntity uploadEntity = null;
|
|
|
try {
|
|
|
- jsonObject=new JSONObject();
|
|
|
+ jsonObject = new JSONObject();
|
|
|
ComponentModelUploadEntity byFileId = componentModelUploadService.findByFileId(fileId);
|
|
|
- if (ObjectUtil.isNotNull(byFileId.getPartsModelUploadId())){
|
|
|
- uploadEntity = modelUploadService.findById(byFileId.getPartsModelUploadId());
|
|
|
- if (ObjectUtil.isNotNull(uploadEntity)){
|
|
|
- jsonObject.put("name", uploadEntity.getFileId()+"#"+fileId);
|
|
|
+ if (ObjectUtil.isNotNull(byFileId.getPartsModelUploadId())) {
|
|
|
+ uploadEntity = modelUploadService.findById(byFileId.getPartsModelUploadId());
|
|
|
+ if (ObjectUtil.isNotNull(uploadEntity)) {
|
|
|
+ jsonObject.put("name", uploadEntity.getFileId() + "#" + fileId);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
jsonObject.put("name", fileId);
|
|
|
}
|
|
|
|
|
@@ -1256,16 +1245,16 @@ public class RunBuild {
|
|
|
Thread.sleep(1000L);
|
|
|
|
|
|
checkExaggerateSurace(jsonObject, filePath, fileId, modelId, taskType, uploadType);
|
|
|
- if (ObjectUtil.isNotNull(uploadEntity)){
|
|
|
- jsonObject.put("name", uploadEntity.getFileId()+"#"+fileId);
|
|
|
- uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/"+uploadEntity.getFileId()+"/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
|
|
|
+ if (ObjectUtil.isNotNull(uploadEntity)) {
|
|
|
+ jsonObject.put("name", uploadEntity.getFileId() + "#" + fileId);
|
|
|
+ uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + uploadEntity.getFileId() + "/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
|
|
|
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
|
|
|
uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
|
|
|
}
|
|
|
|
|
|
- uploadToOssUtil.uploadTo4dTjw(filePath + fileId + "_preview.jpg", "domain/eHome/furniture/models/" +fileId+ "_preview.jpg");
|
|
|
+ uploadToOssUtil.uploadTo4dTjw(filePath + fileId + "_preview.jpg", "domain/eHome/furniture/models/" + fileId + "_preview.jpg");
|
|
|
componentModelUploadEntity = new ComponentModelUploadEntity();
|
|
|
componentModelUploadEntity.setId(Long.valueOf(modelId));
|
|
|
componentModelUploadEntity.setThumStatus(1);
|
|
@@ -1273,7 +1262,7 @@ public class RunBuild {
|
|
|
componentModelUploadService.updateById(componentModelUploadEntity);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- log.error("生成封面失败-{}", e);
|
|
|
+ RunBuild.log.error("生成封面失败-{}", e);
|
|
|
componentModelUploadEntity = new ComponentModelUploadEntity();
|
|
|
componentModelUploadEntity.setId(Long.valueOf(modelId));
|
|
|
componentModelUploadEntity.setThumStatus(-1);
|
|
@@ -1282,18 +1271,18 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
private void customHandler(String fileId, String userId, String modelId, String dataJson, String taskType, String uploadType, String filePath) {
|
|
|
- ModelUploadEntity modelUploadEntity=null;
|
|
|
+ ModelUploadEntity modelUploadEntity = null;
|
|
|
JSONObject jsonObject = null;
|
|
|
try {
|
|
|
- jsonObject=new JSONObject();
|
|
|
- JSONArray componentPositions=JSONObject.parseObject(dataJson).getJSONObject("Param1").getJSONArray("componmentPositions");
|
|
|
- List<String> ids=new LinkedList<>();
|
|
|
+ jsonObject = new JSONObject();
|
|
|
+ JSONArray componentPositions = JSONObject.parseObject(dataJson).getJSONObject("Param1").getJSONArray("componmentPositions");
|
|
|
+ List<String> ids = new LinkedList<>();
|
|
|
ids.add(fileId);
|
|
|
for (Object componentPosition : componentPositions) {
|
|
|
String id = JSON.parseObject(JSONObject.toJSONString(componentPosition)).getString("id");
|
|
|
ids.add(id);
|
|
|
}
|
|
|
- jsonObject.put("name", String.join("#",ids));
|
|
|
+ jsonObject.put("name", String.join("#", ids));
|
|
|
jsonObject.put("taskType", taskType);
|
|
|
jsonObject.put("taskId", userId);
|
|
|
jsonObject.put("params1", JSONObject.parseObject(dataJson).getJSONObject("Param1"));
|
|
@@ -1306,7 +1295,7 @@ public class RunBuild {
|
|
|
|
|
|
uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg", filePath + fileId + "_preview.jpg");
|
|
|
|
|
|
- uploadToOssUtil.uploadTo4dTjw(filePath + fileId + "_preview.jpg", "domain/eHome/furniture/models/" +fileId + "_preview" + ".jpg");
|
|
|
+ uploadToOssUtil.uploadTo4dTjw(filePath + fileId + "_preview.jpg", "domain/eHome/furniture/models/" + fileId + "_preview" + ".jpg");
|
|
|
|
|
|
modelUploadEntity = new ModelUploadEntity();
|
|
|
modelUploadEntity.setId(Long.valueOf(modelId));
|
|
@@ -1315,9 +1304,8 @@ public class RunBuild {
|
|
|
modelUploadService.updateById(modelUploadEntity);
|
|
|
|
|
|
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
- log.error("生成封面失败-{}", e);
|
|
|
+ RunBuild.log.error("生成封面失败-{}", e);
|
|
|
modelUploadEntity = new ModelUploadEntity();
|
|
|
modelUploadEntity.setId(Long.valueOf(modelId));
|
|
|
modelUploadEntity.setThumStatus(-1);
|
|
@@ -1327,10 +1315,10 @@ public class RunBuild {
|
|
|
|
|
|
//成品处理
|
|
|
private void endProductHandler(String fileId, String userId, String modelId, String dataJson, String taskType, String uploadType, String filePath) {
|
|
|
- JSONObject jsonObject=null;
|
|
|
- ModelUploadEntity modelUploadEntity=null;
|
|
|
+ JSONObject jsonObject = null;
|
|
|
+ ModelUploadEntity modelUploadEntity = null;
|
|
|
try {
|
|
|
- jsonObject=new JSONObject();
|
|
|
+ jsonObject = new JSONObject();
|
|
|
jsonObject.put("name", fileId);
|
|
|
jsonObject.put("taskType", taskType);
|
|
|
jsonObject.put("taskId", userId);
|
|
@@ -1350,9 +1338,8 @@ public class RunBuild {
|
|
|
modelUploadService.updateById(modelUploadEntity);
|
|
|
|
|
|
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
- log.error("生成封面失败-{}", e);
|
|
|
+ RunBuild.log.error("生成封面失败-{}", e);
|
|
|
modelUploadEntity = new ModelUploadEntity();
|
|
|
modelUploadEntity.setId(Long.valueOf(modelId));
|
|
|
modelUploadEntity.setThumStatus(-1);
|
|
@@ -1381,9 +1368,9 @@ public class RunBuild {
|
|
|
) throws IOException, InterruptedException {
|
|
|
boolean over = false;
|
|
|
|
|
|
- JSONObject checkPostJson=new JSONObject();
|
|
|
- checkPostJson.put("name",jsonObject.get("name"));
|
|
|
- checkPostJson.put("taskType",jsonObject.get("taskType"));
|
|
|
+ JSONObject checkPostJson = new JSONObject();
|
|
|
+ checkPostJson.put("name", jsonObject.get("name"));
|
|
|
+ checkPostJson.put("taskType", jsonObject.get("taskType"));
|
|
|
while (true) {
|
|
|
String checkResult = OkHttpUtils.httpPostJson(modelBuildUrl + "check", checkPostJson.toString());
|
|
|
JSONObject checkJson = JSONObject.parseObject(checkResult);
|
|
@@ -1407,12 +1394,12 @@ public class RunBuild {
|
|
|
}
|
|
|
|
|
|
if (objectJson.containsKey("progress")) {
|
|
|
- if (uploadType.equals("3")){
|
|
|
- ComponentModelUploadEntity componentModelUploadEntity = new ComponentModelUploadEntity();
|
|
|
+ if (uploadType.equals("3")) {
|
|
|
+ ComponentModelUploadEntity componentModelUploadEntity = new ComponentModelUploadEntity();
|
|
|
componentModelUploadEntity.setId(Long.valueOf(modelId));
|
|
|
componentModelUploadEntity.setProgress(objectJson.getInteger("progress"));
|
|
|
componentModelUploadService.updateById(componentModelUploadEntity);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
ModelUploadEntity modelUploadEntity = new ModelUploadEntity();
|
|
|
modelUploadEntity.setId(Long.valueOf(modelId));
|
|
|
modelUploadEntity.setProgress(objectJson.getInteger("progress"));
|
|
@@ -1444,10 +1431,10 @@ public class RunBuild {
|
|
|
while (true) {
|
|
|
String url = modelBuildUrl + "pro";
|
|
|
String json = jsonObject.toJSONString();
|
|
|
- log.info("modelId-{}, 请求封面渲染接口获取接口数据-{},参数-{}", modelId, json);
|
|
|
+ RunBuild.log.info("modelId-{}, 请求封面渲染接口获取接口数据-{},参数-{}", modelId, json);
|
|
|
String buildResult = OkHttpUtils.httpPostJson(url, json);
|
|
|
JSONObject buildJson = JSONObject.parseObject(buildResult);
|
|
|
- log.info("请求封面渲染接口返回数据-{}", buildJson);
|
|
|
+ RunBuild.log.info("请求封面渲染接口返回数据-{}", buildJson);
|
|
|
|
|
|
if ("isBusy".equals(buildJson.getString("msg"))) {
|
|
|
Thread.sleep(2000L);
|