Parcourir la source

删除obj及V3场景计算逻辑

tianboguang il y a 2 ans
Parent
commit
10c57aa2e8

+ 0 - 66
src/main/java/com/fdkankan/contro/mq/listener/BuildObjListener.java

@@ -1,66 +0,0 @@
-package com.fdkankan.contro.mq.listener;
-
-import com.fdkankan.contro.mq.service.impl.BuildObjServiceImpl;
-import com.rabbitmq.client.Channel;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.Message;
-import org.springframework.amqp.rabbit.annotation.Queue;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-/**
- * <p>
- * TODO
- * </p>
- *
- * @author dengsixing
- * @since 2022/4/19
- **/
-@Slf4j
-@Component
-public class BuildObjListener extends AbstrackBuildSceneListener {
-
-
-    @Value("${queue.modeling.obj.modeling-pre}")
-    private String queueObjModelingPre;
-    @Value("${queue.modeling.obj.modeling-post}")
-    private String queueObjModelingPost;
-
-    @Autowired
-    private BuildObjServiceImpl buildObjService;
-
-
-    /**
-     * 场景计算前置资源准备处理
-     *
-     * @param channel
-     * @param message
-     * @throws Exception
-     */
-    @RabbitListener(
-            queuesToDeclare = @Queue("${queue.modeling.obj.modeling-pre}"),
-            concurrency = "${maxThread.modeling.modeling-pre}"
-    )
-    public void buildObjScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel, queueObjModelingPre, message, buildObjService);
-    }
-
-
-    /**
-     * 场景计算后置结果处理
-     *
-     * @param channel
-     * @param message
-     * @throws Exception
-     */
-    @RabbitListener(
-            queuesToDeclare = @Queue("${queue.modeling.obj.modeling-post}"),
-            concurrency = "${maxThread.modeling.modeling-post}"
-    )
-    public void buildObjScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel, queueObjModelingPost, message, buildObjService);
-
-    }
-}

+ 0 - 53
src/main/java/com/fdkankan/contro/mq/listener/BuildV3SceneListener.java

@@ -1,53 +0,0 @@
-package com.fdkankan.contro.mq.listener;
-
-import com.fdkankan.contro.mq.service.impl.BuildV3SceneServiceImpl;
-import com.rabbitmq.client.Channel;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.Message;
-import org.springframework.amqp.rabbit.annotation.Queue;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-@Slf4j
-@Component
-public class BuildV3SceneListener extends AbstrackBuildSceneListener {
-
-    @Value("${queue.modeling.v3.modeling-pre}")
-    private String queueModelingPre;
-    @Value("${queue.modeling.v3.modeling-post}")
-    private String queueModelingPost;
-
-    @Autowired
-    private BuildV3SceneServiceImpl buildSceneService;
-
-    /**
-     * 场景计算前置资源准备处理
-     * @param channel
-     * @param message
-     * @throws Exception
-     */
-    @RabbitListener(
-            queuesToDeclare = @Queue("${queue.modeling.v3.modeling-pre}"),
-            concurrency = "${maxThread.modeling.modeling-pre}"
-    )
-    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel,queueModelingPre,message,buildSceneService);
-    }
-
-    /**
-     * 场景计算后置结果处理
-     * @param channel
-     * @param message
-     * @throws Exception
-     */
-    @RabbitListener(
-            queuesToDeclare = @Queue("${queue.modeling.v3.modeling-post}"),
-            concurrency = "${maxThread.modeling.modeling-post}"
-    )
-    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel,queueModelingPost,message,buildSceneService);
-
-    }
-}

