浏览代码

更新:
vr项目删除后,对场景编辑的检查

wuweihao 4 年之前
父节点
当前提交
c65adddb8e

+ 1 - 1
cms_pano_consumer/src/main/resources/application-pro.properties

@@ -58,7 +58,7 @@ oss.domain=https://vr-oss01.fcb.com.cn/
 #log
 logging.path=/home/tomcat/log/${project.name}_log
 logging.config=classpath:logback-spring.xml
-logging.level.com.gis=info
+logging.level.com.gis=debug
 
 
 # ÉÏ´«Îļþ±£´æÂ·¾¶

+ 1 - 1
cms_pano_consumer/src/main/resources/application-uat.properties

@@ -63,7 +63,7 @@ oss.domain=https://vr-web02-uat.fcb.com.cn/
 #log
 logging.path=/home/data/${project.name}_log
 logging.config=classpath:logback-spring.xml
-logging.level.com.gis=info
+logging.level.com.gis=debug
 
 
 # ÉÏ´«Îļþ±£´æÂ·¾¶

+ 22 - 0
cms_pano_fcb/gis_domain/src/main/java/com/gis/domain/dto/UseHotsDto.java

@@ -0,0 +1,22 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+/**
+ * Created by owen on 2021/2/25 0025 18:32
+ */
+
+@Data
+public class UseHotsDto {
+
+    @NotBlank(message = "全景id能为空")
+    @ApiModelProperty(value = "id", required = true)
+    private String id;
+
+    @ApiModelProperty(value = "场景关联的场景码, 多个以逗号隔开")
+    private List sceneCodes;
+}

+ 5 - 0
cms_pano_fcb/gis_domain/src/main/java/com/gis/domain/entity/SceneEntity.java

@@ -5,7 +5,9 @@ import lombok.Data;
 
 import javax.persistence.Entity;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 import java.io.Serializable;
+import java.util.List;
 
 @Data
 @Entity
@@ -79,5 +81,8 @@ public class SceneEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value =  "初始视觉")
     private String initVisual;
 
+    @ApiModelProperty(value =  "热点关联场景, 场景码,允许多个以逗号隔开")
+    private String useHots;
+
 
 }

+ 5 - 1
cms_pano_fcb/gis_mapper/src/main/java/com/gis/mapper/SceneMapper.java

