Преглед изворни кода

更新:
dev 修复删除场景时需要检查vr项目状态

wuweihao пре 4 година
родитељ
комит
182a8b2211

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

@@ -72,4 +72,6 @@ public interface SceneService extends IBaseService<SceneEntity, String> {
     SceneEntity findByHouseIdAndSceneCode(String houseId, String sceneCode);
 
     Result editAgent(AgentDto param);
+
+    Result remove(String id);
 }

+ 73 - 49
cms_pano_fcb/gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java

@@ -90,7 +90,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 
         // 文件名不能为空
         String originalFilename = file.getOriginalFilename();
-        originalFilename = StringUtils.substringBeforeLast(originalFilename,".");
+        originalFilename = StringUtils.substringBeforeLast(originalFilename, ".");
         if (StringUtils.isAllBlank(originalFilename)) {
             return Result.failure("文件名不能为空");
         }
@@ -163,7 +163,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
             // 压缩图片并上传oss
             // 全景图缩略图统一命名规则: http:// oss/cms_pano_fcb/image/thumb_sceneCode.jpg
             String iconPath = convertAndUploadOss(
-                    panoPath, configConstant.filePath, configConstant.ossBasePath, configConstant.ossDomain, 600, 300, "image/thumb_"+sceneCode+".jpg");
+                    panoPath, configConstant.filePath, configConstant.ossBasePath, configConstant.ossDomain, 600, 300, "image/thumb_" + sceneCode + ".jpg");
             log.info("iconPath:" + iconPath);
             entity.setIcon(iconPath);
             entity.setStatus(1);
@@ -177,7 +177,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
             entity.setSceneTitle(entity.getFileName());
 
             // /hengda.html?m=场景码&prodId=房车宝楼盘ID&houseId=自己维护的楼盘ID
-            String webSite = "/hengda.html?m="+ sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
+            String webSite = "/hengda.html?m=" + sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
             log.info("webSite: " + webSite);
             entity.setWebSite(webSite);
 
@@ -187,7 +187,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
             rabbitTemplate.convertAndSend(RabbitConfig.PANO_EXCHANGE, RabbitConfig.PANO_QUEUE_ROUTING, entity.getId());
             log.info("全景图入队成功: 场景码:{},场景id:{} ", sceneCode, entity.getId());
 
