Quellcode durchsuchen

[update] message:

kelei vor 6 Monaten
Ursprung
Commit
4234f8b49d
23 geänderte Dateien mit 307 neuen und 31 gelöschten Zeilen
  1. 1 1
      admin/src/main/java/com/flyer/foster/config/SaTokenConfigure.java
  2. 29 0
      admin/src/main/java/com/flyer/foster/controller/WorldMapController.java
  3. 4 8
      admin/src/main/java/com/flyer/foster/controller/app/AppAreaController.java
  4. 1 1
      admin/src/main/java/com/flyer/foster/controller/app/AppFosterRecordController.java
  5. 14 1
      admin/src/main/java/com/flyer/foster/controller/app/AppGardenController.java
  6. 1 1
      admin/src/main/java/com/flyer/foster/controller/app/AppPosterLibController.java
  7. 1 1
      admin/src/main/java/com/flyer/foster/controller/app/AppSubscribeController.java
  8. 30 14
      admin/src/main/java/com/flyer/foster/controller/app/AppTreeController.java
  9. 1 1
      admin/src/main/java/com/flyer/foster/controller/app/AppTreePosterContentController.java
  10. 1 1
      admin/src/main/java/com/flyer/foster/controller/app/AppUserController.java
  11. 30 0
      admin/src/main/java/com/flyer/foster/controller/app/AppWorldMapController.java
  12. 3 0
      admin/src/main/java/com/flyer/foster/dto/GardenAddDTO.java
  13. 6 0
      admin/src/main/java/com/flyer/foster/dto/GardenRespDTO.java
  14. 15 0
      admin/src/main/java/com/flyer/foster/dto/GardenUpdateDTO.java
  15. 15 0
      admin/src/main/java/com/flyer/foster/entity/Garden.java
  16. 88 0
      admin/src/main/java/com/flyer/foster/entity/WorldMap.java
  17. 16 0
      admin/src/main/java/com/flyer/foster/mapper/IWorldMapMapper.java
  18. 16 0
      admin/src/main/java/com/flyer/foster/service/IWorldMapService.java
  19. 3 0
      admin/src/main/java/com/flyer/foster/service/impl/GardenServiceImpl.java
  20. 3 2
      admin/src/main/java/com/flyer/foster/service/impl/TreePosterContentServiceImpl.java
  21. 20 0
      admin/src/main/java/com/flyer/foster/service/impl/WorldMapServiceImpl.java
  22. 4 0
      admin/src/main/resources/mapper/GardenMapper.xml
  23. 5 0
      admin/src/main/resources/mapper/WorldMapMapper.xml

+ 1 - 1
admin/src/main/java/com/flyer/foster/config/SaTokenConfigure.java

@@ -26,7 +26,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
                     .check(r -> StpUtil.checkLogin());
 
             SaRouter.match("/app/**")
-                    .notMatch("/app/user/login")
+                    .notMatch("/app/user/login","/app/user/send-sub-msg")
                     .check(r -> StpAppUtil.checkLogin());
 
 

+ 29 - 0
admin/src/main/java/com/flyer/foster/controller/WorldMapController.java

@@ -0,0 +1,29 @@
+package com.flyer.foster.controller;
+
+import com.flyer.foster.service.IWorldMapService;
+import com.flyer.util.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 世界地图
+ *
+ * @author flyer
+ * @since 2024-05-18
+ */
+@RestController
+@RequestMapping("/admin/world-map")
+public class WorldMapController {
+    @Autowired
+    private IWorldMapService iWorldMapService;
+
+    /**
+     * 获取世界地图列表
+     *
+     * @return
+     */
+    @GetMapping("/list")
+    public R getList() {
+        return R.ok().result(iWorldMapService.list());
+    }
+}

+ 4 - 8
admin/src/main/java/com/flyer/foster/controller/app/AppAreaController.java

@@ -1,22 +1,18 @@
 package com.flyer.foster.controller.app;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.flyer.foster.dto.AreaAddDTO;
 import com.flyer.foster.dto.AreaQueryDTO;
-import com.flyer.foster.dto.AreaRespDTO;
-import com.flyer.foster.dto.AreaUpdateDTO;
 import com.flyer.foster.entity.Area;
 import com.flyer.foster.service.IAreaService;
 import com.flyer.util.R;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
