浏览代码

更改为- pano添加mybatis

wuweihao 3 年之前
父节点
当前提交
0f03ee06db
共有 38 个文件被更改,包括 2000 次插入34 次删除
  1. 1 1
      gis_admin/src/main/java/com/gis/admin/controller/LoginController.java
  2. 2 3
      gis_admin/src/main/java/com/gis/admin/shiro/ShiroRealm.java
  3. 4 4
      gis_application/pom.xml
  4. 12 0
      gis_application/src/main/resources/application.properties
  5. 2 7
      gis_cms/src/main/java/com/gis/cms/controller/WebManageController.java
  6. 0 4
      gis_cms/src/main/java/com/gis/cms/entity/vo/CommentVo.java
  7. 13 0
      gis_common/pom.xml
  8. 43 2
      gis_common/src/main/java/com/gis/common/base/exception/BaseRuntimeException.java
  9. 19 0
      gis_common/src/main/java/com/gis/common/base/mapper/provider/BaseProvider.java
  10. 2 5
      gis_common/src/main/java/com/gis/common/base/service/impl/IBaseServiceImpl.java
  11. 55 0
      gis_common/src/main/java/com/gis/common/constant/ErrorEnum.java
  12. 16 0
      gis_common/src/main/java/com/gis/common/constant/RedisConstant.java
  13. 20 0
      gis_common/src/main/java/com/gis/common/util/BaseUtil.java
  14. 56 0
      gis_common/src/main/java/com/gis/common/util/DateUtils.java
  15. 143 4
      gis_common/src/main/java/com/gis/common/util/FileUtils.java
  16. 24 1
      gis_common/src/main/java/com/gis/common/util/RedisUtil.java
  17. 150 0
      gis_common/src/main/java/com/gis/common/util/RedisUtils.java
  18. 28 0
      gis_pano/pom.xml
  19. 49 0
      gis_pano/src/main/java/com/gis/cms/controller/FodderController.java
  20. 47 0
      gis_pano/src/main/java/com/gis/cms/controller/OpsController.java
  21. 106 0
      gis_pano/src/main/java/com/gis/cms/controller/WorkController.java
  22. 23 0
      gis_pano/src/main/java/com/gis/cms/entity/dto/FodderDto.java
  23. 26 0
      gis_pano/src/main/java/com/gis/cms/entity/dto/SomeDataDto.java
  24. 25 0
      gis_pano/src/main/java/com/gis/cms/entity/dto/WorkDto.java
  25. 66 0
      gis_pano/src/main/java/com/gis/cms/entity/po/FodderEntity.java
  26. 63 0
      gis_pano/src/main/java/com/gis/cms/entity/po/WorkEntity.java
  27. 16 0
      gis_pano/src/main/java/com/gis/cms/mapper/FodderMapper.java
  28. 51 0
      gis_pano/src/main/java/com/gis/cms/mapper/WorkMapper.java
  29. 27 0
      gis_pano/src/main/java/com/gis/cms/service/FodderService.java
  30. 44 0
      gis_pano/src/main/java/com/gis/cms/service/IBaseService.java
  31. 21 0
      gis_pano/src/main/java/com/gis/cms/service/OpsService.java
  32. 50 0
      gis_pano/src/main/java/com/gis/cms/service/WorkService.java
  33. 100 0
      gis_pano/src/main/java/com/gis/cms/service/impl/FodderServiceImpl.java
  34. 305 0
      gis_pano/src/main/java/com/gis/cms/service/impl/OpsServiceImpl.java
  35. 322 0
      gis_pano/src/main/java/com/gis/cms/service/impl/WorkServiceImpl.java
  36. 46 0
      gis_pano/src/main/resources/someData.json
  37. 9 0
      gis_pano/src/main/resources/zip.sh
  38. 14 3
      pom.xml

+ 1 - 1
gis_admin/src/main/java/com/gis/admin/controller/LoginController.java

