Ver Fonte

rewrite

tanlie há 3 semanas atrás
pai
commit
6cfce333ff
22 ficheiros alterados com 117 adições e 142 exclusões
  1. 2 2
      wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/UserWish.java
  2. 1 1
      wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/WishingTree.java
  3. 39 0
      wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/WishingTreeExtension.java
  4. 1 1
      wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/WishingUser.java
  5. BIN
      wishing-platform/platform-entity/platform-entity-wishing/target/classes/cn/qinys/platform/entity/wishing/WishingTreeExtension.class
  6. 0 59
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/config/FeignConfiguration.java
  7. 0 3
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/controller/FileUploadController.java
  8. 6 6
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/controller/TreeController.java
  9. 2 3
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/controller/UserWishController.java
  10. 14 0
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/mapper/WishingTreeExtensionMapper.java
  11. 23 3
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/mapper/WishingTreeMapper.java
  12. 1 1
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/req/TreeDetailReq.java
  13. 1 1
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/req/WishCreateReq.java
  14. 1 1
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/TreeDetailResp.java
  15. 2 4
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/TreeListResp.java
  16. 2 2
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/WishDetailResp.java
  17. 3 7
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/TreeService.java
  18. 1 1
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/UserWishService.java
  19. 1 2
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/AttachmentServiceImpl.java
  20. 13 41
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/TreeServiceImpl.java
  21. 3 2
      wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/UserWishServiceImpl.java
  22. 1 2
      wishing-tree-h5/src/views/HomeView.vue

+ 2 - 2
wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/UserWish.java

