Kaynağa Gözat

自动添加场景接口

wuweihao 1 ay önce
ebeveyn
işleme
93c7aca7e3

+ 14 - 3
README.md

@@ -14,21 +14,30 @@
     3.1 2021-12-1   
     
  ## 4. 支付宝-用户信息记录
-    4.1 2022-5-5   
+    4.1 2022-5-5 
+
+# dev
+127.0.0.1:8109/doc.html
     
 # pro
+   
   server: 47.112.166.173
   tomcat: /指房宝控制-47.112.166.173/root/user/java/tomcat_cms_statistics_baidu_8109
   doc: 47.112.166.173:8109/doc.html
+  doc: https://count.4dage.com/doc.html
   开启了定时任务,每天凌晨3点
   根据场景码查询: 
     http://47.112.166.173:8109/api/baidu/bigScene/getSceneData/782
   
   根据日期查询:
-    http://47.112.166.173:8109//api/baidu/bigScene/getData/20210301
+    http://47.112.166.173:8109/api/baidu/bigScene/getData/20210301
     
     <Context path="" docBase="/root/user/java/tomcat_cms_statistics_baidu_8109/webapps/cms_statistics_baidu" debug="0" reloadable="true" crossContext="true"/>
 
+      添加场景码数据
+    https://count.4dage.com/api/count/addCode?code=aaaaa2&remark=1111
+
+
     
 # 2021-08-10
     新增:大场景分享接口数据统计
@@ -44,4 +53,6 @@
     
 
 # deploy-pro
-    2022-3-25 更新大场景统计点赞功能  pro已更新        
+    2022-3-25 更新大场景统计点赞功能  pro已更新      
+    2023-10-25 v1.1 新增文物访问量接口,需要初始化数据, 根据类型区分  
+    2025-06-27 添加统计场景接口

+ 4 - 0
gis_domain/src/main/java/com/gis/domain/entity/SceneCountEntity.java

@@ -29,4 +29,8 @@ public class SceneCountEntity extends BaseEntity {
     @ApiModelProperty(value = "点赞量")
     private Integer starSum;
 
+
+    @ApiModelProperty(value = "简介")
+    private String remark;
+
 }

+ 6 - 0
gis_service/src/main/java/com/gis/service/SceneCountService.java

@@ -16,9 +16,15 @@ public interface SceneCountService extends IBaseService<SceneCountEntity, Long>
 
     Result saveVisit(String sceneCode);
 
+    Result saveVisit(String sceneCode, String type);
+
     Result saveShare(String sceneCode);
 
     Result detail(String sceneCode);
 
     Result saveStar(String sceneCode);
+
+    Result detail(String sceneCode, String type);
+
+    SceneCountEntity findBySceneCode(String sceneCode);
 }

+ 23 - 0
gis_service/src/main/java/com/gis/service/impl/SceneCountServiceImpl.java

@@ -36,6 +36,15 @@ public class SceneCountServiceImpl extends IBaseServiceImpl<SceneCountEntity, Lo
         return Result.success(entity);
     }
 
+
+
+    @Override
+    public Result saveVisit(String sceneCode, String type) {
+        entityMapper.saveVisit(sceneCode, type);
+        SceneCountEntity entity = entityMapper.findBySceneCode(sceneCode, type);
+        return Result.success(entity);
+    }
+
     @Override
     public Result saveShare(String sceneCode) {
         entityMapper.saveShare(sceneCode, TYPE);
@@ -50,9 +59,23 @@ public class SceneCountServiceImpl extends IBaseServiceImpl<SceneCountEntity, Lo
     }
 
     @Override
+    public Result detail(String sceneCode, String type) {
+        SceneCountEntity entity = entityMapper.findBySceneCode(sceneCode, type);
+        return Result.success(entity);
+    }
+
+    @Override
+    public SceneCountEntity findBySceneCode(String sceneCode) {
+        SceneCountEntity entity = entityMapper.findBySceneCode(sceneCode, TYPE);
+        return entity;
+    }
+
+    @Override
     public Result saveStar(String sceneCode) {
         entityMapper.saveStar(sceneCode, TYPE);
         SceneCountEntity entity = entityMapper.findBySceneCode(sceneCode, TYPE);
         return Result.success(entity);
     }
+
+
 }

+ 41 - 1
gis_web/src/main/java/com/gis/web/controller/SceneCountController.java

@@ -1,6 +1,8 @@
 package com.gis.web.controller;
 
+import com.gis.common.exception.BaseRuntimeException;
 import com.gis.common.util.Result;
+import com.gis.domain.entity.SceneCountEntity;
 import com.gis.service.SceneCountService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -18,18 +20,49 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Api(tags = "场景数据统计-大场景")
 @RestController
-@RequestMapping("api/count")
+@RequestMapping("/api/count")
 public class SceneCountController {
 
     @Autowired
     SceneCountService entityService;
 
+    @ApiOperation("添加场景码统计")
+    @GetMapping("addCode")
+    public Result saveVisit(String code, String remark){
+        BaseRuntimeException.isBlank(code, null, "场景码不能为空");
+        BaseRuntimeException.isBlank(remark, null, "场景描述不能为空");
+
+        SceneCountEntity entity = entityService.findBySceneCode(code);
+        if (entity != null){
+            return Result.failure("场景码已存在,不能重复添加");
+        }
+
+        entity = new SceneCountEntity();
+        entity.setSceneCode(code);
+        entity.setRemark(remark);
+        entity.setType("bigScene");
+        entity.setVisitSum(0);
+        entity.setStarSum(0);
+        entity.setShareSum(0);
+        entity.setVisitSum(0);
+
+        entityService.save(entity);
+
+        return Result.success(entity);
+    }
+
     @ApiOperation("访问量")
     @GetMapping("saveVisit/{sceneCode}")
     public Result saveVisit(@PathVariable String sceneCode){
         return entityService.saveVisit(sceneCode);
     }
 
+    @ApiOperation(value = "v1.1-保存-访问量", notes = "需要数据库初始化数据、类型")
+    @GetMapping("/saveVisitByType/{sceneCode}/{type}")
+    public Result saveVisitByType(@PathVariable String sceneCode, @PathVariable String type){
+        return entityService.saveVisit(sceneCode, type);
+    }
+
 
     /**
      * 2022-3-25
@@ -62,4 +95,11 @@ public class SceneCountController {
 
     }
 
+    @ApiOperation("v1.1-详情")
+    @GetMapping("/detailByType/{sceneCode}/{type}")
+    public Result detailByType(@PathVariable String sceneCode, @PathVariable String type){
+        return entityService.detail(sceneCode, type);
+
+    }
+
 }