|
@@ -3166,40 +3166,132 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData uploadObjAndImg(FileParamVO param, MultipartFile file) throws Exception{
|
|
|
- String sceneNum = param.getNum();
|
|
|
+ public ResultData uploadObjAndImg(String sceneNum, MultipartFile file) throws Exception{
|
|
|
if(StrUtil.isEmpty(sceneNum)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
}
|
|
|
|
|
|
- ScenePro scenePro = baseMapper.findByNum(sceneNum);
|
|
|
+ ScenePro scenePro = this.findBySceneNum(sceneNum);
|
|
|
if(scenePro == null){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
|
|
|
- SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
|
|
|
- if(sceneProEdit == 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(scenePro.getNum())
|
|
|
- .append(File.separator);
|
|
|
-
|
|
|
- StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
|
|
|
-
|
|
|
//文件上传的位置可以自定义
|
|
|
String path = sceneProExt.getDataSource() + "_obj2txt";
|
|
|
String zipPath = path + "/zip/";
|
|
|
String filePath = path + "/extras/";
|
|
|
+ String resultPath = path + "/results/";
|
|
|
+
|
|
|
+ //压缩文件处理:解压缩,解压缩后复制等操作
|
|
|
+ this.objAndImgFileHandler(resultPath, filePath, zipPath, file);
|
|
|
+
|
|
|
+ //创建data.json
|
|
|
+ this.writeDataJson(path);
|
|
|
+
|
|
|
+ //调用算法,不同的类型调用不同的算法
|
|
|
+ if("V2".equals(scenePro.getBuildType())){
|
|
|
+ CreateObjUtil.objToTxt(path , "1");
|
|
|
+ }
|
|
|
+ if("V3".equals(scenePro.getBuildType())){
|
|
|
+ CreateObjUtil.build3dModel(path , "1");
|
|
|
+ }
|
|
|
+
|
|
|
+ //算法计算完后,生成压缩文件,上传到oss
|
|
|
+ this.uploadFileofterRebuildPanoram(path, sceneNum);
|
|
|
+
|
|
|
+ //更新版本信息
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getBySceneProId(scenePro.getId());
|
|
|
+ if(Objects.isNull(sceneEditInfo)){
|
|
|
+ sceneEditInfo = new SceneEditInfo();
|
|
|
+ sceneEditInfo.setSceneProId(scenePro.getId());
|
|
|
+ sceneEditInfo.setFloorPublishVer(1);
|
|
|
+ sceneEditInfo.setFloorEditVer(1);
|
|
|
+ sceneEditInfo.setIsUploadObj(CommonStatus.YES.code());
|
|
|
+ sceneEditInfoService.save(sceneEditInfo);
|
|
|
+ }else{
|
|
|
+ sceneEditInfoService.update(
|
|
|
+ new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
+ .setSql("version = version + 1")
|
|
|
+ .setSql("floor_edit_ver = floor_edit_ver + 1")
|
|
|
+ .setSql("floor_publish_ver = floor_publish_ver + 1")
|
|
|
+ .set(SceneEditInfo::getIsUploadObj, CommonStatus.YES.code())
|
|
|
+ .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void uploadFileofterRebuildPanoram(String path, String sceneNum) throws Exception {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
- FileUtils.delAllFile(path + "/results/");
|
|
|
+ Map<String,String> map = new HashMap<String,String>();
|
|
|
+ JSONObject fileJson = null;
|
|
|
+ String fileName = "";
|
|
|
+ String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
|
+ 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,
|
|
|
+ imgViewPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
|
|
|
+
|
|
|
+ // TODO: 2022/2/17 这里复制一份到本地,不知道需不需要,先注释掉
|
|
|
+ //复制一份到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", imgViewPath +ConstantFileName.modelUUID+"_50k.dam.lzma");
|
|
|
+ map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam", imgViewPath+ConstantFileName.modelUUID+"_50k.dam");
|
|
|
+
|
|
|
+ uploadToOssUtil.uploadMulFiles(map);
|
|
|
+
|
|
|
+ // TODO: 2022/2/17 这里复制一份到本地,不知道需不需要,先注释掉
|
|
|
+// 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void writeDataJson(String path) throws IOException {
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void objAndImgFileHandler(String resultPath, String filePath, String zipPath, MultipartFile file)
|
|
|
+ throws Exception {
|
|
|
+ FileUtils.delAllFile(resultPath);
|
|
|
File targetFile = new File(filePath);
|
|
|
if (!targetFile.exists()) {
|
|
|
targetFile.mkdirs();
|
|
@@ -3218,20 +3310,18 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(!targetFile.getParentFile().exists()){
|
|
|
targetFile.getParentFile().mkdirs();
|
|
|
}
|
|
|
- // 保存
|
|
|
- synchronized(this)
|
|
|
+ // 保存压缩包到本地
|
|
|
+ if(targetFile.exists())
|
|
|
{
|
|
|
- if(targetFile.exists())
|
|
|
- {
|
|
|
- FileUtils.deleteFile(zipPath + file.getOriginalFilename());
|
|
|
- }
|
|
|
- file.transferTo(targetFile);
|
|
|
+ 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()){
|
|
@@ -3244,163 +3334,55 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //是否包含obj文件
|
|
|
boolean objFlag = false;
|
|
|
+ //是否包含mtl文件
|
|
|
boolean mtlFlag = false;
|
|
|
+ File[] files = null;
|
|
|
+ String dataPath = null;
|
|
|
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;
|
|
|
- }
|
|
|
+ files = dataFile.listFiles();
|
|
|
+ dataPath = zipPath + "data/";
|
|
|
+ }else{
|
|
|
+ files = new File(zipPath + "data/" + targetName).listFiles();
|
|
|
+ dataPath = zipPath + "data/" + targetName + File.separator;
|
|
|
+ }
|
|
|
|
|
|
- FileUtils.copyFile(zipPath + "data/" + data.getName(), filePath + data.getName(), true);
|
|
|
+ for(File data : files){
|
|
|
+ if(data.isDirectory()){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5018);
|
|
|
+ }
|
|
|
+ if(data.getName().endsWith(".obj") && objFlag){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5019);
|
|
|
}
|
|
|
- }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(".jpg") || data.getName().endsWith(".png")){
|
|
|
+ if(!FileUtils.checkFileSizeIsLimit(data.length(), 1.5, "M")){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5020);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if(data.getName().endsWith(".mtl")){
|
|
|
- mtlFlag = true;
|
|
|
+ if(data.getName().endsWith(".obj") && !objFlag){
|
|
|
+ if(!FileUtils.checkFileSizeIsLimit(data.length(), 20, "M")){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5020);
|
|
|
}
|
|
|
|
|
|
- FileUtils.copyFile(zipPath + "data/" + targetName + File.separator + data.getName(), filePath + data.getName(), true);
|
|
|
+ objFlag = true;
|
|
|
+ FileUtils.copyFile(dataPath + data.getName(), filePath + "mesh.obj", true);
|
|
|
+ continue;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- 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(scenePro.getBuildType())){
|
|
|
- CreateObjUtil.objToTxt(path , "1");
|
|
|
- }
|
|
|
- if("V3".equals(scenePro.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 + "文件不存在");
|
|
|
+ if(data.getName().endsWith(".mtl")){
|
|
|
+ mtlFlag = true;
|
|
|
}
|
|
|
|
|
|
- //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;
|
|
|
- }
|
|
|
+ FileUtils.copyFile(dataPath + data.getName(), filePath + data.getName(), true);
|
|
|
}
|
|
|
|
|
|
- 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");
|
|
|
-
|
|
|
- uploadToOssUtil.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", sceneProEdit.getVersion() + 1);
|
|
|
- scenejson.put("floorEditVer", sceneProEdit.getFloorEditVer() + 1);
|
|
|
- scenejson.put("floorPublishVer", sceneProEdit.getFloorPublishVer() + 1);
|
|
|
- FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+sceneNum+File.separator+"scene.json", scenejson.toString());
|
|
|
- log.info("写入scene.json文件完成——"+sceneNum);
|
|
|
+ //压缩文件中必须有且仅有一个obj和mtl文件,否则抛出异常
|
|
|
+ if(!mtlFlag && !objFlag){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5019);
|
|
|
}
|
|
|
-
|
|
|
- //floorEditVer字段增加1
|
|
|
- sceneProEdit.setVersion(sceneProEdit.getVersion() + 1);
|
|
|
- sceneProEdit.setFloorPublishVer(sceneProEdit.getFloorPublishVer() + 1);
|
|
|
- sceneProEdit.setFloorEditVer(sceneProEdit.getFloorEditVer() + 1);
|
|
|
- sceneProEdit.setUpdateTime(Calendar.getInstance().getTime());
|
|
|
- sceneProEditService.updateById(sceneProEdit);
|
|
|
-
|
|
|
- return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -4555,30 +4537,37 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
|
|
|
- if(!new File(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum).exists()){
|
|
|
- new File(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum).mkdirs();
|
|
|
- }
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getBySceneProId(scenePro.getId());
|
|
|
|
|
|
- String sceneJsonPath = String.format(ConstantFilePath.SCENE_PATH_FORMAT, scenePro.getNum());
|
|
|
- String strsceneInfos = FileUtils.readFile(sceneJsonPath);
|
|
|
- JSONObject scenejson = new JSONObject();
|
|
|
- if(strsceneInfos!=null) {
|
|
|
- scenejson = JSONObject.parseObject(strsceneInfos);
|
|
|
+ String localImagePath = String.format(ConstantFilePath.IMAGESBUFFER_FORMAT, sceneNum);
|
|
|
+ if(!new File(localImagePath).exists()){
|
|
|
+ new File(localImagePath).mkdirs();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
String newData = sceneProExt.getDataSource() + "_obj2txt/extras";
|
|
|
String newResultData = sceneProExt.getDataSource() + "_obj2txt/results/upload.json";
|
|
|
- if(scenejson.containsKey("isUploadObj") && new File(newData).exists() && new File(newResultData).exists()){
|
|
|
- FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/" + sceneNum + ".zip", newData);
|
|
|
- return ResultData.ok(mainUrl + "scene/images/images" + sceneNum + "/" + sceneNum + ".zip?t=" +System.currentTimeMillis());
|
|
|
+ String zipName = sceneNum + "_extras.zip";
|
|
|
+ String zipPath = localImagePath + zipName;
|
|
|
+ if(CommonStatus.YES.code().equals(sceneEditInfo.getIsUploadObj())
|
|
|
+ && new File(newData).exists()
|
|
|
+ && new File(newResultData).exists()){
|
|
|
+ //打包
|
|
|
+ FileUtils.zipFile(zipPath, newData);
|
|
|
+ //上传压缩包
|
|
|
+ uploadToOssUtil.upload(zipPath, "downloads/extras/" + zipName);
|
|
|
+ String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
|
+ return ResultData.ok(url);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
String buildType = scenePro.getBuildType();
|
|
|
if("V3".equals(buildType)){
|
|
|
+ String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum);
|
|
|
//V3版本去oss下载2048模型
|
|
|
- String meshPath = ConstantFilePath.SCENE_PATH + "data/data" + sceneNum + "/mesh";
|
|
|
+ String meshPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, sceneNum) + "mesh";
|
|
|
FileUtils.deleteDirectory(meshPath);
|
|
|
- CreateObjUtil.ossUtilCp("data/data" + sceneNum + "/mesh", meshPath);
|
|
|
+ CreateObjUtil.ossUtilCp(dataViewPath + "mesh", meshPath);
|
|
|
if(new File(meshPath.concat("/mesh")).listFiles().length > 0){
|
|
|
for(File file : new File(meshPath.concat("/mesh")).listFiles()){
|
|
|
if(file.getName().endsWith(".obj") && !"output.house.obj".equals(file.getName()) &&
|
|
@@ -4590,8 +4579,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
file.delete();
|
|
|
}
|
|
|
}
|
|
|
- FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/" + sceneNum + ".zip", meshPath);
|
|
|
- return ResultData.ok(mainUrl + "scene/images/images" + sceneNum + "/" + sceneNum + ".zip?t=" +System.currentTimeMillis());
|
|
|
+ //打包
|
|
|
+ FileUtils.zipFile(zipPath, meshPath);
|
|
|
+ //上传压缩包
|
|
|
+ uploadToOssUtil.upload(zipPath, "downloads/extras/" + zipName);
|
|
|
+ String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
|
+ return ResultData.ok(url);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -4611,8 +4604,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/" + sceneNum + ".zip", editData);
|
|
|
- return ResultData.ok(mainUrl + "scene/images/images" + sceneNum + "/" + sceneNum + ".zip?t=" +System.currentTimeMillis());
|
|
|
+ FileUtils.zipFile(zipPath, editData);
|
|
|
+ //上传压缩包
|
|
|
+ uploadToOssUtil.upload(zipPath, "downloads/extras/" + zipName);
|
|
|
+ String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
|
+ return ResultData.ok(url);
|
|
|
}
|
|
|
|
|
|
//没上传过返回源资源
|
|
@@ -4632,8 +4628,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- FileUtils.zipFile(ConstantFilePath.SCENE_PATH + "images/images" + sceneNum + "/" + sceneNum + ".zip", dataPath);
|
|
|
- return ResultData.ok(mainUrl + "scene/images/images" + sceneNum + "/" + sceneNum + ".zip?t=" +System.currentTimeMillis());
|
|
|
+ FileUtils.zipFile(zipPath, dataPath);
|
|
|
+ //上传压缩包
|
|
|
+ uploadToOssUtil.upload(zipPath, "downloads/extras/" + zipName);
|
|
|
+ String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
|
+ return ResultData.ok(url);
|
|
|
}
|
|
|
|
|
|
private void dealTour(SceneEditParamVO base, JSONObject scenejson, Map<String,String> map,
|