@@ -14,9 +14,9 @@ import java.math.BigDecimal;
 public class UserWish extends BaseEntity {
 public class UserWish extends BaseEntity {
 
 
     @TableId(type = IdType.AUTO)
     @TableId(type = IdType.AUTO)
-    private Long id;
+    private Integer id;
 
 
-    private Long treeId;
+    private Integer treeId;
 
 
     private String treeName;
     private String treeName;
 
 

+ 1 - 1
wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/WishingTree.java

@@ -19,7 +19,7 @@ import java.math.BigDecimal;
 public class WishingTree extends BaseEntity  {
 public class WishingTree extends BaseEntity  {
 
 
     @TableId(type = IdType.AUTO)
     @TableId(type = IdType.AUTO)
-    private Long id;
+    private Integer id;
 
 
     private String name; // 许愿树名称
     private String name; // 许愿树名称
 
 

+ 39 - 0
wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/WishingTreeExtension.java

@@ -0,0 +1,39 @@
+package cn.qinys.platform.entity.wishing;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author lie tan
+ * @description
+ * @date 2026-05-17 21:33
+ **/
+@Data
+@TableName("wishing_tree_extension")
+public class WishingTreeExtension implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    private Integer treeId;
+
+    private Integer totalCount;
+
+    private Integer publicCount;
+
+    private Integer privateCount;
+
+    @Version
+    private Integer version;
+
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createdAt;
+
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updatedAt;
+
+
+}

+ 1 - 1
wishing-platform/platform-entity/platform-entity-wishing/src/main/java/cn/qinys/platform/entity/wishing/WishingUser.java

@@ -21,7 +21,7 @@ import java.util.Locale;
 public class WishingUser extends BaseEntity implements Serializable {
 public class WishingUser extends BaseEntity implements Serializable {
 
 
     @TableId(type = IdType.AUTO)
     @TableId(type = IdType.AUTO)
-    private Long id;
+    private Integer id;
 
 
     private String nickname;
     private String nickname;
 
 

BIN
wishing-platform/platform-entity/platform-entity-wishing/target/classes/cn/qinys/platform/entity/wishing/WishingTreeExtension.class


+ 0 - 59
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/config/FeignConfiguration.java

@@ -1,59 +0,0 @@
-package cn.qinys.platform.config;
-
-
-import feign.RequestInterceptor;
-import feign.RequestTemplate;
-import feign.Retryer;
-import jakarta.servlet.http.HttpServletRequest;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Feign配置类
- *
- * @author v-lishiquan.gx@chinatelecom.cn
- * @date 2020-08-26
- */
-@Configuration
-@Slf4j
-public class FeignConfiguration implements RequestInterceptor {
-
-    @Bean
-    Retryer feignRetryer() {
-        return Retryer.NEVER_RETRY;
-    }
-
-    @Override
-    public void apply(RequestTemplate requestTemplate) {
-        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
-        if (Objects.nonNull(requestAttributes)) {
-            RequestContextHolder.setRequestAttributes(requestAttributes, true);
-            ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
-            HttpServletRequest request = attributes.getRequest();
-            // 添加请求头
-            Enumeration<String> headerNames = request.getHeaderNames();
-            if (headerNames != null) {
-                while (headerNames.hasMoreElements()) {
-                    String name = headerNames.nextElement();
-                    if(this.removeHead().contains(name)){
-                        continue;
-                    }
-                    String values = request.getHeader(name);
-                    requestTemplate.header(name, values);
-                }
-            }
-        }
-    }
-
-    private List<String> removeHead() {
-        return List.of("content-length");
-    }
-}

+ 0 - 3
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/controller/FileUploadController.java

@@ -5,15 +5,12 @@ import cn.qinys.platform.base.response.Result;
 import cn.qinys.platform.mobile.service.AttachmentService;
 import cn.qinys.platform.mobile.service.AttachmentService;
 import jakarta.annotation.Resource;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
-import java.util.Map;
-
 @Slf4j
 @Slf4j
 @RestController
 @RestController
 @RequestMapping("/dgapi/mobile/upload")
 @RequestMapping("/dgapi/mobile/upload")

+ 6 - 6
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/controller/TreeController.java

@@ -4,8 +4,8 @@ import cn.qinys.platform.base.response.Result;
 import cn.qinys.platform.mobile.req.TreeDetailReq;
 import cn.qinys.platform.mobile.req.TreeDetailReq;
 import cn.qinys.platform.mobile.req.WishingTreeListReq;
 import cn.qinys.platform.mobile.req.WishingTreeListReq;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
-import cn.qinys.platform.mobile.resp.WishingTreeListResp;
-import cn.qinys.platform.mobile.service.WishTreeService;
+import cn.qinys.platform.mobile.resp.TreeListResp;
+import cn.qinys.platform.mobile.service.TreeService;
 import jakarta.annotation.Resource;
 import jakarta.annotation.Resource;
 import jakarta.validation.Valid;
 import jakarta.validation.Valid;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -22,14 +22,14 @@ import java.util.List;
 public class TreeController {
 public class TreeController {
 
 
     @Resource
     @Resource
-    private WishTreeService wishTreeService;
+    private TreeService treeService;
 
 
     /**
     /**
      * 查询附近许愿树列表
      * 查询附近许愿树列表
      */
      */
     @PostMapping("/list")
     @PostMapping("/list")
-    public Result<List<WishingTreeListResp>> list(@RequestBody @Valid WishingTreeListReq req) {
-        List<WishingTreeListResp> list = wishTreeService.listNearbyTrees(req);
+    public Result<List<TreeListResp>> list(@RequestBody @Valid WishingTreeListReq req) {
+        List<TreeListResp> list = treeService.listNearbyTrees(req);
         return new Result<>(list);
         return new Result<>(list);
     }
     }
 
 
@@ -38,7 +38,7 @@ public class TreeController {
      */
      */
     @PostMapping("/detail")
     @PostMapping("/detail")
     public Result<TreeDetailResp> detail(@RequestBody @Valid TreeDetailReq req) {
     public Result<TreeDetailResp> detail(@RequestBody @Valid TreeDetailReq req) {
-        TreeDetailResp resp = wishTreeService.getTreeDetail(req);
+        TreeDetailResp resp = treeService.getTreeDetail(req);
         return new Result<>(resp);
         return new Result<>(resp);
     }
     }
 }
 }

+ 2 - 3
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/controller/UserWishController.java

@@ -18,9 +18,8 @@ public class UserWishController {
 
 
     /** 创建愿望 */
     /** 创建愿望 */
     @PostMapping("/create")
     @PostMapping("/create")
-    public Result<WishDetailResp> create(@RequestBody @Valid WishCreateReq req,
-                                         @RequestHeader(value = "X-User-Id", defaultValue = "anonymous") String userId) {
-        WishDetailResp resp = wishService.create(req, userId);
+    public Result<WishDetailResp> create(@RequestBody @Valid WishCreateReq req) {
+        WishDetailResp resp = wishService.create(req);
         return new Result<>(resp);
         return new Result<>(resp);
     }
     }
 
 

+ 14 - 0
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/mapper/WishingTreeExtensionMapper.java

@@ -0,0 +1,14 @@
+package cn.qinys.platform.mobile.mapper;
+
+import cn.qinys.platform.entity.wishing.WishingTreeExtension;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author lie tan
+ * @description
+ * @date 2026-06-07 14:53
+ **/
+@Mapper
+public interface WishingTreeExtensionMapper extends BaseMapper<WishingTreeExtension> {
+}

+ 23 - 3
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/mapper/WishingTreeMapper.java

@@ -2,12 +2,14 @@ package cn.qinys.platform.mobile.mapper;
 
 
 import cn.qinys.platform.entity.wishing.WishingTree;
 import cn.qinys.platform.entity.wishing.WishingTree;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
-import cn.qinys.platform.mobile.resp.WishDetailResp;
+import cn.qinys.platform.mobile.resp.TreeListResp;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
 
 
+import java.util.List;
+
 /**
 /**
  * @author lie tan
  * @author lie tan
  * @description
  * @description
@@ -16,7 +18,25 @@ import org.apache.ibatis.annotations.Select;
 @Mapper
 @Mapper
 public interface WishingTreeMapper extends BaseMapper<WishingTree> {
 public interface WishingTreeMapper extends BaseMapper<WishingTree> {
 
 
+    /**
+     * 首页许愿数列表
+     *
+     * @return
+     */
+    @Select("SELECT t.*, e.total_count as totalWishes FROM wishing_tree t " +
+            "LEFT JOIN wishing_tree_extension e ON t.id = e.tree_id " +
+            "WHERE t.is_active = 1 AND t.is_deleted = 0")
+    List<TreeListResp> selectActiveTrees();
+
+    /**
+     * 许愿数详情
+     *
+     * @param id
+     * @return
+     */
+    @Select("SELECT t.*, e.total_count as totalWishes FROM wishing_tree t " +
+            "LEFT JOIN wishing_tree_extension e ON t.id = e.tree_id " +
+            "WHERE t.id = #{id} LIMIT 1")
+    TreeDetailResp selectDetailById(@Param("id") Integer id);
 
 
-    @Select("SELECT * FROM wishing_tree WHERE id = #{id}")
-    TreeDetailResp selectDetailById(@Param("id") Long id);
 }
 }

+ 1 - 1
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/req/TreeDetailReq.java

@@ -15,7 +15,7 @@ import java.math.BigDecimal;
 public class TreeDetailReq implements Serializable {
 public class TreeDetailReq implements Serializable {
 
 
     @NotNull(message = "id can not be null")
     @NotNull(message = "id can not be null")
-    private Long id;
+    private Integer id;
 
 
     @NotNull(message = "lng can not be null")
     @NotNull(message = "lng can not be null")
     private BigDecimal lng;
     private BigDecimal lng;

+ 1 - 1
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/req/WishCreateReq.java

@@ -12,7 +12,7 @@ import java.util.List;
 public class WishCreateReq implements Serializable {
 public class WishCreateReq implements Serializable {
 
 
     @NotNull(message = "treeId can not be null")
     @NotNull(message = "treeId can not be null")
-    private Long treeId;
+    private Integer treeId;
 
 
     @NotBlank(message = "content can not be blank")
     @NotBlank(message = "content can not be blank")
     private String content;
     private String content;

+ 1 - 1
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/TreeDetailResp.java

@@ -13,7 +13,7 @@ import java.math.BigDecimal;
 @Data
 @Data
 public class TreeDetailResp implements Serializable {
 public class TreeDetailResp implements Serializable {
 
 
-    private Long id;
+    private Integer id;
 
 
     private String name;
     private String name;
 
 

+ 2 - 4
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/WishingTreeListResp.java → wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/TreeListResp.java

@@ -11,9 +11,9 @@ import java.math.BigDecimal;
  * @date 2026-05-23 13:47
  * @date 2026-05-23 13:47
  **/
  **/
 @Data
 @Data
-public class WishingTreeListResp implements Serializable {
+public class TreeListResp implements Serializable {
 
 
-    private Long id;
+    private Integer id;
 
 
     private String name;
     private String name;
 
 
@@ -30,10 +30,8 @@ public class WishingTreeListResp implements Serializable {
     private String coverImage;
     private String coverImage;
 
 
     private Integer totalWishes;
     private Integer totalWishes;
-
     /** 距离(米) */
     /** 距离(米) */
     private Integer distance;
     private Integer distance;
-
     /** 是否在可许愿范围内 */
     /** 是否在可许愿范围内 */
     private Boolean isInRange;
     private Boolean isInRange;
 }
 }

+ 2 - 2
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/resp/WishDetailResp.java

@@ -10,9 +10,9 @@ import java.util.List;
 @Data
 @Data
 public class WishDetailResp implements Serializable {
 public class WishDetailResp implements Serializable {
 
 
-    private Long id;
+    private Integer id;
 
 
-    private Long treeId;
+    private Integer treeId;
 
 
     private String treeName;
     private String treeName;
 
 

+ 3 - 7
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/WishTreeService.java → wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/TreeService.java

@@ -3,7 +3,7 @@ package cn.qinys.platform.mobile.service;
 import cn.qinys.platform.mobile.req.TreeDetailReq;
 import cn.qinys.platform.mobile.req.TreeDetailReq;
 import cn.qinys.platform.mobile.req.WishingTreeListReq;
 import cn.qinys.platform.mobile.req.WishingTreeListReq;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
-import cn.qinys.platform.mobile.resp.WishingTreeListResp;
+import cn.qinys.platform.mobile.resp.TreeListResp;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -12,18 +12,14 @@ import java.util.List;
  * @description 许愿树服务
  * @description 许愿树服务
  * @date 2026-05-24 21:33
  * @date 2026-05-24 21:33
  **/
  **/
-public interface WishTreeService {
+public interface TreeService {
 
 
     /**
     /**
      * 查询附近许愿树列表
      * 查询附近许愿树列表
      *
      *
-     * @param lng         用户经度
-     * @param lat         用户纬度
-     * @param maxDistance 最大距离(米),默认 50000
-     * @param limit       最大返回条数,默认 100
      * @return 许愿树列表(含距离、是否在范围内)
      * @return 许愿树列表(含距离、是否在范围内)
      */
      */
-    List<WishingTreeListResp> listNearbyTrees(WishingTreeListReq req);
+    List<TreeListResp> listNearbyTrees(WishingTreeListReq req);
 
 
     /**
     /**
      * 查询许愿树详情
      * 查询许愿树详情

+ 1 - 1
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/UserWishService.java

@@ -12,7 +12,7 @@ public interface UserWishService {
 
 
     WishDetailResp getDetail(Long id);
     WishDetailResp getDetail(Long id);
 
 
-    WishDetailResp create(WishCreateReq req, String userId);
+    WishDetailResp create(WishCreateReq req);
 
 
     boolean delete(Long id, String userId);
     boolean delete(Long id, String userId);
 
 

+ 1 - 2
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/AttachmentServiceImpl.java

@@ -74,8 +74,7 @@ public class AttachmentServiceImpl implements AttachmentService {
             dto.setSuffix(suffix);
             dto.setSuffix(suffix);
             dto.setStorageType(BaseConstants.StorageType.LOCAL.getCode());
             dto.setStorageType(BaseConstants.StorageType.LOCAL.getCode());
         } catch (IOException e) {
         } catch (IOException e) {
-            log.error("上传文件异常:[{}]", e.getMessage());
-            e.printStackTrace();
+            log.error("上传文件异常:[{}]", e.getMessage(), e);
             throw new BizException("上传文件异常");
             throw new BizException("上传文件异常");
         }
         }
         return dto;
         return dto;

+ 13 - 41
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/WishTreeServiceImpl.java → wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/TreeServiceImpl.java

@@ -1,19 +1,16 @@
 package cn.qinys.platform.mobile.service.impl;
 package cn.qinys.platform.mobile.service.impl;
 
 
-import cn.qinys.platform.entity.wishing.WishingTree;
 import cn.qinys.platform.mobile.mapper.WishingTreeMapper;
 import cn.qinys.platform.mobile.mapper.WishingTreeMapper;
 import cn.qinys.platform.mobile.req.TreeDetailReq;
 import cn.qinys.platform.mobile.req.TreeDetailReq;
 import cn.qinys.platform.mobile.req.WishingTreeListReq;
 import cn.qinys.platform.mobile.req.WishingTreeListReq;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
 import cn.qinys.platform.mobile.resp.TreeDetailResp;
-import cn.qinys.platform.mobile.resp.WishingTreeListResp;
-import cn.qinys.platform.mobile.service.WishTreeService;
+import cn.qinys.platform.mobile.resp.TreeListResp;
+import cn.qinys.platform.mobile.service.TreeService;
 import cn.qinys.platform.mobile.util.CoordUtil;
 import cn.qinys.platform.mobile.util.CoordUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import jakarta.annotation.Resource;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
-import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Comparator;
 import java.util.List;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -25,7 +22,7 @@ import java.util.stream.Collectors;
  **/
  **/
 @Slf4j
 @Slf4j
 @Service
 @Service
-public class WishTreeServiceImpl implements WishTreeService {
+public class TreeServiceImpl implements TreeService {
 
 
     @Resource
     @Resource
     private WishingTreeMapper treeMapper;
     private WishingTreeMapper treeMapper;
@@ -33,43 +30,20 @@ public class WishTreeServiceImpl implements WishTreeService {
     private static final int EARTH_RADIUS = 6371000; // 地球半径(米)
     private static final int EARTH_RADIUS = 6371000; // 地球半径(米)
 
 
     @Override
     @Override
-    public List<WishingTreeListResp> listNearbyTrees(WishingTreeListReq req) {
-
-
+    public List<TreeListResp> listNearbyTrees(WishingTreeListReq req) {
         // 查询所有启用的许愿树
         // 查询所有启用的许愿树
-        List<WishingTree> trees = treeMapper.selectList(
-                new LambdaQueryWrapper<WishingTree>()
-                        .eq(WishingTree::getIsActive, 1)
-        );
-
+        List<TreeListResp> trees = treeMapper.selectActiveTrees();
         // 用户 GPS 是 WGS-84,DB 存的是 GCJ-02,统一转为 GCJ-02 计算距离
         // 用户 GPS 是 WGS-84,DB 存的是 GCJ-02,统一转为 GCJ-02 计算距离
         double[] gcj = CoordUtil.wgs84ToGcj02(req.getLng().doubleValue(), req.getLat().doubleValue());
         double[] gcj = CoordUtil.wgs84ToGcj02(req.getLng().doubleValue(), req.getLat().doubleValue());
-
-        List<WishingTreeListResp> result = new ArrayList<>();
-        for (WishingTree tree : trees) {
-            int dist = haversine(
-                    gcj[0], gcj[1],
-                    tree.getLongitude().doubleValue(), tree.getLatitude().doubleValue()
-            );
-
-            WishingTreeListResp resp = new WishingTreeListResp();
-            resp.setId(tree.getId());
-            resp.setName(tree.getName());
-            resp.setDescription(tree.getDescription());
-            resp.setLongitude(tree.getLongitude());
-            resp.setLatitude(tree.getLatitude());
-            resp.setAddress(tree.getAddress());
-            resp.setRadius(tree.getRadius());
-            resp.setCoverImage(tree.getCoverImage());
-            resp.setTotalWishes(tree.getTotalWishes());
-            resp.setDistance(dist);
-            resp.setIsInRange(dist <= (tree.getRadius() != null ? tree.getRadius() : 100));
-            result.add(resp);
-        }
+        trees.forEach(tree -> {
+            int dist = haversine(gcj[0], gcj[1], tree.getLongitude().doubleValue(), tree.getLatitude().doubleValue());
+            tree.setDistance(dist);
+            tree.setIsInRange(dist <= (tree.getRadius() != null ? tree.getRadius() : 100));
+        });
 
 
         // 按距离排序,限制返回数量
         // 按距离排序,限制返回数量
-        return result.stream()
-                .sorted(Comparator.comparingInt(WishingTreeListResp::getDistance))
+        return trees.stream()
+                .sorted(Comparator.comparingInt(TreeListResp::getDistance))
                 .filter(it -> it.getDistance() <= req.getMaxDistance())
                 .filter(it -> it.getDistance() <= req.getMaxDistance())
                 .limit(req.getLimit())
                 .limit(req.getLimit())
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
@@ -80,9 +54,7 @@ public class WishTreeServiceImpl implements WishTreeService {
         TreeDetailResp tree = treeMapper.selectDetailById(req.getId());
         TreeDetailResp tree = treeMapper.selectDetailById(req.getId());
         // 用户 GPS 是 WGS-84,DB 存的是 GCJ-02,统一转为 GCJ-02 计算距离
         // 用户 GPS 是 WGS-84,DB 存的是 GCJ-02,统一转为 GCJ-02 计算距离
         double[] gcj = CoordUtil.wgs84ToGcj02(req.getLng().doubleValue(), req.getLat().doubleValue());
         double[] gcj = CoordUtil.wgs84ToGcj02(req.getLng().doubleValue(), req.getLat().doubleValue());
-        int dist = haversine(gcj[0], gcj[1],
-                tree.getLongitude().doubleValue(), tree.getLatitude().doubleValue()
-        );
+        int dist = haversine(gcj[0], gcj[1], tree.getLongitude().doubleValue(), tree.getLatitude().doubleValue());
         tree.setDistance(dist);
         tree.setDistance(dist);
         tree.setIsInRange(dist <= (tree.getRadius() != null ? tree.getRadius() : 100));
         tree.setIsInRange(dist <= (tree.getRadius() != null ? tree.getRadius() : 100));
         return tree;
         return tree;

+ 3 - 2
wishing-platform/platform-service/platform-service-mobile/src/main/java/cn/qinys/platform/mobile/service/impl/UserWishServiceImpl.java

@@ -1,4 +1,5 @@
 package cn.qinys.platform.mobile.service.impl;
 package cn.qinys.platform.mobile.service.impl;
+import cn.qinys.platform.base.security.utils.CurrentUtils;
 import cn.qinys.platform.entity.wishing.UserWish;
 import cn.qinys.platform.entity.wishing.UserWish;
 import cn.qinys.platform.entity.wishing.WishingTree;
 import cn.qinys.platform.entity.wishing.WishingTree;
 import cn.qinys.platform.mobile.mapper.UserWishMapper;
 import cn.qinys.platform.mobile.mapper.UserWishMapper;
@@ -70,13 +71,13 @@ public class UserWishServiceImpl implements UserWishService {
     }
     }
 
 
     @Override
     @Override
-    public WishDetailResp create(WishCreateReq req, String userId) {
+    public WishDetailResp create(WishCreateReq req) {
         WishingTree tree = wishingTreeMapper.selectById(req.getTreeId());
         WishingTree tree = wishingTreeMapper.selectById(req.getTreeId());
 
 
         UserWish wish = new UserWish();
         UserWish wish = new UserWish();
         wish.setTreeId(req.getTreeId());
         wish.setTreeId(req.getTreeId());
         wish.setTreeName(tree != null ? tree.getName() : "");
         wish.setTreeName(tree != null ? tree.getName() : "");
-        wish.setUserId(userId);
+        wish.setUserId(CurrentUtils.getCurrentUserId());
         wish.setContent(req.getContent());
         wish.setContent(req.getContent());
         wish.setImages(toJson(req.getImages()));
         wish.setImages(toJson(req.getImages()));
         wish.setLongitude(req.getLng());
         wish.setLongitude(req.getLng());

+ 1 - 2
wishing-tree-h5/src/views/HomeView.vue

@@ -13,7 +13,7 @@
       </div>
       </div>
     </div>
     </div>
 
 
-    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+    <van-pull-refresh v-if="!locating" v-model="refreshing" @refresh="onRefresh">
       <van-list
       <van-list
         v-model:loading="loading"
         v-model:loading="loading"
         :finished="finished"
         :finished="finished"
@@ -99,7 +99,6 @@ onMounted(async () => {
     })
     })
   }
   }
   locating.value = false
   locating.value = false
-  loadTrees()
 })
 })
 
 
 onUnmounted(() => {
 onUnmounted(() => {