-        }  catch (Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         log.info("全景图上传完成:{}", sceneCode);
@@ -198,13 +198,14 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     /**
      * 2021-04-27
      * 使用convert 生成缩略图
+     *
      * @param inputFilePath
      * @param ossBasePath
      * @param ossDomain
      * @return
      */
-    public  String convertAndUploadOss(
-            String inputFilePath, String serverBasePath, String ossBasePath, String ossDomain, Integer width, Integer height, String fileName){
+    public String convertAndUploadOss(
+            String inputFilePath, String serverBasePath, String ossBasePath, String ossDomain, Integer width, Integer height, String fileName) {
 
         // 保存图片位置
         String saveCompressImgPath = serverBasePath + fileName;
@@ -222,7 +223,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 
             if (FileUtil.isFile(saveCompressImgPath)) {
                 // 上传oss
-                String ossPath = ossBasePath  + fileName;
+                String ossPath = ossBasePath + fileName;
                 log.info("ossPath: " + ossPath);
                 asyncTask.uploadOss(saveCompressImgPath, ossPath);
                 ossUrl = ossDomain + ossPath;
@@ -239,15 +240,15 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
     /**
      * 查询VR项目是否可编辑
      * true: 可编辑
      * false: 不可编辑
+     *
      * @param houseId
      * @return
      */
-    private boolean canEdit(String houseId){
+    private boolean canEdit(String houseId) {
         Result result = null;
         try {
             result = houseFeign.canEdit(houseId);
@@ -259,14 +260,12 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
                     return true;
                 } else {
                     log.info("vr项目不可编辑");
-//                    throw new BaseRuntimeException(7005, "VR项目不可编辑");
                     return false;
                 }
 
             } else {
-                log.error("VR项目接口查询失败:" + result.getMsg() );
+                log.error("VR项目接口查询失败:" + result.getMsg());
                 throw new BaseRuntimeException(7007, "VR项目接口查询失败");
-//                return Result.failure(7007, "VR项目接口查询失败");
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -310,15 +309,13 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 //    }
 
 
-
-
     @Override
     public Result search(ScenePageDto param) {
         startPage(param);
         List<SceneEntity> search = null;
 
-            // TODO: 2021/1/8 0008 调用720云数据
-            search = entityMapper.search(param);
+        // TODO: 2021/1/8 0008 调用720云数据
+        search = entityMapper.search(param);
         PageInfo<SceneEntity> page = new PageInfo<>(search);
         log.info("page size: " + page.getSize());
         log.info("page total: " + page.getTotal());
@@ -364,7 +361,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 
         // 使用foreach遍历,for循环容易导致数据有误
         if (!list.isEmpty()) {
-            for (SceneEntity sceneEntity: list) {
+            for (SceneEntity sceneEntity : list) {
                 String byType = sceneEntity.getByType();
                 String sceneCode = sceneEntity.getSceneCode();
                 String houseId = sceneEntity.getHouseId();
@@ -394,27 +391,22 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
     @Override
     public Result saveGardenVrModel(GardenVrModelDto param) {
         String id = param.getId();
-        log.info("id: "+ id);
+        log.info("id: " + id);
 
         // 检查VR项目状态
         String houseId = param.getHouseId();
-//        Result resStatus =  canEdit(houseId);
-//        if (resStatus != null) {
-//            return resStatus;
-//        }
         if (!canEdit(houseId)) {
             log.error("VR项目不可编辑");
             return Result.failure(7005, "VR项目不可编辑");
         }
         SceneEntity entity = null;
 
-        if ( id == null) {
+        if (id == null) {
             entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), param.getHouseId());
-            if (entity != null){
+            if (entity != null) {
                 log.error("VrModelId已存在");
                 return Result.failure(3001, "场景码已存在, 不能重复添加");
             }
@@ -423,7 +415,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 
             @NotBlank(message = "场景码不能为空") String sceneCode = param.getSceneCode();
             @NotBlank(message = "恒大id不能为空") String hengdaId = param.getHengdaId();
-            String webSite = "/hengda.html?m="+ sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
+            String webSite = "/hengda.html?m=" + sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
 
 
             BeanUtils.copyProperties(param, entity);
@@ -465,12 +457,52 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
         if (entity == null) {
             return Result.failure("场景不存在:" + id);
         }
+
+        // 检查VR项目状态
+        String houseId = entity.getHouseId();
+        if (!canEdit(houseId)) {
+            log.error("VR项目不可编辑");
+            return Result.failure(7005, "VR项目不可编辑");
+        }
+
         entity.setAgentId(param.getAgentId());
         entity.setUpdateTime(new Date());
         this.update(entity);
         return Result.success();
     }
 
+    @Override
+    public Result remove(String id) {
+        SceneEntity entity = this.findById(id);
+        if (entity.getStatus() == 1) {
+            return Result.failure(7004, "执行中的任务不能删除");
+
+        }
+        String sceneCode = entity.getSceneCode();
+        String houseId = entity.getHouseId();
+
+        // 检查VR项目状态
+        if (!canEdit(houseId)) {
+            log.error("VR项目不可编辑");
+            return Result.failure(7005, "VR项目不可编辑");
+        }
+
+        // 查询热点关联场景
+        List<SceneEntity> list = this.searchUseHots(houseId, sceneCode);
+        log.info("关联热点场景数量: " + list.size());
+        if (list.size() > 0) {
+            return Result.failure(7008, "有关联热点场景使用此场景,不能删除");
+        }
+
+        entity.setIsDelete(1);
+        entity.setUpdateTime(new Date());
+        this.update(entity);
+        // 处理初始场景
+        sceneInitService.removeByHouseIdAndSceneId(houseId, id);
+
+        return Result.success();
+    }
+
 
     @Override
     public Result saveUseHots(UseHotsDto param) {
@@ -486,20 +518,19 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
         entity.setUseHots(jsonObject.toJSONString());
         entity.setUpdateTime(new Date());
         this.update(entity);
-        return Result.success() ;
+        return Result.success();
     }
 
     @Override
     public List<SceneEntity> searchUseHots(String houseId, String sceneCode) {
-        sceneCode = "%"+sceneCode+"%";
+        sceneCode = "%" + sceneCode + "%";
         return entityMapper.searchUseHots(houseId, sceneCode);
     }
 
 
-
-
     /**
      * 检查是否有计算中的场景
+     *
      * @param houseId
      * @param status
      * @return true: 有, false:没有
@@ -514,7 +545,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
     @Override
     public Result findByHouseId(String houseId) {
         return Result.success(entityMapper.findByHouseId(houseId));
@@ -539,7 +569,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
             log.info("id: " + id);
             log.info("sort: " + sort);
             entityMapper.setSortById(id, sort);
-            n ++;
+            n++;
         }
 
         return Result.success();
@@ -549,7 +579,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     public Result getVrSceneCode(String houseId, String status, String type) {
         // 需要把状态 3:审查中, 4:审核通过的数据都返回
         List<String> vrSceneCode = entityMapper.getVrSceneCode(houseId, status, type);
-        log.info("返回给恒大管理后台数据: " +  vrSceneCode);
+        log.info("返回给恒大管理后台数据: " + vrSceneCode);
 
         return Result.success(vrSceneCode);
     }
@@ -604,11 +634,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
-
-
     /**
      * 添加VR模型
+     *
      * @return
      */
     @Override
@@ -618,7 +646,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
         // 只获取计算成功的, 0:计算成功
         param.setStatus("0");
         String searchKey = param.getSearchKey();
-        if (StringUtils.isNotBlank(searchKey)){
+        if (StringUtils.isNotBlank(searchKey)) {
             param.setSceneName(searchKey);
         }
 
@@ -668,11 +696,10 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
     @Override
     public Result saveVrModel(VrModelDto param) {
         String id = param.getId();
-        log.info("id: "+ id);
+        log.info("id: " + id);
 
         // 检查VR项目状态
         String houseId = param.getHouseId();
@@ -686,21 +713,20 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
         SceneEntity entity = null;
         @NotBlank(message = "场景码不能为空") String sceneCode = param.getSceneCode();
         @NotBlank(message = "恒大id不能为空") String hengdaId = param.getHengdaId();
-        String webSite = "/hengda.html?m="+ sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
-
+        String webSite = "/hengda.html?m=" + sceneCode + "&prodId=" + hengdaId + "&houseId=" + houseId;
 
 
-        if ( id == null) {
+        if (id == null) {
 
             // 一个VR项目不能有相同的户型
             List<SceneEntity> sceneEntities = entityMapper.findByHouseIdAndRoomId(houseId, roomId);
             if (sceneEntities.size() > 0) {
-                return Result.failure(MsgCode.e3002,"户型已存在,不能重复添加");
+                return Result.failure(MsgCode.e3002, "户型已存在,不能重复添加");
             }
 
             // 一个VR项目不能有相同的模型
-             entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), houseId);
-            if (entity != null){
+            entity = entityMapper.findByVrModelIdAndHouseId(param.getVrModelId(), houseId);
+            if (entity != null) {
                 log.error("VrModelId已存在");
                 return Result.failure(MsgCode.e3001, "场景码已存在, 不能重复添加");
             }
@@ -733,9 +759,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
 
 
     // 该VR项目下如果没有设置任何初始场景,把户型设置为默认初始场景
-    private void checkSceneInit(String houseId, String id){
+    private void checkSceneInit(String houseId, String id) {
         List<SceneInitEntity> list = sceneInitService.findByHouseId(houseId);
-        if (list.size() == 0){
+        if (list.size() == 0) {
             SceneInitEntity entity = new SceneInitEntity();
             entity.setId(RandomUtils.getUuid("init"));
             entity.setHouseId(houseId);
@@ -745,7 +771,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
     @Override
     public Result upload(MultipartFile file) {
 
@@ -788,7 +813,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, String> impl
     }
 
 
-
     @Override
     public SceneEntity findBySceneCode(String sceneCode) {
         return entityMapper.findBySceneCode(sceneCode);

+ 3 - 32
cms_pano_fcb/gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -149,7 +149,7 @@ public class SceneController extends BaseController {
     }
 
     @WebControllerLog(description = "场景管理-VR项目删除")
-    @ApiOperation(value = "VR项目删除", position = 3, notes = "删除VR项目时,把相应场景设置为删除状态")
+    @ApiOperation(value = "VR项目删除", position = 3, notes = "管理后台删除VR项目时,把相应场景设置为删除状态")
     @GetMapping("house/remove/{houseId}")
     public Result houseRemove(@PathVariable String houseId) {
         return sceneService.houseRemove(houseId);
@@ -316,44 +316,15 @@ public class SceneController extends BaseController {
         return Result.success(entity);
     }
 
+
     @WebControllerLog(description = "场景管理-场景删除")
     @ApiOperation(value = "场景删除", notes = "判断VR项目关联场景、关联热点等判断")
     @GetMapping("removes/{id}")
     public Result remove(@PathVariable String id) {
-        log.info("场景删除");
-        SceneEntity entity = sceneService.findById(id);
-        if (entity.getStatus() == 1) {
-            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());
-
-        sceneService.update(entity);
-
-        // 删除相应初始场景
-//        sceneInitService.removeByHouseIdAndSceneCode(houseId, sceneCode);
-        // 2021-05-13
-        sceneInitService.removeByHouseIdAndSceneId(houseId, id);
-
-        return Result.success();
+        return sceneService.remove(id);
     }
 
 
 
 
-
-
 }

+ 7 - 0
cms_pano_fcb/remark.md

@@ -165,17 +165,24 @@ sit:
    select id, house_id, scene_code from tb_scene where is_delete=0 and scene_code='HDtcapGhji' ;
    select id, house_id, scene_code from tb_scene where is_delete=0 and scene_code='HDxcAX2Lox' ;
    
+   select id, house_id, scene_code from tb_scene where is_delete=0 and scene_code in ('HD97YbFh8Z','HDcUOiyghL') ;
+   
    得到 house_id 然后查伟玉tm_house
    select id, house_title , estate_id from tm_house where id = 'houseId';
    select id, house_title , estate_id from tm_house where id in ('houseId');
    
    
    
+   
    查询相关VR项目信息
    select id, house_title , estate_id from tm_house where id in ('HUS000011394121801578721280','HUS000011394144078557802496,'HUS000011393785418390167552');
    select id,estate_name,belong_company_name,create_by_name,create_time from tm_estate where id in ('');
    
+   # 通过场景码查询模型被那个楼盘绑定, uat(使用的是同一个数据):
+   select a.estate_name,a.create_by_name,b.house_title,c.scene_code from tm_estate a left join tm_house b on b.estate_id=a.id left join tb_scene c on c.house_id=b.id where is_delete=0 and scene_code in ('HD97YbFh8Z','HDcUOiyghL');
    
+   # uat-根据VR项目id查询楼盘信息
+   select a.estate_name,a.belong_company_name,a.create_by_name,a.create_time,b.id from tm_estate a left join tm_house b on b.estate_id = a.id where b.isDelete=0 and b.id in ('HUS000011354375761111633920');
    
    select id, house_id, scene_code, is_delete,status,create_time,update_time from tb_scene where  scene_code in ('HD0IlKnd7m','HD571wG73e') ;