|
@@ -30,6 +30,7 @@ import com.fdkankan.model.constants.UploadFilePath;
|
|
|
import com.fdkankan.model.enums.ModelTypeEnums;
|
|
|
import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
+import com.fdkankan.model.utils.SceneUtil;
|
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
@@ -126,10 +127,26 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
//下载资源到本地
|
|
|
this.downLoadSource(message, message.getPath());
|
|
|
|
|
|
+ JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
|
|
|
+
|
|
|
+ boolean rewrite = false;
|
|
|
+ // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
|
|
|
+ if (fdageJson.containsKey("OnlyExportMeshObj")) {
|
|
|
+ log.info("data.fdage 包含 OnlyExportMeshObj,进行去除!");
|
|
|
+ // 写入data.fdage 防止重算
|
|
|
+ fdageJson.remove("OnlyExportMeshObj");
|
|
|
+ String ossPath = getOssPath(message.getPath());
|
|
|
+ fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
|
|
|
+ rewrite = true;
|
|
|
+ }
|
|
|
+
|
|
|
if (!ObjectUtils.isEmpty(modelType)) {
|
|
|
// 修改dataFdage文件
|
|
|
- JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
|
|
|
fdageJson.put("modelType", modelType);
|
|
|
+ rewrite = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rewrite) {
|
|
|
FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
|
|
|
}
|
|
|
|
|
@@ -159,14 +176,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
|
|
|
+ private String getOssPath(String path) {
|
|
|
String ossPath = ConstantFilePath.OSS_PREFIX
|
|
|
+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
|
|
|
if (!ossPath.endsWith("/")) {
|
|
|
ossPath = ossPath.concat("/");
|
|
|
}
|
|
|
+ return ossPath;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
|
|
|
+ String ossPath = getOssPath(path);
|
|
|
fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
|
|
|
}
|
|
|
|
|
@@ -241,8 +263,11 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
|
|
|
// dam 文件设置请求头
|
|
|
uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
- .filter(entry -> new File(entry.getKey()).exists())
|
|
|
.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");
|
|
|
// 重命名
|
|
@@ -254,6 +279,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
//拷贝部分文件到编辑目录,用于用户编辑
|
|
|
this.copyToEditDir(sceneCode);
|
|
|
|
|
|
+ //计算完毕后,同步全景图到缓存目录
|
|
|
+ this.cachePanorama(path, sceneCode);
|
|
|
+
|
|
|
//生成houseTypejson并上传
|
|
|
uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
|
|
|
.forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
|
|
@@ -266,12 +294,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
|
|
|
if (cameraType == 14) {
|
|
|
- // 如果是激光场景,上传全景文件到V3路径,激光系统上线后,可不用上传
|
|
|
- String imagePath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode);
|
|
|
- String V3ImagePath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, sceneCode);
|
|
|
- uploadFiles.entrySet().stream().filter(entry -> entry.getValue().contains(imagePath)).forEach(entry -> {
|
|
|
- fYunFileService.uploadFile(entry.getKey(), entry.getValue().replace(imagePath, V3ImagePath));
|
|
|
- });
|
|
|
//计算成功 激光转台相机 同步 请求
|
|
|
fdkkLaserService.syncBuildResult(scenePlus.getNum(), scenePlusExt.getDataSource(),scenePlus.getCreateTime());
|
|
|
sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
|
|
@@ -304,6 +326,24 @@ 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 Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
|
|
|
if (ObjectUtils.isEmpty(scenePlus)) {
|
|
|
throw new Exception("未找到场景信息:" + path);
|
|
@@ -761,10 +801,13 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
|
|
|
if(!ObjectUtils.isEmpty(userIncrement) && userIncrement.getIsExpired().equals(ExpiredStatus.NOT_EXPIRED.code())){
|
|
|
IncrementType type = incrementTypeService.getById(userIncrement.getIncrementTypeId());
|
|
|
- if (ObjectUtils.isEmpty(type) || type.getType().equals("cn")) {
|
|
|
- return PayStatus.PAY.code();
|
|
|
- } else if (type.getType().equals("eur")) {
|
|
|
- totalSpace = type.getCameraCapacity() * 1024 * 1024L;
|
|
|
+ if(type != null){
|
|
|
+ Integer cameraCapacity = type.getCameraCapacity();
|
|
|
+ if(cameraCapacity == -1){ //无限容量权益
|
|
|
+ return PayStatus.PAY.code();
|
|
|
+ }else {
|
|
|
+ totalSpace = cameraCapacity *1024 * 1024 * 1024L; //权益设置容量
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|