wuweihao 5 лет назад
Родитель
Сommit
f6a445e43c

help.md → README.md


+ 1 - 0
gis_application/src/main/resources/application-sit.properties

@@ -56,3 +56,4 @@ logging.level.com.gis=debug
 file.path=/root/user/army_cms_data/
 server.domain =http://192.168.0.44:8101/
 
+

+ 219 - 0
gis_common/src/main/java/com/gis/common/proto/util/ConvertUtils.java

@@ -0,0 +1,219 @@
+package com.gis.common.proto.util;
+
+import com.gis.common.proto.Visionmodeldata;
+import com.gis.common.proto.format.JsonFormat;
+import lombok.extern.log4j.Log4j2;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+@Log4j2
+public class ConvertUtils {
+
+    public static void convertVisionModelDataToTxt(String srcPath, String desPath) throws Exception {
+
+        BufferedOutputStream bos = null;
+        BufferedInputStream bis = null;
+        try {
+            File file = new File(srcPath);
+            FileInputStream fis = new FileInputStream(file);
+
+            Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
+
+            String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+            ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+            bos = new BufferedOutputStream(new FileOutputStream(desPath));//设置输出路径
+            bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            //out.close();
+            bis.close();
+            bos.close();
+        } catch (Exception e) {
+            StringWriter trace = new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (bis != null) {
+                bis.close();
+            }
+        }
+    }
+
+    public static void convertTxtToVisionModelData(String srcPath, String desPath) throws Exception {
+        BufferedOutputStream bos = null;
+        BufferedInputStream bis = null;
+        try {
+            Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
+            String jsonFormat = readTxtFileToJson(srcPath);
+            JsonFormat.merge(jsonFormat, builder);
+            byte[] buf = builder.build().toByteArray();
+
+            //把序列化后的数据写入本地磁盘
+            ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+            bos = new BufferedOutputStream(new FileOutputStream(desPath));//设置输出路径
+            bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            bis.close();
+            bos.close();
+        } catch (Exception e) {
+            StringWriter trace = new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (bis != null) {
+                bis.close();
+            }
+        }
+    }
+
+    public static String readTxtFileToJson(String filePath) {
+        try {
+            String encoding = "UTF-8";
+            File file = new File(filePath);
+            if (file.isFile() && file.exists()) {
+                InputStreamReader read = new InputStreamReader(
+                        new FileInputStream(file), encoding);
+                BufferedReader bufferedReader = new BufferedReader(read);
+                String lineTxt = null;
+                String result = "";
+                while ((lineTxt = bufferedReader.readLine()) != null) {
+                    result += lineTxt;
+                }
+                read.close();
+                return result;
+            } else {
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    public List<List<String>> descartes(List<List<String>> dimValue) {
+        List<List<String>> res = new ArrayList<>();
+        if (dimValue == null || dimValue.size() == 0)
+            return res;
+        backtrace(dimValue, 0, res, new ArrayList<>());
+        return res;
+
+    }
+
+    /**
+     * 递归回溯法求解
+     *
+     * @param dimValue 原始数据集合
+     * @param index 当前执行的集合索引
+     * @param result 结果集合
+     * @param curList 当前的单个结果集
+     */
+    private void backtrace(List<List<String>> dimValue, int index,
+                           List<List<String>> result, List<String> curList) {
+
+        if (curList.size() == dimValue.size())
+            result.add(new ArrayList<>(curList));
+        else
+            for (int j = 0; j < dimValue.get(index).size(); j++) {
+                curList.add(dimValue.get(index).get(j));
+                backtrace(dimValue, index + 1, result, curList);
+                curList.remove(curList.size() - 1);
+            }
+
+    }
+
+    public static void main(String[] args) {
+        List<String> list1 = new ArrayList<String>();
+        list1.add("普通会员");
+        list1.add("专业会员");
+        list1.add("商业会员");
+        List<String> list2 = new ArrayList<String>();
+        list2.add("1G");
+        list2.add("1T");
+        List<List<String>> dimValue = new ArrayList<List<String>>();
+        dimValue.add(list1);
+        dimValue.add(list2);
+
+        // 递归实现笛卡尔积
+        ConvertUtils s = new ConvertUtils();
+        List<List<String>> res = s.descartes(dimValue);
+        System.out.println("递归实现笛卡尔乘积: 共 " + res.size() + " 个结果");
+        for (List<String> list : res) {
+            for (String string : list) {
+                System.out.print(string + " ");
+            }
+            System.out.println();
+        }
+    }
+
+//    public static void convertTxtToVisionmodeldata(String srcpath,String despath)throws Exception
+//    {
+//        try
+//        {
+//            Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
+//            String jsonFormat = readTxtFileToJson(srcpath);
+//            JsonFormat.merge(jsonFormat, builder);
+//            byte[] buf= builder.build().toByteArray();
+//
+//            //把序列化后的数据写入本地磁盘
+//            ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+//            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+//            BufferedInputStream bis = new BufferedInputStream(stream);
+//            int b = -1;
+//            while ((b = bis.read()) != -1) {
+//                bos.write(b);
+//            }
+//            bis.close();
+//            bos.close();
+//        }
+//        catch(Exception e)
+//        {
+//            StringWriter trace=new StringWriter();
+//            e.printStackTrace(new PrintWriter(trace));
+//            log.error(trace.toString());
+//        }
+//    }
+
+//    public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
+//    {
+//        try
+//        {
+//            File file = new File(srcpath);
+//            FileInputStream fis=new FileInputStream(file);
+//
+//            Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
+//
+//            //PrintStream out = new PrintStream(despath);
+//            String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+//            ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+//            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+//            BufferedInputStream bis = new BufferedInputStream(stream);
+//            int b = -1;
+//            while ((b = bis.read()) != -1) {
+//                bos.write(b);
+//            }
+//            //out.close();
+//            bis.close();
+//            bos.close();
+//        }
+//        catch(Exception e)
+//        {
+//            StringWriter trace=new StringWriter();
+//            e.printStackTrace(new PrintWriter(trace));
+//            log.error(trace.toString());
+//        }
+//    }
+}

+ 2 - 2
gis_domain/src/main/java/com/gis/domain/dto/FodderDto.java

@@ -23,8 +23,8 @@ public class FodderDto {
     @ApiModelProperty(value = "类型:1:图片, 2:视频" , required = true)
     private Integer type;
 
-//    @ApiModelProperty(value = "文件url")
-//    private String fileUrl;
+    @ApiModelProperty(value = "文件url")
+    private String fileUrl;
 
     @ApiModelProperty(value = "缩略图url")
     private String thumb;

+ 24 - 0
gis_domain/src/main/java/com/gis/domain/dto/RoamViableDto.java

@@ -0,0 +1,24 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * Created by owen on 2020/7/27 0027 16:01
+ *
+ * 漫游可行
+ */
+
+@Data
+public class RoamViableDto {
+
+    @NotBlank(message = "场景码不能为空")
+    @ApiModelProperty(value = "场景码")
+    private String sceneCode;
+
+    @NotBlank(message = "漫游数据不能为空")
+    @ApiModelProperty(value = "漫游数据")
+    private String data;
+}

+ 1 - 1
gis_domain/src/main/java/com/gis/domain/dto/SceneDataDto.java

@@ -32,7 +32,7 @@ public class SceneDataDto {
     /** data2.js */
     private String tourAudio;
 
-    /** data2.js */
+    /** data2.js 数组*/
     private String overlays;
 
 

+ 2 - 2
gis_domain/src/main/java/com/gis/domain/po/FodderEntity.java

@@ -21,8 +21,8 @@ public class FodderEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "类型:1:图片, 2:视频")
     private Integer type;
 
-//    @ApiModelProperty(value = "文件url")
-//    private String fileUrl;
+    @ApiModelProperty(value = "文件url")
+    private String fileUrl;
 
     @ApiModelProperty(value = "缩略图url")
     private String thumb;

+ 4 - 0
gis_service/src/main/java/com/gis/service/SceneService.java

@@ -1,7 +1,9 @@
 package com.gis.service;
 
 
+import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
+import com.gis.domain.dto.RoamViableDto;
 import com.gis.domain.po.SceneEntity;
 
 import java.util.List;
@@ -16,4 +18,6 @@ public interface SceneService extends IBaseService<SceneEntity, Long> {
     SceneEntity findBySceneCode(String m);
 
     List<SceneEntity> search(PageDto param);
+
+    Result roamViable(RoamViableDto param) throws Exception;
 }

+ 8 - 0
gis_service/src/main/java/com/gis/service/impl/IBaseServiceImpl.java

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
 import com.gis.mapper.IBaseMapper;
 import com.gis.domain.po.BaseEntity;
 import com.gis.service.IBaseService;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import tk.mybatis.mapper.entity.Condition;
@@ -20,6 +21,13 @@ import java.util.List;
 @Transactional
 public abstract class IBaseServiceImpl<T extends BaseEntity, ID extends Serializable> implements IBaseService<T, ID> {
 
+
+    @Value("${file.path}")
+    public String FILE_PATH;
+
+    @Value("${server.domain}")
+    public String SERVER_DOMAIN;
+
     public abstract IBaseMapper<T, ID> getBaseMapper();
 
     private Class<T> entityClass;

+ 102 - 0
gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java

@@ -1,10 +1,19 @@
 package com.gis.service.impl;
 
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.gis.common.proto.util.ConvertUtils;
+import com.gis.common.util.FileUtils;
+import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
+import com.gis.domain.dto.RoamViableDto;
 import com.gis.domain.po.SceneEntity;
 import com.gis.mapper.SceneMapper;
 import com.gis.mapper.IBaseMapper;
 import com.gis.service.SceneService;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -14,6 +23,7 @@ import java.util.List;
 /**
  * Created by owen on 2020/3/11 0011 16:16
  */
+@Log4j2
 @Service
 public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implements SceneService {
 
@@ -35,4 +45,96 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
     public List<SceneEntity> search(PageDto param) {
         return entityMapper.search(param);
     }
+
+    /**
+     * 漫游可行
+     */
+    @Override
+    public Result roamViable(RoamViableDto param) throws Exception {
+        String sceneCode = param.getSceneCode();
+        SceneEntity entity = entityMapper.findBySceneCode(param.getSceneCode());
+        if (entity == null) {
+            log.error("场景不存在:{}", sceneCode);
+            return Result.failure("场景不存在");
+        }
+
+        // 1. 从oss下载vision.modeldata
+        String visionModelDataName = "vision.modeldata";
+        // 注意网络下载会有缓存,必须加时间戳
+//        String urlPath = OSS_DOMAIN + OSS_PATH + sceneCode + "/" + visionModelDataName+ "?m=" + System.currentTimeMillis();
+//        log.info("网络下载文件地址: {}", urlPath);
+        String localBasePath = FILE_PATH + sceneCode;
+//        FileUtils.downLoadFromUrl(urlPath, visionModelDataName, localBasePath);
+
+        // 2. 将vision.modeldata 转 vision.json
+        String visionModelDataPath = localBasePath + "/" + visionModelDataName;
+        if (!FileUtil.exist(visionModelDataPath)) {
+            log.error("vision.modeldata不存在 : {}", visionModelDataPath);
+            return Result.failure("vision.modeldata不存在");
+        }
+//        log.info(visionModelDataName+ "下载完成");
+
+
+        String visionJsonPath = localBasePath + "/vision.json";
+        ConvertUtils.convertVisionModelDataToTxt(visionModelDataPath, visionJsonPath);
+        if (!FileUtil.exist(visionJsonPath)) {
+            log.error("vision.json不存在 : {}", visionJsonPath);
+            return Result.failure("vision.modeldata不存在");
+        }
+
+        // 3. 编辑新数据到vision.json
+        JSONArray inputDates = JSONObject.parseArray(param.getData());
+
+        JSONObject visionJson = JSONObject.parseObject(FileUtil.readUtf8String(visionJsonPath));
+        JSONArray sweepLocations = visionJson.getJSONArray("sweepLocations");
+
+        for (int i = 0; i < sweepLocations.size(); i++) {
+            JSONObject pano = sweepLocations.getJSONObject(i);
+
+            for (int j = 0; j < inputDates.size(); j++) {
+                JSONObject jo = inputDates.getJSONObject(j);
+                String panoID = jo.getString("panoID");
+                JSONArray visibles3 = jo.getJSONArray("visibles3");
+
+                // 去掉uuid 的“-”
+                String uuid = pano.getString("uuid");
+                String s = StringUtils.replaceAll(uuid, "-", "");
+                if (s.equals(panoID)) {
+                    log.info("uuid: {}, panoID: {}", uuid, panoID);
+                    pano.put("visibles", visibles3);
+                    log.info("visibles: {},visibles3:{}", pano.get("visibles"), visibles3);
+                }
+            }
+        }
+
+
+        // 删除旧vision.json,vision.modeldata
+        FileUtil.del(visionJsonPath);
+        FileUtil.del(visionModelDataPath);
+
+        // 写入新vision.json
+        FileUtil.writeUtf8String(visionJson.toJSONString(), visionJsonPath);
+        if (!FileUtil.exist(visionJsonPath)) {
+            log.error("new vision.json不存在");
+        }
+
+        log.info( "新vision.json创建完成 :{}", visionJsonPath);
+
+
+
+
+        // 4. 将vision.json转vision.modeldata
+        ConvertUtils.convertTxtToVisionModelData(visionJsonPath, visionModelDataPath);
+
+        // 5. 将新的vision.modeldata上传到oss
+        if (!FileUtil.exist(visionModelDataPath)) {
+            log.error("vision.modeldata不存在");
+        }
+        log.info("新" + visionModelDataName+ "创建完成 :{}", visionModelDataPath);
+//        QiniuOssUtil.upload(visionModelDataPath, OSS_PATH + sceneCode + "/" + visionModelDataName);
+//        log.info(visionModelDataName+ "已上传到七牛云");
+
+
+        return Result.success();
+    }
 }

+ 91 - 22
gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -1,10 +1,13 @@
 package com.gis.web.controller;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.gis.common.exception.BaseRuntimeException;
 import com.gis.common.proto.constant.ConstantCmd;
 import com.gis.common.proto.constant.ConstantFileName;
@@ -13,6 +16,7 @@ import com.gis.common.util.FileUtils;
 import com.gis.common.util.RandomUtils;
 import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
+import com.gis.domain.dto.RoamViableDto;
 import com.gis.domain.dto.SceneDataDto;
 import com.gis.domain.po.SceneEntity;
 import com.gis.domain.po.SysUserEntity;
@@ -37,6 +41,8 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import java.io.File;
 import java.io.IOException;
 import java.util.*;
 
@@ -79,10 +85,10 @@ public class SceneController extends BaseController {
     @ApiOperation("场景编辑")
     @PostMapping("edit")
     public Result edit(@Valid @RequestBody SceneDataDto param) {
-
+        String sceneCode = param.getSceneCode();
         SceneEntity entity = sceneService.findBySceneCode(param.getSceneCode());
         if (entity == null) {
-            log.error("场景不存在 : {}", param.getSceneCode());
+            log.error("场景不存在 : {}", sceneCode);
             return Result.failure("场景不存在");
         }
 
@@ -116,21 +122,28 @@ public class SceneController extends BaseController {
             // 处理model
             JSONObject model = someDataJson.getJSONObject("model");
             if (model != null) {
-                model.put("name", infoJson.get("name"));
-                model.put("summary", infoJson.get("summary"));
-                model.put("camera_start", infoJson.getJSONObject("camera_start"));
-//                model.put("camera_start", infoJson.get("camera_start"));
+//                model.put("name", infoJson.get("name"));
+//                model.put("summary", infoJson.get("summary"));
+//                model.put("camera_start", infoJson.getJSONObject("camera_start"));
 
                 if (guidesArray != null) {
                     model.put("images", guidesArray);
                 }
 
-
+                // camera_start放最外层
+//                someDataJson.put("camera_start", infoJson.getJSONObject("camera_start"));
             }
 
             // 更新someDataJson
             someDataJson.put("model", model);
-            someDataJson.put("loadlogo", infoJson.get("loadlogo"));
+//            someDataJson.put("loadlogo", infoJson.get("loadlogo"));
+
+            // info信息添加到someDataJson最外层
+            Set<String> infoKey = infoJson.keySet();
+            for (String key : infoKey) {
+
+                someDataJson.put(key, infoJson.get(key));
+            }
 
             // 删除旧someDataJson
             FileUtil.del(someDataPath);
@@ -153,19 +166,16 @@ public class SceneController extends BaseController {
         String tourAudio = param.getTourAudio();
         if (tourAudio != null) {
             data2Json.put("tourAudio", JSONObject.parseObject(tourAudio));
-//            data2Json.put("tourAudio", tourAudio);
+        } else {
+            data2Json.put("tourAudio", new JSONObject());
         }
 
+        // overlays是数组
         String overlays = param.getOverlays();
         if (overlays != null) {
-            data2Json.put("overlays", JSONObject.parseObject(overlays));
-//            data2Json.put("overlays", overlays);
-        }
-
-        String hots = param.getHots();
-        if (hots != null) {
-            data2Json.put("hots", JSONObject.parseObject(hots));
-//            data2Json.put("hots", hots);
+            data2Json.put("overlays", JSONObject.parseArray(overlays));
+        } else {
+            data2Json.put("overlays", new JSONArray());
         }
 
         // 处理guidesArray,将scan_id的值作为key, value:  time":40000
@@ -174,26 +184,73 @@ public class SceneController extends BaseController {
         timeJson.put("time", 40000);
         if (guidesArray != null) {
 
+            // 将旧的audio字段删除
+            data2Json.remove("audio");
+
             for (int i = 0; i < guidesArray.size() ; i++) {
-                String scanId = guidesArray.getJSONObject(i).getString("scan_id");
-                audioJson.put(scanId, timeJson);
+                JSONObject metadata = guidesArray.getJSONObject(i).getJSONObject("metadata");
+                if (metadata != null) {
+                    String scanId = metadata.getString("scan_id");
+                    if (scanId == null) {
+                        log.error("guides.metadata.scan_id为空: {}", i);
+                        return Result.failure("guides.metadata.scan_id为空: " + i);
+                    }
+                    // Fastjson-fastjson中$ref对象重复引用问题,拿不到想要的效果
+//                    JSONObject timeJson = new JSONObject();
+//                    timeJson.put("time", 40000);
+                    audioJson.put(scanId, JSON.toJSONString(timeJson, SerializerFeature.DisableCircularReferenceDetect));
+
+                }
             }
 
+            // 新增audio
             data2Json.put("audio", audioJson);
         }
 
 
+        // host在data2.js、data.js都需要处理
+        String hots = param.getHots();
+        log.info("input hots: {}", hots);
+        if (hots != null) {
+            // 获取所有key
+            JSONObject hotJson = JSONObject.parseObject(hots);
+
+            Set<String> strings = hotJson.keySet();
+            for (String key: strings) {
+                JSONObject subJson = hotJson.getJSONObject(key);
+//                String url  = "https://www.4dmodel.com/SuperTwo/hot_online/index.html?m=" + key;
+                String url  = SERVER_DOMAIN + "edit-backstage/hot_online/index.html?m=" + key;
+
+                // 将link 添加进去
+                subJson.put("link", url);
+            }
+            data2Json.put("hots", hotJson);
+        } else {
+            data2Json.put("hots", new JSONObject());
+        }
+
+
         // 删除旧data2.js
         FileUtil.del(data2Path);
+
+
         // 写入新data2.js
         FileUtil.writeUtf8String(data2Json.toJSONString(), data2Path);
         log.info("新data2.js写入完成");
 
 
+        //处理data.js 文件
+        editDataJs(entity, hots);
 
         return Result.success();
     }
 
+    @ApiOperation("漫游可行")
+    @PostMapping("roamViable")
+    public Result roamViable(@RequestBody RoamViableDto param) throws Exception {
+        return sceneService.roamViable(param);
+    }
+
 
     /**
      * 素材文件,真删除
@@ -434,6 +491,7 @@ public class SceneController extends BaseController {
         log.info("文件转换完成");
 
         // 场景url
+//        String webSite = SERVER_DOMAIN + "SuperTwo/index.html?m=" + sceneCode;
         String webSite = SERVER_DOMAIN + "SuperTwo/index.html?m=" + sceneCode;
         log.info("webSite: {}", webSite);
 
@@ -569,7 +627,8 @@ public class SceneController extends BaseController {
     }
 
 
-    @ApiOperation(value = "上传", notes = "编辑场景使用,根据场景码位置上传(应用程序项目、web),自定义上传位置,文件名需要验证中文字符")
+    @ApiOperation(value = "上传", notes = "编辑场景使用,根据场景码位置上传(应用程序项目、web),自定义上传位置,文件名需要验证中文字符" +
+            "会重命名文件")
     @PostMapping(value = "upload/{sceneCode}", consumes = {"multipart/form-data"})
     public Result upload(MultipartFile file , @PathVariable String sceneCode) throws IOException {
 
@@ -585,12 +644,18 @@ public class SceneController extends BaseController {
         }
 
         String fileName = file.getOriginalFilename();
+        String suffix = StringUtils.substringAfterLast(fileName, ".");
 
         if (Validator.hasChinese(fileName)) {
             log.error("文件名不能有中文字符: {}", fileName);
             return Result.failure("文件名不能有中文字符:" + fileName);
         }
 
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
+
+        // 重命名
+        fileName = time + "." + suffix;
+
         String savePath = entity.getPath() + "/edit/" + fileName;
         FileUtil.writeFromStream(file.getInputStream(), savePath);
 
@@ -637,7 +702,7 @@ public class SceneController extends BaseController {
             for (String key: strings) {
                 JSONObject subJson = hotJson.getJSONObject(key);
 //                String url  = "https://www.4dmodel.com/SuperTwo/hot_online/index.html?m=" + key;
-                String url  = SERVER_DOMAIN + "SuperTwo/hot_online/index.html?m=" + key;
+                String url  = SERVER_DOMAIN + "edit-backstage/hot_online/index.html?m=" + key;
                 // 将link 添加进去
                 subJson.put("link", url);
             }
@@ -705,7 +770,11 @@ public class SceneController extends BaseController {
             }
 
         }
-        String dataPath = entity.getPath() + entity.getSceneCode() + "/hot/js/data.js";
+
+        log.info("out data.js : {}", dataJsJson);
+
+
+        String dataPath = entity.getPath() + "/hot/js/data.js";
         FileUtil.writeUtf8String(dataJsJson.toJSONString(), dataPath);
 
         log.info("新data.js写入完成: {}", dataPath);