+ 0 - 216
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -1,216 +0,0 @@
-package com.fdkankan.contro.mq.service.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.entity.ScenePlus;
-import com.fdkankan.contro.entity.ScenePro;
-import com.fdkankan.contro.entity.SceneProEdit;
-import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.service.*;
-import com.fdkankan.contro.service.impl.FdkkV4Service;
-import com.fdkankan.fyun.face.FYunFileServiceInterface;
-import com.fdkankan.model.constants.ConstantFileName;
-import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.UploadFilePath;
-import com.fdkankan.model.utils.CreateObjUtil;
-import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
-import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
-import com.fdkankan.rabbitmq.util.RabbitMqProducer;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-
-import java.io.File;
-
-/**
- * <p>
- * TODO
- * </p>
- *
- * @author dengsixing
- * @since 2022/3/1
- **/
-@Slf4j
-@Service
-public class BuildObjServiceImpl implements IBuildSceneService {
-
-    @Value("${queue.modeling.modeling-call}")
-    private String queueModelingCall;
-
-    @Value("${queue.modeling.obj.modeling-post}")
-    private String queueObjModelingPost;
-
-    @Autowired
-    private RabbitMqProducer mqProducer;
-
-    @Autowired
-    private FYunFileServiceInterface fYunFileService;
-
-    @Autowired
-    private ISceneProService sceneProService;
-
-    @Autowired
-    private IFdkkLaserService fdkkLaserService;
-
-    @Autowired
-    private FdkkV4Service fdkkV4Service;
-
-    @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-
-    @Autowired
-    private ISceneProEditService sceneProEditService;
-
-
-    @Autowired
-    private IScenePlusService scenePlusService;
-
-    @Override
-    public void buildScenePre(BuildSceneCallMessage message) {
-        boolean success = false;
-        try {
-            String path = message.getPath();
-            //根据相机类型,组装资源路径
-            String laserObjFilePath = path + "_laser_obj";
-            log.info("开始准备生成OBJ场景资源,路径:{}", laserObjFilePath);
-
-            FileUtils.delAllFile(laserObjFilePath);
-
-            //获取解压后的资源的data.fdage中的数据
-            File folderPath = new File(path);
-            fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage", path + "/capture/data.fdage");
-            JSONObject jsonObject = FileUtils.readJson(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage");
-            if(ObjectUtils.isEmpty(jsonObject)){
-                log.error("data.fdage文件不存在");
-                return ;
-            }
-            if (!jsonObject.containsKey("exportMeshObj") || jsonObject.getIntValue("exportMeshObj") != 1) {
-                // 写入data.fdage 防止重算
-                jsonObject.put("exportMeshObj", 1);
-                FileUtils.writeFile(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage", jsonObject.toJSONString());
-                fYunFileService.uploadFile(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage",
-                        ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
-            }
-            // 重新构造datafdage文件,添加生成obt文件选项
-            jsonObject.put("OnlyExportMeshObj",true);
-            FileUtils.writeFile(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage", jsonObject.toJSONString());
-
-            message.getBuildContext().put("previousPath",path);
-            message.setCameraType("14");
-            message.setResolution(jsonObject.getString("resolution"));
-            message.setPath(laserObjFilePath);
-            message.setResultReceiverMqName(queueObjModelingPost);
-
-            //下载资源到本地
-            this.downLoadSource(message, laserObjFilePath);
-
-            //发送mq,就进行计算
-            mqProducer.sendByWorkQueue(queueModelingCall, message);
-
-            success = true;
-
-            log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
-
-        }catch (Exception e){
-            log.error("场景计算前置处理出错", e);
-        }finally {
-            //如果前置处理失败,发送钉钉消息
-            if(!success){
-                buildSceneDTService.handBaseFail("生成OBJ场景资源准备异常", message.getPath(), message.getSceneNum(), "计算控制服务器");
-            }
-
-        }
-    }
-
-    @Override
-    public void downLoadSource(BuildSceneCallMessage message,String path) throws Exception{
-
-        String prevoisPath = message.getBuildContext().get("previousPath").toString();
-        FileUtils.copyFile(prevoisPath + "/caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin", true);
-        FileUtils.copyFile(prevoisPath + "/caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json", true);
-        FileUtils.copyDirectiory(prevoisPath + "/caches/images", path + "/caches/images");
-
-        FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_csc", path + "/caches/depthmap_csc");
-        FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_vis", path + "/caches/depthmap_vis");
-        FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap", path + "/caches/depthmap");
-        FileUtils.copyFile(prevoisPath + "/caches/panorama.json", path + "/caches/panorama.json", true);
-        FileUtils.copyFile(prevoisPath + "/results/laserData/laser.ply", path + "/results/laserData/laser.ply", true);
-    }
-
-    @Override
-    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
-
-        if (!message.getBuildSuccess()) {
-            log.error("生成OBJ场景计算失败!");
-            // 发送钉钉消息,计算失败
-            buildSceneDTService.handModelFail("生成OBJ场景计算失败!", message.getPath(), message.getBuildContext().get("sceneNum").toString(), message.getHostName());
-            return;
-        }
-
-        String path = message.getPath();
-        String projectNum = message.getBuildContext().get("sceneNum").toString();
-
-        String laserObjFilePath = path;
-        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", String.format(UploadFilePath.IMG_VIEW_PATH,  projectNum) + ConstantFileName.modelUUID + "_50k.dam.lzma");
-        fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", String.format(UploadFilePath.IMG_VIEW_PATH,  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(),
-                            String.format(UploadFilePath.IMG_VIEW_PATH,  projectNum) + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/"+textureFile.getName());
-                }
-            }
-        }
-
-        fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + "tex/texture1.jpg",
-                String.format(UploadFilePath.IMG_VIEW_PATH,  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");
-
-
-        ScenePro scenePro = sceneProService.getByNum(projectNum);
-        if(!ObjectUtils.isEmpty(scenePro)){
-            LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<ScenePro>()
-                    .set(ScenePro::getStatus, -2).eq(ScenePro::getNum, projectNum);
-            sceneProService.update(updateWrapper);
-            sceneProEditService.update(new LambdaUpdateWrapper<SceneProEdit>().set(SceneProEdit::getMapVisi,0)
-                    .eq(SceneProEdit::getProId,scenePro.getId()));
-        }
-
-        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
-        if(!ObjectUtils.isEmpty(scenePlus)){
-            LambdaUpdateWrapper<ScenePlus> plusUpdateWrapper = new LambdaUpdateWrapper<ScenePlus>()
-                    .set(ScenePlus::getSceneStatus, -2).eq(ScenePlus::getNum, projectNum);
-            scenePlusService.update(plusUpdateWrapper);
-        }
-
-        // 如果未升级V4,则升级V4
-        fdkkV4Service.upgradeToV4(projectNum);
-    }
-
-}

+ 0 - 574
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -1,574 +0,0 @@
-package com.fdkankan.contro.mq.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.io.file.FileNameUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.core.util.ZipUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.constant.ExpiredStatus;
-import com.fdkankan.common.constant.PayStatus;
-import com.fdkankan.common.constant.SceneStatus;
-import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.entity.*;
-import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.service.*;
-import com.fdkankan.contro.service.impl.FdkkV4Service;
-import com.fdkankan.fyun.config.FYunFileConfig;
-import com.fdkankan.fyun.constant.FYunTypeEnum;
-import com.fdkankan.fyun.face.FYunFileServiceInterface;
-import com.fdkankan.model.constants.ConstantFileName;
-import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.UploadFilePath;
-import com.fdkankan.model.utils.CreateHouseJsonUtil;
-import com.fdkankan.model.utils.CreateObjUtil;
-import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
-import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
-import com.fdkankan.rabbitmq.util.RabbitMqProducer;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
-
-/**
- * <p>
- * TODO
- * </p>
- *
- * @author dengsixing
- * @since 2022/4/20
- **/
-@Slf4j
-@Service
-public class BuildV3SceneServiceImpl implements IBuildSceneService {
-
-    @Value("${queue.modeling.modeling-call}")
-    private String queueModelingCall;
-
-    @Value("${queue.modeling.v3.modeling-post}")
-    private String queueV3ModelingPost;
-
-    @Value("${model.type:#{null}}")
-    private String modelSceneKind;
-
-    @Autowired
-    private RabbitMqProducer mqProducer;
-
-    @Autowired
-    private FYunFileServiceInterface fYunFileService;
-    @Autowired
-    private ICameraDetailService cameraDetailService;
-
-    @Autowired
-    private FYunFileConfig fYunFileConfig;
-
-    @Autowired
-    private ISceneProService sceneProService;
-
-    @Autowired
-    private IUserIncrementService userIncrementService;
-
-    @Autowired
-    private IFdkkLaserService fdkkLaserService;
-
-    @Autowired
-    private FdkkV4Service fdkkV4Service;
-
-    @Autowired
-    private IIncrementTypeService incrementTypeService;
-
-    @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-
-    @Autowired
-    private ISceneProEditService sceneProEditService;
-
-    @Override
-    public void buildScenePre(BuildSceneCallMessage message) {
-        boolean success = false;
-        try {
-            //根据相机类型,组装资源路径
-            //下载资源到本地
-            this.downLoadSource(message, message.getPath());
-            JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
-            // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
-            boolean rewrite = false;
-            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(modelSceneKind)) {
-                // 修改dataFdage文件
-                fdageJson.put("modelType", modelSceneKind);
-                rewrite = true;
-            }
-
-            if (rewrite) {
-                FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
-            }
-
-            message.getBuildContext().put("cameraType",message.getCameraType());
-
-            message.setResultReceiverMqName(queueV3ModelingPost);
-
-            //发送mq,就进行计算
-            mqProducer.sendByWorkQueue(queueModelingCall, message);
-
-            success = true;
-
-            log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
-
-        }catch (Exception e){
-            log.error("场景计算前置处理出错", e);
-        }finally {
-            //如果前置处理失败,发送钉钉消息
-            if(!success){
-                buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
-            }
-
-        }
-    }
-
-    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);
-    }
-
-
-    @Override
-    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
-        Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
-        String sceneCode = message.getBuildContext().get("sceneNum").toString();
-        Long computeTime = message.getComputeTime();
-
-        String path = message.getPath();
-
-        Boolean buildSuccess = message.getBuildSuccess();
-        JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
-        Integer videoVersion = fdageData.getInteger("videoVersion");
-        try {
-            // 上传计算日志
-            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
-            log.info("开始上传计算日志");
-            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
-            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
-            log.info("计算日志上传完成");
-
-            if (!buildSuccess) {
-                log.error("建模失败,修改状态为失败状态");
-                sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
-                        .set(ScenePro::getStatus, SceneStatus.FAILD.code())
-                        .eq(ScenePro::getNum, sceneCode));
-                // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
-                return;
-            }
-
-            Map<String, String> uploadFiles = getUploadFiles(sceneCode,path,cameraType,fdageData);
-
-            //建模成功走以下逻辑
-            log.info("cameraType:{}",cameraType);
-
-            //计算场景消耗磁盘空间
-            long space = this.calUseSpace(uploadFiles);
-
-            //读取计算结果文件生成videosJson
-            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
-
-            //写入数据库
-            ScenePro scenePro = this.updateDbPlus(sceneCode, space, videosJson.toJSONString(), computeTime,fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1);
-
-            scenePro.setPayStatus(PayStatus.PAY.code());
-            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
-            if (cameraType != 14) {
-                scenePro.setPayStatus(this.getPayStatus(scenePro.getCameraId(), space));
-                sceneProService.update(
-                        new LambdaUpdateWrapper<ScenePro>()
-                                .set(ScenePro::getPayStatus, scenePro.getPayStatus())
-                                .eq(ScenePro::getId, scenePro.getId()));
-            }
-
-            //上传文件
-            log.info("开始上传场景计算结果数据,num:{}", sceneCode);
-            fYunFileService.uploadMulFiles(uploadFiles);
-
-            Map<String,String> damFileHeaders = new HashMap<>();
-            damFileHeaders.put("Content-Encoding","gzip");
-
-            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 -> {
-                            // 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);
-                        });
-            }
-
-            //生成houseTypejson并上传
-            uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
-                    .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
-
-
-
-            //计算成功,通知APP
-            Integer pushChannel = fdageData.getInteger("pushChannel");
-            String pushToken = fdageData.getString("pushToken");
-            this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePro.getSceneName(), scenePro.getWebSite());
-
-            SceneProEdit sceneProEdit = sceneProEditService.getByProId(scenePro.getId());
-            sceneProEdit.setVersion(ObjectUtils.isEmpty(sceneProEdit.getVersion()) ? 0 : sceneProEdit.getVersion() + 1);
-            sceneProEdit.setImagesVersion(ObjectUtils.isEmpty(sceneProEdit.getImagesVersion()) ? 0 : sceneProEdit.getImagesVersion() + 1);
-            sceneProEdit.setFloorEditVer(ObjectUtils.isEmpty(sceneProEdit.getFloorEditVer()) ? 0 : sceneProEdit.getFloorEditVer() + 1);
-            sceneProEdit.setFloorPublishVer(ObjectUtils.isEmpty(sceneProEdit.getFloorPublishVer()) ? 0 : sceneProEdit.getFloorPublishVer() + 1);
-            if (cameraType == 14) {
-                //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime());
-                sceneProEdit.setMapVisi(0);
-            }
-            sceneProEditService.updateById(sceneProEdit);
-
-            //写scene.json
-            log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
-            this.writeSceneJson(videosJson,scenePro,sceneProEdit);
-
-            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
-            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
-            // 判断是否升级V4
-            if(fdageData.containsKey("updateV4") && fdageData.getIntValue("updateV4") == 1){
-                fdkkV4Service.upgradeToV4(sceneCode);
-            }
-
-        }catch (Exception e){
-            e.printStackTrace();
-            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
-        }
-    }
-
-    private Map<String, String> getUploadFiles(String projectNum,String path,Integer cameraType,JSONObject fdageData) throws Exception {
-        String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
-        String imagesPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
-        String videoPath = String.format(ConstantFilePath.VIDEO_PATH_FORMAT, projectNum);
-        String resultsPath = path + File.separator + "results" + File.separator;
-
-        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
-        JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
-
-        JSONObject fileJson = null;
-        String fileName = "";
-
-        Map<String, String> map = new HashMap();
-
-        for (int i = 0; i < array.size(); ++i) {
-            fileJson = array.getJSONObject(i);
-            fileName = fileJson.getString("file");
-            String filePath = resultsPath + fileName;
-
-            if (!(new File(filePath)).exists()) {
-                throw new Exception(filePath + "文件不存在");
-            }
-
-            if ("vision2.txt".equals(fileName)) {
-                CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
-                map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
-                map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
-            }
-
-            if (fileJson.getIntValue("clazz") == 2) {
-                map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
-            } else if (fileJson.getIntValue("clazz") == 3) {
-                map.put(filePath, imagesPath + "pan/high/" + fileName.replace("high/", ""));
-            } else if (fileJson.getIntValue("clazz") == 4) {
-                map.put(filePath, imagesPath + "pan/low/" + fileName.replace("low/", ""));
-            } else if (fileJson.getIntValue("clazz") == 5) {
-                map.put(filePath, imagesPath + fileName);
-            } else if (fileJson.getIntValue("clazz") == 7) {
-                map.put(filePath, imagesPath + fileName);
-            } else if (fileJson.getIntValue("clazz") == 10) {
-                String mappingOssPath = String.format("scene_edit_data/%s/data/", projectNum) + fileName.replace("updown", "mapping");
-                map.put(filePath, mappingOssPath);
-            } else {
-                if (fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12) {
-                    map.put(filePath, videoPath + fileName.replace("videos/", ""));
-                    if (fileName.contains(".mp4")) {
-                        map.put(resultsPath + fileName.replace("mp4", "flv"), videoPath + fileName.replace("videos/", "").replace("mp4", "flv"));
-                    }
-                }
-
-                if (fileJson.getIntValue("clazz") == 16) {
-                    map.put(filePath, dataViewPath + fileName);
-                }
-
-                if (fileJson.getIntValue("clazz") == 18) {
-                    map.put(filePath, imagesPath + fileName);
-                }
-            }
-        }
-
-
-        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");
-        }
-
-        CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
-        map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
-        map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
-
-        log.info("数据转换完成:" + projectNum);
-
-        FileUtil.touch("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
-        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.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/Up.xml", dataViewPath + "Up.xml");
-        map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
-        map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
-        map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
-        return map;
-
-    }
-
-    private JSONObject getFdageData(String dataFdagePath) {
-        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
-        String data = FileUtils.readFile(dataFdagePath);
-        //获取data.fdage的内容
-        JSONObject dataJson = new JSONObject();
-        if(data!=null){
-            dataJson = JSONObject.parseObject(data);
-        }
-        return dataJson;
-    }
-
-    private void writeSceneJson(JSONObject videosJson, ScenePro scenePro,SceneProEdit sceneProEdit)  throws Exception{
-        String num = scenePro.getNum();
-        String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num);
-        //如果云端没有scene.json文件,生成一份
-
-        JSONObject sceneJson = JSONObject.parseObject(JSONObject.toJSONString(scenePro));
-        sceneJson.put("videos",videosJson.toJSONString());
-        sceneJson.put("version",sceneProEdit.getVersion());
-        sceneJson.put("imagesVersion",sceneProEdit.getImagesVersion());
-        sceneJson.put("floorEditVer",sceneProEdit.getFloorEditVer());
-        sceneJson.put("floorPublishVer",sceneProEdit.getFloorPublishVer());
-        String sceneJsonStr = JSON.toJSONString(sceneJson);
-
-        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "scene.json", sceneJsonStr);
-        //上传sceneJson文件
-        fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
-
-        // 上传status JSON.
-        JSONObject statusJson = new JSONObject();
-        //临时将-2改成1,app还没完全更新
-        statusJson.put("status", 1);
-        statusJson.put("webSite", scenePro.getWebSite());
-        statusJson.put("sceneNum", num);
-        statusJson.put("thumb", scenePro.getThumb());
-        statusJson.put("payStatus", scenePro.getPayStatus());
-        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
-
-        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
-                dataViewPath + "status.json");
-    }
-
-    private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
-        log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
-    }
-
-    private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
-        //读取videos_hdr_param.json, 保存点位视频的value
-        Map<String, Object> videoMap = new HashMap<>();
-        String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
-        JSONArray videoArray = null;
-        if(StringUtils.isNotEmpty(videosHdr)){
-            videoArray = JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
-        }
-        if(videoArray != null){
-            for(int i = 0, len = videoArray.size(); i < len; i++) {
-                videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
-                if(videoArray.getJSONObject(i).containsKey("fov")){
-                    videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
-                }
-            }
-        }
-
-        //获取upload中的video视频名称
-        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
-        JSONObject uploadJson = null;
-        JSONArray array = null;
-        if(uploadData!=null) {
-            uploadJson = JSONObject.parseObject(uploadData);
-            array = uploadJson.getJSONArray("upload");
-        }
-        JSONObject fileJson = null;
-        String fileName = "";
-
-        //计算ts文件的大小,并拼接成json格式
-        JSONArray jsonArray = new JSONArray();
-        JSONObject videoJson = null;
-        JSONObject videosJson = new JSONObject();
-        long videoSize = 0L;
-        for(int i = 0, len = array.size(); i < len; i++) {
-            fileJson = array.getJSONObject(i);
-            fileName = fileJson.getString("file");
-            if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
-                videoJson = new JSONObject();
-                videoJson.put("id", fileName.substring(
-                    0, fileName.lastIndexOf(".")).replace("videos/", ""));
-
-                //如果ts文件存在,就计算ts大小
-                if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
-                    videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
-                    videoJson.put("tsSize", videoSize);
-                }
-                if(videoMap.containsKey(videoJson.get("id"))){
-                    videoJson.put("value", videoMap.get(videoJson.get("id")));
-                }
-                if(videoMap.containsKey(videoJson.get("id") + "_fov")){
-                    videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
-                }else {
-                    videoJson.put("blend_fov", 7);
-                }
-                jsonArray.add(videoJson);
-            }
-        }
-
-        videosJson.put("data", jsonArray);
-        if(Objects.nonNull(videoVersion) && videoVersion >= 4){
-            videosJson.put("version", 3);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum) + "Up.xml");
-            if(cameraType == 13){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }else {
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum) + "Up2.xml");
-            if(cameraType == 13){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }
-
-        if(cameraType == 5 || cameraType == 6){
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum) + "stitch_params.txt");
-        }
-
-        return videosJson;
-    }
-
-    private Long calUseSpace(Map<String, String> uploadFile) {
-        return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
-    }
-
-    /**
-     * <p>
-     双目场景更新数据库
-     * </p>
-     * @author dengsixing
-     * @date 2022/3/21
-     * @param num
-     * @param space
-     **/
-    private void updateDb4Sm(String num, long space){
-        List<ScenePro> ScenePlusList = sceneProService.list(
-            new LambdaQueryWrapper<ScenePro>().select(ScenePro::getId).eq(ScenePro::getNum, num));
-
-        if(CollUtil.isEmpty(ScenePlusList)){
-            return ;
-        }
-
-        List<Long> sceneIds = ScenePlusList.stream().map(ScenePro::getId).collect(Collectors.toList());
-
-        //更新场景创建时间
-        sceneProService.update(new LambdaUpdateWrapper<ScenePro>().in(ScenePro::getId, sceneIds)
-            .set(ScenePro::getStatus, SceneStatus.NO_DISPLAY.code())
-                .set(ScenePro::getSpace,space)
-                .set(ScenePro::getCreateTime,new Date())
-        );
-    }
-
-    private ScenePro updateDbPlus(String num, Long space, String videosJson, Long computeTime,boolean isObj){
-        sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
-                .eq(ScenePro::getNum, num)
-                .set(ScenePro::getStatus, SceneStatus.NO_DISPLAY.code())
-                .set(ScenePro::getUpdateTime, new Date())
-                .set(ScenePro::getCreateTime, new Date())
-                .set(ScenePro::getSpace, space)
-                .set(ScenePro::getComputeTime, computeTime)
-                .set(ScenePro::getVideos, videosJson)
-                .set(ScenePro::getIsObj, isObj ? 1 : 0)
-                .set(ScenePro::getPayStatus, PayStatus.PAY.code()));
-       return sceneProService.getByNum(num);
-    }
-
-    private int getPayStatus(Long cameraId, Long space) throws Exception{
-        //更新相机使用用量
-        CameraDetail cameraDetail = cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
-        Long totalSpace = cameraDetail.getTotalSpace();
-
-        UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
-        if(!ObjectUtils.isEmpty(userIncrement) && userIncrement.getIsExpired().equals(ExpiredStatus.NOT_EXPIRED.code())){
-            IncrementType type = incrementTypeService.getById(userIncrement.getIncrementTypeId());
-            if(type != null){
-                Integer cameraCapacity = type.getCameraCapacity();
-                if(cameraCapacity == -1){           //无限容量权益
-                    return PayStatus.PAY.code();
-                }else {
-                    totalSpace = cameraCapacity *1024 * 1024 * 1024L;     //权益设置容量
-                }
-            }
-        }
-
-        return totalSpace.compareTo(cameraDetail.getUsedSpace()) == -1 ? PayStatus.NO_CAPACITY.code() : PayStatus.PAY.code();
-    }
-
-    public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
-        if (!new File(floorPlanCardFilePath).exists()) {
-            log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
-            return;
-        }
-        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
-        String hourseTypeJsonPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num) + "houseType.json";
-        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
-        hourseTypeJsonPath = String.format(UploadFilePath.DATA_EDIT_PATH, num) + "houseType.json";
-        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
-    }
-}