@@ -34,6 +34,9 @@ public interface SceneMapper extends IBaseMapper<SceneEntity, String> {
     @Select("select * from tb_scene where is_delete = 0 and scene_code = #{sceneCode}")
     SceneEntity findBySceneCode(String sceneCode);
 
+    @Select("select * from tb_scene where is_delete = 0 and scene_code = #{sceneCode}")
+    List<SceneEntity> listFindBySceneCode(String sceneCode);
+
     @Select("select * from tb_scene where is_delete = 0 and vr_model_id = #{vrModelId}")
     SceneEntity findByVrModelId(String vrModelId);
 
@@ -77,5 +80,6 @@ public interface SceneMapper extends IBaseMapper<SceneEntity, String> {
     @Select("select * from tb_scene where is_delete = 0 and id = #{id} for update")
     SceneEntity findByIdForUpdate(String id);
 
-
+    @Select("select * from tb_scene where is_delete = 0 and house_id = #{houseId} and use_hots like #{sceneCode}")
+    List<SceneEntity> searchUseHots(String houseId, String sceneCode);
 }

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

@@ -7,6 +7,7 @@ import com.gis.domain.dto.*;
 import com.gis.domain.entity.SceneEntity;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
 import java.util.Map;
 
 
@@ -36,6 +37,8 @@ public interface SceneService extends IBaseService<SceneEntity, String> {
 
     SceneEntity findBySceneCode(String sceneCode);
 
+    List<SceneEntity> listFindBySceneCode(String sceneCode);
+
     Result findRoom(String houseId);
 
     Result editSomeData(EditSomeDataDto param);
@@ -59,4 +62,8 @@ public interface SceneService extends IBaseService<SceneEntity, String> {
 //    Result checkStatus(String houseId, String status);
 
     JSONObject jsonSearch(ScenePageDto param);
+
+    Result saveUseHots(UseHotsDto param);
+
+    List<SceneEntity> searchUseHots(String houseId, String sceneCode);
 }

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

@@ -3,7 +3,9 @@ package com.gis.service.impl;
 import cn.hutool.core.io.FileTypeUtil;
 import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.gis.common.constant.ConfigConstant;
 import com.gis.common.constant.RabbitConfig;
 import com.gis.common.task.AsyncTask;
@@ -242,7 +244,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 
         if (result.getCode() == -1){
             log.error("VR项目接口查询失败:" + result.getMsg() );
-            return Result.failure("VR项目接口查询失败");
+            return Result.failure(7007, "VR项目接口查询失败");
         }
 
         return null;
@@ -297,6 +299,29 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
         return result;
     }
 
+    @Override
+    public Result saveUseHots(UseHotsDto param) {
+        String id = param.getId();
+        SceneEntity entity = this.findById(id);
+        if (entity == null) {
+            log.info("对象不存在:" + id);
+            return Result.failure("对象不存在");
+
+        }
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("data", param.getSceneCodes());
+        entity.setUseHots(jsonObject.toJSONString());
+        entity.setUpdateTime(new Date());
+        this.update(entity);
+        return Result.success() ;
+    }
+
+    @Override
+    public List<SceneEntity> searchUseHots(String houseId, String sceneCode) {
+        sceneCode = "%"+sceneCode+"%";
+        return entityMapper.searchUseHots(houseId, sceneCode);
+    }
+
 
     /**
      * 检查是否有计算中的场景
@@ -912,6 +937,11 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
     @Override
+    public List<SceneEntity> listFindBySceneCode(String sceneCode) {
+        return entityMapper.listFindBySceneCode(sceneCode);
+    }
+
+    @Override
     public Result findRoom(String houseId) {
         return null;
     }

+ 1 - 1
cms_pano_fcb/gis_web/src/main/java/com/gis/web/controller/HouseController.java

@@ -48,7 +48,7 @@ public class HouseController extends BaseController {
             @ApiImplicitParam(name = "houseId", value = "房源id", dataType = "String", required = true),
             @ApiImplicitParam(name = "status", value = "状态, 1:计算中", dataType = "String"),
     })
-    @ApiOperation(value = "提审检查场景状态")
+    @ApiOperation(value = "提审检查场景状态", notes = "检查是否有计算中的场景")
     @GetMapping("checkStatus/{houseId}/{status}")
     public Result checkStatus(@PathVariable String houseId, @PathVariable String status) {
         log.info("提审检查场景状态");

+ 38 - 23
cms_pano_fcb/gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
+import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -43,16 +44,12 @@ public class SceneController extends BaseController {
     @Autowired
     private SceneMapper sceneMapper;
 
-    /**
-     * 改VR项目有计算中的模型,允许轮询,否则停止轮询
-     * 30s 轮询一次
-     */
-//    @WebControllerLog(description = "场景管理-场景列表")
-//    @ApiOperation(value = "场景列表", position = 1)
-//    @PostMapping("list")
-//    public Result list(@RequestBody ScenePageDto param) {
-//        return sceneService.search(param);
-//    }
+
+    @ApiOperation(value = "保存关联场景热点", position = 1, notes = "sceneCodes:场景关联的场景码")
+    @PostMapping("save/useHots")
+    public Result saveUseHots(@Valid @RequestBody UseHotsDto param) {
+        return sceneService.saveUseHots(param);
+    }
 
     /**
      * 改VR项目有计算中的模型,允许轮询,否则停止轮询
@@ -112,7 +109,7 @@ public class SceneController extends BaseController {
     }
 
     @WebControllerLog(description = "场景管理-编辑场景")
-    @ApiOperation(value = "VR项目修改", position = 3)
+    @ApiOperation(value = "VR项目修改", position = 3, notes = "修改VR项目的基础信息")
     @PostMapping("house/edit")
     public Result editHouse(@Valid @RequestBody EditHouseDto param) {
         return sceneService.editHouse(param);
@@ -137,7 +134,7 @@ public class SceneController extends BaseController {
     }
 
     @WebControllerLog(description = "场景管理-VR项目删除")
-    @ApiOperation(value = "VR项目删除", position = 3)
+    @ApiOperation(value = "VR项目删除", position = 3, notes = "删除VR项目时,把相应场景设置为删除状态")
     @GetMapping("house/remove/{houseId}")
     public Result houseRemove(@PathVariable String houseId) {
         log.info("VR项目删除: " + houseId);
@@ -177,7 +174,7 @@ public class SceneController extends BaseController {
             @ApiImplicitParam(name = "type", value = "场景类型, 楼盘:building, 园林:garden, 户型:house", dataType = "String", required = true),
             @ApiImplicitParam(name = "status", value = "状态 3:成功", dataType = "String", required = true)
     })
-    @ApiOperation(value = "获取场景码列表", position = 3)
+    @ApiOperation(value = "获取场景码列表", position = 3, notes = "把VR项目相应的计算成功的场景码返回给恒大管理后台")
     @GetMapping("getVrSceneCode/{houseId}/{status}/{type}")
     public Result getVrSceneCode(@PathVariable String houseId, @PathVariable String status, @PathVariable String type) {
         log.info("获取场景码列表");
@@ -189,13 +186,19 @@ public class SceneController extends BaseController {
     @GetMapping("house/detail/{houseId}")
     public Result houseDetail(@PathVariable String houseId) {
         log.info("房源详情");
-        return houseFeign.findByHouseId(houseId);
+        Result result = houseFeign.findByHouseId(houseId);
+        int code = result.getCode();
+        if (code == -1) {
+            log.info("房源不存在: " + houseId);
+            return Result.failure(7007, "房源不存在");
+        }
+        return result;
     }
 
     /**
      * 提供恒大管理后台使用
      */
-    @ApiOperation(value = "房源首页批量获取", position = 3)
+    @ApiOperation(value = "房源首页批量获取", position = 3, notes = "获取所有VR项目的首页场景链接")
     @PostMapping("house/findAllHouseId")
     public Result findAllHouseId(@RequestBody HouseIndexPageDto param) {
         log.info("房源首页批量获取");
@@ -208,7 +211,7 @@ public class SceneController extends BaseController {
      * @param param
      * @return
      */
-    @ApiOperation(value = "VR模型查找", position = 3)
+    @ApiOperation(value = "VR模型查找", position = 3, notes = "获取四维看看计算成功的场景信息")
     @PostMapping("findVrModel")
     public Result findVrModel(@Valid @RequestBody SceneRroPageDto param) {
         log.info("VR模型查找");
@@ -220,13 +223,15 @@ public class SceneController extends BaseController {
      * @param sceneCode
      * @return
      */
-    @ApiOperation(value = "VR模模型-根据场景码查询")
+    @ApiOperation(value = "VR模模型-根据场景码查询", notes = "提供给四维看看,判断是否在720yun中使用此场景,true:有,四维看看不能删除此场景; false:可以删除")
     @GetMapping(value = "fdkk/findBySceneCode")
     public Result vrFindBySceneCode(String sceneCode) {
         log.info("VR模模型-根据场景码查询: " + sceneCode);
-        SceneEntity entity = sceneService.findBySceneCode(sceneCode);
+        // 此方法建议把返回值改回list值会更安全
+        List<SceneEntity> list = sceneService.listFindBySceneCode(sceneCode);
+        log.info("使用中的VR模型数量:" + list.size());
         boolean flag = true;
-        if (entity == null) {
+        if (list.isEmpty()) {
             flag = false;
         }
         log.info("查询结果: " + flag);
@@ -249,7 +254,7 @@ public class SceneController extends BaseController {
     })
     public Result saveIndex(@RequestParam String sceneId, @RequestParam String icon) {
         log.info("保存初始画面");
-//        SceneEntity entity = sceneService.findb(sceneId);
+        // forUpdate:数据一致新问题
         SceneEntity entity = sceneMapper.findByIdForUpdate(sceneId);
         if (entity == null) {
             log.error("对象不存在: {}", sceneId);
@@ -265,7 +270,7 @@ public class SceneController extends BaseController {
     }
 
 
-    @ApiOperation("编辑xml")
+    @ApiOperation(value = "编辑xml", notes = "设置初始角度")
     @PostMapping("editXml")
     public Result editXml(@Valid @RequestBody XmlDataDto param) {
 
@@ -286,7 +291,7 @@ public class SceneController extends BaseController {
 
 
     @WebControllerLog(description = "场景管理-场景删除")
-    @ApiOperation("场景删除")
+    @ApiOperation(value = "场景删除", notes = "判断VR项目关联场景、关联热点等判断")
     @GetMapping("removes/{id}")
     public Result remove(@PathVariable String id) {
         log.info("场景删除");
@@ -295,11 +300,21 @@ public class SceneController extends BaseController {
             return Result.failure(7004, "执行中的任务不能删除");
 
         }
+        String sceneCode = entity.getSceneCode();
+        String houseId = entity.getHouseId();
+
+        // 查询热点关联场景
+        List<SceneEntity> list = sceneService.searchUseHots(houseId, sceneCode);
+        log.info("关联热点场景数量: " +list.size());
+        if (list.size() > 0) {
+            return Result.failure(7008, "有关联热点场景使用此场景,不能删除");
+        }
+
         entity.setIsDelete(1);
         // 设置场景为0
         entity.setIsIndex(0);
         entity.setUpdateTime(new Date());
-        String houseId = entity.getHouseId();
+
         sceneService.update(entity);
 
         boolean flag = false;

+ 10 - 0
cms_pano_fcb/remark.md

@@ -93,6 +93,7 @@ sit:
    
    -   alter table tb_scene add sort int(11) DEFAULT 100; (已更新)
    -   alter table tb_scene add init_visual varchar(255) ; (已更新)
+   -   alter table tb_scene add use_hots longtext COMMENT '热点关联场景, 场景码允许多个以逗号隔开';
    
    测试切图工具命令
    krpanotools makepano -config=templates/vtour-multires.config /mnt/cms_pano_fcb_data/test/test.jpg
@@ -123,6 +124,15 @@ sit:
    进入mysql : mysql -h 10.71.184.146 -u user_4dkankan_rw -p
    密码: y2b9a42wRwGNKkJjCm1o
    
+   sql:
+   select id,house_id,scene_title,is_delete,is_index,scene_code from tb_scene where is_delete=0 and scene_code='';
+   
+   大写\G 格式化结果
+   select id,house_id,scene_title,is_delete,is_index,scene_code from tb_scene where is_delete=0 and house_id='' \G;
+   
+   // VR项目表
+   select id, house_title from tb_scene where is_delete=0 and id='' \G;
+   
    web: 
    https://vr-web01-uat.fcb.com.cn/evergrande/#/login
     https://vr-web01-uat.fcb.com.cn/