浏览代码

更新-路径位置

wuweihao 4 年之前
父节点
当前提交
960c133875

+ 12 - 6
gis_application/src/main/resources/application-dev.properties

@@ -54,13 +54,19 @@ logging.path=E:/javaProject/${project.name}_log
 logging.config=classpath:logback-spring.xml
 logging.config=classpath:logback-spring.xml
 logging.level.com.gis=debug
 logging.level.com.gis=debug
 
 
-# \u672C\u5730\u4FDD\u5B58\u8DEF\u5F84
-file.path=F:\\test\\ngin\\${project.name}_data\\
-# 使用本地存在,不用oss时使用; 需要开启nginx
-file.address=/data/${project.name}_data/
+# file info
+server.file.path=F:\\test\\ngin\\${project.name}_data\\
+
+# url info
+server.url.prefix=/data/
+
+# swagger2 \u8BBE\u7F6E\u5168\u5C40\u5B57\u4F53\u683C\u5F0F\u4E3Autf-8
+swagger.package=com.gis.web.controller
+swagger.title=\u6FB3\u95E8\u519B\u53F2\u9986-dev
+swagger.description=${swagger.title}
+swagger.version=1.0
+
 
 
-#server.domain =http://192.168.0.135/
-server.domain =http://192.168.1.100/
 
 
 
 
 
 

+ 10 - 7
gis_application/src/main/resources/application-sit.properties

@@ -52,20 +52,23 @@ logging.path=/root/user/${project.name}_log
 logging.config=classpath:logback-spring.xml
 logging.config=classpath:logback-spring.xml
 logging.level.com.gis=debug
 logging.level.com.gis=debug
 
 
-# \u672C\u5730\u4FDD\u5B58\u8DEF\u5F84
-file.path=/root/user/${project.name}_data/
 
 
 
 
-# 使用本地存在,不用oss时使用; 需要开启nginx
-file.address=/data/${project.name}_data/
+# file info
+server.file.path=/root/user/${project.name}_data/
 
 
+# url prefix
+server.url.prefix=/data/
 
 
-#server.domain =http://192.168.0.44:8101/
-server.domain =http://192.168.1.100:8080/
+# swagger2 \u8BBE\u7F6E\u5168\u5C40\u5B57\u4F53\u683C\u5F0F\u4E3Autf-8
+swagger.package=com.gis.web.controller
+swagger.title=\u6FB3\u95E8\u519B\u53F2\u9986-sit
+swagger.description=${swagger.title}
+swagger.version=1.0
 
 
 
 
 # swagger login
 # swagger login
-# 开启basic登录认证
+# \uFFFD\uFFFD\uFFFD\uFFFDbasic\uFFFD\uFFFD\u00BC\uFFFD\uFFFD\u05A4
 #knife4j.basic.enable=true
 #knife4j.basic.enable=true
 #knife4j.basic.username=owen
 #knife4j.basic.username=owen
 #knife4j.basic.password=owen
 #knife4j.basic.password=owen

+ 13 - 6
gis_common/src/main/java/com/gis/common/config/Swagger2.java

@@ -1,7 +1,10 @@
 package com.gis.common.config;
 package com.gis.common.config;
 
 
+import com.gis.common.constant.ConfigConstant;
 import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
 import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.ApiInfoBuilder;
@@ -30,16 +33,21 @@ import java.util.List;
  *
  *
  * 2.9.2 不需要字启动类配置注解
  * 2.9.2 不需要字启动类配置注解
  */
  */
-@EnableKnife4j  // basic认证需要开启这个注解
+@Slf4j
 @Configuration
 @Configuration
 @EnableSwagger2
 @EnableSwagger2