-import java.util.List;
 
 /**
- * 区域
+ * 区域(小程序)
  *
  * @author flyer
  * @since 2024-05-09

+ 1 - 1
admin/src/main/java/com/flyer/foster/controller/app/AppFosterRecordController.java

@@ -12,7 +12,7 @@ import javax.validation.Valid;
 import java.util.List;
 
 /**
- * 领养记录
+ * 领养记录(小程序)
  *
  * @author flyer
  * @since 2024-05-09

+ 14 - 1
admin/src/main/java/com/flyer/foster/controller/app/AppGardenController.java

@@ -16,7 +16,7 @@ import javax.validation.Valid;
 import java.util.List;
 
 /**
- * 果园
+ * 果园(小程序)
  *
  * @author flyer
  * @since 2024-05-09
@@ -37,4 +37,17 @@ public class AppGardenController {
         return R.ok().result(bean);
     }
 
+    /**
+     * 果园列表-分页
+     *
+     * @param current 当前页
+     * @param size    当前页显示条数
+     * @return
+     */
+    @GetMapping("/list/{current}/{size}")
+    public R getPageList(@PathVariable Integer current, @PathVariable Integer size, GardenQueryDTO queryDTO) {
+        IPage<GardenRespDTO> page = new Page<>(current, size);
+        return R.ok().result(iGardenService.getPageList(page, queryDTO));
+    }
+
 }

+ 1 - 1
admin/src/main/java/com/flyer/foster/controller/app/AppPosterLibController.java

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
- * 小程序海报
+ * 小程序海报(小程序)
  *
  * @author kelei
  * @since 2024/5/15/9:32

+ 1 - 1
admin/src/main/java/com/flyer/foster/controller/app/AppSubscribeController.java

@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
 import java.time.LocalDateTime;
 
 /**
- * 小程序订阅用户
+ * 小程序订阅用户(小程序)
  *
  * @author flyer
  * @since 2024-05-17

+ 30 - 14
admin/src/main/java/com/flyer/foster/controller/app/AppTreeController.java

@@ -2,9 +2,11 @@ package com.flyer.foster.controller.app;
 
 import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.flyer.foster.dto.TreeAddDTO;
+import com.flyer.foster.dto.TreeRespDTO;
 import com.flyer.foster.dto.TreeUpdateDTO;
 import com.flyer.foster.entity.FosterRecord;
 import com.flyer.foster.entity.Tree;
+import com.flyer.foster.pojo.StpAppUtil;
 import com.flyer.foster.service.IFosterRecordService;
 import com.flyer.foster.service.ITreeService;
 import com.flyer.util.R;
@@ -12,11 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.stream.Collectors;
 
 /**
- * 树
+ * 树(小程序)
  *
  * @author flyer
  * @since 2024-05-09
@@ -32,6 +35,7 @@ public class AppTreeController {
 
     /**
      * 根据果园id查询树
+     *
      * @param gardenId
      * @return
      */
