소스 검색

重构 前端改用someData.json文件存储信息

wuweihao 4 년 전
부모
커밋
eb8e807b14
23개의 변경된 파일488개의 추가작업 그리고 246개의 파일을 삭제
  1. 38 0
      720yun_fd_manage/gis_application/src/main/resources/data/someData.json
  2. 1 1
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/config/WebMvcConfig.java
  3. 4 0
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/constant/MsgCode.java
  4. 2 2
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/shiro/JWTFilter.java
  5. 21 75
      720yun_fd_manage/gis_common/src/main/java/com/gis/common/util/FileUtils.java
  6. 3 2
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/BaseDto.java
  7. 24 0
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/SomeDataDto.java
  8. 32 32
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/WorkDto.java
  9. 5 0
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/entity/CatalogEntity.java
  10. 10 0
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/entity/WorkEntity.java
  11. 49 0
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/tree/CatalogTree.java
  12. 29 0
      720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/vo/WorkInfoVo.java
  13. 2 0
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/CatalogService.java
  14. 6 0
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java
  15. 8 1
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/CatalogServiceImpl.java
  16. 7 1
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java
  17. 4 3
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java
  18. 178 55
      720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java
  19. 49 49
      720yun_fd_manage/gis_service/src/main/java/com/gis/tree/CatalogTree.java
  20. 1 0
      720yun_fd_manage/gis_service/src/main/java/com/gis/tree/CatalogTreeUtil.java
  21. 1 1
      720yun_fd_manage/gis_web/pom.xml
  22. 0 13
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/TestController.java
  23. 14 11
      720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java

+ 38 - 0
720yun_fd_manage/gis_application/src/main/resources/data/someData.json

@@ -0,0 +1,38 @@
+{
+  "isPassword": 0,
+  "ossSomeData": "",
+  "icon": "",
+  "description": "",
+  "updateTime": "",
+  "sceneIndex": "",
+  "catalogRoot": [
+    {
+      "id": 100,
+      "name": "全部场景",
+      "children": [
+        1
+      ]
+    }
+  ],
+  "firstScene": {},
+  "userId": "",
+  "isLogo": 1,
+  "appIcon": "",
+  "qrCode": "",
+  "createTime": "",
+  "catalogs": [
+    {
+      "id": 1,
+      "name": "默认二级分组"
+    }
+  ],
+  "isRemind": 1,
+  "name": "",
+  "pcIcon": "",
+  "scenes": [],
+  "isAuto": 1,
+  "logo": "",
+  "share": "",
+  "id": "",
+  "status": 0
+}

+ 1 - 1
720yun_fd_manage/gis_common/src/main/java/com/gis/common/config/WebMvcConfig.java

@@ -59,7 +59,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 
 
         // 设置全程返回时间
-        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm");
         // 设置返回值为null是时输出,不写的话,null 字段 不返回。也可以设置返回空串, 可以同时设置多个
         fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
 

+ 4 - 0
720yun_fd_manage/gis_common/src/main/java/com/gis/common/constant/MsgCode.java

@@ -13,6 +13,10 @@ public class MsgCode {
     public final static Integer e3002 = 3002;
     public final static String m3002 = "请至少保留一个场景";
 
+    /** 文件过大 */
+    public final static Integer e3004 = 3004;
+
+
 
     public final static Integer e5003 = 5003;
     public final static String m5003 = "不支持此图片";

+ 2 - 2
720yun_fd_manage/gis_common/src/main/java/com/gis/common/shiro/JWTFilter.java

@@ -127,8 +127,8 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
             jsonObject.put("msg", ((JwtAuthenticationException) throwable).getMsg());
         } else {
             log.error(msg);
-            jsonObject.put("code", 5002);
-            jsonObject.put("msg", "token invalid");
+            jsonObject.put("code", 5001);
+            jsonObject.put("msg", "token invalid 认证出错");
         }
         // 直接返回Response信息
         this.writeResponse(response, jsonObject);

+ 21 - 75
720yun_fd_manage/gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -324,61 +324,6 @@ public class FileUtils {
     }
 
 
