dengsixing 3 anni fa
parent
commit
7290f959b0

+ 16 - 0
src/main/java/com/fdkankan/scene/bean/ResponseSceneDataDownload.java

@@ -0,0 +1,16 @@
+package com.fdkankan.scene.bean;
+
+import lombok.Data;
+
+/**
+ * Created by Hb_zzZ on 2020/12/31.
+ */
+@Data
+public class ResponseSceneDataDownload {
+
+    private String sceneNum;
+
+    private String fileMd5;
+
+    private String downloadPath;
+}

+ 21 - 0
src/main/java/com/fdkankan/scene/controller/SceneAppEditController.java

@@ -223,4 +223,25 @@ public class SceneAppEditController {
         return sceneProAppService.deleteUploadBgMusic(sceneNum);
     }
 
+    /**
+     * V3版本获取app上传的音频
+     * @return
+     */
+    @CheckCurrentUser(description = "V3版本获取app上传的音频")
+    @RequestMapping(value = "/getRecordAudioFromAppV3", method = RequestMethod.POST)
+    public ResultData getRecordAudioFromAppV3(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        String sceneNum = request.getParameter("sceneNum");
+        String soundFile = request.getParameter("soundFile");
+
+        String type = request.getParameter("type");
+        String fileName = request.getParameter("fileName");
+        String length = request.getParameter("length");
+        //替换视频,1为替换,0或没值为不替换
+        String replace = request.getParameter("replace");
+
+        String times = request.getParameter("times");
+        String index = request.getParameter("index");
+        return sceneProAppService.getRecordAudioFromAppV3(sceneNum, soundFile, type, fileName, length, replace,times, index);
+    }
+
 }

+ 214 - 0
src/main/java/com/fdkankan/scene/controller/SceneController.java

@@ -1,8 +1,26 @@
 package com.fdkankan.scene.controller;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.LoginType;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.JwtUtil;
+import com.fdkankan.common.util.SecurityUtil;
+import com.fdkankan.scene.bean.ResponseSceneDataDownload;
+import com.fdkankan.scene.entity.Camera;
+import com.fdkankan.scene.entity.CameraDetail;
+import com.fdkankan.scene.entity.SceneCooperation;
+import com.fdkankan.scene.entity.SceneDataDownload;
+import com.fdkankan.scene.entity.SceneProEdit;
+import com.fdkankan.scene.entity.User;
+import com.fdkankan.scene.service.ICameraDetailService;
+import com.fdkankan.scene.service.ICameraService;
+import com.fdkankan.scene.service.ISceneCooperationService;
+import com.fdkankan.scene.service.ISceneDataDownloadService;
+import com.fdkankan.scene.service.ISceneProEditService;
+import com.fdkankan.scene.service.IUserService;
+import com.fdkankan.web.model.SSOUser;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.bean.RequestRebuildVedioScene;
 import com.fdkankan.scene.bean.RequestSceneCooperation;
@@ -13,10 +31,14 @@ import com.fdkankan.scene.service.ISceneProService;
 import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.scene.service.IVideoSceneProgressService;
 import com.fdkankan.web.controller.BaseController;
