Explorar el Código

增加
展示端:获取首页场景、密码校验

wuweihao hace 4 años
padre
commit
2c195384a7

+ 2 - 2
720yun_fd_manage/gis_application/src/main/resources/application-loc.properties

@@ -84,8 +84,8 @@ oss.domain=http://ossxiaoan.4dage.com/
 
 # swagger2 \u8BBE\u7F6E\u5168\u5C40\u5B57\u4F53\u683C\u5F0F\u4E3Autf-8
 swagger.package=com.gis.web.controller
-swagger.title=VR720 loc \u56DB\u7EF4\u5168\u666F
-swagger.description=VR720 \u56DB\u7EF4\u5168\u666F API\u6587\u6863
+swagger.title=\u56DB\u7EF4\u5168\u666F loc
+swagger.description=\u56DB\u7EF4\u5168\u666F loc API\u6587\u6863
 swagger.version=1.0
 
 

+ 2 - 2
720yun_fd_manage/gis_application/src/main/resources/application-sit.properties

@@ -80,8 +80,8 @@ oss.domain=https://oss-xiaoan.oss-cn-shenzhen.aliyuncs.com/
 
 # swagger2 \u8BBE\u7F6E\u5168\u5C40\u5B57\u4F53\u683C\u5F0F\u4E3Autf-8
 swagger.package=com.gis.web.controller
-swagger.title=VR720 sit \u5168\u666F\u770B\u770B
-swagger.description=VR720 \u5168\u666F\u770B\u770B API\u6587\u6863
+swagger.title=\u5168\u666F\u770B\u770B sit
+swagger.description=\u5168\u666F\u770B\u770B sit API\u6587\u6863
 swagger.version=1.0
 
 #log

+ 3 - 1
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/entity/WorkEntity.java

@@ -35,7 +35,7 @@ public class WorkEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "访问量")
     private Integer visit;
 
-//    @JSONField(serialize = false)
+    @JSONField(serialize = false)
     @ApiModelProperty(value = "作品密码, 默认0:不需要密码")
     private String password;
 
@@ -69,4 +69,6 @@ public class WorkEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "初始场景id(场景id)")
     private String sceneIndex;
 
+    @ApiModelProperty(value = "是否有密码,0:没有, 1:有")
+    private Integer isPassword;
 }

+ 27 - 0
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/vo/CatalogSceneVo.java

@@ -0,0 +1,27 @@
+package com.gis.domain.vo;
+
+import com.gis.domain.entity.SceneEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by owen on 2021/3/29 0029 14:58
+ *
+ * 展示页,需要目录
+ */
+@Data
+public class CatalogSceneVo extends SceneEntity {
+
+
+    @ApiModelProperty(value = "目录名称")
+    private String CatalogName;
+
+    @ApiModelProperty(value = "目录Id")
+    private Long CatalogId;
+
+    @ApiModelProperty(value = "父目录Id")
+    private Long parentId;
+
+    @ApiModelProperty(value = "父目录名称")
+    private String parentName;
+}

+ 6 - 0
720yun_fd_manage/gis_mapper/src/main/java/com/gis/mapper/SceneMapper.java

@@ -2,6 +2,7 @@ package com.gis.mapper;
 
 
 import com.gis.domain.entity.SceneEntity;
+import com.gis.domain.vo.CatalogSceneVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -51,4 +52,9 @@ public interface SceneMapper extends IBaseMapper<SceneEntity, Long> {
 
     @Update("UPDATE tb_scene SET is_delete = 1 where is_delete = 0 and work_id = #{workId}")
     void setDeleteByWorkId(Long workId);
+
+    @Select("select a.*, b.id as catalogId, b.name as catalogName, c.id as parentId, c.name as parentName " +
+            "from tb_scene a left join tb_catalog b on b.id = a.catalog_id left join tb_catalog c on c.id = b.parent_id " +
+            "where a.is_delete = 0 and a.id = #{sceneId}")
+    CatalogSceneVo findVoById(Long sceneId);
 }

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