@@ -42,21 +46,33 @@ public class AppTreeController {
 
     /**
      * 返回区域随机的一棵树
+     *
      * @return
      */
     @GetMapping("/getRandomTree/{gardenId}")
-    public R getRandomTree(@PathVariable Integer gardenId){
-        List<FosterRecord> records = iFosterRecordService.lambdaQuery().eq(FosterRecord::getGardenId, gardenId).list();
-        //已认养的树
-        List<Integer> fosteredIds = records.stream().map(FosterRecord::getTreeId).collect(Collectors.toList());
-        LambdaQueryChainWrapper<Tree> queryChainWrapper = iTreeService.lambdaQuery().eq(Tree::getGardenId, gardenId);
-        if(fosteredIds.size() > 0){
-            queryChainWrapper = queryChainWrapper.notIn(Tree::getId, fosteredIds);
-        }
-        List<Tree> list = queryChainWrapper.list();
-        if(list.size() > 0){
-            return R.ok().result(list.get(0));
-        }
-        return R.error().message("没有可领养的树!");
+    public R getRandomTree(@PathVariable Integer gardenId) {
+//        List<FosterRecord> records = iFosterRecordService.lambdaQuery().eq(FosterRecord::getGardenId, gardenId).list();
+//        //已认养的树
+//        List<Integer> fosteredIds = records.stream().map(FosterRecord::getTreeId).collect(Collectors.toList());
+//        LambdaQueryChainWrapper<Tree> queryChainWrapper = iTreeService.lambdaQuery().eq(Tree::getGardenId, gardenId);
+//        if(fosteredIds.size() > 0){
+//            queryChainWrapper = queryChainWrapper.notIn(Tree::getId, fosteredIds);
+//        }
+//        List<Tree> list = queryChainWrapper.list();
+//        if(list.size() > 0){
+//            return R.ok().result(list.get(0));
+//        }
+        int tenantId = StpAppUtil.getTokenSession().getInt("tenantId");
+        Tree tree = new Tree();
+        tree.setGardenId(gardenId);
+        tree.setTenantId(tenantId);
+        tree.setCreatedBy("kelei");
+        tree.setCreatedTime(LocalDateTime.now());
+        tree.setUpdatedBy("kelei");
+        tree.setUpdatedTime(LocalDateTime.now());
+        // 根据果园id创建一颗树
+        iTreeService.save(tree);
+        // 获取新插入的树的信息并返回给前端
+        return R.ok().result(iTreeService.getById(tree.getId()));
     }
 }

+ 1 - 1
admin/src/main/java/com/flyer/foster/controller/app/AppTreePosterContentController.java

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.validation.Valid;
 
 /**
- * 小程序果树海报悄悄话
+ * 小程序果树海报悄悄话(小程序)
  *
  * @author flyer
  * @since 2024-05-09

+ 1 - 1
admin/src/main/java/com/flyer/foster/controller/app/AppUserController.java

@@ -20,7 +20,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * 小程序用户
+ * 小程序用户(小程序)
  *
  * @author flyer
  * @since 2024-05-09

+ 30 - 0
admin/src/main/java/com/flyer/foster/controller/app/AppWorldMapController.java

@@ -0,0 +1,30 @@
+package com.flyer.foster.controller.app;
+
+import com.flyer.foster.service.IWorldMapService;
+import com.flyer.util.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 世界地图(小程序)
+ *
+ * @author flyer
+ * @since 2024-05-18
+ */
+@RestController
+@RequestMapping("/app/world-map")
+public class AppWorldMapController {
+    @Autowired
+    private IWorldMapService iWorldMapService;
+
+    /**
+     * 获取世界地图列表
+     * @return
+     */
+    @GetMapping("/list")
+    public R getList() {
+        return R.ok().result(iWorldMapService.list());
+    }
+}

+ 3 - 0
admin/src/main/java/com/flyer/foster/dto/GardenAddDTO.java

@@ -21,6 +21,9 @@ public class GardenAddDTO {
     @NotBlank(message = "果园名称不能为空")
     private String name;
 
+    @NotBlank(message = "果园图标不能为空")
+    private String icon;
+
     /**
      * 果园白天背景
      */

+ 6 - 0
admin/src/main/java/com/flyer/foster/dto/GardenRespDTO.java

@@ -17,6 +17,12 @@ public class GardenRespDTO {
 
     private String name;
 
+    private Integer worldMapId;
+
+    private String wkt;
+
+    private String icon;
+
     private Integer birdseyeGardenId;
 
     private Integer userId;

+ 15 - 0
admin/src/main/java/com/flyer/foster/dto/GardenUpdateDTO.java

@@ -22,6 +22,21 @@ public class GardenUpdateDTO {
     private String name;
 
     /**
+     * 世界地图主键id
+     */
+    private Integer worldMapId;
+
+    /**
+     * 果园在世界地图上的坐标
+     */
+    private String wkt;
+
+    /**
+     * 果园在世界地图上的图标
+     */
+    private String icon;
+
+    /**
      * 果园白天背景
      */
     private String dayBg;

+ 15 - 0
admin/src/main/java/com/flyer/foster/entity/Garden.java

@@ -36,6 +36,21 @@ public class Garden implements Serializable {
     private Integer id;
 
     /**
+     * 世界地图表主键id
+     */
+    private Integer worldMapId;
+
+    /**
+     * 果园在世界地图上的坐标
+     */
+    private String wkt;
+
+    /**
+     * 果园在世界地图上的图标
+     */
+    private String icon;
+
+    /**
      * 果园名称
      */
     private String name;

+ 88 - 0
admin/src/main/java/com/flyer/foster/entity/WorldMap.java

@@ -0,0 +1,88 @@
+package com.flyer.foster.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.Version;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 世界地图
+ * </p>
+ *
+ * @author flyer
+ * @since 2024-05-18
+ */
+@Getter
+@Setter
+@TableName("tb_world_map")
+public class WorldMap implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 地图
+     */
+    private String baseMapUrl;
+
+    /**
+     * 状态-{0.不可用 1.可用}
+     */
+    private Integer status;
+
+    /**
+     * 租户号
+     */
+    private Integer tenantId;
+
+    /**
+     * 乐观锁
+     */
+    @Version
+    private Integer version;
+
+    /**
+     * 是否删除
+     */
+    @TableLogic
+    private Integer isDeleted;
+
+    /**
+     * 创建人
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(fill = FieldFill.UPDATE)
+    private String updatedBy;
+
+    /**
+     * 更新时间
+     */
+    @TableField(fill = FieldFill.UPDATE)
+    private LocalDateTime updatedTime;
+
+
+}

+ 16 - 0
admin/src/main/java/com/flyer/foster/mapper/IWorldMapMapper.java

@@ -0,0 +1,16 @@
+package com.flyer.foster.mapper;
+
+import com.flyer.foster.entity.WorldMap;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 世界地图 Mapper 接口
+ * </p>
+ *
+ * @author flyer
+ * @since 2024-05-18
+ */
+public interface IWorldMapMapper extends BaseMapper<WorldMap> {
+
+}

+ 16 - 0
admin/src/main/java/com/flyer/foster/service/IWorldMapService.java

@@ -0,0 +1,16 @@
+package com.flyer.foster.service;
+
+import com.flyer.foster.entity.WorldMap;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 世界地图 服务类
+ * </p>
+ *
+ * @author flyer
+ * @since 2024-05-18
+ */
+public interface IWorldMapService extends IService<WorldMap> {
+
+}

+ 3 - 0
admin/src/main/java/com/flyer/foster/service/impl/GardenServiceImpl.java

@@ -119,6 +119,9 @@ public class GardenServiceImpl extends ServiceImpl<IGardenMapper, Garden> implem
         }
         return this.lambdaUpdate()
                 .set(StrUtil.isNotBlank(updateDTO.getName()), Garden::getName, updateDTO.getName())
+                .set(updateDTO.getWorldMapId() != null, Garden::getWorldMapId, updateDTO.getWorldMapId())
+                .set(StrUtil.isNotBlank(updateDTO.getWkt()), Garden::getWkt, updateDTO.getWkt())
+                .set(StrUtil.isNotBlank(updateDTO.getIcon()), Garden::getIcon, updateDTO.getIcon())
                 .set(StrUtil.isNotBlank(updateDTO.getDayBg()), Garden::getDayBg, updateDTO.getDayBg())
                 .set(StrUtil.isNotBlank(updateDTO.getNightBg()), Garden::getNightBg, updateDTO.getNightBg())
                 .set(updateDTO.getBirdseyeGardenId() != null, Garden::getBirdseyeGardenId, updateDTO.getBirdseyeGardenId())

+ 3 - 2
admin/src/main/java/com/flyer/foster/service/impl/TreePosterContentServiceImpl.java

@@ -120,8 +120,9 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
 
         LocalDateTime queryDateTime;
         if (StrUtil.isNotBlank(queryDTO.getCreatedTime())) {
-            DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            queryDateTime = LocalDateTime.parse(queryDTO.getCreatedTime(), fmt);
+            queryDateTime = LocalDate.parse(queryDTO.getCreatedTime()).atStartOfDay();
+//            DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+//            queryDateTime = LocalDateTime.parse(queryDTO.getCreatedTime(), fmt);
         } else {
             queryDateTime = LocalDateTime.now();
         }

+ 20 - 0
admin/src/main/java/com/flyer/foster/service/impl/WorldMapServiceImpl.java

@@ -0,0 +1,20 @@
+package com.flyer.foster.service.impl;
+
+import com.flyer.foster.entity.WorldMap;
+import com.flyer.foster.mapper.IWorldMapMapper;
+import com.flyer.foster.service.IWorldMapService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 世界地图 服务实现类
+ * </p>
+ *
+ * @author flyer
+ * @since 2024-05-18
+ */
+@Service
+public class WorldMapServiceImpl extends ServiceImpl<IWorldMapMapper, WorldMap> implements IWorldMapService {
+
+}

+ 4 - 0
admin/src/main/resources/mapper/GardenMapper.xml

@@ -12,6 +12,9 @@
     <select id="getPageList" resultType="com.flyer.foster.dto.GardenRespDTO">
         select a.id           as id,
                a.name         as name,
+               c.id           as worldMapId,
+               a.wkt          as wkt,
+               a.icon         as icon,
                a.user_id      as userId,
                b.username     as username,
                case
@@ -23,5 +26,6 @@
                b.updated_time as updatedTime
         from tb_garden a
                  left join tb_user b on a.user_id = b.id
+                 left join tb_world_map c on a.world_map_id = c.id
     </select>
 </mapper>

+ 5 - 0
admin/src/main/resources/mapper/WorldMapMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.flyer.foster.mapper.IWorldMapMapper">
+
+</mapper>