소스 검색

场景发布,增减判断 发布目录是否存在houseType.json而更改house_type字段

dsx 2 년 전
부모
커밋
a2f8531943

+ 6 - 0
src/main/java/com/fdkankan/scene/entity/ScenePlus.java

@@ -95,6 +95,12 @@ public class ScenePlus implements Serializable {
     private Integer recommend;
 
     /**
+     * 是否有housetype文件(0-否,1-是)
+     */
+    @TableField("house_type")
+    private Integer houseType;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 8 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -1,4 +1,5 @@
 package com.fdkankan.scene.service.impl;
+import cn.hutool.core.net.multipart.UploadFile;
 import cn.hutool.core.util.CharsetUtil;
 import com.fdkankan.common.constant.CommonOperStatus;
 import com.fdkankan.common.constant.SceneAsynFuncType;
@@ -337,11 +338,18 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         scenePlus.setTitle(sceneEditInfo.getTitle());
         scenePlus.setDescription(sceneEditInfo.getDescription());
+        scenePlus.setHouseType(this.existsHouseType(bucket, num));
         scenePlusService.updateById(scenePlus);
 
         return ResultData.ok();
     }
 
+    private int existsHouseType(String bucket, String num){
+        String houseTypePath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
+        boolean exist = fYunFileService.fileExist(bucket, houseTypePath);
+        return exist ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue();
+    }
+
     private void publicSurveillance(String num, Integer surveillances, String bucket) throws IOException {
         String surveillanceJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "surveillance.json";
         if(surveillances == CommonStatus.NO.code().intValue()){