Selaa lähdekoodia

看房需求-准备联调

zhujinghui 4 vuotta sitten
vanhempi
commit
42d3b5bd0e
32 muutettua tiedostoa jossa 871 lisäystä ja 144 poistoa
  1. 9 0
      4dkankan-application/pom.xml
  2. 1 1
      4dkankan-application/src/main/resources/application-dev.properties
  3. 25 0
      4dkankan-application/src/test/java/com/fdkankan/SceneJsonTest.java
  4. 33 0
      4dkankan-common/src/main/java/com/fdkankan/common/SceneOssFileEnum.java
  5. 4 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/Constant.java
  6. 5 0
      4dkankan-common/src/main/java/com/fdkankan/common/exception/BaseRuntimeException.java
  7. 63 20
      4dkankan-common/src/main/java/com/fdkankan/common/exception/GlobalExceptionHandler.java
  8. 1 0
      4dkankan-common/src/main/java/com/fdkankan/common/model/Result.java
  9. 68 0
      4dkankan-common/src/main/java/com/fdkankan/common/model/ViewResult.java
  10. 79 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/FileUtils.java
  11. 8 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/RandomUtil.java
  12. 17 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/UploadToOssUtil.java
  13. 5 0
      4dkankan-scene/pom.xml
  14. 32 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/dto/TestDTO.java
  15. 25 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/dto/scene/SceneJsonDTO.java
  16. 5 5
      4dkankan-scene/src/main/java/com/fdkankan/scene/entity/SceneProEntity.java
  17. 41 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/enums/SceneProEnum.java
  18. 37 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/param/scene/DownloadVideoParam.java
  19. 28 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/param/scene/OperaVideoParam.java
  20. 7 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/service/ISceneProService.java
  21. 78 97
      4dkankan-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  22. 19 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/util/CreateObjUtil.java
  23. 31 0
      4dkankan-scene/src/main/java/com/fdkankan/scene/vo/DownlVideoVO.java
  24. 4 0
      4dkankan-web/pom.xml
  25. 14 0
      4dkankan-web/src/main/java/com/fdkankan/web/aop/CheckScene.java
  26. 67 0
      4dkankan-web/src/main/java/com/fdkankan/web/aop/CheckSceneAspect.java
  27. 33 0
      4dkankan-web/src/main/java/com/fdkankan/web/config/WebConfig.java
  28. 26 18
      4dkankan-web/src/main/java/com/fdkankan/web/controller/SceneController.java
  29. 51 2
      4dkankan-web/src/main/java/com/fdkankan/web/controller/SceneEditController.java
  30. 37 0
      4dkankan-web/src/main/java/com/fdkankan/web/controller/VrController.java
  31. 7 1
      pom.xml
  32. 11 0
      sql/2021年7月版/1创建看房统计表.sql

+ 9 - 0
4dkankan-application/pom.xml

@@ -102,6 +102,7 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
@@ -133,6 +134,14 @@
                     <encoding>UTF-8</encoding>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>${maven-surefire-plugin.version}</version>
+                <configuration>
+                    <skipTests>true</skipTests>    <!--默认关掉单元测试 -->
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>

+ 1 - 1
4dkankan-application/src/main/resources/application-dev.properties

@@ -14,7 +14,7 @@ spring.servlet.multipart.enabled=true
 spring.servlet.multipart.location=/mnt/data/
 #redis
 spring.redis.host=120.25.146.52
-spring.redis.database=0
+spring.redis.database=15
 spring.redis.timeout=3000ms
 spring.redis.jedis.pool.max-idle=8
 spring.redis.jedis.pool.min-idle=0

+ 25 - 0
4dkankan-application/src/test/java/com/fdkankan/SceneJsonTest.java

@@ -0,0 +1,25 @@
+package com.fdkankan;
+
+import com.alibaba.fastjson.JSONObject;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = App.class)
+public class SceneJsonTest {
+
+    String json = "{\"data\":[{\"blend_fov\":\"7\",\"id\":\"2\",\"value\":\"1.31156\"},{\"blend_fov\":\"7\",\"id\":\"4\",\"value\":\"0.890266\"}],\"upPath\":\"https://4dkk.4dage.com/data/datat-kryAqiX/Up.xml\",\"version\":3}";
+
+    /**
+     * 获取对应队列的数量;
+     *
+     * @return
+     */
+    @Test
+    public void jsonTest() {
+        JSONObject scenejson = JSONObject.parseObject(json);
+        System.out.println(scenejson);
+    }
+}

+ 33 - 0
4dkankan-common/src/main/java/com/fdkankan/common/SceneOssFileEnum.java

