瀏覽代碼

获取场景详情接口

dengsixing 3 年之前
父節點
當前提交
cf4a4a7aec

+ 5 - 5
4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/SceneController.java

@@ -5,9 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.scene.service.*;
-import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
-import com.fdkankan.scene.vo.SceneParamVO;
-import com.fdkankan.scene.vo.SceneVO;
+import com.fdkankan.scene.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -36,6 +34,8 @@ public class SceneController {
     IVideoSceneProgressService videoSceneProgressService;
     @Autowired
     IPicSceneProgressService picSceneProgressService;
+    @Autowired
+    ISceneEditInfoService sceneEditInfoService;
 
 
 //    /**
@@ -50,8 +50,8 @@ public class SceneController {
      * 获取场景详情
      */
     @PostMapping(value = "/getInfo")
-    public SceneVO getInfo(@RequestBody SceneParamVO param){
-        return sceneProService.getInfo(param.getSceneNum());
+    public SceneInfoVO getInfo(@RequestBody SceneInfoParamVO param){
+        return sceneEditInfoService.getSceneInfo(param);
     }
 
     /**

+ 3 - 3
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneEditInfoService.java

@@ -3,9 +3,7 @@ package com.fdkankan.scene.service;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.scene.entity.SceneEditInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.fdkankan.scene.vo.SceneEditInfoParamVO;
-import com.fdkankan.scene.vo.SceneEditInfoVO;
-import com.fdkankan.scene.vo.SceneEditParamVO;
+import com.fdkankan.scene.vo.*;
 import org.springframework.web.bind.annotation.RequestBody;
 
 /**
@@ -24,4 +22,6 @@ public interface ISceneEditInfoService extends IService<SceneEditInfo> {
 
     ResultData publicScene(SceneEditInfoParamVO param) throws Exception;
 
+    SceneInfoVO getSceneInfo(SceneInfoParamVO param);
+
 }

+ 24 - 4
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -21,10 +21,7 @@ import com.fdkankan.scene.service.ISceneEditControlsService;
 import com.fdkankan.scene.service.ISceneEditInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.scene.service.ISceneProService;
-import com.fdkankan.scene.vo.SceneEditControlsVO;
-import com.fdkankan.scene.vo.SceneEditInfoParamVO;
-import com.fdkankan.scene.vo.SceneEditInfoVO;
-import com.fdkankan.scene.vo.SceneEditParamVO;
+import com.fdkankan.scene.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -137,4 +134,27 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         return ResultData.ok();
     }
 
+    @Override
+    public SceneInfoVO getSceneInfo(SceneInfoParamVO param) {
+        //如果是查看页面请求,查redis
+        if(Objects.isNull(param.getReqType()) || param.getReqType() == 2){
+            String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, param.getNum()));
+            SceneInfoVO sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
+            return sceneInfoVO;
+        }
+
+        //如果是编辑页面请求,查数据库
+        ScenePro scenePro = sceneProService.findBySceneNum(param.getNum());
+        if(Objects.isNull(scenePro)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+        SceneEditInfo sceneEditInfo = this.getBySceneProId(scenePro.getId());
+        SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
+        SceneInfoVO sceneInfoVO = BeanUtil.copyProperties(sceneEditInfo, SceneInfoVO.class);
+        sceneInfoVO.setControls(BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class));
+        sceneInfoVO.setNum(param.getNum());
+
+        return sceneInfoVO;
+    }
+
 }

+ 37 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneInfoParamVO.java

@@ -0,0 +1,37 @@
+package com.fdkankan.scene.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneInfoParamVO {
+
+    /**
+     * 场景码
+     */
+    @NotBlank(message = "场景码不能为空")
+    private String num;
+
+    /**
+     * 请求来源,1-代表编辑页面,2-代表查看页面,默认查看页面
+     */
+    private Byte reqType;
+
+
+}

+ 87 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java

@@ -0,0 +1,87 @@
+package com.fdkankan.scene.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneInfoVO {
+
+    /**
+     * 场景码
+     */
+    private String num;
+
+    /**
+     * 地面logo名称
+     */
+    private String floorLogoName;
+
+    /**
+     * 地面logo上传地址
+     */
+    private String floorLogoPath;
+
+    /**
+     * 地面logo大小
+     */
+    private Integer floorLogoSize;
+
+    /**
+     * 背景音乐名称
+     */
+    private String musicName;
+
+    /**
+     * 背景音乐上传地址
+     */
+    private String musicPath;
+
+    /**
+     * 浏览密码
+     */
+    private String scenePassword;
+
+    /**
+     * 场景标题
+     */
+    private String title;
+
+    /**
+     * 场景描述
+     */
+    private String description;
+
+    private SceneEditControlsVO controls;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 点位数量
+     */
+    private Integer panoCount;
+
+    /**
+     * 球幕视频数量
+     */
+    private Integer videoCount;
+
+}