wuweihao недель назад: 3
Родитель
Сommit
7737be0d44

+ 3 - 1
README.md

@@ -25,6 +25,7 @@
   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
@@ -55,4 +56,5 @@
 # deploy-pro
     2022-3-25 更新大场景统计点赞功能  pro已更新      
     2023-10-25 v1.1 新增文物访问量接口,需要初始化数据, 根据类型区分  
-    2025-06-27 添加统计场景接口
+    2025-06-27 添加统计场景接口
+    2026-01-20 添加-定义访问量接口

+ 26 - 0
gis_web/src/main/java/com/gis/web/Dto/EditVisitDto.java

@@ -0,0 +1,26 @@
+package com.gis.web.Dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * Created by owen on 2026/1/20 0009 12:20
+ */
+@Data
+public class EditVisitDto {
+
+    @NotNull(message = "场景码不能为空")
+    @ApiModelProperty(value = "场景码",  required = true)
+    private String sceneCode;
+
+    @ApiModelProperty(value = "访问量")
+    private Integer pcsVisit;
+
+    @ApiModelProperty(value = "分享量")
+    private Integer pcsShare;
+
+    @ApiModelProperty(value = "点赞量")
+    private Integer pcsStar;
+}

+ 37 - 4
gis_web/src/main/java/com/gis/web/controller/SceneCountController.java

@@ -4,13 +4,14 @@ import com.gis.common.exception.BaseRuntimeException;
 import com.gis.common.util.Result;
 import com.gis.domain.entity.SceneCountEntity;
 import com.gis.service.SceneCountService;
+import com.gis.web.Dto.EditVisitDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
 
 /**
  * Created by owen on 2021/8/10 0010 10:50
@@ -63,6 +64,38 @@ public class SceneCountController {
         return entityService.saveVisit(sceneCode, type);
     }
 
+    /**
+     * by owen 2026-1-20 编辑访问量
+     * @return
+     */
+    @ApiOperation(value = "v1.2-编辑访问量")
+    @PostMapping("/editVisit")
+    public Result editVisit(@Valid @RequestBody EditVisitDto param){
+        String sceneCode = param.getSceneCode();
+        SceneCountEntity entity = entityService.findBySceneCode(sceneCode);
+        if (entity == null){
+            return Result.failure("场景码不已存在, 编辑失败");
+        }
+
+        Integer pcsVisit = param.getPcsVisit();
+        Integer pcsShare = param.getPcsShare();
+        Integer pcsStar = param.getPcsStar();
+
+        if (pcsVisit != null && pcsVisit > 0 ){
+            entity.setVisitSum(pcsVisit);
+        }
+
+        if (pcsShare != null && pcsShare > 0 ){
+            entity.setShareSum(pcsShare);
+        }
+
+        if (pcsStar != null && pcsStar > 0 ){
+            entity.setStarSum(pcsStar);
+        }
+        entityService.update(entity);
+        return Result.success(entity);
+    }
+
 
     /**
      * 2022-3-25