-    /**
-     * 文件上传,用来上传指定文档,应用程序需要不同的文件,特意针对他们设计
-     * @param file
-     * @param savePath
-     * @param ossBasePath
-     * @param ossDomain
-     * @param type sample:样本文档, empty:空白文档
-     * @param code 用来做目录的,如果code为空,创建code; 不为空,就把文件放到code目录里
-     * @return
-     */
-    public  Map renameUploadOssMap(MultipartFile file, String savePath, String ossBasePath, String ossDomain, String type, String code)  {
-        if (file == null) {
-            log.error("文件不能为空");
-            return null;
-        }
-
-        // 创建目录码
-        if (StringUtils.isBlank(code)) {
-            code = RandomUtils.getSceneCode("");
-        }
-
-        String fileName = file.getOriginalFilename();
-
-        HashMap<String, String> result = new HashMap<>();
-        result.put("fileName", fileName);
-
-        String dirType = "doc/" + code + "/";
-
-        String suffix = StringUtils.substringAfterLast(fileName, ".");
-        String newName = type  + "."  +suffix;
-        savePath = savePath + dirType + newName;
-
-        log.info("savePath: {}", savePath);
-
-        try {
-            FileUtil.writeFromStream(file.getInputStream(), savePath);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        // 上传oss
-        String ossPath = ossBasePath + dirType + newName;
-//        AliyunOssUtil.upload(savePath, ossPath);
-        aliyunOssUtil.upload(savePath, ossPath);
-        // code 是用来区分表格是否放在同一目录
-        String ossUrl = ossDomain + ossPath + "?code=" +code;
-        log.info("ossUrl: {}", ossUrl);
-        result.put("ossUrl", ossUrl);
-
-        // 删除服务器临时文件
-        FileUtil.del(savePath);
-
-        return result;
-
-    }
 
 
 
@@ -429,7 +374,7 @@ public class FileUtils {
 
         String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
         String suffix = StringUtils.substringAfterLast(inputFilePath, ".");
-        String fileName ="thumb_"+ time  + "."  +suffix;
+        String fileName ="/thumb_"+ time  + "."  +suffix;
 
         // 保存图片位置
         String saveCompressImgPath = serverBasePath + fileName;
@@ -484,35 +429,36 @@ public class FileUtils {
         return false;
     }
 
-    /**
-     * 根据路径写入文件,适合oss
-     * @param inPath 网络输入路径
-     * @param outPath 保存文件路径
-     * @throws IOException
-     */
-    public static void fielWrite(String inPath, String outPath) throws IOException {
-        InputStream in = URLUtil.getStream(new URL(inPath));
-        FileUtil.writeFromStream(in, outPath);
-    }
+
+
 
 
     /**
-     * 获取文件资源路径
-     * 这方法,测试时是用当前类路径,当打包成jar包时时,会变成跟目录下。所以要把资源文件放入口类的资源文件夹
-     * @param filePath 文件路径
+     * 读取资源文内容
+     * @param resourcePath : data/someData.json
      * @return
-     * @throws IOException
      */
-    public static String getResourceUrl(String filePath) throws IOException {
-        String path = ResourceUtils.getURL("classpath:").getPath();
-        path = path + filePath;
-        return path;
+    public static String getResourceContent(String resourcePath){
+        InputStream resource = FileUtils.getResource(resourcePath);
+        StringBuilder sb = new StringBuilder();
+        String line;
+        String str = null ;
+        BufferedReader br = new BufferedReader(new InputStreamReader(resource));
+        while (true) {
+            try {
+                if ((line = br.readLine()) == null) break;
+                sb.append(line);
+                str = sb.toString();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return str;
     }
 
 
 
 
-
     /**
      * @param fileName 文件名
      * @return 文件的type

+ 3 - 2
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/BaseDto.java

@@ -2,6 +2,7 @@ package com.gis.domain.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.NonNull;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
@@ -12,11 +13,11 @@ import javax.validation.constraints.NotNull;
 @Data
 public class BaseDto {
 
-    @NotBlank
+    @NotNull(message = "id能为空")
     @ApiModelProperty(value = "id", required = true)
     private Long id;
 
-    @NotBlank(message = "名称能为空")
+    @NotBlank(message = "名称能为空")
     @ApiModelProperty(value = "名称", required = true)
     private String name;
 

+ 24 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/SomeDataDto.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 2021/2/22 0028 16:36
+ */
+@Data
+public class SomeDataDto {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+
+    @NotBlank(message = "someData不能为空")
+    @ApiModelProperty(value = "静态文件信息", required = true)
+    private String someData;
+
+
+
+}

+ 32 - 32
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/WorkDto.java

@@ -14,43 +14,43 @@ public class WorkDto {
     @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
     private Long id;
 
-    @ApiModelProperty(value = "名称")
-    private String name;
-
-    @ApiModelProperty(value = "简介")
-    private String description;
-
-//    @ApiModelProperty(value = "状态")
-//    private Integer status;
-
-//    @ApiModelProperty(value = "创建人")
-//    private String userId;
-
-    @ApiModelProperty(value = "封面图")
-    private String icon;
+//    @ApiModelProperty(value = "名称")
+//    private String name;
+//
+//    @ApiModelProperty(value = "简介")
+//    private String description;
+//
+//    @ApiModelProperty(value = "封面图")
+//    private String icon;
 
     @ApiModelProperty(value = "场景密码")
     private String password;
 
-    @ApiModelProperty(value = "PC端提示语")
-    private String pcIcon;
-
-    @ApiModelProperty(value = "移动端提示语")
-    private String appIcon;
-
-    @ApiModelProperty(value = "提醒开关:0:不提醒, 1:提醒")
-    private Integer isRemind;
-
-    @ApiModelProperty(value = "提醒时间,单位秒")
-    private Integer remindTime;
-
-    @ApiModelProperty(value = "自定义logo")
-    private String logo;
+//    @ApiModelProperty(value = "PC端提示语")
+//    private String pcIcon;
+//
+//    @ApiModelProperty(value = "移动端提示语")
+//    private String appIcon;
+//
+//    @ApiModelProperty(value = "提醒开关:0:不提醒, 1:提醒")
+//    private Integer isRemind;
+//
+//    @ApiModelProperty(value = "提醒时间,单位秒")
+//    private Integer remindTime;
+//
+//    @ApiModelProperty(value = "自定义logo")
+//    private String logo;
+//
+//    @ApiModelProperty(value = "显示logo, 0:关,1:开")
+//    private Integer isLogo;
+//
+//    @ApiModelProperty(value = "自动巡游, 0:关,1:开")
+//    private Integer isAuto;
+//
+//    @NotBlank(message = "someData不能为空")
+//    @ApiModelProperty(value = "静态文件信息", required = true)
+//    private String someData;
 
-    @ApiModelProperty(value = "显示logo, 0:关,1:开")
-    private Integer isLogo;
 
-    @ApiModelProperty(value = "自动巡游, 0:关,1:开")
-    private Integer isAuto;
 
 }

+ 5 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/entity/CatalogEntity.java

@@ -5,7 +5,9 @@ import lombok.Data;
 
 import javax.persistence.Entity;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * 场景分组目录
@@ -31,6 +33,9 @@ public class CatalogEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "父目录Id")
     private Long parentId;
 
+    @Transient
+    private List<Long> children;
+
 
 
 

+ 10 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/entity/WorkEntity.java

@@ -71,4 +71,14 @@ public class WorkEntity extends BaseEntity implements Serializable {
 
     @ApiModelProperty(value = "是否有密码,0:没有, 1:有")
     private Integer isPassword;
+
+
+
+/**********************************************************/
+    @ApiModelProperty(value = "someData OSS路径")
+    private String ossSomeData;
+
+//    @ApiModelProperty(value = "someData 服务器路径")
+//    private String serverPath;
+
 }

+ 49 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/tree/CatalogTree.java

@@ -0,0 +1,49 @@
+package com.gis.domain.tree;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.gis.domain.vo.CatalogSceneVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class CatalogTree implements Serializable {
+
+
+    private static final long serialVersionUID = 5299557851133375944L;
+    private Long id;
+
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @JSONField(serialize = false)
+    @ApiModelProperty(value = "创建人")
+    private String userId;
+
+    @ApiModelProperty(value = "排序(序号小排前面)")
+    private Integer sort;
+
+    @JSONField(serialize = false)
+    @ApiModelProperty(value = "目录层级,最大二级")
+    private Integer level;
+
+    @ApiModelProperty(value = "父目录Id")
+    private Long parentId;
+
+
+    /** 默认给空数组*/
+
+    private List<CatalogTree> children = new ArrayList<>();
+
+    /** 场景实体*/
+//    private List<SceneEntity> scenes;
+    @JSONField(serialize = false)
+    private List<CatalogSceneVo> scenes;
+
+
+//    @JSONField(serialize = false)
+//    private boolean checked = false;
+}

+ 29 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/vo/WorkInfoVo.java

@@ -0,0 +1,29 @@
+package com.gis.domain.vo;
+
+import com.gis.domain.entity.CatalogEntity;
+import com.gis.domain.entity.SceneEntity;
+import com.gis.domain.entity.WorkEntity;
+import com.gis.domain.tree.CatalogTree;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Created by owen on 2021/3/29 0029 14:58
+ *
+ * 展示页,需要目录
+ */
+@Data
+public class WorkInfoVo extends WorkEntity {
+
+    @ApiModelProperty(value = "分类信息ROOT")
+    private List<CatalogEntity> catalogRoot;
+
+    @ApiModelProperty(value = "分类信息")
+    private List<CatalogEntity> catalogs;
+
+    @ApiModelProperty(value = "场景")
+    private List<SceneEntity> scenes;
+
+}

+ 2 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/CatalogService.java

@@ -35,4 +35,6 @@ public interface CatalogService extends IBaseService<CatalogEntity, Long> {
     List<CatalogEntity> findByParentId(Long parentId);
 
     Result editEntity(BaseDto param);
+
+    List<CatalogEntity> findByWorkId(Long id);
 }

+ 6 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/WorkService.java

@@ -3,8 +3,10 @@ package com.gis.service;
 
 import com.gis.common.util.Result;
 import com.gis.domain.dto.PageDto;
+import com.gis.domain.dto.SomeDataDto;
 import com.gis.domain.dto.WorkDto;
 import com.gis.domain.entity.WorkEntity;
+import com.gis.domain.vo.WorkInfoVo;
 
 
 /**
@@ -22,4 +24,8 @@ public interface WorkService extends IBaseService<WorkEntity, Long> {
     Result remove(Long id);
 
     void addVisit(Long id);
+
+    Result<WorkInfoVo> getDetail(Long id);
+
+    Result edit(SomeDataDto param);
 }

+ 8 - 1
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/CatalogServiceImpl.java

@@ -6,6 +6,7 @@ import com.gis.domain.dto.BaseDto;
 import com.gis.domain.dto.CatalogDto;
 import com.gis.domain.entity.CatalogEntity;
 import com.gis.domain.entity.SceneEntity;
+import com.gis.domain.tree.CatalogTree;
 import com.gis.domain.vo.CatalogSceneTree;
 import com.gis.domain.vo.CatalogVo;
 import com.gis.mapper.CatalogMapper;
@@ -21,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.transaction.Transactional;
-import javax.validation.constraints.NotBlank;
 import java.util.Date;
 import java.util.List;
 
@@ -89,6 +89,7 @@ public class CatalogServiceImpl extends IBaseServiceImpl<CatalogEntity, Long> im
     public Result getCatalog(Long workId) {
         List<CatalogEntity> list = entityMapper.findByWorkId(workId);
         CatalogTreeUtil treeUtil = new CatalogTreeUtil(list);
+        List<CatalogTree> catalogTrees = treeUtil.buildTree();
         return Result.success(treeUtil.buildTree());
     }
 
@@ -123,6 +124,12 @@ public class CatalogServiceImpl extends IBaseServiceImpl<CatalogEntity, Long> im
     }
 
     @Override
+    public List<CatalogEntity> findByWorkId(Long id) {
+
+        return entityMapper.findByWorkId(id);
+    }
+
+    @Override
     public Result listTree(Long workId) {
         List<CatalogEntity> list = entityMapper.findByWorkId(workId);
         CatalogTreeUtil treeUtil = new CatalogTreeUtil(list, sceneMapper);

+ 7 - 1
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -98,6 +98,11 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         FodderEntity entity = new FodderEntity();
         try {
         if (type.equals("pano")) {
+
+            if ((size/1024) >= 120) {
+              return Result.failure(MsgCode.e3004, "全景图文件不能超过120MB");
+            }
+
             String sceneCode = RandomUtils.getSceneCode("fd720_");
             newName = sceneCode+"." + suffix;
             savePath =savePath + sceneCode + "/" + newName;
@@ -148,7 +153,8 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
 
         }
             entity.setType(type);
-            entity.setName(fileName);
+            // 用前缀做名称
+            entity.setName(prefix);
             entity.setFileName(newName);
             log.info("ossUrl: " + ossUrl);
             log.info("iconPath:" + iconPath);

+ 4 - 3
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java

@@ -10,6 +10,7 @@ import com.gis.domain.entity.CatalogEntity;
 import com.gis.domain.entity.FodderEntity;
 import com.gis.domain.entity.SceneEntity;
 import com.gis.domain.entity.WorkEntity;
+import com.gis.domain.tree.CatalogTree;
 import com.gis.domain.vo.CatalogSceneVo;
 import com.gis.domain.vo.CatalogVo;
 import com.gis.domain.vo.ProSceneVo;
@@ -19,7 +20,6 @@ import com.gis.mapper.SceneMapper;
 import com.gis.service.CatalogService;
 import com.gis.service.SceneService;
 import com.gis.service.WorkService;
-import com.gis.tree.CatalogTree;
 import com.gis.tree.CatalogTreeUtil;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
@@ -161,6 +161,8 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
         if (catalogId == null) {
             catalogEntity = createCatalog(params);
             catalogId = catalogEntity.getId();
+        } else {
+            catalogEntity = catalogService.findById(catalogId);
         }
 
         List<SceneDto> scenes = params.getScenes();
@@ -480,8 +482,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
             Result.failure("对象不存在");
         }
 
-        entity = findById(id);
-        BeanUtils.copyProperties(param, entity);
+        entity.setSceneTitle(param.getName());
         entity.setUpdateTime(new Date());
         this.update(entity);
 

+ 178 - 55
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -1,27 +1,38 @@
 package com.gis.service.impl;
 
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.gis.common.constant.ConfigConstant;
 import com.gis.common.util.*;
 import com.gis.domain.dto.PageDto;
+import com.gis.domain.dto.SomeDataDto;
 import com.gis.domain.dto.WorkDto;
 import com.gis.domain.entity.CatalogEntity;
+import com.gis.domain.entity.SceneEntity;
 import com.gis.domain.entity.WorkEntity;
+import com.gis.domain.tree.CatalogTree;
+import com.gis.domain.vo.WorkInfoVo;
 import com.gis.mapper.CatalogMapper;
 import com.gis.mapper.SceneMapper;
 import com.gis.mapper.WorkMapper;
 import com.gis.mapper.IBaseMapper;
 import com.gis.service.CatalogService;
+import com.gis.service.SceneService;
 import com.gis.service.WorkService;
+import com.gis.tree.CatalogTreeUtil;
 import com.github.pagehelper.PageInfo;
 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.stereotype.Service;
 
 import javax.transaction.Transactional;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 /**
@@ -51,6 +62,12 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
     @Autowired
     SceneMapper sceneMapper;
 
+    @Autowired
+    SceneService sceneService;
+
+    @Autowired
+    AliyunOssUtil aliyunOssUtil;
+
 
     @Override
     public IBaseMapper<WorkEntity, Long> getBaseMapper() {
@@ -58,7 +75,6 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
     }
 
 
-
     @Override
     public Result search(PageDto param) {
         startPage(param);
@@ -66,78 +82,69 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
         return Result.success(new PageInfo<>(search));
     }
 
+
+
+    /**
+     * 目前只是用来保存密码, 也可以使用保存实体信息
+     */
     @Override
     public Result<WorkEntity> entitySave(WorkDto param) {
         Long id = param.getId();
-        int isPassword = 0;
-        if (StringUtils.isNotBlank(param.getPassword())) {
-            isPassword = 1;
+        WorkEntity entity = this.findById(id);
+
+        if (entity == null) {
+            return Result.failure("对象不存在");
         }
-        WorkEntity entity = null;
-        if (id == null) {
-            entity = new WorkEntity();
-            BeanUtils.copyProperties(param, entity);
-            entity.setUserId(getUserNameForToken());
-            entity.setIsPassword(isPassword);
-            this.save(entity);
-        } else {
-            entity = this.findById(id);
-
-            if (entity == null) {
-                return Result.failure("对象不存在");
-            }
-            BeanUtils.copyProperties(param, entity);
-
-            // 创建二维码
-            String qrCode = entity.getQrCode();
-            if (StringUtils.isBlank(qrCode)) {
-                // 二维码url
-                String url = configConstant.domain4dKK + "/panorama/show.html?id=" + id;
-                 qrCode = qrCodeUtils.generateLogoQrCode(url, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain);
-                 entity.setQrCode(qrCode);
-                 entity.setShare(url);
-            }
+        BeanUtils.copyProperties(param, entity);
 
-            if (entity.getStatus() == 0) {
-                // 设置为显示状态
-                entity.setStatus(1);
-                // 创建默认场景
-                initCatalog(id);
-            }
+        entity.setUpdateTime(new Date());
+        this.update(entity);
 
-            entity.setUpdateTime(new Date());
-            entity.setIsPassword(isPassword);
-            this.update(entity);
-        }
         return Result.success();
     }
 
 
 
-
-    /**
-     * 创建默认场景
-     * @param workId
-     */
-    private void initCatalog(Long workId) {
-        List<CatalogEntity> list = catalogMapper.findByWorkId(workId);
-        if (list.size() == 0) {
-            CatalogEntity  entity = new CatalogEntity();
-            entity.setName("全部场景");
-            entity.setWorkId(workId);
-            catalogService.save(entity);
-        }
-
-    }
-
     @Override
     public Result<WorkEntity> entityAdd() {
         WorkEntity entity = new WorkEntity();
         entity.setUserId(getUserNameForToken());
         this.save(entity);
+
+        // 创建someData
+
+        // 获取文件内容
+        String content = FileUtils.getResourceContent("data/someData.json");
+
+        Long id = entity.getId();
+
+        JSONObject jsonObject = JSONObject.parseObject(content);
+        jsonObject.put("id", id + "");
+
+
+        // 创建二维码、二维码url
+        String shareUrl = configConstant.domain4dKK + "/panorama/show.html?id=" + id;
+        String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain);
+        jsonObject.put("share", shareUrl);
+        jsonObject.put("qrCode", qrCode);
+
+
+        String baseSomeDataPath = id + "/someData.json";
+
+        String ossKeyPath = configConstant.ossBasePath + baseSomeDataPath;
+
+        try {
+            aliyunOssUtil.upload(jsonObject.toJSONString().getBytes(), ossKeyPath);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        String ossUrl = configConstant.ossDomain + ossKeyPath;
+        log.info("ossSomeData:{}", ossUrl);
+
         return Result.success(entity);
     }
 
+
     @Override
     public Result remove(Long id) {
         WorkEntity entity = this.findById(id);
@@ -160,5 +167,121 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
         entityMapper.addVisit(id);
     }
 
+    @Override
+    public Result<WorkInfoVo> getDetail(Long id) {
+        WorkEntity entity = this.findById(id);
+        if (entity == null) {
+            return Result.failure("对象不存在");
+        }
+        WorkInfoVo workInfoVo = new WorkInfoVo();
+        BeanUtils.copyProperties(entity, workInfoVo);
+
+        // 获取分组信息
+        List<CatalogEntity> list = catalogService.findByWorkId(id);
+
+        // 处理第二级
+        Stream<CatalogEntity> stream2 = list.stream();
+        Stream<CatalogEntity> sub = stream2.filter(s -> s.getParentId() != null);
+        List<CatalogEntity> catalogs = sub.collect(Collectors.toList());
+        workInfoVo.setCatalogs(catalogs);
+
+
+        // 处理第一级
+        CatalogTreeUtil treeUtil = new CatalogTreeUtil(list);
+        List<CatalogTree> trees = treeUtil.buildTree();
+
+        List<CatalogEntity> c1 = new ArrayList<>();
+        for (CatalogTree tree : trees) {
+            CatalogEntity catalogEntity = new CatalogEntity();
+            BeanUtils.copyProperties(tree, catalogEntity);
+            // 有子结节
+            List<CatalogTree> children = tree.getChildren();
+
+            // 子节点
+            List<Long> child = new ArrayList<>();
+            if (children.size() > 0) {
+                for (CatalogTree son : children) {
+                    child.add(son.getId());
+                }
+            }
+            catalogEntity.setChildren(child);
+            c1.add(catalogEntity);
+        }
+        workInfoVo.setCatalogRoot(c1);
+
+        // 处理场景
+        List<SceneEntity> scenes = sceneService.findByWorkId(id);
+        workInfoVo.setScenes(scenes);
+
+        return Result.success(workInfoVo);
+    }
+
+    @Override
+    public Result edit(SomeDataDto param) {
+
+        // 更新作品信息
+        boolean isEdit = editEntity(param);
+        if (!isEdit) {
+            return Result.failure("对象不存在");
+        }
+        log.info("更新作品完成");
+        // 保存someData.json
+        editSomeData( param);
+
+        return Result.success();
+    }
+
+    /**
+     * 更新作品实体信息
+     */
+    private boolean editEntity(SomeDataDto param) {
+
+        Long id = param.getId();
+        WorkEntity entity = this.findById(id);
+        if (entity == null) {
+            log.error("对象不存在: " + id);
+            return false;
+        }
+
+        String someData = param.getSomeData();
+        JSONObject sd = JSONObject.parseObject(someData);
+        entity.setName(sd.getString("name"));
+        entity.setDescription(sd.getString("description"));
+        entity.setIcon(sd.getString("icon"));
+        entity.setShare(sd.getString("share"));
+        entity.setQrCode(sd.getString("qrCode"));
+        entity.setStatus(sd.getInteger("status"));
+
+        entity.setUpdateTime(new Date());
+
+        this.update(entity);
+        return true;
+
+    }
+
+
+    /**
+     * 更新someData.json
+     */
+    private void editSomeData(SomeDataDto param) {
+
+        Long id = param.getId();
+        String baseSomeDathPath = id + "/someData.json";
+        String saveSomeDataPath = configConstant.serverBasePath + baseSomeDathPath;
+        // 写入服务器
+        FileUtil.writeUtf8String(param.getSomeData(), saveSomeDataPath);
+
+        // 保存oss
+        if (!FileUtil.isFile(saveSomeDataPath)) {
+            Result.failure("服务器someData.json文件不存在");
+        }
+
+        String ossKeyPath = configConstant.ossBasePath + baseSomeDathPath;
+        aliyunOssUtil.upload(saveSomeDataPath, ossKeyPath);
+        log.info("someData.json 上传完成 : {}", ossKeyPath);
+        String ossUrl = configConstant.ossDomain + ossKeyPath;
+        log.info("ossUrl: {}", ossUrl);
+
+    }
 
 }

+ 49 - 49
720yun_fd_manage/gis_service/src/main/java/com/gis/tree/CatalogTree.java

@@ -1,50 +1,50 @@
-package com.gis.tree;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import com.gis.domain.entity.SceneEntity;
-import com.gis.domain.vo.CatalogSceneVo;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-@Data
-public class CatalogTree implements Serializable {
-
-
-    private static final long serialVersionUID = 5299557851133375944L;
-    private Long id;
-
-    @ApiModelProperty(value = "名称")
-    private String name;
-
-    @JSONField(serialize = false)
-    @ApiModelProperty(value = "创建人")
-    private String userId;
-
-    @ApiModelProperty(value = "排序(序号小排前面)")
-    private Integer sort;
-
-    @JSONField(serialize = false)
-    @ApiModelProperty(value = "目录层级,最大二级")
-    private Integer level;
-
-    @ApiModelProperty(value = "父目录Id")
-    private Long parentId;
-
-
-    /** 默认给空数组*/
-
-    private List<CatalogTree> children = new ArrayList<>();
-
-    /** 场景实体*/
-//    private List<SceneEntity> scenes;
-    @JSONField(serialize = false)
-    private List<CatalogSceneVo> scenes;
-
-
+//package com.gis.tree;
+//
+//import com.alibaba.fastjson.annotation.JSONField;
+//import com.gis.domain.entity.SceneEntity;
+//import com.gis.domain.vo.CatalogSceneVo;
+//import io.swagger.annotations.ApiModelProperty;
+//import lombok.Data;
+//
+//import java.io.Serializable;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//@Data
+//public class CatalogTree implements Serializable {
+//
+//
+//    private static final long serialVersionUID = 5299557851133375944L;
+//    private Long id;
+//
+//    @ApiModelProperty(value = "名称")
+//    private String name;
+//
 //    @JSONField(serialize = false)
-//    private boolean checked = false;
-}
+//    @ApiModelProperty(value = "创建人")
+//    private String userId;
+//
+//    @ApiModelProperty(value = "排序(序号小排前面)")
+//    private Integer sort;
+//
+//    @JSONField(serialize = false)
+//    @ApiModelProperty(value = "目录层级,最大二级")
+//    private Integer level;
+//
+//    @ApiModelProperty(value = "父目录Id")
+//    private Long parentId;
+//
+//
+//    /** 默认给空数组*/
+//
+//    private List<CatalogTree> children = new ArrayList<>();
+//
+//    /** 场景实体*/
+////    private List<SceneEntity> scenes;
+//    @JSONField(serialize = false)
+//    private List<CatalogSceneVo> scenes;
+//
+//
+////    @JSONField(serialize = false)
+////    private boolean checked = false;
+//}

+ 1 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/tree/CatalogTreeUtil.java

@@ -3,6 +3,7 @@ package com.gis.tree;
 
 import com.gis.domain.entity.CatalogEntity;
 import com.gis.domain.entity.SceneEntity;
+import com.gis.domain.tree.CatalogTree;
 import com.gis.domain.vo.CatalogSceneVo;
 import com.gis.mapper.SceneMapper;
 import com.gis.service.CatalogService;

+ 1 - 1
720yun_fd_manage/gis_web/pom.xml

@@ -3,7 +3,7 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
-        <artifactId>cms_pano_manage_fd</artifactId>
+        <artifactId>720yun_fd_manage</artifactId>
         <groupId>com.gis</groupId>
         <version>1.0.0</version>
     </parent>

+ 0 - 13
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/TestController.java

@@ -130,19 +130,6 @@ public class TestController extends BaseController {
         //return response;
     }
 
-//    @GetMapping("ossUtil/{sceneCode}")
-//    @ApiOperation(value = "ossUtil", position = 1)
-//    public Result uploadOss(@PathVariable String sceneCode){
-//        String cmd = CmdConstant.OSSUTIL_UPLOAD_DIR;
-//        cmd = cmd.replaceAll("@sceneCode", sceneCode);
-//        log.info("ossCmd: " + cmd);
-//        long start = System.currentTimeMillis();
-//        CmdUtils.callshell(cmd);
-//        log.info("step 1");
-//        long end = System.currentTimeMillis();
-//        log.info("切图上传完成, 耗时:{} s" , (end-start)/1000 );
-//        return Result.success();
-//    }
 
 
 

+ 14 - 11
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java

@@ -2,12 +2,10 @@ package com.gis.web.controller;
 
 
 import com.gis.common.util.Result;
-import com.gis.domain.dto.FodderDto;
-import com.gis.domain.dto.FodderPageDto;
-import com.gis.domain.dto.PageDto;
-import com.gis.domain.dto.WorkDto;
+import com.gis.domain.dto.*;
 import com.gis.domain.entity.FodderEntity;
 import com.gis.domain.entity.WorkEntity;
+import com.gis.domain.vo.WorkInfoVo;
 import com.gis.service.FodderService;
 import com.gis.service.SceneService;
 import com.gis.service.WorkService;
@@ -19,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.validation.Valid;
 import java.util.Date;
 
 
@@ -55,23 +54,27 @@ public class WorkController extends BaseController {
         return workService.entityAdd();
     }
 
+
     @ApiOperation(value = "详情", position = 1)
     @GetMapping("detail/{id}")
-    public Result<WorkEntity> detail(@PathVariable Long id) {
-        WorkEntity entity = workService.findById(id);
-        if (entity == null) {
-            return Result.failure("对象不存在");
-        }
-        return Result.success(entity);
+    public Result<WorkInfoVo> detail(@PathVariable Long id) {
+        return workService.getDetail(id);
     }
 
-    @ApiOperation(value = "修改", position = 1)
+    @ApiOperation(value = "修改实体", position = 1)
     @PostMapping("save")
     public Result<WorkEntity> save(@RequestBody WorkDto param) {
         return workService.entitySave(param);
     }
 
 
+    @ApiOperation(value = "修改someData", position = 1)
+    @PostMapping("edit")
+    public Result<WorkEntity> edit(@Valid @RequestBody SomeDataDto param) {
+        return workService.edit(param);
+    }
+
+
     @ApiOperation(value = "删除", position = 1)
     @PostMapping("remove/{id}")
     public Result remove( @PathVariable Long id) {