|
@@ -2,6 +2,7 @@ package com.fdkankan.contro.mq.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
+import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -17,8 +18,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.contro.bean.SceneJsonBean;
|
|
import com.fdkankan.contro.bean.SceneJsonBean;
|
|
|
|
+import com.fdkankan.contro.constant.UserEditDataType;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
|
|
+import com.fdkankan.contro.mq.service.ICommonService;
|
|
import com.fdkankan.contro.service.*;
|
|
import com.fdkankan.contro.service.*;
|
|
import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
@@ -26,10 +29,12 @@ import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.model.constants.ConstantFileName;
|
|
import com.fdkankan.model.constants.ConstantFileName;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
|
+import com.fdkankan.model.constants.SceneBuildProcessType;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.enums.ModelTypeEnums;
|
|
import com.fdkankan.model.enums.ModelTypeEnums;
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
|
+import com.fdkankan.model.utils.FloorPlanUserUtil;
|
|
import com.fdkankan.model.utils.SceneUtil;
|
|
import com.fdkankan.model.utils.SceneUtil;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
@@ -38,6 +43,7 @@ import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
|
+import com.sun.org.apache.xpath.internal.operations.Plus;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -73,6 +79,15 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
@Value("${model.type:#{null}}")
|
|
@Value("${model.type:#{null}}")
|
|
private String modelType;
|
|
private String modelType;
|
|
|
|
|
|
|
|
+ @Value("${model.modelKind:3dtiles}")
|
|
|
|
+ private String modelKind;
|
|
|
|
+
|
|
|
|
+ @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
|
|
|
|
+ private List<Integer> sdTilesSceneSourceList;
|
|
|
|
+
|
|
|
|
+ @Value("${env:gn}")
|
|
|
|
+ private String env;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private RabbitMqProducer mqProducer;
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
|
|
@@ -115,10 +130,15 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
private ICompanyService companyService;
|
|
private ICompanyService companyService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneAsynOperLogService sceneAsynOperLogService;
|
|
private ISceneAsynOperLogService sceneAsynOperLogService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICommonService commonService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISceneBuildProcessLogService sceneBuildProcessLogService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void buildScenePre(BuildSceneCallMessage message) {
|
|
|
|
|
|
+ public void buildScenePre(BuildSceneCallMessage message) throws Exception{
|
|
boolean success = false;
|
|
boolean success = false;
|
|
|
|
+ String num = message.getSceneNum();
|
|
try {
|
|
try {
|
|
//重新计算时需要删除文件夹,否知使用缓存
|
|
//重新计算时需要删除文件夹,否知使用缓存
|
|
if(new File(message.getPath() + File.separator + "results").exists()){
|
|
if(new File(message.getPath() + File.separator + "results").exists()){
|
|
@@ -168,13 +188,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
|
|
log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- log.error("场景计算前置处理出错", e);
|
|
|
|
- }finally {
|
|
|
|
- //如果前置处理失败,发送钉钉消息
|
|
|
|
- if(!success){
|
|
|
|
- buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ log.error("场景计算前置处理出错,num"+num, e);
|
|
|
|
+ buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
|
|
|
|
+ throw e;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -235,8 +251,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
scenePlus.setUpdateTime(new Date());
|
|
scenePlus.setUpdateTime(new Date());
|
|
scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
|
|
scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
|
|
- scenePlusService.updateById(scenePlus);
|
|
|
|
-
|
|
|
|
|
|
|
|
Integer videoVersion = fdageData.getInteger("videoVersion");
|
|
Integer videoVersion = fdageData.getInteger("videoVersion");
|
|
//读取计算结果文件生成videosJson
|
|
//读取计算结果文件生成videosJson
|
|
@@ -247,56 +261,59 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
//写入数据库
|
|
//写入数据库
|
|
this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
|
|
this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
|
|
|
|
|
|
- Object[] editInfoArr = this.updateEditInfo(scenePlus);
|
|
|
|
- SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
|
|
- SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
|
|
- SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
|
|
-
|
|
|
|
//上传全景图俯视图
|
|
//上传全景图俯视图
|
|
this.uploadFloorCad(path, sceneCode, uploadFiles);
|
|
this.uploadFloorCad(path, sceneCode, uploadFiles);
|
|
|
|
|
|
- //上传文件
|
|
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
|
|
+ //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
|
|
|
|
+ fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
|
|
|
|
+ //上传文件
|
|
fYunFileService.uploadMulFiles(uploadFiles);
|
|
fYunFileService.uploadMulFiles(uploadFiles);
|
|
|
|
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
-
|
|
|
|
- if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
|
|
|
|
- // dam 文件设置请求头
|
|
|
|
- uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
|
- .forEach(entry -> {
|
|
|
|
- if (!new File(entry.getKey()).exists()) {
|
|
|
|
- log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- // gzip压缩
|
|
|
|
- FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
|
|
|
|
- // 重命名
|
|
|
|
- FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
|
- fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ // dam 文件设置请求头
|
|
|
|
+ uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
|
+ .forEach(entry -> {
|
|
|
|
+ if (!new File(entry.getKey()).exists()) {
|
|
|
|
+ log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // gzip压缩
|
|
|
|
+ FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
|
|
|
|
+ // 重命名
|
|
|
|
+ FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
|
+ fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
|
+ });
|
|
|
|
|
|
//拷贝部分文件到编辑目录,用于用户编辑
|
|
//拷贝部分文件到编辑目录,用于用户编辑
|
|
this.copyToEditDir(sceneCode);
|
|
this.copyToEditDir(sceneCode);
|
|
|
|
|
|
//计算完毕后,同步全景图到缓存目录
|
|
//计算完毕后,同步全景图到缓存目录
|
|
- this.cachePanorama(path, sceneCode);
|
|
|
|
|
|
+// this.cachePanorama(path, sceneCode);
|
|
|
|
|
|
//生成houseTypejson并上传
|
|
//生成houseTypejson并上传
|
|
- uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
|
|
|
|
- .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
|
|
|
|
|
|
+ boolean existHouseType = this.uploadHouseTypeJson(sceneCode, scenePlusExt.getDataSource());
|
|
|
|
+ scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
|
|
|
|
+
|
|
|
|
+ //生成floorpan.json
|
|
|
|
+ commonService.uploadFloorplanJson(sceneCode, scenePlusExt.getDataSource());
|
|
|
|
|
|
//重置异步操作记录
|
|
//重置异步操作记录
|
|
this.removeSceneAsynOperLog(sceneCode);
|
|
this.removeSceneAsynOperLog(sceneCode);
|
|
|
|
|
|
- //写scene.json
|
|
|
|
|
|
+ //清除用户编辑业务数据
|
|
|
|
+ Set<String> bizs = new HashSet<>();
|
|
|
|
+ bizs.add(UserEditDataType.BOX_MODEL.message());
|
|
|
|
+ commonService.initUserEditData(sceneCode, bizs, null);
|
|
|
|
|
|
|
|
+ //上传计算结果文件
|
|
|
|
+ commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
|
|
|
|
|
|
- log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
|
|
- CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
|
- Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
|
|
|
+ Object[] editInfoArr = this.updateEditInfo(scenePlus);
|
|
|
|
+ SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
|
|
+ SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
|
|
|
|
if (cameraType == 14) {
|
|
if (cameraType == 14) {
|
|
//计算成功 激光转台相机 同步 请求
|
|
//计算成功 激光转台相机 同步 请求
|
|
@@ -304,8 +321,14 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
|
|
sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
|
|
.eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
|
|
.eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
|
|
sceneEditControls.setShowMap(0);
|
|
sceneEditControls.setShowMap(0);
|
|
|
|
+ } else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
|
|
|
|
+ fdkkLaserService.cloudPointBuild(sceneCode,path);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
|
+ Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
|
+ //写scene.json
|
|
this.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
this.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
|
|
|
|
String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
@@ -319,15 +342,23 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
String pushToken = fdageData.getString("pushToken");
|
|
String pushToken = fdageData.getString("pushToken");
|
|
this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
|
|
this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
|
|
|
|
|
|
|
|
+ //更新场景主表
|
|
|
|
+ scenePlusService.updateById(scenePlus);
|
|
|
|
|
|
|
|
+ //删除计算目录
|
|
|
|
+ CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
|
|
|
|
|
|
- CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
|
|
|
|
|
|
+ //国际环境需要发邮件通知
|
|
|
|
+ if("eur".equals(env)){
|
|
|
|
+ commonService.sendEmail(sceneCode);
|
|
|
|
+ }
|
|
|
|
|
|
log.info("场景计算结果处理结束,场景码:{}", sceneCode);
|
|
log.info("场景计算结果处理结束,场景码:{}", sceneCode);
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- log.error("场景计算结果处理出错!", e);
|
|
|
|
|
|
+ log.error("场景计算结果处理出错,num"+sceneCode, e);
|
|
buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
|
|
buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
|
|
|
|
+ throw e;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -351,23 +382,23 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- private void cachePanorama(String dataSource, String num){
|
|
|
|
- String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
|
|
- //将全景图缓存到缓存目录
|
|
|
|
- List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
|
|
|
|
- //先清除旧的全景图
|
|
|
|
- cn.hutool.core.io.FileUtil.del(cachedImagesPath);
|
|
|
|
- String visionPath = dataSource + "/results/vision.txt";
|
|
|
|
- List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
|
- imagesList.stream().forEach(fileName -> {
|
|
|
|
- if (panoramaImageList.contains(fileName)) {
|
|
|
|
- String srcPath = dataSource + "/caches/images/" + fileName;
|
|
|
|
- String targetPath = cachedImagesPath + fileName;
|
|
|
|
- log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
|
|
|
|
- cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+// private void cachePanorama(String dataSource, String num){
|
|
|
|
+// String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
|
|
+// //将全景图缓存到缓存目录
|
|
|
|
+// List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
|
|
|
|
+// //先清除旧的全景图
|
|
|
|
+// cn.hutool.core.io.FileUtil.del(cachedImagesPath);
|
|
|
|
+// String visionPath = dataSource + "/results/vision.txt";
|
|
|
|
+// List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
|
+// imagesList.stream().forEach(fileName -> {
|
|
|
|
+// if (panoramaImageList.contains(fileName)) {
|
|
|
|
+// String srcPath = dataSource + "/caches/images/" + fileName;
|
|
|
|
+// String targetPath = cachedImagesPath + fileName;
|
|
|
|
+// log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
|
|
|
|
+// cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// }
|
|
|
|
|
|
private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
|
|
private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
|
|
if (ObjectUtils.isEmpty(scenePlus)) {
|
|
if (ObjectUtils.isEmpty(scenePlus)) {
|
|
@@ -437,14 +468,37 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //exportMeshObj这个是字段由app写入的
|
|
|
|
+ boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
|
|
|
|
+ if(!ObjectUtils.isEmpty(cameraType)
|
|
|
|
+ && cameraType == 14
|
|
|
|
+ && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
|
|
|
|
+ genModel = false;
|
|
|
|
+ }
|
|
|
|
+ boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
|
|
|
|
+ if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
|
|
|
|
+ || CollUtil.isEmpty(sdTilesSceneSourceList)
|
|
|
|
+ || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
|
|
|
|
+ gen3dTiles = false;
|
|
|
|
+ }
|
|
|
|
|
|
- if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
|
|
|
|
- || (!ObjectUtils.isEmpty(cameraType) && (!cameraType.equals(14)))) {
|
|
|
|
- CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
- CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
|
|
|
|
- CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
- map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
|
- map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
|
|
+ if(genModel){
|
|
|
|
+ if (!gen3dTiles) {
|
|
|
|
+ CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
|
|
|
|
+ CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
|
+ map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ }else{
|
|
|
|
+ List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
|
+ if(CollUtil.isEmpty(list)){
|
|
|
|
+ log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
|
+ throw new Exception("3dtiles目录异常");
|
|
|
|
+ }
|
|
|
|
+ list.stream().forEach(str->{
|
|
|
|
+ map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
|
|
CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
|
|
@@ -455,7 +509,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
|
|
if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
|
|
FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
|
|
FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
|
|
}
|
|
}
|
|
- map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
|
|
|
|
|
|
+// map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
|
|
map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
|
|
map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
|
|
map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
|
|
map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
|
|
map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
|
|
map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
|
|
@@ -480,8 +534,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
|
|
private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
|
|
|
|
|
|
//户型图上传
|
|
//户型图上传
|
|
- String userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
|
|
|
|
- String userViewPath = UploadFilePath.USER_VIEW_PATH + "floor-cad-%s.%s";
|
|
|
|
|
|
+ String dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
|
|
String floorCadPath = path + "/results/floorplan_cad";
|
|
String floorCadPath = path + "/results/floorplan_cad";
|
|
List<String> floorCadList = FileUtils.getFileList(floorCadPath);
|
|
List<String> floorCadList = FileUtils.getFileList(floorCadPath);
|
|
if(CollUtil.isNotEmpty(floorCadList)){
|
|
if(CollUtil.isNotEmpty(floorCadList)){
|
|
@@ -489,8 +542,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
String substring = str.substring(str.lastIndexOf(File.separator) + 1);
|
|
String substring = str.substring(str.lastIndexOf(File.separator) + 1);
|
|
String[] arr = substring.split("floor");
|
|
String[] arr = substring.split("floor");
|
|
String[] arr2 = arr[1].split("\\.");
|
|
String[] arr2 = arr[1].split("\\.");
|
|
- uploadFiles.put(str, String.format(userEditPath, num, arr2[0], arr2[1]));
|
|
|
|
- uploadFiles.put(str, String.format(userViewPath, num, arr2[0], arr2[1]));
|
|
|
|
|
|
+ uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -512,6 +564,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
|
|
sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
|
|
sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
sceneJson.setSceneKind(scenePlusExt.getSceneKind());
|
|
sceneJson.setSceneKind(scenePlusExt.getSceneKind());
|
|
|
|
+ sceneJson.setModelKind(scenePlusExt.getModelKind());
|
|
sceneJson.setVideos(JSON.toJSONString(videosJson));
|
|
sceneJson.setVideos(JSON.toJSONString(videosJson));
|
|
sceneJson.setPayStatus(scenePlus.getPayStatus());
|
|
sceneJson.setPayStatus(scenePlus.getPayStatus());
|
|
|
|
|
|
@@ -582,6 +635,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
QrConfig qrConfig = QrConfig.create();
|
|
QrConfig qrConfig = QrConfig.create();
|
|
|
|
+ qrConfig.setWidth(512);
|
|
|
|
+ qrConfig.setHeight(512);
|
|
if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
qrConfig.setImg(localLogoPath);
|
|
qrConfig.setImg(localLogoPath);
|
|
}
|
|
}
|
|
@@ -746,42 +801,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
|
|
return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
|
|
}
|
|
}
|
|
|
|
|
|
- private void sealScene(Long scenePlusId){
|
|
|
|
- scenePlusService.update(
|
|
|
|
- new LambdaUpdateWrapper<ScenePlus>()
|
|
|
|
- .set(ScenePlus::getPayStatus, PayStatus.NO_CAPACITY.code())
|
|
|
|
- .eq(ScenePlus::getId, scenePlusId));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * <p>
|
|
|
|
- 双目场景更新数据库
|
|
|
|
- * </p>
|
|
|
|
- * @author dengsixing
|
|
|
|
- * @date 2022/3/21
|
|
|
|
- * @param num
|
|
|
|
- * @param space
|
|
|
|
- **/
|
|
|
|
- private void updateDb4Sm(String num, long space){
|
|
|
|
- List<ScenePlus> ScenePlusList = scenePlusService.list(
|
|
|
|
- new LambdaQueryWrapper<ScenePlus>().select(ScenePlus::getId).eq(ScenePlus::getNum, num));
|
|
|
|
-
|
|
|
|
- if(CollUtil.isEmpty(ScenePlusList)){
|
|
|
|
- return ;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<Long> sceneIds = ScenePlusList.stream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- //更新场景创建时间
|
|
|
|
- scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>().in(ScenePlus::getId, sceneIds)
|
|
|
|
- .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code()));
|
|
|
|
-
|
|
|
|
- //更新使用容量
|
|
|
|
- scenePlusExtService.update(new LambdaUpdateWrapper<ScenePlusExt>().in(ScenePlusExt::getPlusId, sceneIds)
|
|
|
|
- .set(ScenePlusExt::getSpace, space)
|
|
|
|
- .set(ScenePlusExt::getAlgorithmTime, Calendar.getInstance().getTime()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
|
|
private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
|
|
|
|
|
|
scenePlusExt.setSpace(space);
|
|
scenePlusExt.setSpace(space);
|
|
@@ -815,6 +834,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
|
|
String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
|
|
scenePlusExt.setSceneKind(sceneKind);
|
|
scenePlusExt.setSceneKind(sceneKind);
|
|
|
|
+// scenePlusExt.setModelKind(modelKind);
|
|
|
|
|
|
scenePlusExtService.updateById(scenePlusExt);
|
|
scenePlusExtService.updateById(scenePlusExt);
|
|
}
|
|
}
|
|
@@ -850,12 +870,36 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
sceneEditInfo.setDescription(scenePlus.getDescription());
|
|
sceneEditInfo.setDescription(scenePlus.getDescription());
|
|
sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
sceneEditInfoService.save(sceneEditInfo);
|
|
sceneEditInfoService.save(sceneEditInfo);
|
|
-
|
|
|
|
}else{
|
|
}else{
|
|
|
|
+
|
|
|
|
+ int version = 0;
|
|
|
|
+ int imgVersion = 0;
|
|
|
|
+ int linkVersion = 0;
|
|
|
|
+ //获取展示页的版本号
|
|
|
|
+ String sceneJsonStr = fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json");
|
|
|
|
+ if(StrUtil.isNotEmpty(sceneJsonStr)){
|
|
|
|
+ JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
|
|
|
|
+ version = sceneJson.getIntValue("version");
|
|
|
|
+ imgVersion = sceneJson.getIntValue("imgVersion");
|
|
|
|
+ linkVersion = sceneJson.getIntValue("linkVersion");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(version < sceneEditInfo.getVersion()){
|
|
|
|
+ version = sceneEditInfo.getVersion();
|
|
|
|
+ }
|
|
|
|
+ if(imgVersion < sceneEditInfo.getImgVersion()){
|
|
|
|
+ imgVersion = sceneEditInfo.getImgVersion();
|
|
|
|
+ }
|
|
|
|
+ if(linkVersion < sceneEditInfo.getLinkVersion()){
|
|
|
|
+ linkVersion = sceneEditInfo.getLinkVersion();
|
|
|
|
+ }
|
|
|
|
+
|
|
sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
- sceneEditInfo.setVersion(sceneEditInfo.getVersion() + 1);
|
|
|
|
- sceneEditInfo.setImgVersion(sceneEditInfo.getImgVersion() + 1);
|
|
|
|
|
|
+ sceneEditInfo.setVersion(version + 1);
|
|
|
|
+ sceneEditInfo.setImgVersion(imgVersion + 1);
|
|
|
|
+ sceneEditInfo.setLinkVersion(linkVersion + 1);
|
|
|
|
+ sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
|
|
sceneEditInfoService.updateById(sceneEditInfo);
|
|
sceneEditInfoService.updateById(sceneEditInfo);
|
|
}
|
|
}
|
|
if(sceneEditControls == null){
|
|
if(sceneEditControls == null){
|
|
@@ -872,15 +916,21 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
|
|
return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
|
|
}
|
|
}
|
|
|
|
|
|
- public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
|
|
|
|
|
|
+ public boolean uploadHouseTypeJson(String num, String dataSource) {
|
|
|
|
+ String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
|
|
if (!new File(floorPlanCardFilePath).exists()) {
|
|
if (!new File(floorPlanCardFilePath).exists()) {
|
|
- log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
|
|
|
|
- return;
|
|
|
|
|
|
+ log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
|
|
JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
|
|
- String hourseTypeJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "houseType.json";
|
|
|
|
|
|
+ if(Objects.isNull(json)){
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
|
|
fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
- hourseTypeJsonPath = String.format(UploadFilePath.DATA_EDIT_PATH, num) + "houseType.json";
|
|
|
|
|
|
+ hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
|
|
fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
|
|
+
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
}
|
|
}
|