+@EnableKnife4j
 public class Swagger2 {
 public class Swagger2 {
+
+    @Autowired
+    ConfigConstant configConstant;
+
     @Bean
     @Bean
     public Docket createRestApi() {
     public Docket createRestApi() {
         return new Docket(DocumentationType.SWAGGER_2)
         return new Docket(DocumentationType.SWAGGER_2)
                 .apiInfo(apiInfo())
                 .apiInfo(apiInfo())
                 .select()
                 .select()
-                .apis(RequestHandlerSelectors.basePackage("com.gis.web.controller"))
+                .apis(RequestHandlerSelectors.basePackage(configConstant.swaggerPackage))
                 .paths(PathSelectors.any())
                 .paths(PathSelectors.any())
                 .build()
                 .build()
                 //添加登录认证,可以使用token
                 //添加登录认证,可以使用token
@@ -50,16 +58,15 @@ public class Swagger2 {
 
 
     private ApiInfo apiInfo() {
     private ApiInfo apiInfo() {
         return new ApiInfoBuilder()
         return new ApiInfoBuilder()
-                .title("驻澳部队cms APIs")
-                .description("驻澳部队cms Api接口文档")
-                .version("1.0")
+                .title(configConstant.swaggerTitle)
+                .description(configConstant.swaggerDescription)
+                .version(configConstant.swaggerVersion)
                 .build();
                 .build();
     }
     }
 
 
     private List<ApiKey> securitySchemes() {
     private List<ApiKey> securitySchemes() {
         //设置请求头信息
         //设置请求头信息
         List<ApiKey> result = new ArrayList<>();
         List<ApiKey> result = new ArrayList<>();
-//        ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
         ApiKey apiKey = new ApiKey("Authorization", "token", "header");
         ApiKey apiKey = new ApiKey("Authorization", "token", "header");
         result.add(apiKey);
         result.add(apiKey);
         return result;
         return result;

+ 71 - 0
gis_common/src/main/java/com/gis/common/constant/ConfigConstant.java

@@ -0,0 +1,71 @@
+package com.gis.common.constant;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by owen on 2020/12/31 0031 14:22
+ *
+ * 全局动态参数
+ */
+@Component
+public class ConfigConstant {
+
+    /** 服务器文件地址*/
+    @Value("${server.file.path}")
+    public  String serverBasePath;
+
+    /** 服务器域名*/
+//    @Value("${server.domain}")
+//    public  String serverDomain;
+
+    @Value("${server.url.prefix}")
+    public String serverUrlPrefix;
+
+    @Value("${project.name}")
+    public String projectName;
+
+//    @Value("${project.name}")
+//    public String serverDomain;
+
+//    @Value("${oss.point}")
+//    public  String ossPoint;
+//
+//    @Value("${oss.key}")
+//    public  String ossKey;
+//
+//    @Value("${oss.secrecy}")
+//    public  String ossSecrecy;
+//
+//    @Value("${oss.bucket}")
+//    public  String ossBucket;
+//
+//    @Value("${oss.file.path}")
+//    public  String ossBasePath;
+//
+//    @Value("${oss.domain}")
+//    public  String ossDomain;
+
+
+    @Value("${swagger.package}")
+    public  String swaggerPackage;
+
+    @Value("${swagger.title}")
+    public  String swaggerTitle;
+
+    @Value("${swagger.description}")
+    public  String swaggerDescription;
+
+    @Value("${swagger.version}")
+    public  String swaggerVersion;
+
+
+    /*********************** 其他参数 ***********************/
+//
+//    @Value("${domain.4dkk}")
+//    public  String domain4dKK;
+
+
+
+
+}

+ 0 - 2
gis_mapper/src/main/java/com/gis/mapper/CommentMapper.java

@@ -3,9 +3,7 @@ package com.gis.mapper;
 
 
 import com.gis.domain.dto.PageDateDto;
 import com.gis.domain.dto.PageDateDto;
 import com.gis.domain.po.CommentEntity;
 import com.gis.domain.po.CommentEntity;
-import com.gis.domain.vo.CommentVo;
 import com.gis.mapper.provider.CommentProvider;
 import com.gis.mapper.provider.CommentProvider;
-import com.gis.mapper.provider.SpiritProvider;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.SelectProvider;
 import org.apache.ibatis.annotations.SelectProvider;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;

+ 0 - 2
gis_mapper/src/main/java/com/gis/mapper/SceneMapper.java

@@ -1,11 +1,9 @@
 package com.gis.mapper;
 package com.gis.mapper;
 
 
 
 
-import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.ScenePageDto;
 import com.gis.domain.dto.ScenePageDto;
 import com.gis.domain.po.SceneEntity;
 import com.gis.domain.po.SceneEntity;
 import com.gis.mapper.provider.SceneProvider;
 import com.gis.mapper.provider.SceneProvider;
-import com.gis.mapper.provider.SpiritProvider;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.SelectProvider;
 import org.apache.ibatis.annotations.SelectProvider;

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

@@ -4,6 +4,7 @@ package com.gis.service;
 import com.gis.common.util.Result;
 import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.RoamViableDto;
 import com.gis.domain.dto.RoamViableDto;
+import com.gis.domain.dto.SceneDataDto;
 import com.gis.domain.dto.ScenePageDto;
 import com.gis.domain.dto.ScenePageDto;
 import com.gis.domain.po.SceneEntity;
 import com.gis.domain.po.SceneEntity;
 
 
@@ -21,4 +22,6 @@ public interface SceneService extends IBaseService<SceneEntity, Long> {
     List<SceneEntity> search(ScenePageDto param);
     List<SceneEntity> search(ScenePageDto param);
 
 
     Result roamViable(RoamViableDto param) throws Exception;
     Result roamViable(RoamViableDto param) throws Exception;
+
+    Result edit(SceneDataDto param);
 }
 }

+ 9 - 4
gis_service/src/main/java/com/gis/service/impl/IBaseServiceImpl.java

@@ -1,10 +1,12 @@
 package com.gis.service.impl;
 package com.gis.service.impl;
 
 
+import com.gis.common.constant.ConfigConstant;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import com.gis.mapper.IBaseMapper;
 import com.gis.mapper.IBaseMapper;
 import com.gis.domain.po.BaseEntity;
 import com.gis.domain.po.BaseEntity;
 import com.gis.service.IBaseService;
 import com.gis.service.IBaseService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
@@ -22,11 +24,14 @@ import java.util.List;
 public abstract class IBaseServiceImpl<T extends BaseEntity, ID extends Serializable> implements IBaseService<T, ID> {
 public abstract class IBaseServiceImpl<T extends BaseEntity, ID extends Serializable> implements IBaseService<T, ID> {
 
 
 
 
-    @Value("${file.path}")
-    public String FILE_PATH;
+//    @Value("${file.path}")
+//    public String FILE_PATH;
+//
+//    @Value("${server.domain}")
+//    public String SERVER_DOMAIN;
 
 
-    @Value("${server.domain}")
-    public String SERVER_DOMAIN;
+    @Autowired
+    ConfigConstant configConstant;
 
 
     public abstract IBaseMapper<T, ID> getBaseMapper();
     public abstract IBaseMapper<T, ID> getBaseMapper();
 
 

+ 223 - 1
gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java

@@ -1,13 +1,16 @@
 package com.gis.service.impl;
 package com.gis.service.impl;
 
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.gis.common.proto.util.ConvertUtils;
 import com.gis.common.proto.util.ConvertUtils;
 import com.gis.common.util.FileUtils;
 import com.gis.common.util.FileUtils;
 import com.gis.common.util.Result;
 import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.PageDto;
 import com.gis.domain.dto.RoamViableDto;
 import com.gis.domain.dto.RoamViableDto;
+import com.gis.domain.dto.SceneDataDto;
 import com.gis.domain.dto.ScenePageDto;
 import com.gis.domain.dto.ScenePageDto;
 import com.gis.domain.po.SceneEntity;
 import com.gis.domain.po.SceneEntity;
 import com.gis.mapper.SceneMapper;
 import com.gis.mapper.SceneMapper;
@@ -19,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Set;
 
 
 
 
 /**
 /**
@@ -59,11 +63,13 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
             return Result.failure("场景不存在");
             return Result.failure("场景不存在");
         }
         }
 
 
+
         // 1. 从oss下载vision.modeldata
         // 1. 从oss下载vision.modeldata
         String visionModelDataName = "vision.modeldata";
         String visionModelDataName = "vision.modeldata";
         // 注意网络下载会有缓存,必须加时间戳
         // 注意网络下载会有缓存,必须加时间戳
 //        log.info("网络下载文件地址: {}", urlPath);
 //        log.info("网络下载文件地址: {}", urlPath);
-        String localBasePath = FILE_PATH + sceneCode;
+//        String localBasePath = FILE_PATH + sceneCode;
+        String localBasePath = configConstant.serverBasePath + sceneCode;
 
 
         // 2. 将vision.modeldata 转 vision.json
         // 2. 将vision.modeldata 转 vision.json
         String visionModelDataPath = localBasePath + "/" + visionModelDataName;
         String visionModelDataPath = localBasePath + "/" + visionModelDataName;
@@ -134,4 +140,220 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
 
 
         return Result.success();
         return Result.success();
     }
     }
+
+    @Override
+    public Result edit(SceneDataDto param) {
+        String sceneCode = param.getSceneCode();
+        SceneEntity entity = this.findBySceneCode(param.getSceneCode());
+        if (entity == null) {
+            log.error("场景不存在 : {}", sceneCode);
+            return Result.failure("场景不存在");
+        }
+
+        String basePath = configConstant.serverBasePath + sceneCode;
+
+
+        // 处理someData.json
+
+//        String someDataPath = entity.getPath() + "/someData.json";
+        String someDataPath = basePath + "/someData.json";
+        if (!FileUtil.isFile(someDataPath)) {
+            log.error("someData.json文件不存在");
+            return Result.failure("someData.json文件不存在");
+        }
+
+        // 读取someDataJson
+        String someData = FileUtil.readUtf8String(someDataPath);
+        JSONObject someDataJson = JSONObject.parseObject(someData);
+
+
+
+        String info = param.getInfo();
+        String guides = param.getGuides();
+        JSONArray guidesArray = new JSONArray();
+        if (guides != null) {
+            guidesArray = JSONObject.parseArray(guides);
+
+        }
+
+
+        if (info != null) {
+            JSONObject infoJson = JSONObject.parseObject(info);
+
+            // 处理model
+            JSONObject model = someDataJson.getJSONObject("model");
+            if (model != null) {
+                if (guidesArray != null) {
+                    model.put("images", guidesArray);
+                }
+
+            }
+
+            // 更新someDataJson
+            someDataJson.put("model", model);
+
+            // info信息添加到someDataJson最外层
+            Set<String> infoKey = infoJson.keySet();
+            for (String key : infoKey) {
+
+                someDataJson.put(key, infoJson.get(key));
+            }
+
+            // 删除旧someDataJson
+            FileUtil.del(someDataPath);
+            // 写入新someDataJson
+            FileUtil.writeUtf8String(someDataJson.toJSONString(), someDataPath);
+            log.info("someData.json写入完成");
+        }
+
+        // 处理data2.js
+        String data2Path = basePath + "/data2.js";
+        boolean file = FileUtil.isFile(data2Path);
+        if (!file) {
+            log.error("data2.js文件不存在");
+            return Result.failure("data2.js文件不存在");
+        }
+
+        String data2 = FileUtil.readUtf8String(data2Path);
+        JSONObject data2Json = JSONObject.parseObject(data2);
+
+        String tourAudio = param.getTourAudio();
+        if (tourAudio != null) {
+            data2Json.put("tourAudio", JSONObject.parseObject(tourAudio));
+        } else {
+            data2Json.put("tourAudio", new JSONObject());
+        }
+
+        // overlays是数组
+        String overlays = param.getOverlays();
+        if (overlays != null) {
+            data2Json.put("overlays", JSONObject.parseArray(overlays));
+        } else {
+            data2Json.put("overlays", new JSONArray());
+        }
+
+        // 处理guidesArray,将scan_id的值作为key, value:  time":40000
+        JSONObject audioJson = new JSONObject();
+        JSONObject timeJson = new JSONObject();
+        timeJson.put("time", 40000);
+        if (guidesArray != null) {
+
+            // 将旧的audio字段删除
+            data2Json.remove("audio");
+
+            for (int i = 0; i < guidesArray.size() ; i++) {
+                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对象重复引用问题,拿不到想要的效果
+                    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;
+                String url  = "/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();
+    }
+
+    /**
+     * 处理data.js 文件
+     */
+    private void editDataJs(SceneEntity entity, String hots )  {
+
+        // 因为data.js只是热点信息,所以直接创建上传oss
+        JSONObject dataJsJson = new JSONObject();
+        if (hots != null) {
+            dataJsJson = JSONObject.parseObject(hots);
+
+            Set<String> strings = dataJsJson.keySet();
+            for (String key: strings) {
+                JSONObject subJson = dataJsJson.getJSONObject(key);
+                JSONObject infoAttribute = subJson.getJSONObject("infoAttribute");
+                if (infoAttribute != null) {
+                    Set<String> infoKey = infoAttribute.keySet();
+
+                    for (String s: infoKey) {
+                        Object val = null;
+                        // 添加到第一层, 空值不添加
+                        if ("images".equals(s) || "styleImg".equals(s) || "model".equals(s) || "video".equals(s) || "iframe".equals(s)) {
+                            JSONArray jsonArray = infoAttribute.getJSONArray(s);
+                            if (jsonArray.size() == 0) {
+                                continue;
+                            }
+                            val = jsonArray;
+
+                        } else {
+                            String a = infoAttribute.getString(s);
+                            if (StringUtils.isBlank(a)){
+                                continue;
+                            }
+                            val = a;
+                        }
+
+
+                        subJson.put(s, val);
+                    }
+
+                }
+
+                // 删除infoAttribute
+                subJson.remove("infoAttribute");
+
+            }
+
+        }
+
+        log.info("out data.js : {}", dataJsJson);
+        String basePath = configConstant.serverBasePath + entity.getSceneCode();
+
+        String dataPath = basePath + "/hot/js/data.js";
+        FileUtil.writeUtf8String(dataJsJson.toJSONString(), dataPath);
+
+        log.info("新data.js写入完成: {}", dataPath);
+
+
+    }
 }
 }

+ 33 - 25
gis_web/src/main/java/com/gis/web/controller/BaseController.java

@@ -1,6 +1,7 @@
 package com.gis.web.controller;
 package com.gis.web.controller;
 
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.FileUtil;
+import com.gis.common.constant.ConfigConstant;
 import com.gis.domain.po.LogEntity;
 import com.gis.domain.po.LogEntity;
 import com.gis.domain.po.SysUserEntity;
 import com.gis.domain.po.SysUserEntity;
 import com.gis.service.FileService;
 import com.gis.service.FileService;
@@ -39,19 +40,22 @@ public class BaseController {
     /**
     /**
      * 服务器保存文件路径前缀
      * 服务器保存文件路径前缀
      */
      */
-    @Value("${file.path}")
-    public String FILE_PATH;
+//    @Value("${file.path}")
+//    public String FILE_PATH;
 
 
-    @Value("${server.domain}")
-    public String SERVER_DOMAIN;
-
-    /** 项目名*/
-    @Value("${project.name}")
-    public String PROJECT_NAME;
+//    @Value("${server.domain}")
+//    public String SERVER_DOMAIN;
+//
+//    /** 项目名*/
+//    @Value("${project.name}")
+//    public String PROJECT_NAME;
+//
+//    /** 文件访问目录地址*/
+//    @Value("${file.address}")
+//    public String FILE_ADDRESS;
 
 
-    /** 文件访问目录地址*/
-    @Value("${file.address}")
-    public String FILE_ADDRESS;
+    @Autowired
+    ConfigConstant configConstant;
 
 
 
 
 
 
@@ -73,12 +77,6 @@ public class BaseController {
 
 
 
 
 
 
-    SysUserEntity getSysUser(){
-        return sysUserService.findById(getTokenUserId());
-    }
-
-
-
     /** 获取header token */
     /** 获取header token */
     String getToken(){
     String getToken(){
         return request.getHeader("token");
         return request.getHeader("token");
@@ -116,7 +114,7 @@ public class BaseController {
      * @param path
      * @param path
      * @return 物理位置
      * @return 物理位置
      */
      */
-    public String subStringAfter(String path){
+/*    public String subStringAfter(String path){
         log.info("input param: {}", path);
         log.info("input param: {}", path);
         if (StringUtils.isNotBlank(path)) {
         if (StringUtils.isNotBlank(path)) {
             String s = StringUtils.substringAfter(path, "/data/");
             String s = StringUtils.substringAfter(path, "/data/");
@@ -125,6 +123,23 @@ public class BaseController {
         }
         }
         return null;
         return null;
 
 
+    }*/
+
+    /**
+     * 截取文件路径
+     * @param path
+     * @return 物理位置
+     */
+    public String subStringAfter(String path){
+        log.info("input param: {}", path);
+        if (StringUtils.isNotBlank(path)) {
+            String s = StringUtils.substringAfter(path, "/data/");
+            s = configConstant.serverBasePath + s;
+            log.info("filePath: {}", s);
+            return s;
+        }
+        return null;
+
     }
     }
 
 
     /**
     /**
@@ -142,13 +157,6 @@ public class BaseController {
     }
     }
 
 
 
 
-//    public static void main(String[] args) {
-//        for (int i = 0; i < 100; i++) {
-////            FileUtil.del("");
-//            FileUtil.del("d:\\dddddd");
-//
-//        }
-//    }
 
 
 
 
 
 

+ 7 - 6
gis_web/src/main/java/com/gis/web/controller/FileController.java

@@ -56,7 +56,7 @@ public class FileController extends BaseController {
         }
         }
 
 
         // 写入本地服务器
         // 写入本地服务器
-        String basePath = FILE_PATH + "media/";
+        String basePath = configConstant.serverBasePath + "media/";
         HashMap<String, String> fileInfo = FileUtils.upload(file, basePath);
         HashMap<String, String> fileInfo = FileUtils.upload(file, basePath);
 
 
 
 
@@ -69,7 +69,8 @@ public class FileController extends BaseController {
 
 
         String newName = fileInfo.get("newName");
         String newName = fileInfo.get("newName");
 //        String urlPath = SERVER_DOMAIN+"data/media/" + newName;
 //        String urlPath = SERVER_DOMAIN+"data/media/" + newName;
-        String urlPath = FILE_ADDRESS +"media/" + newName;
+//        String urlPath = FILE_ADDRESS +"media/" + newName;
+        String urlPath = configConstant.serverUrlPrefix +"media/" + newName;
         entity.setUrlPath(urlPath);
         entity.setUrlPath(urlPath);
         log.info("文件生成完成: {}", urlPath);
         log.info("文件生成完成: {}", urlPath);
 
 
@@ -87,7 +88,7 @@ public class FileController extends BaseController {
                 createThumb(filePath, thumbPath);
                 createThumb(filePath, thumbPath);
 
 
 //                thumbUrl = SERVER_DOMAIN+"data/media/thumb_" + newName;
 //                thumbUrl = SERVER_DOMAIN+"data/media/thumb_" + newName;
-                thumbUrl = FILE_ADDRESS +"media/thumb_" + newName;
+                thumbUrl = configConstant.serverUrlPrefix +"media/thumb_" + newName;
             }
             }
         }
         }
 
 
@@ -111,20 +112,20 @@ public class FileController extends BaseController {
         }
         }
 
 
         // 写入本地服务器
         // 写入本地服务器
-        List<Map<String, String>> uploads = FileUtils.uploads(file, FILE_PATH);
+        List<Map<String, String>> uploads = FileUtils.uploads(file, configConstant.serverBasePath);
 
 
         HashMap<String, String> resultMap = new HashMap<>();
         HashMap<String, String> resultMap = new HashMap<>();
         String dir = null;
         String dir = null;
         for (Map<String, String> map: uploads) {
         for (Map<String, String> map: uploads) {
             String fileName = map.get("name");
             String fileName = map.get("name");
             String newName = map.get("newName");
             String newName = map.get("newName");
-            String path = FILE_PATH+"/" + newName;
+            String path = configConstant.serverBasePath+"/" + newName;
             String filePath = map.get("path");
             String filePath = map.get("path");
             log.info("local {}, ", filePath);
             log.info("local {}, ", filePath);
             // urlPath
             // urlPath
             dir = map.get("dir");
             dir = map.get("dir");
 //            String urlPath = SERVER_DOMAIN+"data/"+dir+"/"+newName;
 //            String urlPath = SERVER_DOMAIN+"data/"+dir+"/"+newName;
-            String urlPath = FILE_ADDRESS + dir+"/"+newName;
+            String urlPath = configConstant.serverUrlPrefix + dir+"/"+newName;
 
 
             // 保存db
             // 保存db
             FileEntity entity = new FileEntity();
             FileEntity entity = new FileEntity();

+ 2 - 2
gis_web/src/main/java/com/gis/web/controller/FodderController.java

@@ -194,7 +194,7 @@ public class FodderController extends BaseController {
         String fileType = FileUtils.getFileType(filename) + "/";
         String fileType = FileUtils.getFileType(filename) + "/";
 
 
         // 写入本地服务器
         // 写入本地服务器
-        String basePath = FILE_PATH + "fodder/" + fileType;
+        String basePath = configConstant.serverBasePath + "fodder/" + fileType;
 
 
         // 去除特殊符号
         // 去除特殊符号
         String pinyinName = RegexUtil.specificSymbol(filename);
         String pinyinName = RegexUtil.specificSymbol(filename);
@@ -216,7 +216,7 @@ public class FodderController extends BaseController {
         entity.setFilePath(savePath);
         entity.setFilePath(savePath);
 
 
 //        String urlPath = SERVER_DOMAIN+"data/fodder/" + pinyinName;
 //        String urlPath = SERVER_DOMAIN+"data/fodder/" + pinyinName;
-        String urlPath = FILE_ADDRESS + "fodder/" + fileType + pinyinName;
+        String urlPath = configConstant.serverUrlPrefix + "fodder/" + fileType + pinyinName;
         entity.setUrlPath(urlPath);
         entity.setUrlPath(urlPath);
         log.info("文件生成完成: {}", urlPath);
         log.info("文件生成完成: {}", urlPath);
 
 

+ 26 - 10
gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -81,7 +81,9 @@ public class SceneController extends BaseController {
      * @param param
      * @param param
      * @return
      * @return
      */
      */
-    @ApiOperation("场景编辑")
+
+
+/*    @ApiOperation("场景编辑")
     @PostMapping("edit")
     @PostMapping("edit")
     public Result edit(@Valid @RequestBody SceneDataDto param) {
     public Result edit(@Valid @RequestBody SceneDataDto param) {
         String sceneCode = param.getSceneCode();
         String sceneCode = param.getSceneCode();
@@ -94,6 +96,7 @@ public class SceneController extends BaseController {
 
 
 
 
         // 处理someData.json
         // 处理someData.json
+
         String someDataPath = entity.getPath() + "/someData.json";
         String someDataPath = entity.getPath() + "/someData.json";
         if (!FileUtil.isFile(someDataPath)) {
         if (!FileUtil.isFile(someDataPath)) {
             log.error("someData.json文件不存在");
             log.error("someData.json文件不存在");
@@ -239,6 +242,13 @@ public class SceneController extends BaseController {
         editDataJs(entity, hots);
         editDataJs(entity, hots);
 
 
         return Result.success();
         return Result.success();
+    }*/
+
+
+    @ApiOperation("场景编辑")
+    @PostMapping("edit")
+    public Result edit(@Valid @RequestBody SceneDataDto param)  {
+        return sceneService.edit(param);
     }
     }
 
 
     @ApiOperation("漫游可行")
     @ApiOperation("漫游可行")
@@ -256,8 +266,10 @@ public class SceneController extends BaseController {
     @GetMapping("removes/{ids}")
     @GetMapping("removes/{ids}")
     public Result removes(@PathVariable String ids) {
     public Result removes(@PathVariable String ids) {
         List<SceneEntity> entities = sceneService.findByIds(ids);
         List<SceneEntity> entities = sceneService.findByIds(ids);
+        String basePath = configConstant.serverBasePath;
+
         for (SceneEntity entity: entities) {
         for (SceneEntity entity: entities) {
-            FileUtil.del(entity.getPath());
+            FileUtil.del(basePath + entity.getSceneCode());
             sceneService.delete(entity);
             sceneService.delete(entity);
 
 
 
 
@@ -340,7 +352,7 @@ public class SceneController extends BaseController {
         }
         }
 
 
         // 保存位置(箭头函数传参,需要定义final, 使用时需要赋值使用)
         // 保存位置(箭头函数传参,需要定义final, 使用时需要赋值使用)
-        String basePath = entity.getPath();
+        String basePath = configConstant.serverBasePath + sceneCode;
         final String saveBasePath = basePath + "/boxVideo/";
         final String saveBasePath = basePath + "/boxVideo/";
 
 
         // box视频信息
         // box视频信息
@@ -371,7 +383,8 @@ public class SceneController extends BaseController {
 
 
             // 给相对路径,tomcat配置静态资源让前端读取
             // 给相对路径,tomcat配置静态资源让前端读取
             // http://192.168.0.44:8101/data/ar_I4Ef2SS4y/boxVideo/20180201_101827.mp4
             // http://192.168.0.44:8101/data/ar_I4Ef2SS4y/boxVideo/20180201_101827.mp4
-            String boxVideoPath = FILE_ADDRESS + entity.getSceneCode()+ "/boxVideo/" + fileName;
+//            String boxVideoPath = FILE_ADDRESS + entity.getSceneCode()+ "/boxVideo/" + fileName;
+            String boxVideoPath = configConstant.serverUrlPrefix + entity.getSceneCode()+ "/boxVideo/" + fileName;
 //            log.info("boxVideoPath: {}", boxVideoPath);
 //            log.info("boxVideoPath: {}", boxVideoPath);
 
 
             // 添加视频参数到overlayJaon
             // 添加视频参数到overlayJaon
@@ -659,13 +672,15 @@ public class SceneController extends BaseController {
 
 
         // 重命名
         // 重命名
         fileName = time + "." + suffix;
         fileName = time + "." + suffix;
-
-        String savePath = entity.getPath() + "/edit/" + fileName;
+        String basePath = configConstant.serverBasePath + sceneCode;
+        String savePath = basePath + "/edit/" + fileName;
         log.info("文件保存位置:{}" + savePath);
         log.info("文件保存位置:{}" + savePath);
         FileUtil.writeFromStream(file.getInputStream(), savePath);
         FileUtil.writeFromStream(file.getInputStream(), savePath);
 
 
 //        Object urlPath = SERVER_DOMAIN + "data/" + sceneCode + "/edit/" + fileName;
 //        Object urlPath = SERVER_DOMAIN + "data/" + sceneCode + "/edit/" + fileName;
-        Object urlPath = FILE_ADDRESS + sceneCode + "/edit/" + fileName;
+//        Object urlPath = FILE_ADDRESS + sceneCode + "/edit/" + fileName;
+        Object urlPath = configConstant.serverUrlPrefix + sceneCode + "/edit/" + fileName;
+
         log.info("文件写入成功: {}", urlPath);
         log.info("文件写入成功: {}", urlPath);
 
 
         // 返回前端数据
         // 返回前端数据
@@ -681,15 +696,16 @@ public class SceneController extends BaseController {
     @ApiOperation(value = "编辑热点(应用程序项目部)", notes = "应用程序项目部编辑场景热点")
     @ApiOperation(value = "编辑热点(应用程序项目部)", notes = "应用程序项目部编辑场景热点")
     @PostMapping("editHots")
     @PostMapping("editHots")
     public Result editHots(@Valid @RequestBody SceneDataDto param){
     public Result editHots(@Valid @RequestBody SceneDataDto param){
-
+        String sceneCode = param.getSceneCode();
         SceneEntity entity = sceneService.findBySceneCode(param.getSceneCode());
         SceneEntity entity = sceneService.findBySceneCode(param.getSceneCode());
         if (entity == null) {
         if (entity == null) {
-            log.error("场景不存在 : {}", param.getSceneCode());
+            log.error("场景不存在 : {}", sceneCode);
             return Result.failure("场景不存在");
             return Result.failure("场景不存在");
         }
         }
+        String basePath = configConstant.serverBasePath + sceneCode;
 
 
         // 处理data2.js
         // 处理data2.js
-        String data2Path = entity.getPath() + "/data2.js";
+        String data2Path = basePath + "/data2.js";
         boolean file = FileUtil.isFile(data2Path);
         boolean file = FileUtil.isFile(data2Path);
         if (!file) {
         if (!file) {
             log.error("data2.js文件不存在");
             log.error("data2.js文件不存在");