@@ -50,4 +50,6 @@ public interface SceneService extends IBaseService<SceneEntity, Long> {
     Result saveUseHots(UseHotsDto param);
 
     List<SceneEntity> findByWorkId(Long workId);
+
+    Result getVoIndex(Long workId);
 }

+ 19 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java

@@ -10,6 +10,7 @@ import com.gis.domain.entity.CatalogEntity;
 import com.gis.domain.entity.FodderEntity;
 import com.gis.domain.entity.SceneEntity;
 import com.gis.domain.entity.WorkEntity;
+import com.gis.domain.vo.CatalogSceneVo;
 import com.gis.domain.vo.ProSceneVo;
 import com.gis.mapper.CatalogMapper;
 import com.gis.mapper.IBaseMapper;
@@ -438,5 +439,23 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
         return entityMapper.findByWorkId(workId);
     }
 
+    @Override
+    public Result getVoIndex(Long workId) {
+        WorkEntity entity = workService.findById(workId);
+
+        if (entity == null) {
+            log.error("作品不存在,id:  {}", workId);
+            return Result.failure("作品不存在");
+        }
+        String sceneIndex = entity.getSceneIndex();
+        CatalogSceneVo vo = null;
+        // 字符串判断需要用isNotBlank
+        if (StringUtils.isNotBlank(sceneIndex)) {
+            Long sceneId = Long.valueOf(sceneIndex);
+            vo =entityMapper.findVoById(sceneId);
+        }
+        return Result.success(vo) ;
+    }
+
 
 }

+ 6 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -69,11 +69,16 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
     @Override
     public Result<WorkEntity> entitySave(WorkDto param) {
         Long id = param.getId();
+        int isPassword = 0;
+        if (StringUtils.isNotBlank(param.getPassword())) {
+            isPassword = 1;
+        }
         WorkEntity entity = null;
         if (id == null) {
             entity = new WorkEntity();
             BeanUtils.copyProperties(param, entity);
             entity.setUserId(getUserNameForToken());
+            entity.setIsPassword(isPassword);
             this.save(entity);
         } else {
             entity = this.findById(id);
@@ -101,6 +106,7 @@ public class WorkServiceImpl extends IBaseServiceImpl<WorkEntity, Long> implemen
             }
 
             entity.setUpdateTime(new Date());
+            entity.setIsPassword(isPassword);
             this.update(entity);
         }
         return Result.success();

+ 27 - 3
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WebController.java

@@ -35,6 +35,9 @@ public class WebController extends BaseController {
     @Autowired
     WorkService workService;
 
+    @Autowired
+    SceneService sceneService;
+
     @ApiOperation(value = "作品列表", position = 1)
     @GetMapping("listTree/{workId}")
     public Result listTree(@PathVariable Long workId) {
@@ -44,8 +47,22 @@ public class WebController extends BaseController {
     }
 
     @ApiOperation("作品详情")
-    @GetMapping("detail/{workId}/{password}")
-    public Result detail(@PathVariable Long workId, @PathVariable String password) {
+    @GetMapping("detail/{workId}")
+    public Result detail(@PathVariable Long workId) {
+        WorkEntity entity = workService.findById(workId);
+        if (entity == null) {
+            log.error("对象不存在, 场景码:{}", workId);
+            return Result.failure("对象不存在");
+        }
+
+        return Result.success(entity);
+    }
+
+
+
+    @ApiOperation("检验密码")
+    @PostMapping("checkPwd")
+    public Result checkPwd(Long workId, String password) {
         WorkEntity entity = workService.findById(workId);
         if (entity == null) {
             log.error("对象不存在, 场景码:{}", workId);
@@ -54,12 +71,19 @@ public class WebController extends BaseController {
 
         String dbPassword = entity.getPassword();
         if (!dbPassword.equals(password)) {
-            return Result.failure("场景密码有误");
+            return Result.failure("密码有误");
         }
         return Result.success(entity);
     }
 
 
+    @ApiOperation(value = "初始场景-获取", position = 3)
+    @GetMapping("getIndex/{workId}")
+    public Result getIndex(@PathVariable Long workId) {
+        return sceneService.getVoIndex(workId);
+    }
+
+
 
 
     @ApiOperation(value = "检查token是否有效" , position = 3)