@@ -0,0 +1,33 @@
+package com.fdkankan.common;
+
+/**
+ * @author Admin
+ */
+
+public enum SceneOssFileEnum {
+    DATA("data", "data"),
+    IMAGES("images", "图片"),
+    VOICE("voice", "音频"),
+    VIDEO("video", "视频"),
+            ;
+
+    private String key;
+    private String remark;
+
+    public String getKey() {
+        return key;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    SceneOssFileEnum(String key, String remark) {
+        this.key = key;
+        this.remark = remark;
+    }
+
+    SceneOssFileEnum(String key) {
+        this.key = key;
+    }
+}

+ 4 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/Constant.java

@@ -10,5 +10,9 @@ public class Constant {
     public static String EXPANSION_SPACE_VALUE_1P = "1125899906842624";
     // 八目相机基础容量10G
     public static String CAMERA_BASE_SPACE_VALUE = "10737418240";
+
+    public static final String SCENE_VIDEO_SHARE_SUFFIX = "_share";
+
+    public static final String WATER_MARK_PATH = "/mnt/4Dkankan/watermark/shuiyin.png";
 }
 

+ 5 - 0
4dkankan-common/src/main/java/com/fdkankan/common/exception/BaseRuntimeException.java

@@ -1,13 +1,18 @@
 package com.fdkankan.common.exception;
 
+/**
+ * @author Admin
+ */
 public class BaseRuntimeException extends RuntimeException{
 
     private static final long serialVersionUID = -1518945670203783450L;
+    private final int DEFAULT = 9999;
     private Integer code;
     private String msg;
 
     public BaseRuntimeException(String msg){
         super(msg);
+        this.code = DEFAULT;
         this.msg = msg;
     }
 

+ 63 - 20
4dkankan-common/src/main/java/com/fdkankan/common/exception/GlobalExceptionHandler.java

@@ -1,41 +1,84 @@
 package com.fdkankan.common.exception;
 
 import com.fdkankan.common.model.Result;
-import lombok.extern.log4j.Log4j2;
+import com.fdkankan.common.model.ViewResult;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.support.DefaultMessageSourceResolvable;
 import org.springframework.http.HttpStatus;
+import org.springframework.validation.BindException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.stream.Collectors;
 
 /**
  * 全局异常捕获统一返回客户端
+ * @author Admin
  */
-@Log4j2
+@Slf4j
 @RestControllerAdvice
 public class GlobalExceptionHandler {
 
-//    @ResponseBody
-//    @ExceptionHandler(Exception.class)
-//    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public Result exceptionHandler(HttpServletRequest request, Exception e) {
-        log.error(request.getRequestURI() + ":" + e.getCause());
-        Result result = Result.failure("系统错误:"+ e);
-//        if (e instanceof RuntimeException){
-//            String msg = e.getCause() == null ? e.toString() : e.getCause().getMessage();
-//            if (msg.contains("Load balancer does not have available server for client")){
-//                result = Result.failure(msg.split(":")[1] + "服务不可用");
-//            }
-//            if (e instanceof BaseFeignException){
-//                result = Result.failure( Result.CODE_FAILURE, e.getMessage());
-//            }
-//        }
-        return result;
+    /**
+     * 处理其他异常
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(value = Exception.class)
+    public ViewResult exceptionHandler(Exception e){
+        log.error("程序错误原因:", e);
+        return ViewResult.error("服务端异常");
     }
 
-    @ResponseBody
+
+    /**
+     * 处理其他异常
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(value = MissingServletRequestParameterException.class)
+    public ViewResult exceptionHandler(MissingServletRequestParameterException e){
+        log.error("缺少必要参数:", e);
+        return ViewResult.error(HttpStatus.BAD_REQUEST.value(), "缺少必要参数");
+    }
+
+
+
+    /**
+     * 处理请求参数格式错误 @RequestBody上validate失败后抛出的异常是MethodArgumentNotValidException异常
+     */
+    @ExceptionHandler(MethodArgumentNotValidException.class)
+    public ViewResult MethodArgumentNotValidExceptionHandler(MethodArgumentNotValidException e) {
+        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
+        //下边ResultCodeEnum.PARAMS_BS_ERROR.getCode()就是你自己自定义的返回code码
+        return ViewResult.error(HttpStatus.BAD_REQUEST.value(), message);
+    }
+
+    /**
+     * 处理Get请求中 使用@Valid 验证路径中请求实体校验失败后抛出的异常
+     */
+    @ExceptionHandler(BindException.class)
+    public ViewResult BindExceptionHandler(BindException e) {
+        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
+        return ViewResult.error(HttpStatus.BAD_REQUEST.value(), message);
+    }
+
+    /**
+     * @link https://www.cnblogs.com/cjyboy/p/11465876.html
+     * 处理请求参数格式错误 @RequestParam上validate失败后抛出的异常是ConstraintViolationException
+     */
+//    @ExceptionHandler(ConstraintViolationException.class)
+//    public ViewResult ConstraintViolationExceptionHandler(ConstraintViolationException e) {
+//        String message = e.getConstraintViolations().stream().map(ConstraintViolation::getMessage).collect(Collectors.joining());
+//        return ViewResult.error(HttpStatus.BAD_REQUEST.value(), message);
+//    }
+
+
+
     @ExceptionHandler(BaseRuntimeException.class)
     @ResponseStatus(HttpStatus.OK)
     public Result runtimeExceptionHandler(HttpServletRequest request, BaseRuntimeException e) {

+ 1 - 0
4dkankan-common/src/main/java/com/fdkankan/common/model/Result.java

@@ -15,6 +15,7 @@ import java.io.Serializable;
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
+@Deprecated
 public class Result<T> implements Serializable {
     private static final long serialVersionUID = -1491499610244557029L;
     public static final String SUCCESS_MSG = "操作成功";

+ 68 - 0
4dkankan-common/src/main/java/com/fdkankan/common/model/ViewResult.java

@@ -0,0 +1,68 @@
+package com.fdkankan.common.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.http.HttpStatus;
+
+
+/**
+ * @author zhujh
+ */
+@ApiModel
+@Data
+public class ViewResult<T> {
+
+    @ApiModelProperty("返回码")
+    private Integer code;
+
+    @ApiModelProperty("返回说明")
+    private String msg;
+
+    @ApiModelProperty("返回数据")
+    private T data;
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public ViewResult(Integer code) {
+        this.code = code;
+    }
+
+    public ViewResult(Integer code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public ViewResult(Integer code, String msg, T data) {
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public static ViewResult success() {
+        return new ViewResult(HttpStatus.OK.value(), "操作成功");
+    }
+
+    public static ViewResult success(Object data) {
+        return new ViewResult(HttpStatus.OK.value(), "成功", data);
+    }
+
+    public static ViewResult success(Integer code, String msg, Object data) {
+        return new ViewResult(code, msg, data);
+    }
+
+    public static ViewResult success(Integer code, String msg) {
+        return new ViewResult(code, msg);
+    }
+
+    public static ViewResult error(String msg) {
+        return new ViewResult(500, msg);
+    }
+
+    public static ViewResult error(Integer code, String msg) {
+        return new ViewResult(code, msg);
+    }
+
+}

+ 79 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/FileUtils.java

@@ -955,4 +955,83 @@ public class FileUtils {
 
     }
 
+    public static void copyFolderAllFiles(String srcFolder, String destFolder, boolean overlay) throws IOException {
+        // 创建目标文件夹
+        (new File(destFolder)).mkdirs();
+        // 获取源文件夹当前下的文件或目录
+        File[] file = (new File(srcFolder)).listFiles();
+        if (file == null || file.length == 0) {
+            log.info("原文件夹为空-{}", srcFolder);
+            return;
+        }
+        for (int i = 0; i < file.length; i++) {
+            if (file[i].isFile()) {
+                // 复制文件
+                copyFile(file[i],new File(destFolder+file[i].getName()));
+            }
+            if (file[i].isDirectory()) {
+                // 复制目录
+                String sourceDir=srcFolder+File.separator+file[i].getName();
+                String targetDir=destFolder+File.separator+file[i].getName();
+                copyDirectiory(sourceDir, targetDir);
+            }
+        }
+    }
+
+
+    // 复制文件夹
+    public static void copyDirectiory(String sourceDir, String targetDir)
+            throws IOException {
+        // 新建目标目录
+        (new File(targetDir)).mkdirs();
+        // 获取源文件夹当前下的文件或目录
+        File[] file = (new File(sourceDir)).listFiles();
+        for (int i = 0; i < file.length; i++) {
+            if (file[i].isFile()) {
+                // 源文件
+                File sourceFile=file[i];
+                // 目标文件
+                File targetFile=new
+                        File(new File(targetDir).getAbsolutePath()
+                        +File.separator+file[i].getName());
+                copyFile(sourceFile,targetFile);
+            }
+            if (file[i].isDirectory()) {
+                // 准备复制的源文件夹
+                String dir1=sourceDir + "/" + file[i].getName();
+                // 准备复制的目标文件夹
+                String dir2=targetDir + "/"+ file[i].getName();
+                copyDirectiory(dir1, dir2);
+            }
+        }
+    }
+
+
+    // 复制文件
+    public static void copyFile(File sourceFile,File targetFile)
+            throws IOException{
+        // 新建文件输入流并对它进行缓冲
+        FileInputStream input = new FileInputStream(sourceFile);
+        BufferedInputStream inBuff=new BufferedInputStream(input);
+
+        // 新建文件输出流并对它进行缓冲
+        FileOutputStream output = new FileOutputStream(targetFile);
+        BufferedOutputStream outBuff=new BufferedOutputStream(output);
+
+        // 缓冲数组
+        byte[] b = new byte[1024 * 5];
+        int len;
+        while ((len =inBuff.read(b)) != -1) {
+            outBuff.write(b, 0, len);
+        }
+        // 刷新此缓冲的输出流
+        outBuff.flush();
+
+        //关闭流
+        inBuff.close();
+        outBuff.close();
+        output.close();
+        input.close();
+    }
+
 }

+ 8 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/RandomUtil.java

@@ -27,6 +27,14 @@ public class RandomUtil {
     }
 
     /**
+     * 生成没有横杠的uuid
+     * @return
+     */
+    public static String generateOnlyStringLongUuid() {
+        return UUID.randomUUID().toString().replace("-", "");
+    }
+
+    /**
      * 获取随机字符串
      *
      * @param num

+ 17 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/UploadToOssUtil.java

@@ -5,6 +5,8 @@ import com.aliyun.oss.model.OSSObjectSummary;
 import com.aliyun.oss.model.ObjectListing;
 import com.aliyun.oss.model.ObjectMetadata;
 import com.aliyun.oss.model.PutObjectResult;
+import com.fdkankan.common.SceneOssFileEnum;
+import com.fdkankan.common.constant.ConstantFilePath;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.FileItemFactory;
@@ -150,6 +152,21 @@ public class UploadToOssUtil {
 		log.info("批量上传阿里云完毕:" + (System.currentTimeMillis() - start));
 	}
 
+	//上传的数据是文件夹,参数是文件夹路径,key是上传后的文件名
+	public void uploadMulFilesV2(SceneOssFileEnum sceneOssFile, String sceneNum, String fileName) {
+		Map<String, String> map = new HashMap<>(1);
+
+		StringBuffer dataBuf = new StringBuffer()
+				.append(sceneOssFile.getKey()).append(File.separator)
+				.append(sceneOssFile.getKey()).append(sceneNum)
+				.append(File.separator);
+
+		StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf);
+		map.put(dataBuffer + fileName, dataBuf + fileName);
+		uploadMulFiles(map);
+	}
+
+
 	public int deleteFile(String prefix){
 		OSSClient ossClient = new OSSClient(point, key, secrey);
 

+ 5 - 0
4dkankan-scene/pom.xml

@@ -56,6 +56,11 @@
             <artifactId>thumbnailator</artifactId>
             <version>0.4.8</version>
         </dependency>
+
+<!--        <dependency>-->
+<!--            <groupId>org.hibernate</groupId>-->
+<!--            <artifactId>hibernate-validator</artifactId>-->
+<!--        </dependency>-->
     </dependencies>
 
     <distributionManagement>

+ 32 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/dto/TestDTO.java

@@ -0,0 +1,32 @@
+package com.fdkankan.scene.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.ToString;
+
+
+/**
+ * @author Admin
+ */
+@Data
+@ToString
+@ApiModel("测试swagger requesbody入参")
+public class TestDTO {
+
+    /**
+     * 编号
+     */
+    @ApiModelProperty("id")
+//    @NotNull(message = "id不能为空")
+    private String id;
+
+
+
+    /**
+     * 序号
+     */
+    @ApiModelProperty("序号")
+    private String seq;
+
+}

+ 25 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/dto/scene/SceneJsonDTO.java

@@ -0,0 +1,25 @@
+package com.fdkankan.scene.dto.scene;
+
+import lombok.Data;
+
+/**
+ * @author Admin
+ */
+@Data
+public class SceneJsonDTO {
+
+    private String upPath;
+    private Integer version;
+    private Data data;
+
+
+    @Data
+    class DataDTO {
+        private String id;
+        private String blendFov;
+        private String value;
+
+    }
+
+
+}

+ 5 - 5
4dkankan-scene/src/main/java/com/fdkankan/scene/entity/SceneProEntity.java

@@ -66,22 +66,22 @@ public class SceneProEntity extends BaseEntity implements Serializable {
      * 0表示其他,1表示文博,2表示地产,3表示电商,4表示餐饮,5表示家居
      */
     @Column(name = "scene_type")
-    private int sceneType;
+    private Integer sceneType;
     /**
      * 1表示推荐,0表示正常
      */
     @Column(name = "recommend")
-    private int recommend;
+    private Integer recommend;
     /**
      * 浏览次数
      */
     @Column(name = "view_count")
-    private int viewCount;
+    private Integer viewCount;
     /**
      * 拍摄数量
      */
     @Column(name = "shoot_count")
-    private int shootCount;
+    private Integer shootCount;
     /**
      * 要gps定位
      */
@@ -91,7 +91,7 @@ public class SceneProEntity extends BaseEntity implements Serializable {
      * 方案:1是双目,2是转台,3是六目,4是八目
      */
     @Column(name = "scene_scheme")
-    private int sceneScheme;
+    private Integer sceneScheme;
     /**
      * 用户表t_user的id
      */

+ 41 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/enums/SceneProEnum.java

@@ -0,0 +1,41 @@
+package com.fdkankan.scene.enums;
+
+/**
+ * @author Admin
+ */
+public class SceneProEnum {
+
+    public enum StatusEnum {
+        CALCULATING(0, "计算中"),
+        AUDITED(1, "已审核"),
+        FAIL(-1, "计算失败"),
+        UNREVIEWED(2, "未审核")
+        ;
+
+        private Integer key;
+        private String value;
+
+        StatusEnum(Integer key, String value) {
+            this.key = key;
+            this.value = value;
+        }
+
+        public Integer getKey() {
+            return key;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        static public StatusEnum get(Integer key) {
+            for (StatusEnum e : StatusEnum.values()) {
+                if (e.getKey().equals(key)) {
+                    return e;
+                }
+            }
+            return CALCULATING;
+        }
+    }
+
+}

+ 37 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/param/scene/DownloadVideoParam.java

@@ -0,0 +1,37 @@
+package com.fdkankan.scene.param.scene;
+
+import com.fdkankan.base.constant.LoginConstant;
+import com.fdkankan.common.exception.BaseRuntimeException;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author Admin
+ */
+@Data
+@ApiModel("下载球幕视频param")
+public class DownloadVideoParam {
+
+    @ApiModelProperty("场景码")
+//    @NotBlank(message = "场景码不能为空")
+    private String sceneNum;
+
+    @ApiModelProperty("文件名")
+//    @NotBlank(message = "fileName不能为空")
+    private String fileName;
+
+    @ApiModelProperty("planIdn")
+//    @NotBlank(message = "planId不能为空")
+    private String planId;
+
+
+    public void setFileName(String fileName) {
+        if(fileName.contains("..") || fileName.contains("./\\") || fileName.contains(".//")
+                || fileName.contains(".\\\\") || fileName.contains(".\\/")){
+            throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3018, LoginConstant.FAILURE_MSG_3018);
+        }
+        this.fileName = fileName;
+    }
+}

+ 28 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/param/scene/OperaVideoParam.java

@@ -0,0 +1,28 @@
+package com.fdkankan.scene.param.scene;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author Admin
+ */
+@Data
+@ApiModel("控制球幕视频入参")
+public class OperaVideoParam {
+
+    @ApiModelProperty("场景码")
+//    @NotBlank(message = "场景码不能为空")
+    private String num;
+
+    @ApiModelProperty("视频id")
+//    @NotBlank(message = "id不能为空")
+    private String id;
+
+
+    @ApiModelProperty(name = "show", value = "true:打开/false:关闭", dataType = "boolean")
+//    @NotBlank(message = "show不能为空")
+    private Boolean show;
+
+}

+ 7 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -6,8 +6,11 @@ import com.fdkankan.common.vo.request.RequestScene;
 import com.fdkankan.common.vo.request.RequestSceneEdit;
 import com.fdkankan.common.vo.response.ResponseScene;
 import com.fdkankan.scene.entity.SceneProEntity;
+import com.fdkankan.scene.param.scene.DownloadVideoParam;
+import com.fdkankan.scene.param.scene.OperaVideoParam;
 import com.github.pagehelper.PageInfo;
 import org.springframework.web.multipart.MultipartFile;
+
 import java.util.List;
 
 /**
@@ -121,4 +124,8 @@ public interface ISceneProService extends IBaseService<SceneProEntity, String> {
                           String videoDirMatrix, String dir, String hfov, String vfov) throws Exception;
 
     Result deleteROIVideo(String sceneNum, String fileName, String planId) throws Exception;
+
+    void operaVideo(OperaVideoParam operaVideoDTO) throws Exception;
+
+    String downloadVideo(DownloadVideoParam downloadVideoParam) throws Exception;
 }

+ 78 - 97
4dkankan-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -9,6 +9,8 @@ import com.fdkankan.base.constant.SceneConstant;
 import com.fdkankan.base.mapper.base.IBaseMapper;
 import com.fdkankan.base.service.impl.BaseServiceImpl;
 import com.fdkankan.base.util.ConvertUtils;
+import com.fdkankan.common.SceneOssFileEnum;
+import com.fdkankan.common.constant.Constant;
 import com.fdkankan.common.constant.ConstantFileName;
 import com.fdkankan.common.constant.ConstantFilePath;
 import com.fdkankan.common.exception.BaseRuntimeException;
@@ -28,6 +30,8 @@ import com.fdkankan.scene.entity.SceneProEntity;
 import com.fdkankan.scene.feign.DepartmentFeign;
 import com.fdkankan.scene.mapper.ISceneProEditMapper;
 import com.fdkankan.scene.mapper.ISceneProMapper;
+import com.fdkankan.scene.param.scene.DownloadVideoParam;
+import com.fdkankan.scene.param.scene.OperaVideoParam;
 import com.fdkankan.scene.service.ICameraService;
 import com.fdkankan.scene.service.ISceneProService;
 import com.fdkankan.scene.util.CreateObjUtil;
@@ -49,6 +53,7 @@ import tk.mybatis.mapper.entity.Condition;
 
 import java.io.File;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * Created by Hb_zzZ on 2019/7/23.
@@ -1634,79 +1639,6 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
 
             scenejson.put("floorEditVer", sceneProEditEntity.getFloorEditVer());
             scenejson.put("floorPublishVer", sceneProEditEntity.getFloorEditVer());
-//            }else {
-//
-//                String path = sceneProEntity.getDataSource();
-//                if(path != null && !"".equals(path) && path.startsWith("http")){
-//                    path = ConstantFilePath.BUILD_MODEL_PATH + path.split("/")[path.split("/").length - 2];
-//                }
-//                path = path + "_edit";
-//                String projectNum = base.getSceneNum();
-//
-//                //读取upload文件,检验需要上传的文件是否存在
-//                String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
-//                JSONObject uploadJson = null;
-//                JSONArray array = null;
-//                if(uploadData!=null) {
-//                    uploadJson = JSONObject.parseObject(uploadData);
-//                    array = uploadJson.getJSONArray("upload");
-//                }
-//                if(array != null){
-//                    JSONObject fileJson = null;
-//                    String fileName = "";
-//                    for(int i = 0, len = array.size(); i < len; i++){
-//                        fileJson = array.getJSONObject(i);
-//                        fileName = fileJson.getString("file");
-//                        //文件不存在抛出异常
-//                        if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){
-//                            throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在");
-//                        }
-//
-//                        //tex文件夹
-//                        if(fileJson.getIntValue("clazz") == 2 && !fileJson.containsKey("pack-file")){
-//                            map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
-//                                    projectNum+"/"+ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
-//                        }
-//
-//                        //2048的模型和贴图
-//                        if(fileJson.getIntValue("clazz") == 16){
-//                            map.put(path + File.separator + "results" + File.separator+ fileName,"data/data"+
-//                                    projectNum+ File.separator + fileName);
-//                        }
-//                    }
-//
-//                    map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam.lzma");
-//                    map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam");
-////        map.put(path + File.separator + "results" +File.separator+"modeldata.js","data/"+projectNum+"/"+"modeldata.js");
-//
-////				map.put(path + File.separator + "results" +File.separator+"vision.modeldata", "images/images"+projectNum+"/"+"vision.modeldata");
-////				if(new File(path + File.separator + "results" +File.separator+"vision2.modeldata").exists()){
-////					map.put(path + File.separator + "results" +File.separator+"vision2.modeldata", "images/images"+projectNum+"/"+"vision2.modeldata");
-////				}
-////				List<String> list1 = FileUtil.readfileNamesForDirectory(path + File.separator + "results" +File.separator+"tex",".jpg");
-////				for(int i=0;i<list1.size();++i)
-////				{
-////					String imgName = list1.get(i);
-////					map.put(path + File.separator + "results" +File.separator+"tex"+File.separator+imgName,"images/images"+projectNum+"/"+Constant.modelUUID+"_50k_texture_jpg_high1/"+imgName);
-////				}
-//
-//                    File file = new File(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum);
-//                    if(!file.exists())
-//                    {
-//                        file.mkdir();
-//                    }
-//                    log.info("计算大场景:开始上传大场景文件到阿里——"+projectNum);
-//                    //上传修改后的本地的缩略图
-//                    map.put(dataBuffer.toString() + "floor.json", dataBuf.toString() + "floor.json");
-//
-//                    //发布重新建模场景,将floorPublishVer设为floorEditVer的值
-//                    sceneProEditEntity.setFloorPublishVer(sceneProEditEntity.getFloorEditVer());
-//
-//                    scenejson.put("floorEditVer", sceneProEditEntity.getFloorEditVer());
-//                    scenejson.put("floorPublishVer", sceneProEditEntity.getFloorEditVer());
-//                }
-//            }
-
         }
 
         //重算全景图并上传oss或视频上传oss
@@ -3117,8 +3049,6 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
         String path = sceneProEntity.getDataSource();
 
         String url = "";
-//        String zipName = "";
-
         if("image".equals(type)){
             if(!new File(path + "/caches/images/" + fileName).exists()){
                 throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3018, LoginConstant.FAILURE_MSG_3018);
@@ -3131,38 +3061,38 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
             //复制打包数据,并且改名
             FileUtils.copyFile(path + "/caches/images/" + fileName, imagesBuffer.toString() + "caches/" + planId + ".jpg", true);
 //            //将图片打成zip包
-//            zipName = imagesBuffer.toString() + "caches/" + sceneNum + "-image-" + planId + ".zip";
-//            FileUtils.zipFile(zipName, imagesBuffer.toString() + "caches/" + planId + ".jpg");
-//
-//            url = mainIntranetUrl + zipName.replace(ConstantFilePath.BASE_PATH + "/", "");
-
             url = mainIntranetUrl + "scene/" + imagesBuf.toString() + "caches/" + planId + ".jpg";
         }
 
         if("video".equals(type)){
-//            if(!new File(path + "/caches/videos/" + fileName).exists()){
-//                throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3018, LoginConstant.FAILURE_MSG_3018);
-//            }
-//
-//            //备份原始数据
-//            if(!new File(imagesBuffer.toString() + "caches/back-" + fileName).exists()){
-//                FileUtils.copyFile(path + "/caches/videos/" + fileName, imagesBuffer.toString() + "caches/back-" + fileName, false);
-//            }
-//            //复制打包数据,并且改名
-//            FileUtils.copyFile(path + "/caches/videos/" + fileName, imagesBuffer.toString() + "caches/" + planId + ".mp4", true);
-////            //将视频打成zip包
-////            zipName = imagesBuffer.toString() + "caches/" + sceneNum + "-video-" + planId + ".zip";
-////            FileUtils.zipFile(zipName, imagesBuffer.toString() + "caches/" + planId + ".mp4");
-////            url = mainIntranetUrl + zipName.replace(ConstantFilePath.BASE_PATH + "/", "");
-//
-//            url = mainIntranetUrl + "scene/" + imagesBuf.toString() + "caches/" + planId + ".mp4";
-
             //使用oss的路径
             url = prefixAli + "video/video" + sceneProEntity.getNum() + "/" + planId + ".mp4";
         }
         return url;
     }
 
+
+    @Override
+    public String downloadVideo(DownloadVideoParam downloadVideoParam) throws Exception {
+        String fileName = downloadVideoParam.getPlanId() + ".mp4";
+        String newFileName = downloadVideoParam.getPlanId() + Constant.SCENE_VIDEO_SHARE_SUFFIX +".mp4";
+        String url = prefixAli + "video/video" + downloadVideoParam.getSceneNum() + "/" + newFileName;
+
+        // oss下载原视频
+        String ossFile = "video/video" + downloadVideoParam.getSceneNum() + "/" + fileName;
+        String targetFile = ConstantFilePath.SCENE_PATH + "video/video" + downloadVideoParam.getSceneNum() + "/" + fileName;
+        CreateObjUtil.ossUtilCp(ossFile, targetFile);
+
+        // 生成水印视频
+        CreateObjUtil.generateShareVideo(targetFile);
+
+        // 上传到oss
+        uploadToOssUtil.uploadMulFilesV2(SceneOssFileEnum.VIDEO, downloadVideoParam.getSceneNum(), newFileName);
+
+        return url;
+    }
+
+
     @Override
     public Result uploadPanoramaOrVideo(String sceneNum, String fileName, String type, MultipartFile file, String planId) throws Exception {
         if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(fileName) || StringUtils.isEmpty(type) || StringUtils.isEmpty(planId)){
@@ -3872,4 +3802,55 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
         return Result.success();
     }
 
+    /**
+     * 操作球幕视频
+     * @param operaVideoDTO
+     * @throws Exception
+     */
+    @Override
+    public void operaVideo(OperaVideoParam operaVideoDTO) throws Exception {
+        SceneProEntity sceneProEntity = findBySceneNum(operaVideoDTO.getNum());
+        if(sceneProEntity == null){
+            throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(sceneProEntity.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf);
+
+        String strsceneInfos = FileUtils.readFile(dataBuffer + "scene.json");
+        JSONObject scenejson = new JSONObject();
+        if(strsceneInfos != null) {
+            scenejson = JSONObject.parseObject(strsceneInfos);
+        }
+
+        JSONObject object = putVideoDataToSceneJson(operaVideoDTO, scenejson);
+        FileUtils.writeFile(dataBuffer + "scene.json", scenejson.toString());
+
+        Map<String, String> uploadMap = new HashMap<>();
+        uploadMap.put(dataBuffer + "scene.json", dataBuf + "scene.json");
+        uploadToOssUtil.uploadMulFiles(uploadMap);
+
+        sceneProEntity.setVideos(object.toString());
+        update(sceneProEntity);
+    }
+
+
+    // todo
+    private JSONObject putVideoDataToSceneJson(OperaVideoParam operaVideoDTO, JSONObject scenejson) {
+        Object data = scenejson.get("data");
+        if (data == null || data instanceof JSONArray == false) {
+            throw new BaseRuntimeException("json数据data异常");
+        }
+        JSONArray jsonArray = (JSONArray) data;
+        Object jsonObj = jsonArray.stream().filter(j -> operaVideoDTO.getId().equals(((JSONObject)j).get("id")))
+                .findAny().orElseThrow(() -> new BaseRuntimeException("json数据data里找不到对应记录"));
+
+        ((JSONObject)jsonObj).put("show", operaVideoDTO.getShow());
+        return ((JSONObject)jsonObj);
+    }
+
 }

+ 19 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/util/CreateObjUtil.java

@@ -4,6 +4,7 @@ import com.fdkankan.base.proto.BigSceneProto.binary_mesh;
 import com.fdkankan.base.proto.Common;
 import com.fdkankan.base.proto.Visionmodeldata;
 import com.fdkankan.base.proto.format.JsonFormat;
+import com.fdkankan.common.constant.Constant;
 import com.fdkankan.common.constant.ConstantCmd;
 import com.fdkankan.common.constant.ConstantFileName;
 import com.google.protobuf.TextFormat;
@@ -39,6 +40,24 @@ public class CreateObjUtil{
 		log.info("转换完毕:" + command);
 	}
 
+	/**
+	 * 生成水印视频
+	 * @param folderName
+	 * @param isModel
+	 * @throws Exception
+	 */
+	public static void generateShareVideo(String videoPath) throws Exception{
+		log.info("生成水印视频开始");
+		String fileName = videoPath.substring(videoPath.lastIndexOf("/"));
+		String fileFolderPath = videoPath.substring(0, videoPath.lastIndexOf("/") + 1);
+		String command = "4dage-ffmpeg-rotVwatermark -s " + videoPath
+				+ " -w " + Constant.WATER_MARK_PATH
+				+ " -n " + fileName + Constant.SCENE_VIDEO_SHARE_SUFFIX
+				+ " -o" + fileFolderPath;
+		callshell(command);
+		log.info("生成水印视频结束");
+	}
+
 
 	public static void convertDamToLzma(String folderName)throws Exception
 	{

+ 31 - 0
4dkankan-scene/src/main/java/com/fdkankan/scene/vo/DownlVideoVO.java

@@ -0,0 +1,31 @@
+package com.fdkankan.scene.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+/**
+ * @author Admin
+ */
+@Data
+@ApiModel("下载球幕视频出参")
+@NoArgsConstructor
+public class DownlVideoVO {
+
+
+    public DownlVideoVO(String url) {
+        fileUrl = url + "?t=" + System.currentTimeMillis();
+        fileName = url.substring(url.lastIndexOf("/") + 1);
+    }
+
+    @ApiModelProperty("fileUrl")
+    private String fileUrl;
+
+
+    @ApiModelProperty("fileName")
+    private String fileName;
+
+}

+ 4 - 0
4dkankan-web/pom.xml

@@ -37,6 +37,10 @@
             <groupId>com.fdkankan</groupId>
             <artifactId>4dkankan-scene</artifactId>
         </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.hibernate</groupId>-->
+<!--            <artifactId>hibernate-validator</artifactId>-->
+<!--        </dependency>-->
     </dependencies>
 
     <distributionManagement>

+ 14 - 0
4dkankan-web/src/main/java/com/fdkankan/web/aop/CheckScene.java

@@ -0,0 +1,14 @@
+package com.fdkankan.web.aop;
+
+import java.lang.annotation.*;
+
+/**
+ *  检查场景是否允许更改
+ * @author Admin
+ */
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface CheckScene {
+    String description() default "";
+}

+ 67 - 0
4dkankan-web/src/main/java/com/fdkankan/web/aop/CheckSceneAspect.java

@@ -0,0 +1,67 @@
+package com.fdkankan.web.aop;
+
+import com.fdkankan.common.exception.BaseRuntimeException;
+import com.fdkankan.common.vo.request.RequestScene;
+import com.fdkankan.scene.entity.SceneProEntity;
+import com.fdkankan.scene.enums.SceneProEnum;
+import com.fdkankan.scene.service.ISceneProService;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+/**
+ * 查看场景信息,进行拦截
+ * @author Admin
+ */
+@Log4j2
+@Aspect
+@Component
+@Order(3)
+public class CheckSceneAspect {
+
+	@Autowired
+	private ISceneProService sceneProService;
+
+
+	@Pointcut("@annotation(com.fdkankan.web.aop.CheckScene)")
+	public void checkSceneAspect() {
+	}
+
+	/**
+	 * 前置通知 用于拦截Controller层记录用户的操作
+	 *
+	 * @param joinPoint
+	 *            切点
+	 * @throws IOException
+	 */
+	@Before("checkSceneAspect()")
+	public void doBefore(JoinPoint joinPoint) throws Exception {
+		Object[] objects = joinPoint.getArgs();
+		if (objects.length == 0) {
+			throw new BaseRuntimeException("缺少场景码参数");
+		}
+		RequestScene requestScene = (RequestScene) objects[0];
+		if (requestScene == null || StringUtils.isEmpty(requestScene.getSceneNum())) {
+			throw new BaseRuntimeException("缺少场景码参数");
+		}
+
+		SceneProEntity param = new SceneProEntity();
+		param.setNum(requestScene.getSceneNum());
+		SceneProEntity result = sceneProService.findOne(param);
+		if (result == null) {
+			throw new BaseRuntimeException("场景不存在");
+		}
+		if (result.getStatus().equals(SceneProEnum.StatusEnum.AUDITED.getKey())) {
+			throw new BaseRuntimeException("该场景已上线,不可编辑");
+		}
+	}
+
+}

+ 33 - 0
4dkankan-web/src/main/java/com/fdkankan/web/config/WebConfig.java

@@ -0,0 +1,33 @@
+package com.fdkankan.web.config;
+
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
+
+
+/**
+ * validate参数校验默认的是一个参数校验失败后,还会继续校验后面的参数
+ * 通过这个配置改成:校验参数时只要出现校验失败的情况,就立即抛出对应的异常,结束校验,不再进行后续的校验
+ */
+//@Configuration
+public class WebConfig {
+
+//    @Bean
+//    public Validator validator() {
+//        ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
+//                .configure()
+//                //failFast的意思只要出现校验失败的情况,就立即结束校验,不再进行后续的校验。
+//                .failFast(true)
+//                .buildValidatorFactory();
+//        return validatorFactory.getValidator();
+//    }
+//
+//    @Bean
+//    public MethodValidationPostProcessor methodValidationPostProcessor() {
+//        MethodValidationPostProcessor methodValidationPostProcessor = new MethodValidationPostProcessor();
+//        methodValidationPostProcessor.setValidator(validator());
+//        return methodValidationPostProcessor;
+//    }
+
+}

+ 26 - 18
4dkankan-web/src/main/java/com/fdkankan/web/controller/SceneController.java

@@ -10,6 +10,7 @@ import com.fdkankan.common.api.BaseController;
 import com.fdkankan.common.constant.ConstantFilePath;
 import com.fdkankan.common.exception.BaseRuntimeException;
 import com.fdkankan.common.model.Result;
+import com.fdkankan.common.model.ViewResult;
 import com.fdkankan.common.util.*;
 import com.fdkankan.common.vo.request.RequestScene;
 import com.fdkankan.common.vo.response.ResponseScene;
@@ -19,6 +20,7 @@ import com.fdkankan.scene.feign.PanoFeign;
 import com.fdkankan.scene.service.*;
 import com.fdkankan.scene.util.CreateObjUtil;
 import com.fdkankan.scene.util.ComputerUtil;
+import com.fdkankan.web.aop.CheckScene;
 import com.fdkankan.web.aop.WebControllerLog;
 import com.github.pagehelper.util.StringUtil;
 import io.swagger.annotations.Api;
@@ -35,12 +37,14 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
 import springfox.documentation.annotations.ApiIgnore;
+import tk.mybatis.mapper.entity.Condition;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.List;
 
 @Log4j2
 @Api(tags = "场景管理")
@@ -125,6 +129,8 @@ public class SceneController extends BaseController {
         return Result.success(sceneProService.getAllSceneByPage(param));
     }
 
+
+
     /**
      * 删除场景
      */
@@ -133,6 +139,7 @@ public class SceneController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "id", dataType = "String", required = true)})
     @WebControllerLog(description = "VR模型---删除VR模型")
+    @CheckScene
     public Result delete(@RequestBody RequestScene param, HttpServletRequest request) throws Exception{
         if(param.getId() == null){
             throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
@@ -551,11 +558,9 @@ public class SceneController extends BaseController {
     @ApiOperation("是否已登录")
     @RequestMapping(value = "/isLogin", method = RequestMethod.POST)
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "token", value = "用户token", dataType = "String"),
-            @ApiImplicitParam(name = "num", value = "场景码", dataType = "String")})
-    public Result isLogin(HttpServletRequest request) throws Exception{
-        String num = request.getParameter("num");
-        String token = request.getHeader("token");
+            @ApiImplicitParam(name = "token", value = "用户token", dataType = "String", required = true),
+            @ApiImplicitParam(name = "num", value = "场景码", dataType = "String", required = true)})
+    public ViewResult isLogin(@RequestParam String token, @RequestParam String num) throws Exception{
         if(StringUtil.isEmpty(num) ){
             throw new BaseRuntimeException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
         }
@@ -565,6 +570,7 @@ public class SceneController extends BaseController {
         }
 
         String jsonStr = redisTemplate.opsForValue().get(request.getHeader("token"));
+
         JSONObject ssoUser = null;
         if (StringUtil.isNotEmpty(jsonStr)) {
             ssoUser = JSONObject.parseObject(jsonStr);
@@ -578,12 +584,8 @@ public class SceneController extends BaseController {
             throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
         }
 
-        if(sceneProEntity.getStatus() == 1){
-            throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5025, SceneConstant.FAILURE_MSG_5025);
-        }
-
         if("admin".equals(ssoUser.getString("roleKey")) || "group".equals(ssoUser.getString("roleKey"))){
-            return Result.success();
+            return ViewResult.success();
         }
 
         if(StringUtils.isEmpty(sceneProEntity.getDepartmentId()) ||
@@ -592,14 +594,7 @@ public class SceneController extends BaseController {
             throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
         }
 
-//        CameraEntity cameraEntity = cameraService.findById(sceneProEntity.getCameraId());
-//        if(cameraEntity == null || StringUtil.isEmpty(cameraEntity.getDepartmentId()) ||
-//                !cameraEntity.getDepartmentId().equals(ssoUser.getString("departmentId"))){
-//            log.info(ssoUser.getString("userName") + "该用户无权操作该场景:" + num);
-//            throw new BaseRuntimeException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
-//        }
-
-        return Result.success();
+        return ViewResult.success(sceneProEntity.getStatus());
 
     }
 
@@ -646,6 +641,7 @@ public class SceneController extends BaseController {
      */
     @ApiOperation("修改场景状态")
     @RequestMapping(value = "/statisticsPoints", method = RequestMethod.POST)
+    @CheckScene
     @ApiImplicitParams({
             @ApiImplicitParam(name = "sceneNum", value = "场景码", dataType = "String", required = true)
     })
@@ -670,4 +666,16 @@ public class SceneController extends BaseController {
     }
 
 
+    @ApiOperation("根据场景码数组查询符合的场景")
+    @RequestMapping(value = "/listScenesInNums", method = RequestMethod.POST)
+    public ViewResult<SceneProEntity> listScenesInNums(List<String> nums) throws Exception{
+        CameraEntity entity = null;
+        Condition condition = new Condition(SceneProEntity.class);
+        condition.createCriteria().andIn("num", nums);
+        List<CameraEntity> cameraEntityList = cameraService.findAll(condition);
+        List<SceneProEntity> scenes = sceneProService.findAll(condition);
+        return ViewResult.success(scenes);
+    }
+
+
 }

+ 51 - 2
4dkankan-web/src/main/java/com/fdkankan/web/controller/SceneEditController.java

@@ -1,5 +1,6 @@
 package com.fdkankan.web.controller;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.base.constant.LoginConstant;
 import com.fdkankan.base.constant.SceneConstant;
@@ -8,13 +9,18 @@ import com.fdkankan.common.api.BaseController;
 import com.fdkankan.common.constant.ConstantFilePath;
 import com.fdkankan.common.exception.BaseRuntimeException;
 import com.fdkankan.common.model.Result;
+import com.fdkankan.common.model.ViewResult;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.common.vo.request.RequestSceneEdit;
 import com.fdkankan.scene.entity.SceneProEntity;
 import com.fdkankan.scene.feign.PanoFeign;
+import com.fdkankan.scene.param.scene.DownloadVideoParam;
+import com.fdkankan.scene.param.scene.OperaVideoParam;
 import com.fdkankan.scene.service.ISceneProService;
 import com.fdkankan.scene.util.CreateObjUtil;
+import com.fdkankan.scene.vo.DownlVideoVO;
 import com.fdkankan.web.aop.CheckCurrentUser;
+import com.fdkankan.web.aop.CheckScene;
 import com.github.pagehelper.util.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -29,10 +35,11 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -1136,4 +1143,46 @@ public class SceneEditController extends BaseController {
         String planId = request.getParameter("planId");
         return sceneProService.deleteROIVideo(sceneNum, fileName, planId);
     }
+
+
+    @ApiOperation("控制球幕视频")
+    @CheckCurrentUser(description = "控制球幕视频")
+    @CheckScene
+    @PostMapping("/operaVideo")
+    public ViewResult operaVideo(@RequestBody OperaVideoParam operaVideoDTO) throws Exception{
+        sceneProService.operaVideo(operaVideoDTO);
+        return ViewResult.success();
+    }
+
+
+    @ApiOperation("下载球幕视频")
+    @CheckCurrentUser(description = "下载球幕视频")
+    @CheckScene
+    @GetMapping("/downloadVideo")
+    public ViewResult<DownlVideoVO> downloadVideo(DownloadVideoParam downloadVideoParam) throws Exception{
+        String url = sceneProService.downloadVideo(downloadVideoParam);
+        return ViewResult.success(new DownlVideoVO(url));
+    }
+
+
+    @ApiOperation(value = "", hidden = true)
+    @GetMapping("/test")
+    public ViewResult test() throws Exception{
+        String json = "{\"data\":[{\"blend_fov\":\"7\",\"id\":\"2\",\"value\":\"1.31156\"},{\"blend_fov\":\"7\",\"id\":\"4\",\"value\":\"0.890266\"}],\"upPath\":\"https://4dkk.4dage.com/data/datat-kryAqiX/Up.xml\",\"version\":3}";
+        JSONObject scenejson = JSONObject.parseObject(json);
+        System.out.println(scenejson);
+        Object data =  scenejson.get("data");
+        JSONArray jsonArray = (JSONArray) data;
+        Object jsonObj = jsonArray.stream().filter(j -> "2".equals(((JSONObject)j).get("id")))
+                .findAny().orElseThrow(() -> new BaseRuntimeException("json数据data里找不到对应记录"));
+
+        ((JSONObject)jsonObj).put("show", true);
+
+        System.out.println(scenejson);
+        return null;
+    }
+
+
+
+
 }

+ 37 - 0
4dkankan-web/src/main/java/com/fdkankan/web/controller/VrController.java

@@ -0,0 +1,37 @@
+package com.fdkankan.web.controller;
+
+import com.fdkankan.common.api.BaseController;
+import com.fdkankan.common.model.ViewResult;
+import com.fdkankan.common.util.RandomUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.UUID;
+
+/**
+ * @author Admin
+ */
+@Log4j2
+@Api(tags = "vr带客看房")
+@RestController
+@RequestMapping("/api/vr")
+public class VrController extends BaseController {
+
+    @ApiOperation("获取房号id")
+    @GetMapping("/createRoomId")
+    public ViewResult createRoomId () {
+        return ViewResult.success(RandomUtil.generateOnlyStringLongUuid());
+    }
+
+//    @ApiOperation("获取")
+//    @PostMapping("/test")
+//    public void test(@Valid @RequestBody TestDTO testDTO) {
+//        System.out.println("");
+//    }
+
+
+}

+ 7 - 1
pom.xml

@@ -80,7 +80,7 @@
 
         <jackson.version>2.10.1</jackson.version>
         <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
-        <javax-validation.version>2.0.1.Final</javax-validation.version>
+        <javax-validation.version>1.1.0.Final</javax-validation.version>
         <jedis.version>2.9.0</jedis.version>
         <joda-time.version>2.9.9</joda-time.version>
         <jjwt.version>0.6.0</jjwt.version>
@@ -114,6 +114,7 @@
 
         <zxing.version>2.1</zxing.version>
         <nacos-config-spring-boot.version>0.2.1</nacos-config-spring-boot.version>
+        <hibernate-validator.version>5.2.0.Final</hibernate-validator.version>
     </properties>
 
     <dependencyManagement>
@@ -521,6 +522,11 @@
                 <artifactId>validation-api</artifactId>
                 <version>${javax-validation.version}</version>
             </dependency>
+<!--            <dependency>-->
+<!--                <groupId>org.hibernate</groupId>-->
+<!--                <artifactId>hibernate-validator</artifactId>-->
+<!--                <version>${hibernate-validator.version}</version>-->
+<!--            </dependency>-->
             <dependency>
                 <groupId>org.springframework</groupId>
                 <artifactId>spring-test</artifactId>

+ 11 - 0
sql/2021年7月版/1创建看房统计表.sql

@@ -0,0 +1,11 @@
+CREATE TABLE `t_room_view` (
+  `id` varchar(20) NOT NULL,
+  `vr_id` varchar(28) NOT NULL COMMENT 'vr项目id,对应tm_house.id',
+  `room_id` varchar(32) NOT NULL COMMENT '房号id,对应看房那边uuid',
+  `user_id` varchar(20) NOT NULL COMMENT '用户id,对应t_user.id',
+  `user_type` varchar(10) NOT NULL DEFAULT 'customer' COMMENT '用户类型,customer(看房人)/agent(经纪人)',
+  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+  `is_delete` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '记录的状态,0: 生效,1: 禁用',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='看房统计表';