+import com.fdkankan.web.user.SSOLoginHelper;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -38,6 +60,29 @@ public class SceneController extends BaseController {
     private IVideoSceneProgressService videoSceneProgressService;
     @Autowired
     private IPicSceneProgressService picSceneProgressService;
+    @Autowired
+    private ISceneProEditService sceneProEditService;
+    @Autowired
+    private ISceneDataDownloadService sceneDataDownloadService;
+    @Autowired
+    private ICameraService cameraService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private SSOLoginHelper ssoLoginHelper;
+    @Autowired
+    private ISceneCooperationService sceneCooperationService;
+
+    @Value("${scene.pro.url}")
+    private String sceneProUrl;
+    @Value("${scene.pro.new.url}")
+    private String sceneProNewUrl;
+    @Value("${scene.pro.v4.url}")
+    private String sceneProV4Url;
+    @Value("${main.url}")
+    private String mainUrl;
+    @Autowired
+    private IUserService userService;
 
     /**
      * 是否已登录
@@ -124,4 +169,173 @@ public class SceneController extends BaseController {
         return ResultData.ok(picSceneProgress.getRebuildResult());
     }
 
+    /**
+     * 根据场景密码打开场景
+     */
+    @RequestMapping(value = "/openSceneBykey")
+    public ResultData openSceneBykey(HttpServletRequest request) throws Exception {
+        String sceneNum = request.getParameter("num");
+        String sceneKey = request.getParameter("sceneKey");
+        if (StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(sceneKey)) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+        ScenePro scenePro = sceneProService.findBySceneNum(sceneNum);
+        if (scenePro == null) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+        if (scenePro.getPayStatus() != 1) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        SceneProEdit editEntity = sceneProEditService.findBySceneProId(scenePro.getId());
+        if (editEntity == null) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        if(!sceneKey.equals(editEntity.getSceneKey())){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5021);
+        }
+
+        return ResultData.ok();
+    }
+
+    /**
+     * 获取数据对接下载信息
+     */
+    @RequestMapping(value = "/downLoadZSData", method = RequestMethod.GET)
+    public ResultData downLoadZSData(HttpServletRequest request) throws Exception{
+        String sceneNum = request.getParameter("sceneNum");
+        if(StrUtil.isEmpty(sceneNum)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+        ScenePro sceneProEntity = sceneProService.findBySceneNum(sceneNum);
+        if(sceneProEntity == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        SceneDataDownload sceneDataDownloadEntity = sceneDataDownloadService.findBySceneNum(sceneNum);
+        if(sceneDataDownloadEntity == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5025);
+        }
+
+        ResponseSceneDataDownload responseSceneDataDownload = new ResponseSceneDataDownload();
+        BeanUtils.copyProperties(sceneDataDownloadEntity, responseSceneDataDownload);
+        return ResultData.ok(responseSceneDataDownload);
+    }
+
+    @RequestMapping("goEditScenePage")
+    public void goEditScenePage(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        String phoneNum = request.getParameter("phoneNum");
+        String password = request.getParameter("password");
+        String sceneNum = request.getParameter("sceneNum");
+        String childName = request.getParameter("childName");
+        String lang = request.getParameter("lang");
+        String vlog = request.getParameter("vlog");
+
+        ScenePro scene = sceneProService.findBySceneNum(sceneNum);
+
+        if(scene == null) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        if(StrUtil.isNotEmpty(childName)){
+            Camera cameraEntity = cameraService.findByChildName(childName);
+            if(cameraEntity != null){
+
+                CameraDetail cameraDetailEntity = cameraDetailService.findByCameraId(cameraEntity.getId());
+                if(cameraDetailEntity != null && cameraDetailEntity.getCooperationUser() != null){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
+                }
+
+                SSOUser dbUser = new SSOUser();
+                dbUser.setUserName(childName);
+                dbUser.setId(scene.getUserId());
+                if(dbUser.getId() == null){
+                    dbUser.setCameraLogin(1);
+                    dbUser.setCameraId(cameraEntity.getId());
+                }
+
+                String token = JwtUtil.createJWT(-1, childName, LoginType.USER.code());
+                ssoLoginHelper.loginV3(token, dbUser);
+
+                //登录成功
+                if(scene.getWebSite().contains(sceneProUrl)){
+                    response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
+                        sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
+                        (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
+                }
+
+                if(scene.getIsUpgrade() != null && scene.getIsUpgrade() == 1){
+                    if(scene.getWebSite().contains(sceneProV4Url)){
+                        response.sendRedirect(mainUrl + sceneProV4Url.replace("s", "e") +
+                            sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
+                            (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
+                        return;
+                    }
+                }
+
+                if(scene.getWebSite().contains(sceneProNewUrl)){
+                    response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
+                        sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
+                        (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
+                }
+                return;
+            }
+        }
+
+        if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)
+            || StringUtils.isEmpty(sceneNum)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+
+        if(scene.getUserId()==null)
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5013);
+
+        User user = userService.findByUserName(phoneNum);
+        if(user == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3015);
+        }
+
+        if(user.getId().longValue() != scene.getUserId().longValue()) {
+            SceneCooperation sceneCooperationEntity = sceneCooperationService.getByNum(sceneNum);
+            if(sceneCooperationEntity == null){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
+            }
+
+            if(sceneCooperationEntity.getUserId().longValue() != user.getId().longValue()){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
+            }
+
+        }
+
+        if(!SecurityUtil.MD5(password).equals(user.getPassword()))
+        {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3015);
+        }
+
+        String token = JwtUtil.createJWT(-1, user.getUserName(), LoginType.USER.code());
+        ssoLoginHelper.loginV3(token, BeanUtil.copyProperties(user, SSOUser.class));
+        //登录成功
+        if(scene.getWebSite().contains(sceneProUrl)){
+            response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
+                sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
+                (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
+        }
+
+        if(scene.getIsUpgrade() != null && scene.getIsUpgrade() == 1){
+            if(scene.getWebSite().contains(sceneProV4Url)){
+                response.sendRedirect(mainUrl + sceneProV4Url.replace("s", "e") +
+                    sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
+                    (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
+                return;
+            }
+        }
+
+        if(scene.getWebSite().contains(sceneProNewUrl)) {
+            response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
+                sceneNum + "&t=" + System.currentTimeMillis() + "&token=" + token + "&app" +
+                (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
+        }
+    }
+
 }

+ 21 - 0
src/main/java/com/fdkankan/scene/controller/SceneDataDownloadController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.scene.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 安居客场景数据下载 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2022-09-05
+ */
+@RestController
+@RequestMapping("/scene/sceneDataDownload")
+public class SceneDataDownloadController {
+
+}
+

+ 40 - 0
src/main/java/com/fdkankan/scene/controller/SceneEditController.java

@@ -370,6 +370,46 @@ public class SceneEditController extends BaseController {
         return sceneProService.deleteUploadBgMusic(sceneNum);
     }
 
+    /**
+     * 安居客
+     */
+    @CheckCurrentUser(description = "安居客")
+    @RequestMapping(value = "/uploadFloorJsonAjk", method = RequestMethod.POST)
+    public ResultData uploadFloorJsonAjk(HttpServletRequest request, @RequestParam("file") MultipartFile[] file) throws Exception{
+        String sceneNum = request.getParameter("sceneNum");
+        String ajkJson = request.getParameter("ajkJson");
+        String cameraJson = request.getParameter("cameraJson");
+        String floorPlanJson = request.getParameter("floorPlanJson");
+
+        return sceneProService.uploadFloorJsonAjk(sceneNum, ajkJson, cameraJson, floorPlanJson, file);
+    }
+
+    /**
+     * 上传点位全景图或视频
+     */
+    @CheckCurrentUser(description = "上传点位全景图或视频")
+    @RequestMapping(value = "/uploadPanoramaOrVideo", method = RequestMethod.POST)
+    public ResultData uploadPanoramaOrVideo(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws Exception{
+        String sceneNum = request.getParameter("sceneNum");
+        String fileName = request.getParameter("fileName");
+        String type = request.getParameter("type");
+        String planId = request.getParameter("planId");
+        return sceneProService.uploadPanoramaOrVideo(sceneNum, fileName, type, file, planId);
+    }
+
+    /**
+     * 肖安需求,上传修改后的obj和贴图
+     * @param file
+     * @return
+     */
+    @CheckCurrentUser(description = "肖安需求,上传修改后的obj和贴图")
+    @SystemControllerLog(description = "上传修改后的obj和贴图")
+    @RequestMapping(value = "/uploadObjAndImg", method = RequestMethod.POST)
+    public ResultData uploadObjAndImg(HttpServletRequest request, HttpServletResponse response, @RequestParam("file") MultipartFile file) throws Exception {
+        String sceneNum = request.getParameter("sceneNum");
+        return sceneProService.uploadObjAndImg(sceneNum, file);
+    }
+
 
 
 }

+ 60 - 0
src/main/java/com/fdkankan/scene/entity/SceneDataDownload.java

@@ -0,0 +1,60 @@
+package com.fdkankan.scene.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 安居客场景数据下载
+ * </p>
+ *
+ * @author 
+ * @since 2022-09-05
+ */
+@Getter
+@Setter
+@TableName("t_scene_data_download")
+public class SceneDataDownload implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("scene_num")
+    private String sceneNum;
+
+    /**
+     * 文件md5
+     */
+    @TableField("file_md5")
+    private String fileMd5;
+
+    /**
+     * 文件下载地址
+     */
+    @TableField("download_path")
+    private String downloadPath;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("rec_status")
+    @TableLogic("A")
+    private String recStatus;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/scene/generate/AutoGenerate.java

@@ -20,7 +20,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"scene", getTables(new String[]{
-                "t_video_scene_progress",
+                "t_scene_data_download"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/scene/mapper/ISceneDataDownloadMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.SceneDataDownload;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 安居客场景数据下载 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-09-05
+ */
+@Mapper
+public interface ISceneDataDownloadMapper extends BaseMapper<SceneDataDownload> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/scene/service/ISceneDataDownloadService.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.scene.entity.SceneDataDownload;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 安居客场景数据下载 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-09-05
+ */
+public interface ISceneDataDownloadService extends IService<SceneDataDownload> {
+
+    SceneDataDownload findBySceneNum(String sceneNum);
+
+}

+ 2 - 0
src/main/java/com/fdkankan/scene/service/ISceneProAppService.java

@@ -38,4 +38,6 @@ public interface ISceneProAppService extends IService<ScenePro> {
     ResultData uploadBgMusic(String sceneNum, String fileName, MultipartFile file) throws Exception;
 
     ResultData deleteUploadBgMusic(String sceneNum) throws Exception;
+
+    ResultData getRecordAudioFromAppV3(String sceneNum, String soundFile, String type, String fileName, String length, String replace, String times, String index) throws Exception;
 }

+ 6 - 0
src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -82,4 +82,10 @@ public interface ISceneProService extends IService<ScenePro> {
 
     ResultData deleteUploadBgMusic(String sceneNum) throws Exception;
 
+    ResultData uploadFloorJsonAjk(String sceneNum, String ajkJson, String cameraJson, String floorPlanJson, MultipartFile[] file) throws Exception;
+
+    ResultData uploadPanoramaOrVideo(String sceneNum, String fileName, String type, MultipartFile file, String planId) throws Exception;
+
+    ResultData uploadObjAndImg(String sceneNum, MultipartFile file) throws Exception;
+
 }

+ 35 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneDataDownloadServiceImpl.java

@@ -0,0 +1,35 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.scene.entity.SceneDataDownload;
+import com.fdkankan.scene.mapper.ISceneDataDownloadMapper;
+import com.fdkankan.scene.service.ISceneDataDownloadService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import java.util.List;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 安居客场景数据下载 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-09-05
+ */
+@Service
+public class SceneDataDownloadServiceImpl extends ServiceImpl<ISceneDataDownloadMapper, SceneDataDownload> implements ISceneDataDownloadService {
+
+    @Override
+    public SceneDataDownload findBySceneNum(String sceneNum) {
+
+        List<SceneDataDownload> list = this.list(new LambdaQueryWrapper<SceneDataDownload>()
+            .eq(SceneDataDownload::getSceneNum, sceneNum)
+            .orderByDesc(SceneDataDownload::getId));
+        if(CollUtil.isEmpty(list)){
+            return null;
+        }
+        return list.get(0);
+    }
+
+}

+ 131 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java

@@ -38,6 +38,7 @@ import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.session.StoreType;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -1250,4 +1251,134 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
         return ResultData.ok();
     }
 
+    @Override
+    public ResultData getRecordAudioFromAppV3(String sceneNum, String soundFile, String type, String fileName,
+        String length, String replace, String times, String index) throws Exception {
+        if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(soundFile)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+
+        ScenePro sceneProEntity = sceneProService.findBySceneNum(sceneNum);
+        if(sceneProEntity == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        SceneProEdit sceneProEditEntity = sceneProEditService.findBySceneProId(sceneProEntity.getId());
+
+        String strsceneInfos = FileUtils.readFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneNum + File.separator + "scene.json");
+        JSONObject scenejson = new JSONObject();
+        if(strsceneInfos!=null) {
+            scenejson = JSONObject.parseObject(strsceneInfos);
+        }
+
+        String originalFileName = ConstantFileName.APP_VOICE_NAME+".mp3";
+
+        //文件上传的位置可以自定义
+        String path = ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+sceneNum;
+
+        //判断分房间模块文件夹是否存在
+        String partPath = path + File.separator + "part";
+        File partFile = new File(partPath);
+        if(!partFile.exists()){
+            partFile.mkdirs();
+        }
+
+        if(!"1".equals(replace)){
+            if(new File(partPath+File.separator+fileName).exists()) {
+                FileUtils.deleteFile(partPath + File.separator + fileName);
+            }
+
+            if(FYunTypeEnum.AWS.code().equals(this.ossType)){
+                CreateObjUtil.ossFileCp("voice"+File.separator+"voice"+sceneNum + "/" + soundFile, partPath + File.separator + fileName);
+            }else {
+                CreateObjUtil.ossUtilCp("voice"+File.separator+"voice"+sceneNum + "/" + soundFile, partPath + File.separator);
+                new File(partPath + File.separator + soundFile).renameTo(new File(partPath + File.separator + fileName));
+            }
+
+            //获取总音频多少段,每段时长
+            String[] time = times.split(",");
+            //遍历判断音频是否存在,不存在生成空白音效
+            for(int i = 0, len = time.length; i < len; i++){
+                if(!new File(partPath + File.separator + i + ".mp3").exists()){
+                    //某部分文件不存在,直接生成一段静音后拼接文件
+                    CreateObjUtil.createMuteViode(Double.valueOf(time[i]), partPath + File.separator + i + ".mp3");
+                }
+            }
+
+            //拼接所有音频文件
+            if(time.length > 2){
+
+                //若是多部分,两个两个合并,最后合成最终文件
+                for(int i = 1, len = time.length; i < len; i++){
+                    if(i == 1){
+//                        FileUtils.deleteFile(partPath + File.separator + i + "muteSound.mp3");
+
+                        CreateObjUtil.mergeVideo(partPath + File.separator + (i - 1) + ".mp3", partPath + File.separator + i + ".mp3",
+                            partPath + File.separator + i + "muteSound.mp3");
+                    }else if(i == len - 1){
+                        CreateObjUtil.mergeVideo(partPath + File.separator + (i - 1) + "muteSound.mp3", partPath + File.separator + i + ".mp3",
+                            path + File.separator + originalFileName);
+                    }else {
+                        CreateObjUtil.mergeVideo(partPath + File.separator + (i - 1) + "muteSound.mp3", partPath + File.separator + i + ".mp3",
+                            partPath + File.separator + i + "muteSound.mp3");
+                    }
+                }
+            }else {
+                //若只有两部分,直接合并成最终文件
+                CreateObjUtil.mergeVideo(partPath + File.separator + "0.mp3", partPath + File.separator + "1.mp3", path + File.separator + originalFileName);
+            }
+
+            fYunFileService.uploadFile(path+File.separator +originalFileName, "voice/voice"+sceneNum+"/"+originalFileName);
+
+            String voiceSrc = ossPrefixUrl+"voice/voice"+sceneNum+"/"+originalFileName;
+
+            Map map = new HashMap();
+            map.put("screencapVoiceSoundsyncFileName", originalFileName);
+            map.put("screencapVoiceSoundsync", voiceSrc);
+            map.put("uploadVoiceSoundsync", 1);
+            map.put("screencapVoiceType", type);
+            map.put("version", scenejson.getIntValue("version")+1);
+
+            sceneProEditEntity.setScreencapVoiceType("soundsync");
+            sceneProEditEntity.setScreencapVoiceSoundsync(voiceSrc);
+            sceneProEditEntity.setVersion(scenejson.getIntValue("version")+1);
+
+            FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneNum + File.separator + "scene.json", map);
+            sceneProEditService.updateById(sceneProEditEntity);
+            FileUtils.deleteFile(path+File.separator+ConstantFileName.WECHAT_VOICE_NAME+".amr");
+            return ResultData.ok(voiceSrc);
+        }
+
+        FileUtils.delAllFile(path + File.separator + "part");
+        if(FYunTypeEnum.AWS.code().equals(this.ossType)){
+            CreateObjUtil.ossFileCp("voice"+File.separator+"voice"+sceneNum + "/" + soundFile, partPath + File.separator + fileName);
+        }else {
+            CreateObjUtil.ossUtilCp("voice"+File.separator+"voice"+sceneNum + "/" + soundFile, partPath + File.separator);
+            new File(partPath + File.separator + soundFile).renameTo(new File(partPath + File.separator + fileName));
+        }
+
+        FileUtils.copyFile(partPath+File.separator+fileName, path + File.separator + originalFileName, true);
+
+        fYunFileService.uploadFile(path+File.separator +originalFileName, "voice/voice"+sceneNum+"/"+originalFileName);
+
+        String voiceSrc = ossPrefixUrl+"voice/voice"+sceneNum+"/"+originalFileName;
+
+        Map map = new HashMap();
+        map.put("screencapVoiceSoundsyncFileName", originalFileName);
+        map.put("screencapVoiceSoundsync", voiceSrc);
+        map.put("uploadVoiceSoundsync", 1);
+        map.put("screencapVoiceType", type);
+        map.put("version", scenejson.getIntValue("version")+1);
+
+        sceneProEditEntity.setScreencapVoiceType("soundsync");
+        sceneProEditEntity.setScreencapVoiceSoundsync(voiceSrc);
+        sceneProEditEntity.setVersion(scenejson.getIntValue("version")+1);
+
+        FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneNum + File.separator + "scene.json", map);
+        sceneProEditService.updateById(sceneProEditEntity);
+
+        FileUtils.deleteFile(path+File.separator+ConstantFileName.WECHAT_VOICE_NAME+".amr");
+        return ResultData.ok(voiceSrc);
+    }
+
 }

+ 479 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.util.FileMd5Util;
 import com.fdkankan.image.MatrixToImageWriterUtil;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
@@ -15,6 +16,8 @@ import com.fdkankan.common.constant.ConstantUrl;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.RecStatus;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.entity.SceneDataDownload;
+import com.fdkankan.scene.service.ISceneDataDownloadService;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.model.utils.ConvertUtils;
 import com.fdkankan.model.utils.CreateObjUtil;
@@ -92,6 +95,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     private FYunFileServiceInterface fYunFileService;
     @Autowired
     private ISceneService sceneService;
+    @Autowired
+    private ISceneDataDownloadService sceneDataDownloadService;
 
     @Value("${main.url}")
     private String mainUrl;
@@ -2775,4 +2780,478 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         return ResultData.ok();
     }
 
+    @Override
+    public ResultData uploadFloorJsonAjk(String sceneNum, String ajkJson, String cameraJson, String floorPlanJson, MultipartFile[] file) throws Exception {
+//        log.info("画墙重建模型开始时间:" + start);
+
+        String lock = sceneNum.toString().intern();
+
+        synchronized(lock){
+            if(org.apache.commons.lang3.StringUtils.isEmpty(sceneNum)){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+            }
+
+            ScenePro sceneProEntity = this.findBySceneNum(sceneNum);
+            if(sceneProEntity == null){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+            }
+
+            SceneProEdit sceneProEditEntity = sceneProEditService.findBySceneProId(sceneProEntity.getId());
+            if(sceneProEditEntity == null){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+            }
+
+            //更新scene.json文件
+            String strsceneInfos = FileUtils.readFile(ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + sceneNum + File.separator + "scene.json");
+            JSONObject scenejson = new JSONObject();
+            if(strsceneInfos!=null)
+            {
+                scenejson = JSONObject.parseObject(strsceneInfos);
+            }else {
+                new File(ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + sceneNum + File.separator + "scene.json").createNewFile();
+            }
+
+            String path = sceneProEntity.getDataSource();
+            if(path != null && !"".equals(path) && path.startsWith("http")){
+                path = ConstantFilePath.BUILD_MODEL_PATH + File.separator + path.split("/")[path.split("/").length - 2];
+            }
+            String target = path + "_ajk";
+            File editPath = new File(target);
+            if(!editPath.exists()){
+                editPath.mkdirs();
+            }
+
+            //创建文件夹软连接并且复制data.json和project.json
+            if(new File(target + File.separator + "capture").exists()){
+                new File(target + File.separator + "capture").delete();
+            }
+            if(new File(target + File.separator + "caches").exists()){
+                //删除link
+                new File(target + File.separator + "caches" + File.separator + "images").delete();
+                //删除所有文件
+                FileUtils.delAllFile(target + File.separator + "caches");
+            }
+            if(new File(target + File.separator + "results").exists()){
+                FileUtils.delAllFile(target + File.separator + "results");
+            }
+            //创建文件夹,并link文件夹
+            new File(target + File.separator + "caches").mkdirs();
+            CreateObjUtil.createSoftConnection(path + File.separator + "capture", target + File.separator + "capture");
+            if(new File(path + File.separator + "caches" + File.separator + "images").exists()){
+                CreateObjUtil.createSoftConnection(path + File.separator + "caches" + File.separator + "images", target + File.separator + "caches" + File.separator + "images");
+            }
+
+            FileUtils.copyFile(path + File.separator + "data.json", target + File.separator+"data.json", true);
+            FileUtils.copyFile(path + File.separator + "project.json", target + File.separator+"project.json", true);
+
+            //data.json增加extras为执行重建算法
+            String project = FileUtils.readFile(target + File.separator+"project.json");
+            if(project != null){
+                JSONObject projectJson = JSONObject.parseObject(project);
+                projectJson.put("parent", projectJson.get("uuid"));
+                projectJson.put("uuid", UUID.randomUUID().toString());
+                projectJson.put("time", System.currentTimeMillis());
+                FileUtils.writeFile(path + File.separator + "project.json", projectJson.toString());
+            }
+
+            String data = FileUtils.readFile(target + File.separator+"data.json");
+            if(data != null){
+                JSONObject floorplanJson = new JSONObject();
+                floorplanJson.put("has_floor_ajk_json", true);
+                floorplanJson.put("has_vision_txt", true);
+                floorplanJson.put("has_floorplan_json", true);
+
+                JSONObject dataJson = JSONObject.parseObject(data);
+                dataJson.put("extras", floorplanJson);
+                //V5表示不需要生成high,low文件
+                dataJson.put("skybox_type", "SKYBOX_V8");
+                dataJson.put("split_type", "SPLIT_V10");
+                FileUtils.writeFile(target + File.separator+"data.json", new String(dataJson.toString().getBytes(), "UTF-8"));
+            }
+
+            //文件上传的位置可以自定义
+            log.info("画墙重建模型开始");
+            File targetFile = new File(target + File.separator + "extras" + File.separator + "floor_ajk.json");
+            if(!targetFile.getParentFile().exists()){
+                targetFile.getParentFile().mkdirs();
+            }
+            if(targetFile.exists()){
+                FileUtils.deleteFile(target + File.separator + "extras" + File.separator + "floor_ajk.json");
+            }
+            // 保存
+            FileUtils.writeFile(target + File.separator + "extras" + File.separator + "floorplan.json", new String(floorPlanJson.getBytes(), "UTF-8"));
+
+            FileUtils.writeFile(target + File.separator + "extras" + File.separator + "floor_ajk.json", new String(ajkJson.getBytes(), "UTF-8"));
+            FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+sceneNum + File.separator + "floor_ajk.json", new String(ajkJson.getBytes(), "UTF-8"));
+
+            FileUtils.writeFile(target + File.separator + "extras" + File.separator + "vision.txt", new String(cameraJson.getBytes(), "UTF-8"));
+            FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+sceneNum + File.separator + "camera.json", new String(cameraJson.getBytes(), "UTF-8"));
+
+            for(int i = 0; i < file.length; i ++){
+
+                File cadImg = new File(target + File.separator + "extras" + File.separator + "Floorplans/" + file[i].getOriginalFilename());
+                if(!cadImg.getParentFile().exists()){
+                    cadImg.getParentFile().mkdirs();
+                }
+                if(cadImg.exists())
+                {
+                    cadImg.delete();
+                }
+
+                file[i].transferTo(cadImg);
+            }
+            //下载封面图
+            FileUtils.downLoadFromUrl(sceneProEntity.getThumb() + "?t=" + System.currentTimeMillis(),
+                "Cover.png", target + File.separator + "extras" + File.separator + "CoverImage");
+            //转换成jpg
+            FileUtils.pngToJpg(target + File.separator + "extras" + File.separator + "CoverImage/Cover.png",
+                target + File.separator + "extras" + File.separator + "CoverImage/Cover.jpg");
+//        FileUtils.deleteFile(target + File.separator + "extras" + File.separator + "CoverImage/Cover.png");
+
+            //安居客算法运行
+            log.info("安居客算法:开始建模——"+sceneNum);
+
+            CreateObjUtil.build3dModel(target , "1");
+            if(!new File(target + File.separator + "results" + File.separator + "upload.json").exists()){
+                return ResultData.error(ErrorCode.FAILURE_CODE_5042);
+            }
+
+            String zipPath = target + File.separator + "results/" + sceneNum + ".zip";
+            new File(zipPath).delete();
+
+//            FileUtils.zipFile(zipPath, target + File.separator + "results/ajk/");
+            String command = "bash /opt/ossutil/gzip.sh " + zipPath.replace(".zip", "") + " " + target + File.separator + "results/ajk/";
+            log.info("压缩文件:" + command);
+            CreateObjUtil.callshell(command);
+
+            if(!new File(zipPath).exists()){
+                return  ResultData.error(ErrorCode.FAILURE_CODE_5043);
+            }
+            String fileMD5 = FileMd5Util.getFileMD5(new File(zipPath));
+
+            fYunFileService.uploadFile(zipPath, "data_download/" + sceneNum + ".zip");
+
+            SceneDataDownload sceneDataDownloadEntity = sceneDataDownloadService.findBySceneNum(sceneNum);
+            if(sceneDataDownloadEntity == null){
+                sceneDataDownloadEntity = new SceneDataDownload();
+                sceneDataDownloadEntity.setSceneNum(sceneNum);
+                sceneDataDownloadEntity.setDownloadPath(ossPrefixUrl + "data_download/" + sceneNum + ".zip");
+                sceneDataDownloadEntity.setFileMd5(fileMD5);
+                sceneDataDownloadService.save(sceneDataDownloadEntity);
+                return ResultData.ok();
+            }
+
+            sceneDataDownloadEntity.setFileMd5(fileMD5);
+            sceneDataDownloadEntity.setUpdateTime(new Date());
+            sceneDataDownloadService.updateById(sceneDataDownloadEntity);
+        }
+
+        return ResultData.ok();
+    }
+
+    @Override
+    public ResultData uploadPanoramaOrVideo(String sceneNum, String fileName, String type, MultipartFile file, String planId) throws Exception {
+        if(org.apache.commons.lang3.StringUtils
+            .isEmpty(sceneNum) || org.apache.commons.lang3.StringUtils
+            .isEmpty(fileName) || org.apache.commons.lang3.StringUtils
+            .isEmpty(type) || org.apache.commons.lang3.StringUtils.isEmpty(planId)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+
+        ScenePro sceneProEntity = this.findBySceneNum(sceneNum);
+        if(sceneProEntity == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        if(!fileName.endsWith(".jpg") && !fileName.endsWith(".mp4")){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5023);
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+            .append("data").append(File.separator)
+            .append("data").append(sceneProEntity.getNum())
+            .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+
+        String path = sceneProEntity.getDataSource();
+
+        if(path != null && !"".equals(path) && path.startsWith("http")){
+            path = ConstantFilePath.BUILD_MODEL_PATH + File.separator + path.split("/")[path.split("/").length - 2];
+        }
+        String target = path + "_images";
+
+        //文件上传的位置可以自定义
+        String filePath = "";
+        if("image".equals(type)){
+            filePath = target + File.separator + "extras/images" + File.separator + fileName;
+        }
+
+        if("video".equals(type)){
+            filePath = target + File.separator + "extras/video" + File.separator + fileName;
+        }
+        File targetFile = new File(filePath);
+        if(!targetFile.getParentFile().exists()){
+            targetFile.getParentFile().mkdirs();
+        }
+
+        //上传文件
+        file.transferTo(targetFile);
+
+        String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
+        JSONObject scenejson = new JSONObject();
+        if(strsceneInfos!=null) {
+            scenejson = JSONObject.parseObject(strsceneInfos);
+        }
+        if(type.equals("video")){
+            scenejson.put("buildImages", 2);
+            FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
+        }else{
+            scenejson.put("buildImages", 1);
+            if(scenejson.containsKey("planId")){
+                scenejson.put("planId",scenejson.getString("planId").concat(","+planId));
+            }else{
+                scenejson.put("planId",planId);
+            }
+            FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
+        }
+
+        return ResultData.ok();
+    }
+
+    @Override
+    public ResultData uploadObjAndImg(String sceneNum, MultipartFile file) throws Exception{
+        if(org.apache.commons.lang3.StringUtils.isEmpty(sceneNum)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+
+        ScenePro sceneProEntity = this.findBySceneNum(sceneNum);
+        if(sceneProEntity == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        SceneProEdit sceneProEditEntity = sceneProEditService.findBySceneProId(sceneProEntity.getId());
+        if(sceneProEditEntity == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        if (file == null || file.getSize() <= 0) {
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+            .append("data").append(File.separator)
+            .append("data").append(sceneProEntity.getNum())
+            .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        //文件上传的位置可以自定义
+        String path = sceneProEntity.getDataSource() + "_obj2txt";
+        String zipPath = path + "/zip/";
+        String filePath =  path + "/extras/";
+
+        FileUtils.delAllFile(path + "/results/");
+        File targetFile = new File(filePath);
+        if (!targetFile.exists()) {
+            targetFile.mkdirs();
+        }else {
+            FileUtils.delAllFile(filePath);
+        }
+
+        targetFile = new File(zipPath);
+        if (!targetFile.exists()) {
+            targetFile.mkdirs();
+        }else {
+            FileUtils.delAllFile(zipPath);
+        }
+
+        targetFile = new File(zipPath + file.getOriginalFilename());
+        if(!targetFile.getParentFile().exists()){
+            targetFile.getParentFile().mkdirs();
+        }
+        // 保存
+        synchronized(this)
+        {
+            if(targetFile.exists())
+            {
+                FileUtils.deleteFile(zipPath + file.getOriginalFilename());
+            }
+            file.transferTo(targetFile);
+        }
+
+        FileUtils.decompress(zipPath + file.getOriginalFilename(), zipPath + "data/");
+
+        //源文件数据,判断是否有多个文件夹,有多个就提示错误,有一个就将文件夹里数据迁移到extras目录,无直接迁移到extras目录
+        boolean flag = false;
+        String targetName = "";
+        File dataFile = new File(zipPath + "data/");
+        for(File data : dataFile.listFiles()){
+            if(data.isDirectory() && flag){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5018);
+            }
+            if(data.isDirectory() && !flag){
+                flag = true;
+                targetName = data.getName();
+            }
+        }
+
+        boolean objFlag = false;
+        boolean mtlFlag = false;
+        if(StrUtil.isEmpty(targetName)){
+            for(File data : dataFile.listFiles()){
+                if(data.getName().endsWith(".obj") && objFlag){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5019);
+                }
+
+                if(data.getName().endsWith(".jpg") || data.getName().endsWith(".png")){
+                    if(!FileUtils.checkFileSizeIsLimit(data.length(), 1.5, "M")){
+                        throw new BusinessException(ErrorCode.FAILURE_CODE_5020);
+                    }
+                }
+
+                if(data.getName().endsWith(".obj") && !objFlag){
+                    if(!FileUtils.checkFileSizeIsLimit(data.length(), 20, "M")){
+                        throw new BusinessException(ErrorCode.FAILURE_CODE_5020);
+                    }
+                    objFlag = true;
+                    FileUtils.copyFile(zipPath + "data/" + data.getName(), filePath + "mesh.obj", true);
+                    continue;
+                }
+
+                if(data.getName().endsWith(".mtl")){
+                    mtlFlag = true;
+                }
+
+                FileUtils.copyFile(zipPath + "data/" + data.getName(), filePath + data.getName(), true);
+            }
+        }else {
+            for(File data : new File(zipPath + "data/" + targetName).listFiles()){
+                if(data.isDirectory()){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5018);
+                }
+                if(data.getName().endsWith(".obj") && objFlag){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5019);
+                }
+
+                if(data.getName().endsWith(".jpg") || data.getName().endsWith(".png")){
+                    if(!FileUtils.checkFileSizeIsLimit(data.length(), 1.5, "M")){
+                        throw new BusinessException(ErrorCode.FAILURE_CODE_5020);
+                    }
+                }
+
+                if(data.getName().endsWith(".obj") && !objFlag){
+                    if(!FileUtils.checkFileSizeIsLimit(data.length(), 20, "M")){
+                        throw new BusinessException(ErrorCode.FAILURE_CODE_5020);
+                    }
+
+                    objFlag = true;
+                    FileUtils.copyFile(zipPath + "data/" + targetName + File.separator + data.getName(), filePath + "mesh.obj", true);
+                    continue;
+                }
+
+                if(data.getName().endsWith(".mtl")){
+                    mtlFlag = true;
+                }
+
+                FileUtils.copyFile(zipPath + "data/" + targetName + File.separator + data.getName(), filePath + data.getName(), true);
+            }
+        }
+
+        if(!mtlFlag && !objFlag){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5019);
+        }
+
+        //创建data.json
+        JSONObject dataJson = new JSONObject();
+        dataJson.put("obj2txt", true);
+        dataJson.put("split_type", "SPLIT_V6");
+        dataJson.put("data_describe", "double spherical");
+        dataJson.put("skybox_type", "SKYBOX_V5");
+        FileUtils.writeFile(path + "/data.json", dataJson.toString());
+
+        //调用objToTxt算法
+        //判断V2还是V3
+        if("V2".equals(sceneProEntity.getBuildType())){
+            CreateObjUtil.objToTxt(path , "1");
+        }
+        if("V3".equals(sceneProEntity.getBuildType())){
+            CreateObjUtil.build3dModel(path , "1");
+        }
+
+        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");
+        }
+        if(array == null){
+            log.error("upload.json数据出错");
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5017);
+        }
+
+        Map<String,String> map = new HashMap<String,String>();
+        JSONObject fileJson = null;
+        String fileName = "";
+        for(int i = 0, len = array.size(); i < len; i++) {
+            fileJson = array.getJSONObject(i);
+            fileName = fileJson.getString("file");
+            //文件不存在抛出异常
+            if (!new File(path + File.separator + "results" + File.separator + fileName).exists()) {
+                throw new Exception(path + File.separator + "results" + File.separator + fileName + "文件不存在");
+            }
+
+            //tex文件夹
+            if (fileJson.getIntValue("clazz") == 15) {
+                map.put(path + File.separator + "results" + File.separator + fileName, "images/images" +
+                    sceneNum + "/" + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
+
+                //复制一份到images本地
+                FileUtils.copyFile(path + File.separator + "results" +File.separator + fileName,
+                    ConstantFilePath.SCENE_PATH+"images"+File.separator+"images"+sceneNum + File.separator +
+                        ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""), true);
+                continue;
+            }
+        }
+
+        CreateObjUtil.convertTxtToDam( path + File.separator + "results" +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+"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", "images/images"+sceneNum+"/"+ConstantFileName.modelUUID+"_50k.dam.lzma");
+        map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam", "images/images"+sceneNum+"/"+ConstantFileName.modelUUID+"_50k.dam");
+
+        fYunFileService.uploadMulFiles(map);
+
+        FileUtils.copyFile(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam",
+            ConstantFilePath.SCENE_PATH+"images"+File.separator+"images"+sceneNum + File.separator + ConstantFileName.modelUUID+"_50k.dam", true);
+        FileUtils.copyFile(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma",
+            ConstantFilePath.SCENE_PATH+"images"+File.separator+"images"+sceneNum + File.separator + ConstantFileName.modelUUID+"_50k.dam.lzma", true);
+        log.info("文件复制到本地ecs完成——"+sceneNum);
+
+        String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
+        JSONObject scenejson = new JSONObject();
+        if(strsceneInfos!=null) {
+            scenejson = JSONObject.parseObject(strsceneInfos);
+        }
+        //更新scene.json文件
+        if(strsceneInfos!=null)
+        {
+            scenejson.put("isUploadObj", true);
+            scenejson.put("version", sceneProEditEntity.getVersion() + 1);
+            scenejson.put("floorEditVer", sceneProEditEntity.getFloorEditVer() + 1);
+            scenejson.put("floorPublishVer", sceneProEditEntity.getFloorPublishVer() + 1);
+            FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+sceneNum+File.separator+"scene.json", scenejson.toString());
+            log.info("写入scene.json文件完成——"+sceneNum);
+        }
+
+        //floorEditVer字段增加1
+        sceneProEditEntity.setVersion(sceneProEditEntity.getVersion() + 1);
+        sceneProEditEntity.setFloorPublishVer(sceneProEditEntity.getFloorPublishVer() + 1);
+        sceneProEditEntity.setFloorEditVer(sceneProEditEntity.getFloorEditVer() + 1);
+        sceneProEditService.updateById(sceneProEditEntity);
+        return ResultData.ok();
+    }
+
 }

+ 5 - 0
src/main/resources/mapper/scene/SceneDataDownloadMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.scene.mapper.ISceneDataDownloadMapper">
+
+</mapper>