@@ -55,7 +55,7 @@ public class LoginController {
     protected HttpServletRequest request;
 
     @Autowired
-    RedisUtil redisUtil;
+    RedisUtils redisUtil;
 
 
     // 目前是24h

+ 2 - 3
gis_admin/src/main/java/com/gis/admin/shiro/ShiroRealm.java

@@ -5,7 +5,7 @@ import com.gis.common.util.JwtUtil;
 import com.gis.admin.entity.po.SysUserEntity;
 import com.gis.admin.service.SysResourceService;
 import com.gis.admin.service.SysUserService;
-import com.gis.common.util.RedisUtil;
+import com.gis.common.util.RedisUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authc.AuthenticationException;
@@ -17,7 +17,6 @@ import org.apache.shiro.authz.SimpleAuthorizationInfo;
 import org.apache.shiro.realm.AuthorizingRealm;
 import org.apache.shiro.subject.PrincipalCollection;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -52,7 +51,7 @@ public class ShiroRealm extends AuthorizingRealm {
     ConfigConstant configConstant;
 
     @Autowired
-    RedisUtil redisUtil;
+    RedisUtils redisUtil;
 
 
     /**

+ 4 - 4
gis_application/pom.xml

@@ -18,10 +18,10 @@
             <artifactId>gis_admin</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.gis</groupId>
-            <artifactId>gis_scene</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>com.gis</groupId>-->
+            <!--<artifactId>gis_pano</artifactId>-->
+        <!--</dependency>-->
 
         <dependency>
             <groupId>com.gis</groupId>

+ 12 - 0
gis_application/src/main/resources/application.properties

@@ -38,6 +38,18 @@ pagehelper.reasonable=false
 pagehelper.support-methods-arguments=true
 
 
+#\u5F00\u542Fsql\u65E5\u5FD7
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+# \u8BE5\u914D\u7F6E\u5C31\u662F\u5C06\u5E26\u6709\u4E0B\u5212\u7EBF\u7684\u8868\u5B57\u6BB5\u6620\u5C04\u4E3A\u9A7C\u5CF0\u683C\u5F0F\u7684\u5B9E\u4F53\u7C7B\u5C5E\u6027
+mybatis-plus.configuration.map-underscore-to-camel-case=true
+mybatis-plus.configuration.call-setters-on-nulls=true
+# \u903B\u8F91\u5220\u9664\u8BBE\u7F6E
+mybatis-plus.global-config.db-config.logic-delete-value=1
+mybatis-plus.global-config.db-config.logic-not-delete-value=0
+mybatis-plus.global-config.db-config.logic-delete-field = isDelete
+mybatis-plus.mapper-locations=classpath*:/mappers/**.xml
+
+
 
 
 

+ 2 - 7
gis_cms/src/main/java/com/gis/cms/controller/WebManageController.java

@@ -10,23 +10,18 @@ import com.gis.cms.service.*;
 import com.gis.common.base.aop.WebControllerLog;
 import com.gis.common.base.entity.dto.PageDateDto;
 import com.gis.common.constant.ConfigConstant;
-import com.gis.common.util.RedisUtil;
+import com.gis.common.util.RedisUtils;
 import com.gis.common.util.Result;
 import com.gis.cms.entity.vo.CommentVo;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 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.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
-import java.util.List;
-import java.util.Map;
 
 /**
  * Created by owen on 2021/6/28 0028 10:58
@@ -56,7 +51,7 @@ public class WebManageController {
     SysUserService sysUserService;
 
     @Autowired
-    RedisUtil redisUtil;
+    RedisUtils redisUtil;
 
     @Autowired
     HttpServletRequest request;

+ 0 - 4
gis_cms/src/main/java/com/gis/cms/entity/vo/CommentVo.java

@@ -1,12 +1,8 @@
 package com.gis.cms.entity.vo;
 
 import com.gis.common.base.entity.po.BaseEntity;
-import com.gis.common.util.RedisUtil;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.Set;
 
 /**
  * Created by owen on 202/6/24.

+ 13 - 0
gis_common/pom.xml

@@ -17,6 +17,7 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
+
         </dependency>
 
         <!-- JPA -->
@@ -72,6 +73,18 @@
             <artifactId>druid-spring-boot-starter</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+
+            <exclusions>
+                <exclusion>
+                    <groupId> org.hibernate</groupId>
+                    <artifactId>hibernate-validator</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
         <!-- knife4j aip 包-->
         <dependency>
             <groupId>com.github.xiaoymin</groupId>

+ 43 - 2
gis_common/src/main/java/com/gis/common/base/exception/BaseRuntimeException.java

@@ -1,6 +1,7 @@
 package com.gis.common.base.exception;
 
 import cn.hutool.core.util.StrUtil;
+import com.gis.common.constant.ErrorEnum;
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
@@ -28,7 +29,10 @@ public class BaseRuntimeException extends RuntimeException{
         this.msg = msg;
     }
 
-
+    public BaseRuntimeException(ErrorEnum errorEnum){
+        this.code = errorEnum.code();
+        this.msg = errorEnum.message();
+    }
 
     public Integer getCode() {
         return code;
@@ -64,7 +68,35 @@ public class BaseRuntimeException extends RuntimeException{
 
     }
 
+    public static void isNull(Object obj, ErrorEnum errorEnum){
+        if (obj == null){
+            getExc(errorEnum.code(), errorEnum.message());
+        }
+    }
+
+    public static void isBlank(Object obj, ErrorEnum errorEnum){
+        Integer code = errorEnum.code();
+        String msg = errorEnum.message();
+        if (obj == null){
+            getExc(code, msg);
+        }
+
+        if (obj instanceof String && StrUtil.isBlank(obj.toString())){
+            getExc(code, msg);
+        }
+
+    }
 
+    /**
+     *
+     * @param obj true 存在抛异常
+     * @param errorEnum
+     */
+    public static void isTrue(boolean obj, ErrorEnum errorEnum){
+        if (obj){
+            getExc(errorEnum.code(), errorEnum.message());
+        }
+    }
 
     /**
      *
@@ -82,7 +114,16 @@ public class BaseRuntimeException extends RuntimeException{
         throw new BaseRuntimeException(code, msg);
     }
 
-
+    /**
+     *
+     * @param obj 集合
+     * @param errorEnum
+     */
+    public static void isEmpty(List obj, ErrorEnum errorEnum){
+        if (CollectionUtils.isEmpty(obj)){
+            getExc(errorEnum.code(), errorEnum.message());
+        }
+    }
 
     public static void isEmpty(List obj, Integer code, String msg){
         if (CollectionUtils.isEmpty(obj)){

+ 19 - 0
gis_common/src/main/java/com/gis/common/base/mapper/provider/BaseProvider.java

@@ -0,0 +1,19 @@
+package com.gis.common.base.mapper.provider;
+
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * Created by owen on 2022/2/9.
+ */
+@Slf4j
+public class BaseProvider {
+
+    public String runSql(String sqlStr){
+        log.info("runSql: {}", sqlStr);
+        return sqlStr;
+    }
+
+
+
+}

+ 2 - 5
gis_common/src/main/java/com/gis/common/base/service/impl/IBaseServiceImpl.java

@@ -7,18 +7,15 @@ import com.gis.common.constant.ConfigConstant;
 import com.gis.common.base.mapper.IBaseMapper;
 import com.gis.common.util.FileUtils;
 import com.gis.common.util.JwtUtil;
-import com.gis.common.util.RedisUtil;
+import com.gis.common.util.RedisUtils;
 import com.gis.common.util.Result;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import tk.mybatis.mapper.entity.Condition;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.Serializable;
 import java.lang.reflect.ParameterizedType;
@@ -42,7 +39,7 @@ public abstract class IBaseServiceImpl<T extends BaseEntity, ID extends Serializ
     public HttpServletRequest request;
 
     @Autowired
-    public RedisUtil redisUtil;
+    public RedisUtils redisUtil;
 
 
     public abstract IBaseMapper<T, ID> getBaseMapper();

+ 55 - 0
gis_common/src/main/java/com/gis/common/constant/ErrorEnum.java

@@ -0,0 +1,55 @@
+package com.gis.common.constant;
+
+/**
+ * Created by owen on 2022/3/10 0010 14:47
+ *
+ *
+ * #1000~1999 区间表示参数错误
+ * #2000~2999 区间表示用户错误
+ * #3000~3999 区间表示接口异常
+ */
+public enum ErrorEnum {
+
+    FAILURE_SYS_2001(2001, "对象不存在"),
+
+    FAILURE_CODE_3001(3001, "缺少必要参数"),
+    FAILURE_CODE_3002(3002, "访问异常!"),
+    FAILURE_CODE_3003(3003, "非法访问!"),
+    FAILURE_CODE_3004(3004, "用户未登录"),
+    FAILURE_CODE_3005(3005, "验证码已过期"),
+    FAILURE_CODE_3006(3006, "验证码错误"),
+    FAILURE_CODE_3007(3007, "昵称已存在"),
+    FAILURE_CODE_3008(3008, "该手机已被注册"),
+    FAILURE_CODE_3009(3009, "两次输入的密码不一致"),
+    FAILURE_CODE_3010(3010, "昵称长度错误"),
+    FAILURE_CODE_3011(3011, "密码需要包含英文大小写、数字,长度8-16字符"),
+    FAILURE_CODE_3012(3012, "昵称包含敏感词"),
+    FAILURE_CODE_3013(3013, "手机号码格式错误"),
+    FAILURE_CODE_3014(3014, "账号或密码不正确"),
+    FAILURE_CODE_3015(3015, "用户不存在"),
+    FAILURE_CODE_3016(3016, "登录失败,账号无权访问"),
+    FAILURE_CODE_3017(3017, "空文件"),
+    FAILURE_CODE_3018(3018, "需要上传或使用的文件不存在"),
+
+    ;
+
+    private Integer code;
+    private String message;
+
+    private ErrorEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+    public String formatMessage(Object... args){
+        return String.format(message, args);
+    }
+}

+ 16 - 0
gis_common/src/main/java/com/gis/common/constant/RedisConstant.java

@@ -0,0 +1,16 @@
+package com.gis.common.constant;
+
+/**
+ * Created by owen on 2022/3/15 0015 16:20
+ */
+public class RedisConstant {
+
+    /**作品id*/
+    public static final String WORK_ID = "workId:";
+
+    /**作品编辑*/
+    public static final String WORK_ID_EDIT = "workId:edit:";
+
+    /**定时删除空作品Key*/
+    public static final String WORK_DEL = "workDel";
+}

+ 20 - 0
gis_common/src/main/java/com/gis/common/util/BaseUtil.java

@@ -0,0 +1,20 @@
+package com.gis.common.util;
+
+import com.gis.common.base.entity.dto.PageDto;
+
+/**
+ * Created by owen on 2021/12/7 0007 16:21
+ */
+public class BaseUtil {
+
+    public static void startPage(PageDto param){
+        Integer pageNum = param.getPageNum();
+        Integer pageSize = param.getPageSize();
+        if (pageNum == null || pageNum <= 0) {
+            param.setPageNum(0);
+        }
+        if (pageSize == null || pageSize <= 0) {
+            param.setPageSize(10);
+        }
+    }
+}

+ 56 - 0
gis_common/src/main/java/com/gis/common/util/DateUtils.java

@@ -0,0 +1,56 @@
+package com.gis.common.util;
+
+import cn.hutool.core.date.DateUtil;
+import org.junit.Test;
+
+import java.time.LocalDateTime;
+
+/**
+ * Created by owen on 2022/4/8 0008 14:32
+ */
+public class DateUtils extends DateUtil {
+
+    private static String YYYY_MM = "yyyy-MM";
+
+
+    private static String YYYYMM = "yyyyMM";
+
+    private static String YYYY_MM_DD = "yyyy-MM-dd";
+
+    private static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
+
+    private static String YYYYMMDD_HHMMSSSSS = "yyyyMMdd_HHmmssSSS";
+
+    private static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
+
+
+    /**
+     * 获取当前月
+     * @return
+     */
+    public static String getMonth(){
+        return format(LocalDateTime.now(), YYYYMM);
+    }
+
+    /**
+     * 获取当前月份的前几个月
+     * @param month
+     * @return
+     */
+    public static String minusMonths(int month){
+        return format(LocalDateTime.now().minusMonths(month), YYYYMM);
+    }
+
+    /**
+     * 获取当前时间戳
+     * @return
+     */
+    public static String getDateTime(){
+        return format(LocalDateTime.now(), YYYYMMDD_HHMMSSSSS);
+    }
+
+    @Test
+    public void test(){
+        System.out.println(getDateTime());
+    }
+}

+ 143 - 4
gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -1,11 +1,22 @@
 package com.gis.common.util;
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.io.FileUtil;
+import com.gis.common.base.exception.BaseRuntimeException;
 import com.gis.common.constant.ConfigConstant;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
 
 /**
  * Created by owen on 2020/5/12 0012 17:21
@@ -17,24 +28,152 @@ public class FileUtils {
     @Autowired
     ConfigConstant configConstant;
 
+    // 确保同一时间上传文件的唯一性
+    private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger();
+
     public boolean checkFile(MultipartFile file) {
         //设置允许上传文件类型
-//        String suffixList = ".jpg,.gif,.png,.ico,.bmp,.jpeg,.zip,.zp,.rar,.mp3,.mp4,.avi,.mov,.4dage,.wav,.wma,.m4a";
         String suffixList = configConstant.serverFileFallow;
         // 获取文件后缀
         if(file == null){
-            log.info("文件流为空不可上传");
+            log.error("文件流为空不可上传");
             return false;
         }
         String fileName = file.getOriginalFilename();
+        log.info("文件名: {}", fileName);
         String suffix = fileName.substring(fileName.lastIndexOf(".")
                 + 1, fileName.length());
         if (suffixList.contains(suffix.trim().toLowerCase())) {
-            log.info("无非法参数可以放行!!!");
             return true;
         }
-        log.info("存在非法参数不能放行!请核对上传文件格式,重新刷新页面再次上传!");
+        log.error("存在非法参数不能放行!请核对上传文件格式,重新刷新页面再次上传!");
         return false;
     }
 
+    /**
+     * 真删除文件
+     * @param path 参数是相对地址
+     */
+    public void del(String path){
+        if (StringUtils.isNotBlank(path)){
+            String delPath = configConstant.serverBasePath + path;
+            FileUtil.del(delPath);
+            log.info("真删除文件: {}", delPath);
+        }
+
+    }
+
+    /**
+     *
+     * @param file
+     * @param isPinYinRename false:时间戳重命名, true:用拼音重名文件
+     * @param savePath 保存地址(前面有斜杠, 后面没有),没有文件名
+     * @return map
+     */
+    public Map<String, Object> uploadMap(MultipartFile file, String savePath, boolean isPinYinRename) {
+        String newName = this.upload(file, savePath, isPinYinRename);
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("fileName", file.getOriginalFilename());
+        result.put("filePath", savePath + "/" + newName);
+        return result;
+
+    }
+
+
+    /**
+     * 上传文件且按比例压缩
+     * @param file
+     * @param savePath
+     * @param isPinYinRename
+     * @return
+     */
+    public Map<String, Object> imgUploadMapAndCompress(MultipartFile file, String savePath, boolean isPinYinRename) {
+        String newName = this.upload(file, savePath, isPinYinRename);
+        String filePath = savePath + "/" + newName;
+        long size = file.getSize();
+        size = size/1000;
+        log.info("文件大小:" + size + "kb");
+        if (size > 1024){
+            String inPath = configConstant.serverBasePath + savePath + "/" + newName;
+            String outPath = configConstant.serverBasePath + savePath + "/cp_" + newName;
+
+//            ImgUtil.compress(new File(inPath), new File(outPath), 0.5f);
+            ImgUtil.compress(new File(inPath), new File(outPath), getQuality(size));
+            log.info("压缩图片位置: {}", outPath);
+            filePath = savePath + "/cp_" + newName;
+            this.del(inPath);
+        }
+
+
+
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("fileName", file.getOriginalFilename());
+        result.put("filePath", filePath);
+
+        return result;
+
+    }
+
+    /**
+     * 通过图片大小计算压缩比例
+     * @param size 单位是KB
+     * @return
+     */
+    private  float getQuality(long size){
+        // 单位用m
+        double n = size/1024;
+
+        // 压缩比例,2M以内使用0.5压缩
+        double quality = 0.5;
+        // 大于2M 按计算比例压缩
+        if (n > 2) {
+            quality = 1 / n;
+        }
+        log.info("压缩比例: {}", quality);
+        Float aFloat = Float.valueOf(quality + "");
+        return aFloat;
+
+    }
+
+
+
+    /**
+     *
+     * @param file
+     * @param isPinYinRename false:时间戳重命名, true:用拼音重名文件
+     * @param savePath 保存地址(前面有斜杠, 后面没有),没有文件名
+     * @return 文件名
+     */
+    public String upload(MultipartFile file, String savePath, boolean isPinYinRename) {
+
+        // 检查非法文件上传
+        boolean checkFile = this.checkFile(file);
+        if (!checkFile) {
+            throw new BaseRuntimeException("上传文件格式有误, 请重新上传");
+        }
+
+
+        // 文件目录
+        String fileName = file.getOriginalFilename();
+        String newName;
+        if (isPinYinRename){
+            newName = RegexUtil.getPinyinName(fileName);
+        } else {
+            String suffix = StringUtils.substringAfterLast(fileName, ".");
+            newName =  DateUtils.getDateTime() + ATOMIC_INTEGER.incrementAndGet() + "." + suffix;
+        }
+
+        savePath = configConstant.serverBasePath + savePath + "/" + newName;
+        log.info("保存文件地址:{}", savePath);
+
+        try {
+            FileUtil.writeFromStream(file.getInputStream(), savePath);
+
+            return newName;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
 }

+ 24 - 1
gis_common/src/main/java/com/gis/common/util/RedisUtil.java

@@ -8,7 +8,6 @@ import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
@@ -46,6 +45,20 @@ public class RedisUtil {
         }
     }
 
+    public boolean set(String key, Object value, long time, TimeUnit unit) {
+        try {
+            if (time > 0) {
+                redisTemplate.opsForValue().set(key, value, time, unit);
+            } else {
+                set(key, value);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
 
 
     /**
@@ -147,4 +160,14 @@ public class RedisUtil {
         }
         return null;
     }
+
+    /**
+     * 判断redis key是否存在
+     * @param key
+     * @return true:存在
+     */
+    public Boolean hasKey(String key){
+        return redisTemplate.hasKey(key);
+    }
+
 }

+ 150 - 0
gis_common/src/main/java/com/gis/common/util/RedisUtils.java

@@ -0,0 +1,150 @@
+package com.gis.common.util;
+
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by owen on 2021/7/9 0009 14:32
+ */
+@Component
+public class RedisUtils {
+
+//    @Autowired
+    @Resource
+    private RedisTemplate<String, Object> redisTemplate;
+
+
+    /**
+     * 普通缓存放入并设置时间
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
+     * @return true成功 false 失败
+     */
+    public boolean set(String key, Object value, long time) {
+        try {
+            if (time > 0) {
+                redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
+            } else {
+                set(key, value);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+
+
+    /**
+     * 普通缓存放入
+     *
+     * @param key   键
+     * @param value 值
+     * @return true成功 false失败
+     */
+    public boolean set(String key, Object value) {
+        try {
+            redisTemplate.opsForValue().set(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+
+    }
+
+    /**
+     * 删除缓存
+     *
+     * @param key 可以传一个值 或多个
+     */
+    @SuppressWarnings("unchecked")
+    public void del(String... key) {
+        if (key != null && key.length > 0) {
+            if (key.length == 1) {
+                redisTemplate.delete(key[0]);
+            } else {
+                redisTemplate.delete(CollectionUtils.arrayToList(key));
+            }
+        }
+    }
+
+
+    /**
+     * 普通缓存获取
+     *
+     * @param key 键
+     * @return 值
+     */
+    public Object get(String key) {
+        return key == null ? null : redisTemplate.opsForValue().get(key);
+    }
+
+
+    /**
+     * list to JSON
+     * @param key
+     * @param value
+     * @param time
+     * @return
+     */
+    public boolean setObjectToJson(String key, Object value, long time) {
+        try {
+            redisTemplate.opsForValue().set(key, JSON.toJSONString(value), time, TimeUnit.SECONDS);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+
+    /**
+     * json to list
+     * @param key
+     * @param classType
+     * @return
+     */
+    public List getJsonList(String key, Class classType) {
+        try {
+            String o = (String)get(key);
+            if (o == null) {
+                return null;
+            }
+            JSONArray objects = JSONArray.parseArray(o);
+            List list = objects.toJavaList(classType);
+            return list;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public Set<Object> getJsonSet(String key) {
+        try {
+            String o = (String)get(key);
+            if (o == null) {
+                return null;
+            }
+            JSONArray array = JSONArray.parseArray(o);
+            Set<Object> set = CollUtil.newHashSet(array);
+            return set;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 28 - 0
gis_pano/pom.xml

@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>army_fuzhou</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>gis_pano</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.gis</groupId>
+            <artifactId>gis_admin</artifactId>
+        </dependency>
+
+        
+
+    </dependencies>
+
+
+
+
+
+</project>

+ 49 - 0
gis_pano/src/main/java/com/gis/cms/controller/FodderController.java

@@ -0,0 +1,49 @@
+package com.gis.cms.controller;
+
+import com.gis.cms.entity.dto.FodderDto;
+import com.gis.cms.entity.po.FodderEntity;
+import com.gis.cms.service.FodderService;
+import com.gis.common.base.entity.dto.PageDto;
+import com.gis.common.util.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * Created by owen on 2022/3/28 0028 11:38
+ */
+@Api(tags = "p-场景管理(素材库)")
+@RestController
+@RequestMapping("/cms/fodder")
+public class FodderController {
+
+    @Autowired
+    FodderService entityService;
+
+    @ApiOperation(value = "列表")
+    @PostMapping("list")
+    public Result<FodderEntity> list(@RequestBody PageDto param) {
+        return entityService.search(param);
+    }
+
+    @ApiOperation(value = "删除")
+    @GetMapping("remove/{id}")
+    public Result remove(@PathVariable String id) {
+        return entityService.remove(id);
+    }
+
+    @ApiOperation(value = "详情(支持批量)")
+    @GetMapping("detail/{id}")
+    public Result<FodderEntity> detail(@PathVariable String id) {
+        return entityService.detail(id);
+    }
+
+    @ApiOperation(value = "修改")
+    @PostMapping("update")
+    public Result update(@RequestBody FodderDto param) {
+        return entityService.updateEntity(param);
+    }
+
+}

+ 47 - 0
gis_pano/src/main/java/com/gis/cms/controller/OpsController.java

@@ -0,0 +1,47 @@
+//package com.gis.cms.controller;
+//
+//import com.gis.cms.entity.po.WorkEntity;
+//import com.gis.cms.service.OpsService;
+//import com.gis.common.util.Result;
+//import io.swagger.annotations.Api;
+//import io.swagger.annotations.ApiOperation;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.*;
+//
+///**
+// * Created by owen on 2022/3/29 0029 10:19
+// */
+//@Api(tags = "ops-项目运维-免token")
+//@RestController
+//@RequestMapping("/api/ops")
+//public class OpsController {
+//
+//    @Autowired
+//    OpsService entityService;
+//
+//    @ApiOperation(value = "下载-作品目录", notes = "支持批量导出, 多个作品id, 用逗号分隔")
+//    @GetMapping("/downloadWork/{ids}")
+//    public Result<WorkEntity> downloadWork(@PathVariable String ids) {
+//        return entityService.downloadWork(ids);
+//    }
+//
+//    @ApiOperation(value = "下载-根据作品id下载全景图目录", notes = "根据作品id, 多个作品id, 用逗号分隔")
+//    @GetMapping("/downloadPano/{ids}")
+//    public Result<WorkEntity> downloadPano(@PathVariable String ids) {
+//        return entityService.downloadPano(ids);
+//    }
+//
+//    @ApiOperation(value = "根据作品码合并tourXml", notes = "返回值直接下载结果文件")
+//    @GetMapping("/mergeTour/{workId}")
+//    public Result mergeTour(@PathVariable String workId) {
+//        return entityService.mergeTour(workId);
+//    }
+//
+//    @ApiOperation(value = "根据作品码打包数据", notes = "返回值直接下载结果文件")
+//    @GetMapping("/pack/{workId}")
+//    public Result pack(@PathVariable String workId) {
+//        return entityService.pack(workId);
+//    }
+//
+//
+//}

+ 106 - 0
gis_pano/src/main/java/com/gis/cms/controller/WorkController.java

@@ -0,0 +1,106 @@
+package com.gis.cms.controller;
+
+
+import com.gis.cms.entity.dto.SomeDataDto;
+import com.gis.cms.entity.dto.WorkDto;
+import com.gis.cms.entity.po.WorkEntity;
+import com.gis.cms.service.WorkService;
+import com.gis.common.base.entity.dto.PageDto;
+import com.gis.common.util.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+
+
+/**
+ * Created by owen on 2022/3/25 0018 12:17
+ *
+ * 先创建一个默认的作品
+ * 初创场景:放到场景码目录,固定命名:xxx_thumb.jpg
+ */
+@Api(tags = "p-我的作品")
+@RestController
+@RequestMapping("/cms/work")
+public class WorkController  {
+
+    @Autowired
+    WorkService workService;
+
+
+
+    @ApiOperation(value = "列表", position = 1)
+    @PostMapping("list")
+    public Result<WorkEntity> list(@RequestBody PageDto param) {
+        return workService.search(param);
+    }
+
+
+    @ApiOperation(value = "新增(空对象)", position = 1)
+    @PostMapping("add")
+    public Result<WorkEntity> add() {
+        return workService.entityAdd();
+    }
+
+
+    @ApiOperation(value = "修改作品信息", position = 1)
+    @PostMapping("save")
+    public Result<WorkEntity> save(@RequestBody WorkDto param) {
+        return workService.entitySave(param);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @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 String id) {
+        return workService.remove(id);
+    }
+
+//    @ApiOperation(value = "选择三维场景", position = 1)
+//    @PostMapping("select/4dkk/{workId}")
+//    public Result select4dkk(@RequestBody PageDto param, @PathVariable String workId) {
+//        return workService.select4dkk(param, workId);
+//    }
+
+
+    @ApiOperation(value = "上传-文件(文件固定命名)", notes = "上传资料会放到场景码的跟目录, 文件固定命名, 场景码:必传")
+    @PostMapping(value = "uploadFix/{sceneCode}")
+    public Result uploadFix(@RequestParam("file") MultipartFile file, @PathVariable String sceneCode) {
+        return workService.uploadFix(file, sceneCode);
+    }
+
+    @ApiOperation(value = "普通上传-文件(后端用时间戳命名)", notes = "场景码:必传")
+    @PostMapping(value = "upload/{sceneCode}")
+    public Result upload(@RequestParam("file") MultipartFile file, @PathVariable String sceneCode) {
+        return workService.upload(file, sceneCode);
+    }
+
+    @ApiOperation(value = "上传-作品文件上传(文件固定命名)", notes = "上传资料会放到场景码的跟目录, 文件固定命名, 作品码:必传")
+    @PostMapping(value = "uploadFixByWork/{workId}")
+    public Result uploadFixByWork(@RequestParam("file") MultipartFile file, @PathVariable String workId) {
+        return workService.uploadFixByWork(file, workId);
+    }
+
+
+    @ApiOperation(value = "检查作品token是否有效" , position = 3)
+    @GetMapping("checkToken/{workId}")
+    public Result checkToken(@PathVariable String workId) {
+        return workService.checkToken(workId);
+
+    }
+
+
+
+
+}

+ 23 - 0
gis_pano/src/main/java/com/gis/cms/entity/dto/FodderDto.java

@@ -0,0 +1,23 @@
+package com.gis.cms.entity.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.Size;
+
+/**
+ * Created by owen on 2021/2/23 0023 16:39
+ */
+@Data
+public class FodderDto {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private Long id;
+
+    @Size(max = 50, message = "长度不能大于50位")
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "封面图")
+    private String icon;
+}

+ 26 - 0
gis_pano/src/main/java/com/gis/cms/entity/dto/SomeDataDto.java

@@ -0,0 +1,26 @@
+package com.gis.cms.entity.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 String id;
+
+
+    @NotBlank(message = "someData不能为空")
+    @ApiModelProperty(value = "静态文件信息", required = true)
+    private String someData;
+
+
+
+
+
+}

+ 25 - 0
gis_pano/src/main/java/com/gis/cms/entity/dto/WorkDto.java

@@ -0,0 +1,25 @@
+package com.gis.cms.entity.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by owen on 2021/2/22 0028 16:36
+ */
+@Data
+public class WorkDto {
+
+    @ApiModelProperty(value = "id, 修改时必须传,新增忽略", name = "id")
+    private String id;
+
+    @ApiModelProperty(value = "场景密码")
+    private String password;
+
+    @ApiModelProperty(value = "封面图")
+    private String icon;
+
+
+
+
+
+}

+ 66 - 0
gis_pano/src/main/java/com/gis/cms/entity/po/FodderEntity.java

@@ -0,0 +1,66 @@
+package com.gis.cms.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.gis.common.base.entity.po.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@TableName(value = "tb_fodder")
+public class FodderEntity extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = -1428200960867373738L;
+
+//    @ApiModelProperty(value = "名称")
+//    private String name;
+
+    @ApiModelProperty(value = "存放地址(数据目录)")
+    private String filePath;
+
+//    @ApiModelProperty(value = "oss存放地址")
+//    private String ossPath;
+
+    @ApiModelProperty(value = "状态 1:切图中, 2:失败, 3:完成")
+    private Integer status;
+
+//    @ApiModelProperty(value = "类型, 全景图:pano, 图片:image, 音频:audio, 视频:video")
+//    private String type;
+
+//    @ApiModelProperty(value = "创建人")
+//    private String userId;
+
+    @ApiModelProperty(value = "封面图")
+    private String icon;
+
+    @ApiModelProperty(value = "预览图(全景图使用)")
+    private String previewIcon;
+
+    @ApiModelProperty(value = "文件名")
+    private String fileName;
+
+    @ApiModelProperty(value = "文件大小,单位KB")
+    private String fileSize;
+
+    @ApiModelProperty(value = "场景码")
+    private String sceneCode;
+
+//    @ApiModelProperty(value = "分辨率")
+//    private String dpi;
+
+
+//    @Transient
+//    @ApiModelProperty(value = "该作品下的场景是否已使用")
+//    private Integer isUse = 0;
+
+    @ApiModelProperty(value = "上传临时用的id, 前端需要用")
+    private String tempId;
+
+    @ApiModelProperty(value = "创建者id")
+    private Long creatorId;
+
+
+
+
+
+}

+ 63 - 0
gis_pano/src/main/java/com/gis/cms/entity/po/WorkEntity.java

@@ -0,0 +1,63 @@
+package com.gis.cms.entity.po;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.gis.common.base.entity.po.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 作品表
+ */
+@Data
+@TableName(value = "tb_work")
+public class WorkEntity extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 6827754544317282072L;
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "简介")
+    private String description;
+
+    @ApiModelProperty(value = "状态, 0:默认不显示, 1:显示")
+    private Integer status;
+
+//    @ApiModelProperty(value = "创建人")
+//    private String userId;
+
+    @ApiModelProperty(value = "封面图")
+    private String icon;
+
+    @ApiModelProperty(value = "访问量")
+    private Integer visit;
+
+    @JSONField(serialize = false)
+    @ApiModelProperty(value = "作品密码, 默认0:不需要密码")
+    private String password;
+
+
+    @ApiModelProperty(value = "二维码")
+    private String qrCode;
+
+    @ApiModelProperty(value = "分享地址(二维码扫描后地址)")
+    private String share;
+
+
+    @ApiModelProperty(value = "是否有密码,0:没有, 1:有")
+    private Integer isPassword;
+
+    /** 用来关联删除素材时使用*/
+    @ApiModelProperty(value = "场景码")
+    private String sceneCodes;
+
+    @ApiModelProperty(value = "创建者id")
+    private Long creatorId;
+
+
+
+}

+ 16 - 0
gis_pano/src/main/java/com/gis/cms/mapper/FodderMapper.java

@@ -0,0 +1,16 @@
+package com.gis.cms.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gis.cms.entity.po.FodderEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * Created by owen on 2022/2/23 0018 11:13
+ */
+@Component
+@Mapper
+public interface FodderMapper extends BaseMapper<FodderEntity> {
+
+}

+ 51 - 0
gis_pano/src/main/java/com/gis/cms/mapper/WorkMapper.java

@@ -0,0 +1,51 @@
+package com.gis.cms.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gis.cms.entity.po.WorkEntity;
+import com.gis.common.base.mapper.provider.BaseProvider;
+import org.apache.ibatis.annotations.*;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+
+@Component
+@Mapper
+public interface WorkMapper extends BaseMapper<WorkEntity> {
+
+
+
+    @SelectProvider(type = BaseProvider.class, method = "runSql")
+    List<WorkEntity> search(String strSql);
+
+    @Update("UPDATE tb_work SET visit= visit + 1 where id = #{id}")
+    void addVisit(String id);
+
+    @Select("select id, name, scene_codes from tb_work where is_delete = 0 and user_id = #{userId} and scene_codes like #{sceneCode}")
+    List<WorkEntity> likeSceneCode(String sceneCode, String userId);
+
+    /**
+     * for update 锁表更新完,才能进行更新,需要开启事务
+     * 并发量大作会出现脏数据
+     *
+     * @param id
+     * @return
+     */
+    @Select("select id, name, scene_codes, user_id from tb_work where is_delete = 0 and id = #{id} for update")
+    WorkEntity findByIdForUpdate(String id);
+
+
+    /***
+     * 2022-3-18
+     * 真删除无效时数据
+     * @param now
+     */
+    @Delete("delete from tb_work where status=0 and DATE_FORMAT( create_time, '%Y%m' ) <= DATE_FORMAT(#{now} , '%Y%m' )")
+    void delByTime(String now);
+
+
+    @SelectProvider(type = BaseProvider.class, method = "runSql")
+    List<Map> runSql(String strSql);
+}

+ 27 - 0
gis_pano/src/main/java/com/gis/cms/service/FodderService.java

@@ -0,0 +1,27 @@
+package com.gis.cms.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gis.cms.entity.dto.FodderDto;
+import com.gis.cms.entity.dto.SomeDataDto;
+import com.gis.cms.entity.po.FodderEntity;
+import com.gis.cms.entity.po.WorkEntity;
+import com.gis.common.base.entity.dto.PageDto;
+import com.gis.common.util.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface FodderService extends IService<FodderEntity> {
+
+
+    Result<FodderEntity> search(PageDto param);
+
+    Result remove(String id);
+
+    Result<FodderEntity> detail(String id);
+
+    Result updateEntity(FodderDto param);
+}

+ 44 - 0
gis_pano/src/main/java/com/gis/cms/service/IBaseService.java

@@ -0,0 +1,44 @@
+package com.gis.cms.service;
+
+import com.gis.common.util.JwtUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * Created by owen on 2021/12/29 0029 14:12
+ */
+@Component
+public class IBaseService {
+
+    @Autowired
+    HttpServletRequest request;
+
+
+
+    public String getToken(){
+        return request.getHeader("token");
+    }
+
+    /**登录用户id*/
+    public Long getUserId(){
+       return JwtUtil.getUserId(getToken());
+    }
+
+    /**登录用户名*/
+    public String getUserName(){
+        return JwtUtil.getUsername(getToken());
+    }
+
+    /**登录用户角色*/
+    public List getUserRole(){
+        return JwtUtil.getUserRole(getToken());
+    }
+
+
+
+
+
+}

+ 21 - 0
gis_pano/src/main/java/com/gis/cms/service/OpsService.java

@@ -0,0 +1,21 @@
+//package com.gis.cms.service;
+//
+//
+//import com.gis.cms.entity.po.WorkEntity;
+//import com.gis.common.util.Result;
+//
+//
+///**
+// * Created by owen on 2020/3/11 0011 16:14
+// */
+//public interface OpsService  {
+//
+//
+//    Result<WorkEntity> downloadWork(String ids);
+//
+//    Result<WorkEntity> downloadPano(String ids);
+//
+//    Result mergeTour(String workId);
+//
+//    Result pack(String workId);
+//}

+ 50 - 0
gis_pano/src/main/java/com/gis/cms/service/WorkService.java

@@ -0,0 +1,50 @@
+package com.gis.cms.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gis.cms.entity.dto.SomeDataDto;
+import com.gis.cms.entity.dto.WorkDto;
+import com.gis.cms.entity.po.WorkEntity;
+import com.gis.common.base.entity.dto.PageDto;
+import com.gis.common.util.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface WorkService extends IService<WorkEntity> {
+
+
+    Result search(PageDto param);
+
+
+
+    Result<WorkEntity> entityAdd();
+
+    Result remove(String id);
+
+    Result edit(SomeDataDto param);
+
+
+
+    Result uploadFix(MultipartFile file, String sceneCode);
+
+
+
+
+    Result checkToken(String workId);
+
+    void addVisit(String id);
+
+    /**检查场景是否存在*/
+    boolean existBySceneCode(String sceneCode);
+
+
+    Result upload(MultipartFile file, String sceneCode);
+
+    Result uploadFixByWork(MultipartFile file, String workId);
+
+    Result<WorkEntity> entitySave(WorkDto param);
+}

+ 100 - 0
gis_pano/src/main/java/com/gis/cms/service/impl/FodderServiceImpl.java

@@ -0,0 +1,100 @@
+package com.gis.cms.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gis.cms.entity.dto.FodderDto;
+import com.gis.cms.entity.po.FodderEntity;
+import com.gis.cms.mapper.FodderMapper;
+import com.gis.cms.service.FodderService;
+import com.gis.cms.service.IBaseService;
+import com.gis.cms.service.WorkService;
+import com.gis.common.base.entity.dto.PageDto;
+import com.gis.common.base.exception.BaseRuntimeException;
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.constant.ErrorEnum;
+import com.gis.common.util.*;
+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;
+
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class FodderServiceImpl extends ServiceImpl<FodderMapper, FodderEntity> implements FodderService {
+
+
+    @Autowired
+    ConfigConstant configConstant;
+
+    @Autowired
+    IBaseService iBaseService;
+
+    @Autowired
+    FileUtils fileUtils;
+
+    @Autowired
+    RedisUtil redisUtil;
+
+    @Autowired
+    FodderMapper entityMapper;
+
+    @Autowired
+    WorkService workService;
+
+
+
+
+    @Override
+    public Result search(PageDto param) {
+        BaseUtil.startPage(param);
+        IPage<FodderEntity> page = new Page<>(param.getPageNum() , param.getPageSize());
+        LambdaQueryWrapper<FodderEntity> wrapper = new LambdaQueryWrapper<> ();
+        wrapper.eq(FodderEntity::getCreatorId, iBaseService.getUserId());
+        String searchKey = param.getSearchKey();
+        if (StringUtils.isNotBlank(searchKey)){
+            wrapper.like(FodderEntity::getFileName, searchKey);
+        }
+        wrapper.orderByDesc(FodderEntity::getCreateTime);
+        IPage<FodderEntity> result = this.page(page, wrapper);
+        return Result.success(result);
+    }
+
+    @Override
+    public Result remove(String id) {
+
+            FodderEntity entity = this.getById(id);
+            // 检查场景是否被引用
+            boolean exist = workService.existBySceneCode(entity.getSceneCode());
+            BaseRuntimeException.isTrue(exist, null, "此场景被作品使用中,不能删除");
+            // 真删除目录
+            fileUtils.del(entity.getFilePath());
+            this.removeById(id);
+
+        return Result.success();
+    }
+
+    @Override
+    public Result<FodderEntity> detail(String id) {
+        return Result.success(getById(id));
+    }
+
+    @Override
+    public Result updateEntity(FodderDto param) {
+        FodderEntity entity = this.getById(param.getId());
+        BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
+        BeanUtils.copyProperties(param, entity);
+        entity.setFileName(param.getName());
+        this.updateById(entity);
+        return Result.success();
+    }
+
+
+}

+ 305 - 0
gis_pano/src/main/java/com/gis/cms/service/impl/OpsServiceImpl.java

@@ -0,0 +1,305 @@
+//package com.gis.cms.service.impl;
+//
+//import cn.hutool.core.io.FileUtil;
+//import cn.hutool.core.util.StrUtil;
+//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+//import com.baomidou.mybatisplus.core.metadata.IPage;
+//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+//import com.gis.cms.entity.dto.FodderDto;
+//import com.gis.cms.entity.po.FodderEntity;
+//import com.gis.cms.entity.po.WorkEntity;
+//import com.gis.cms.mapper.FodderMapper;
+//import com.gis.cms.service.FodderService;
+//import com.gis.cms.service.OpsService;
+//import com.gis.cms.service.WorkService;
+//import com.gis.common.base.entity.dto.PageDto;
+//import com.gis.common.base.exception.BaseRuntimeException;
+//import com.gis.common.base.service.impl.IBaseService;
+//import com.gis.common.constant.CmdConstant;
+//import com.gis.common.constant.ConfigConstant;
+//import com.gis.common.constant.ErrorEnum;
+//import com.gis.common.util.*;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.commons.lang3.StringUtils;
+//import org.junit.Test;
+//import org.springframework.beans.BeanUtils;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//
+//import java.io.File;
+//import java.util.Arrays;
+//import java.util.List;
+//
+//
+///**
+// * Created by owen on 2020/3/11 0011 16:16
+// */
+//@Slf4j
+//@Service
+//public class OpsServiceImpl  implements OpsService {
+//
+//
+//    @Autowired
+//    ConfigConstant configConstant;
+//
+//    @Autowired
+//    WorkService workService;
+//
+//    @Autowired
+//    FileUtils fileUtils;
+//
+//
+//    @Override
+//    public Result<WorkEntity> downloadWork(String ids) {
+//        BaseRuntimeException.isBlank(ids, null, "输入参数为空");
+//        // 替换空格
+//        ids = StringUtils.replaceAll(ids, ",", " ");
+//        log.info("下载作品目录:{}", ids);
+//        String zipName = StrUtils.getTime("work_");
+//        zipName = "/download/" + zipName + ".zip";
+//
+//        String outPath = configConstant.serverBasePath + zipName;
+//        log.info("zip保存路径:{}", outPath);
+//        String cmd = CmdConstant.zip;
+//        cmd = cmd.replaceAll("@output", outPath);
+//        cmd = cmd.replaceAll("@workPace", configConstant.serverBasePath + "/work");
+//        cmd = cmd.replaceAll("@inDir", ids);
+//
+//        CmdUtils.callShLine(cmd, null);
+//
+//        return Result.success(zipName);
+//    }
+//
+//    @Override
+//    public Result<WorkEntity> downloadPano(String ids) {
+//        BaseRuntimeException.isBlank(ids, null, "输入参数为空");
+//        List<WorkEntity> list = workService.listByIds(Arrays.asList(ids));
+//        log.info("作品数量: {}", list.size());
+//        StringBuffer dir = new StringBuffer();
+//        for (WorkEntity entity : list) {
+//            String sceneCodes = entity.getSceneCodes();
+//            if (StringUtils.isNotBlank(sceneCodes)){
+//                dir.append(sceneCodes).append(",");
+//            }
+//        }
+//        String dirCode = dir.toString();
+//        // 替换空格
+//        dirCode = StringUtils.replaceAll(dirCode, ",", " ");
+////        dirCode = StringUtils.substringBeforeLast(dirCode, ",");
+//        log.info("下载全景目录:{}", dirCode);
+//        String zipName = StrUtils.getTime("pano_");
+//        zipName = "/download/" + zipName + ".zip";
+//
+//        String outPath = configConstant.serverBasePath + zipName;
+//        log.info("zip保存路径:{}", outPath);
+//        String cmd = CmdConstant.zip;
+//        cmd = cmd.replaceAll("@output", outPath);
+//        cmd = cmd.replaceAll("@workPace", configConstant.serverBasePath );
+//        cmd = cmd.replaceAll("@inDir", dirCode);
+//
+//        CmdUtils.callShLine(cmd, 100);
+//
+//
+//        return Result.success(zipName);
+//    }
+//
+//    @Override
+//    public Result mergeTour(String workId) {
+//        WorkEntity entity = workService.getById(workId);
+//        BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
+//        String sceneCodes = entity.getSceneCodes();
+//        log.info("场景码:{}", sceneCodes);
+//        BaseRuntimeException.isBlank(sceneCodes, null, "场景码为空, 不需要合并");
+//
+//        String[] split = sceneCodes.split(",");
+//
+//        // tourXml路径
+//        String downloadPath;
+//        String basePath = configConstant.serverBasePath;
+//        int size = split.length;
+//        log.info("场景数量: {}", size);
+//        BaseRuntimeException.isHas(size==0, null, "场景码为空, 不需要合并");
+//        String firstTourPath = File.separator + split[0] + "/vtour/tour.xml";
+//        if (size == 1){
+//            log.info("firstTourPath:{}", firstTourPath);
+//            downloadPath = firstTourPath;
+//        } else {
+//            // 获取scene标签集合
+//            StringBuffer sceneLabels = new StringBuffer();
+//            int i = 0;
+//            String tourPath;
+//            for (String sceneCode : split) {
+//                tourPath = basePath + File.separator + sceneCode + "/vtour/tour.xml";
+//                String scene = getSceneLabel(tourPath);
+//                sceneLabels.append(scene).append("\r\n");
+//                i++;
+//            }
+//            log.info("标签数量: {}", i );
+//
+//            // 获取第一个xml, 做为基础模板
+//            String firstXml = handleFirstXml(basePath + firstTourPath);
+//            // 合并
+//            StringBuffer buffer = new StringBuffer();
+//            buffer.append(firstXml).append(" ");
+//            buffer.append(sceneLabels).append(" ");
+//            buffer.append("</krpano>");
+//            // 保存路径
+//            downloadPath = "/download/" + workId + "_tour.xml";
+//            String savePath =  configConstant.serverBasePath + File.separator + downloadPath;
+//            FileUtil.writeUtf8String(buffer.toString(), savePath);
+//            log.info("合并完成,保存路径: {}", savePath);
+//
+//        }
+//        log.info("下载地址: {}", downloadPath);
+//
+//        return Result.success(downloadPath);
+//    }
+//
+//    @Override
+//    public Result pack(String workId) {
+//        // 复制作品目录
+//        WorkEntity entity = workService.getById(workId);
+//        BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
+//        copyWork(workId);
+//
+//        // 复制场景目录
+//        copyScene(workId, entity.getSceneCodes());
+//
+//        // 合并tour.xml
+//        mergeTour(workId, entity.getSceneCodes());
+//
+//        // 压缩
+//        zipWork(workId);
+//        String filePath = "/download/" + workId + ".zip";
+//        log.info("zip地址:{}", configConstant.serverBasePath + filePath);
+//        return Result.success(filePath);
+//    }
+//
+//    private void zipWork(String workId) {
+//        String outPath = configConstant.serverBasePath + "/download/" + workId +".zip";
+////        String intPath = configConstant.serverBasePath + "/download/" + workId ;
+//
+//        String cmd = CmdConstant.zip;
+//        cmd = cmd.replaceAll("@output", outPath);
+//        cmd = cmd.replaceAll("@workPace", configConstant.serverBasePath + "/download" );
+//        // 已引入工作目录, 直接填写目录即可
+//        cmd = cmd.replaceAll("@inDir", workId);
+//
+//        CmdUtils.callShLine(cmd, 100);
+//
+//    }
+//
+//    private void copyScene(String workId, String sceneCodes) {
+//        log.info("场景码: {}", sceneCodes);
+//        if (StringUtils.isBlank(sceneCodes)){
+//            log.info("场景码为空, 不需要下载");
+//            return;
+//        }
+//        String[] split = sceneCodes.split(",");
+//        log.info("场景数量 : {}", split.length);
+//        String outPath = configConstant.serverBasePath + "/download/" + workId;
+//        String inPath;
+//        for (String sceneCode : split) {
+//            inPath = configConstant.serverBasePath + "/" + sceneCode + "/vtour/panos/" + sceneCode + ".tiles";
+//            String cmd = StrUtil.format("cp -r {} {} ", inPath,  outPath);
+//            CmdUtils.callCmd(cmd);
+//        }
+//
+//    }
+//
+//    private void copyWork(String workId) {
+//        // 复制到指定目录
+//        String outPath = configConstant.serverBasePath + "/download/";
+//        String checkPath = outPath + workId;
+//        // 存在则删除
+//        if (FileUtil.isDirectory(checkPath)){
+//            FileUtil.del(checkPath);
+//        }
+//        String inPath = configConstant.serverBasePath + "/work/" + workId;
+//        String cmd = StrUtil.format("cp -r {} {} ", inPath,  outPath);
+//        CmdUtils.callCmd(cmd);
+//
+//    }
+//
+//    private void mergeTour(String workId, String sceneCodes) {
+//        String[] split = sceneCodes.split(",");
+//        // tourXml路径
+//        String downloadPath;
+//        String outPath = configConstant.serverBasePath + "/download/" + workId;
+//        String basePath = configConstant.serverBasePath;
+//        int size = split.length;
+//        log.info("场景数量: {}", size);
+//        BaseRuntimeException.isHas(size==0, null, "场景码为空, 不需要合并");
+//        String firstTourPath = File.separator + split[0] + "/vtour/tour.xml";
+//        if (size == 1){
+//            log.info("firstTourPath:{}", firstTourPath);
+//            FileUtil.copy(configConstant.serverBasePath + firstTourPath, outPath, true);
+//        } else {
+//            // 获取scene标签集合
+//            StringBuffer sceneLabels = new StringBuffer();
+//            int i = 0;
+//            String tourPath;
+//            for (String sceneCode : split) {
+//                tourPath = basePath + File.separator + sceneCode + "/vtour/tour.xml";
+//                String scene = getSceneLabel(tourPath);
+//                sceneLabels.append(scene).append("\r\n");
+//                i++;
+//            }
+//            log.info("标签数量: {}", i );
+//
+//            // 获取第一个xml, 做为基础模板
+//            String firstXml = handleFirstXml(basePath + firstTourPath);
+//            // 合并
+//            StringBuffer buffer = new StringBuffer();
+//            buffer.append(firstXml).append(" ");
+//            buffer.append(sceneLabels).append(" ");
+//            buffer.append("</krpano>");
+//            // 保存路径
+//            downloadPath = "/download/" + workId + "/tour.xml";
+//            String savePath =  configConstant.serverBasePath + File.separator + downloadPath;
+//            FileUtil.writeUtf8String(buffer.toString(), savePath);
+//            log.info("合并完成,保存路径: {}", savePath);
+//
+//        }
+//
+//    }
+//
+//    /**
+//     * 处理第一个xml
+//     * @param filePath
+//     * @return
+//     */
+//    private static String handleFirstXml(String filePath){
+//
+//        String s = FileUtil.readString(filePath, "UTF-8");
+//
+//        // 截取</krpano>之前的
+//        s = StrUtil.subBefore(s, "<scene name=", false);
+//        return s;
+//
+//    }
+//
+//    /**
+//     * 获取Scene标签值
+//     * @param filePath tour.xml路径
+//     * @return
+//     */
+//    private static String getSceneLabel(String filePath){
+//        String s = FileUtil.readString(filePath, "UTF-8");
+//        // 截取</action>之后的
+//        s = StrUtil.subAfter(s, "</action>", true);
+//        // 截取</krpano>之前的
+//        s = StrUtil.subBefore(s, "</krpano>", true);
+//        return s;
+//
+//    }
+//
+//
+//    @Test
+//    public void test(){
+//        String str = "1";
+//        System.out.println(Arrays.asList(str));
+//
+//    }
+//}

+ 322 - 0
gis_pano/src/main/java/com/gis/cms/service/impl/WorkServiceImpl.java

@@ -0,0 +1,322 @@
+package com.gis.cms.service.impl;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gis.cms.entity.dto.SomeDataDto;
+import com.gis.cms.entity.dto.WorkDto;
+import com.gis.cms.entity.po.WorkEntity;
+import com.gis.cms.mapper.WorkMapper;
+import com.gis.cms.service.IBaseService;
+import com.gis.cms.service.WorkService;
+import com.gis.common.base.entity.dto.PageDto;
+import com.gis.common.base.exception.BaseRuntimeException;
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.constant.ErrorEnum;
+import com.gis.common.constant.RedisConstant;
+import com.gis.common.util.*;
+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 org.springframework.web.multipart.MultipartFile;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+//@Transactional
+public class WorkServiceImpl extends ServiceImpl<WorkMapper, WorkEntity> implements WorkService {
+
+
+    @Autowired
+    ConfigConstant configConstant;
+
+    @Autowired
+    IBaseService iBaseService;
+
+
+
+
+    @Autowired
+    FileUtils fileUtils;
+
+    @Autowired
+    RedisUtil redisUtil;
+
+    @Autowired
+    WorkMapper entityMapper;
+
+
+
+
+    @Override
+    public Result search(PageDto param) {
+        BaseUtil.startPage(param);
+        IPage<WorkEntity> page = new Page<>(param.getPageNum() , param.getPageSize());
+        LambdaQueryWrapper<WorkEntity> wrapper = new LambdaQueryWrapper<> ();
+        // wrapper.eq(WorkEntity::getCreatorId, iBaseService.getUserId());
+        String searchKey = param.getSearchKey();
+        if (StringUtils.isNotBlank(searchKey)){
+            wrapper.like(WorkEntity::getName, param.getSearchKey());
+        }
+        wrapper.orderByDesc(WorkEntity::getCreateTime);
+        IPage<WorkEntity> result = this.page(page, wrapper);
+        return Result.success(result);
+    }
+
+
+    /**
+     * 目前只是用来保存密码, 也可以使用保存实体信息
+     */
+    @Override
+    public Result<WorkEntity> entitySave(WorkDto param) {
+        WorkEntity entity = this.getById(param.getId());
+        BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
+        BeanUtils.copyProperties(param, entity);
+        entity.setUpdateTime(LocalDateTime.now());
+        this.updateById(entity);
+        return Result.success(entity);
+    }
+
+
+    @Override
+    public Result<WorkEntity> entityAdd() {
+        WorkEntity entity = new WorkEntity();
+        entity.setCreatorId(iBaseService.getUserId());
+        entity.setStatus(0);
+        this.save(entity);
+
+        Long id = entity.getId();
+        log.info("创建对象完成: {}", id);
+
+        // 创建someData; 如someData作出修改,记得把代码里的someData 跟服务器里的someData都修改
+        String baseSomeDataPath = configConstant.serverBasePath + "/baseData/someData.json";
+        log.info("服务器base someData.json path: {}", baseSomeDataPath);
+        BaseRuntimeException.isTrue(!FileUtil.isFile(baseSomeDataPath), null, "服务器someData.json模板不存在");
+        String content = FileUtil.readUtf8String(baseSomeDataPath);
+
+        JSONObject jsonObject = JSONObject.parseObject(content);
+        jsonObject.put("id", id + "");
+
+        // 存放到工作目录, 已workId为目录
+        String someDataPath = configConstant.serverBasePath + "/work/" + id + "/someData.json";
+        FileUtil.writeUtf8String(jsonObject.toJSONString(), someDataPath);
+        log.info("someData.json文件保存成功: {}", someDataPath);
+
+        return Result.success(entity);
+    }
+
+    // 删除无效作品数据
+    private void delByTime() {
+        // 定时删除空作品数据,周期:一个月清一次
+        if (!redisUtil.hasKey(RedisConstant.WORK_DEL)) {
+            String now = LocalDate.now().minusMonths(1).toString();
+            log.warn("执行删除: {} 月份之前的空作品数据", now);
+            entityMapper.delByTime(now);
+            redisUtil.set(RedisConstant.WORK_DEL, now, 30, TimeUnit.DAYS);
+        }
+    }
+
+
+    @Override
+    public Result remove(String id) {
+        WorkEntity entity = this.getById(id);
+        if (entity == null) {
+            return Result.success();
+        }
+        this.removeById(id);
+
+        // 删除redis
+        redisUtil.del(RedisConstant.WORK_ID + id);
+
+        // 删除无效作品数据
+        delByTime();
+
+        return Result.success();
+    }
+
+    @Override
+    public void addVisit(String id) {
+        entityMapper.addVisit(id);
+    }
+
+    /**
+     *
+     * @param sceneCode
+     * @return true:存在, false:不存在
+     */
+    @Override
+    public boolean existBySceneCode(String sceneCode) {
+        String sql = StrUtil.format("select id FROM tb_work WHERE  find_in_set('{}' , scene_codes )", sceneCode);
+        List<Map> list = entityMapper.runSql(sql);
+        log.info("引用的作品id: {}", list);
+        return list.size() > 0;
+    }
+
+
+
+    @Override
+    public Result checkToken(String workId) {
+
+        log.info("查找作品id: {}", workId);
+        if (redisUtil.hasKey(RedisConstant.WORK_ID + workId)){
+            return Result.success();
+        }
+
+        WorkEntity entity = this.getById(workId);
+        BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
+
+
+        Long userId = iBaseService.getUserId();
+        log.info("userId: {}", userId);
+//        BaseRuntimeException.isHas(!userId.equals(entity.getCreatorId()), null, "当前无操作权限");
+
+        redisUtil.set(RedisConstant.WORK_ID + workId, entity, 30, TimeUnit.SECONDS);
+
+        return Result.success();
+
+    }
+
+    @Override
+    public Result edit(SomeDataDto param) {
+        // 检查是否是改用户的作品
+        String id = param.getId();
+
+        // 防止重复提交
+        String editKey = RedisConstant.WORK_ID_EDIT + id + ":"+param.toString();
+        if (redisUtil.hasKey(editKey)){
+            log.info("编辑走缓存");
+            return Result.success();
+        }
+
+        // 3秒内防止重复提交
+        redisUtil.set(editKey, param.toString(), 3, TimeUnit.SECONDS);
+
+        WorkEntity entity = getById(id);
+        if (entity == null) {
+            log.error("作品已被删除,无法编辑, id: " + id);
+            throw new BaseRuntimeException(3006, "作品已被删除,无法编辑, id: " + id);
+        }
+
+        //是否该用户作品
+//        BaseRuntimeException.isHas(!iBaseService.getUserId().equals(entity.getCreatorId()), 3005, "当前无操作权限");
+
+        // 更新作品信息
+        boolean isEdit = editEntity(param, entity);
+        if (!isEdit) {
+            return Result.failure("对象不存在");
+        }
+
+        log.info("更新作品完成");
+        // 保存someData.json
+        updateSomeData(param);
+
+        return Result.success();
+    }
+
+    /**
+     * 更新作品实体信息
+     */
+    private boolean editEntity(SomeDataDto param, WorkEntity entity) {
+
+
+        String someData = param.getSomeData();
+        JSONObject sd = JSONObject.parseObject(someData);
+        entity.setName(sd.getString("name"));
+        entity.setIcon(sd.getString("icon"));
+        entity.setShare(sd.getString("share"));
+        entity.setQrCode(sd.getString("qrCode"));
+        entity.setStatus(sd.getInteger("status"));
+        entity.setPassword(sd.getString("password"));
+        String scenes = sd.getString("scenes");
+        entity.setSceneCodes(getSceneCodes(scenes));
+
+        entity.setUpdateTime(LocalDateTime.now());
+
+        this.updateById(entity);
+        return true;
+
+    }
+
+    /**
+     * 传入参数是一个数组json字符串
+     * @param param
+     */
+    private String getSceneCodes(String param){
+        JSONArray array = JSONArray.parseArray(param);
+        List<String> list = new ArrayList<>();
+        for (Object o : array) {
+            JSONObject parse = JSONObject.parseObject(o.toString());
+            String sceneCode = parse.getString("sceneCode");
+            list.add(sceneCode);
+        }
+        String join = StringUtils.join(list, ",");
+        return join;
+
+
+    }
+
+
+
+    /**
+     * 更新someData.json
+     */
+    private void updateSomeData(SomeDataDto param) {
+
+        String id = param.getId();
+        // 存放到工作目录, 已workId为目录
+        String someDataPath = configConstant.serverBasePath + "/work/" + id + "/someData.json";
+        // 写入服务器
+        FileUtil.writeUtf8String(param.getSomeData(), someDataPath);
+
+    }
+
+
+
+    @Override
+    public Result uploadFix(MultipartFile file, String sceneCode) {
+        // 检查非法文件上传
+        BaseRuntimeException.isTrue(!fileUtils.checkFile(file), null, "上传文件格式有误, 请重新上传");
+        Map<String, Object> uploadMap = fileUtils.uploadMap(file, "/pano/" + sceneCode, true);
+        return Result.success(uploadMap);
+    }
+
+
+    @Override
+    public Result upload(MultipartFile file, String sceneCode) {
+        // 检查非法文件上传
+        BaseRuntimeException.isTrue(!fileUtils.checkFile(file), null, "上传文件格式有误, 请重新上传");
+        Map<String, Object> uploadMap = fileUtils.uploadMap(file, "/pano/" + sceneCode + "/edit", false);
+        return Result.success(uploadMap);
+    }
+
+    @Override
+    public Result uploadFixByWork(MultipartFile file, String workId) {
+        // 检查非法文件上传
+        BaseRuntimeException.isTrue(!fileUtils.checkFile(file), null, "上传文件格式有误, 请重新上传");
+        Map<String, Object> uploadMap = fileUtils.uploadMap(file, "/work/" + workId, true);
+        return Result.success(uploadMap);
+    }
+
+
+
+
+
+
+}

+ 46 - 0
gis_pano/src/main/resources/someData.json

@@ -0,0 +1,46 @@
+{
+  "isPassword": 0,
+  "password": "",
+  "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": "",
+  "logoChange": false,
+  "share": "",
+  "id": "",
+  "remindTime": 1,
+  "bgm": {
+    "url": "",
+    "name": ""
+  },
+  "guideDefaultTime": "",
+  "expandHotStyles": [],
+  "scenesOrder": [],
+  "status": 0
+}

+ 9 - 0
gis_pano/src/main/resources/zip.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+workPace=$1    #工作目录
+output=$2      #输出目录
+inDir=$3       #下载目录参数
+echo 工作目录 $1
+echo 输出目录 $2
+echo 目录参数 $3
+cd workPace
+zip -r $2 $3

+ 14 - 3
pom.xml

@@ -20,8 +20,9 @@
     <module>gis_common</module>
     <module>gis_admin</module>
     <module>gis_application</module>
-    <module>gis_scene</module>
+    <!--<module>gis_scene</module>-->
     <module>gis_cms</module>
+    <!--<module>gis_pano</module>-->
   </modules>
 
 
@@ -32,13 +33,14 @@
     <java.version>1.8</java.version>
     <spring.boot.version>2.3.4.RELEASE</spring.boot.version>
     <gis.version>1.0.0</gis.version>
-    <druid.version>1.1.14</druid.version>
     <hutool.version>5.3.3</hutool.version>
     <lombok.version>1.18.2</lombok.version>
     <fastjson.version>1.2.75</fastjson.version>
     <lang3.version>3.7</lang3.version>
     <knife4j.version>2.0.2</knife4j.version>
     <mysql.version>8.0.15</mysql.version>
+    <druid.version>1.2.6</druid.version>
+    <mybatis-plus.version>3.4.3.4</mybatis-plus.version>
     <shiro.version>1.7.1</shiro.version>
     <jwt.version>3.2.0</jwt.version>
     <jjwt.version>0.6.0</jjwt.version>
@@ -76,7 +78,7 @@
 
       <dependency>
         <groupId>com.gis</groupId>
-        <artifactId>gis_scene</artifactId>
+        <artifactId>gis_pano</artifactId>
         <version>${gis.version}</version>
       </dependency>
 
@@ -100,6 +102,8 @@
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
         <version>${spring.boot.version}</version>
+
+
       </dependency>
 
       <dependency>
@@ -145,6 +149,13 @@
         <version>${druid.version}</version>
       </dependency>
 
+      <!-- mybatis-plus 3.3以上版本要配合druid 1.2版本使用-->
+      <dependency>
+        <groupId>com.baomidou</groupId>
+        <artifactId>mybatis-plus-boot-starter</artifactId>
+        <version>${mybatis-plus.version}</version>
+      </dependency>
+
       <!--aliyun oss-->
       <dependency>
         <groupId>com.aliyun.oss</groupId>