|
@@ -3,12 +3,16 @@ package com.fdkankan.contro.mq.service.impl;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
-import com.fdkankan.contro.entity.ScenePlus;
|
|
|
|
|
|
+import com.fdkankan.contro.entity.ScenePro;
|
|
import com.fdkankan.contro.mq.service.IBuildScenePostService;
|
|
import com.fdkankan.contro.mq.service.IBuildScenePostService;
|
|
-import com.fdkankan.contro.service.IScenePlusService;
|
|
|
|
|
|
+import com.fdkankan.contro.service.IFdkkLaserService;
|
|
|
|
+import com.fdkankan.contro.service.ISceneProService;
|
|
import com.fdkankan.contro.service.impl.FdkkV4Service;
|
|
import com.fdkankan.contro.service.impl.FdkkV4Service;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.model.constants.ConstantFileName;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
|
+import com.fdkankan.model.utils.CreateObjUtil;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -32,8 +36,10 @@ public class BuildSceneObjPostServiceImpl implements IBuildScenePostService {
|
|
private FYunFileServiceInterface fYunFileService;
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private IScenePlusService scenePlusService;
|
|
|
|
|
|
+ private ISceneProService sceneProService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IFdkkLaserService fdkkLaserService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private FdkkV4Service fdkkV4Service;
|
|
private FdkkV4Service fdkkV4Service;
|
|
@@ -42,6 +48,7 @@ public class BuildSceneObjPostServiceImpl implements IBuildScenePostService {
|
|
public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
|
|
public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
|
|
// 去除 OnlyExportMeshObj
|
|
// 去除 OnlyExportMeshObj
|
|
String path = message.getPath();
|
|
String path = message.getPath();
|
|
|
|
+ String projectNum = message.getSceneCode();
|
|
String dataFdagePath = path + File.separator + "capture" + File.separator + "data.fdage";
|
|
String dataFdagePath = path + File.separator + "capture" + File.separator + "data.fdage";
|
|
log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
String data = FileUtils.readFile(dataFdagePath);
|
|
String data = FileUtils.readFile(dataFdagePath);
|
|
@@ -55,11 +62,53 @@ public class BuildSceneObjPostServiceImpl implements IBuildScenePostService {
|
|
fYunFileService.uploadFile(path + File.separator + "capture" + File.separator + "data.fdage",
|
|
fYunFileService.uploadFile(path + File.separator + "capture" + File.separator + "data.fdage",
|
|
ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
|
|
ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
|
|
|
|
|
|
- LambdaUpdateWrapper<ScenePlus> updateWrapper = new LambdaUpdateWrapper<ScenePlus>()
|
|
|
|
- .set(ScenePlus::getSceneStatus, -2).eq(ScenePlus::getNum, message.getSceneCode());
|
|
|
|
- scenePlusService.update(updateWrapper);
|
|
|
|
|
|
+
|
|
|
|
+ String laserObjFilePath = path + "_laser_obj";
|
|
|
|
+ CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ CreateObjUtil.convertDamToLzma(laserObjFilePath + File.separator + "results");
|
|
|
|
+ CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ File file = new File(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
|
+ while (!file.exists()) {
|
|
|
|
+ Thread.sleep(60000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", "images/images" + projectNum + "/" + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
|
+ fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", "images/images" + projectNum + "/" + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+
|
|
|
|
+ String texPath = laserObjFilePath + File.separator + "results" + File.separator + "tex";
|
|
|
|
+
|
|
|
|
+ File texFile = new File(texPath);
|
|
|
|
+ if(texFile.exists()){
|
|
|
|
+ for (File textureFile : texFile.listFiles()) {
|
|
|
|
+ if(textureFile.getName().endsWith(".jpg")){
|
|
|
|
+ fYunFileService.uploadFile(textureFile.getAbsolutePath(), "images/images" +
|
|
|
|
+ projectNum + "/" + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/"+textureFile.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + "tex/texture1.jpg", "images/images" +
|
|
|
|
+ projectNum + "/" + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/texture1.jpg");
|
|
|
|
+
|
|
|
|
+ // 拷贝结果
|
|
|
|
+ log.info("开始拷贝obj文件");
|
|
|
|
+ FileUtils.copyFolderAllFiles(laserObjFilePath + "/results/mesh", laserObjFilePath + "/laserData/mesh/", true);
|
|
|
|
+
|
|
|
|
+ File meshFolder = new File(laserObjFilePath + "/results/mesh");
|
|
|
|
+
|
|
|
|
+ for (File meshFile : meshFolder.listFiles()) {
|
|
|
|
+ fYunFileService.uploadFile(meshFile.getAbsolutePath(), String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "mesh/" + meshFile.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fdkkLaserService.pushBuildStatusToLaserSystem(projectNum, laserObjFilePath + "/laserData/mesh");
|
|
|
|
+
|
|
|
|
+ LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<ScenePro>()
|
|
|
|
+ .set(ScenePro::getStatus, -2).eq(ScenePro::getNum, projectNum);
|
|
|
|
+ sceneProService.update(updateWrapper);
|
|
|
|
+
|
|
|
|
+ ScenePro scenePro = sceneProService.getByNum(projectNum);
|
|
|
|
|
|
// 如果未升级V4,则升级V4
|
|
// 如果未升级V4,则升级V4
|
|
- fdkkV4Service.upgradeToV4(ScenePlus.getIsUpgrade().equals(1), scene.getNum());
|
|
|
|
|
|
+ fdkkV4Service.upgradeToV4(scenePro);
|
|
}
|
|
}
|
|
}
|
|
}
|