Bläddra i källkod

feat(app): 增加体育馆包场功能

- 新增 getPlaceInfoNoFixation 接口,用于查询体育馆场地空闲时间段
- 实现 AppSitePriceRulesMapper 中的 theGymnasiumIsCharteredInfo 方法
- 在 DetailServiceImpl 中添加 getPlaceInfoNoFixation 实现逻辑
- 更新 PlaceInfoVO,增加新的数据结构用于包场信息展示
-优化 CourseInfoVO,移除冗余字段,增加年售字段
SheepHy 2 veckor sedan
förälder
incheckning
f3a8e41b7e

+ 13 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/AppDetailController.java

@@ -60,4 +60,17 @@ public class AppDetailController {
     public Result<List<PlaceInfoVO.CourseInfoVO>> courseInfoVOList(@RequestParam @Schema(description="课程类型")String type, @RequestParam @Schema(description="课程ID")String id){
         return Result.ok(detailService.courseInfoVOList(type, id));
     }
+
+    /**
+     * @Author SheepHy
+     * @Description 根据类目类型查询体育馆场地空闲时间段(包场 -门店详情页使用)
+     * @Date 10:14 2025/7/9
+     * @Param id, categoryId
+     * @return PlaceInfoVO.theGymnasiumIsCharteredVO
+     **/
+    @GetMapping("/getPlaceInfoNoFixation")
+    @Operation(summary = "根据类目类型查询体育馆场地空闲时间段(包场 -门店详情页使用)")
+    public Result<PlaceInfoVO.theGymnasiumIsCharteredVO> getPlaceInfoNoFixation(@RequestParam @Schema(description="门店ID")String id, @RequestParam @Schema(description="类目")String categoryId){
+        return Result.ok(detailService.getPlaceInfoNoFixation(id, categoryId));
+    }
 }

+ 4 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IDetailService.java

@@ -35,9 +35,10 @@ public interface IDetailService {
     
     /** 
      * @Author SheepHy
-     * @Description 根据类目类型查询体育馆场地空闲时间段
+     * @Description 根据类目类型查询体育馆场地空闲时间段(包场 -门店详情页使用)
      * @Date 10:14 2025/7/9
-     * @Param 
-     * @return 
+     * @Param id, categoryId
+     * @return PlaceInfoVO.theGymnasiumIsCharteredVO
      **/
+    PlaceInfoVO.theGymnasiumIsCharteredVO getPlaceInfoNoFixation(String id, String categoryId);
 }

+ 1 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/AppHomeServiceImpl.java

@@ -240,6 +240,7 @@ public class AppHomeServiceImpl implements IAppHomeService {
         }
         return searchPlaceVOPage;
     }
+
     /**
      * @Author SheepHy
      * @Description 根据类目ID获取完整的类目名称

+ 37 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -18,8 +18,10 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+
 @Service
 @Log4j2
 public class DetailServiceImpl implements IDetailService {
@@ -39,6 +41,8 @@ public class DetailServiceImpl implements IDetailService {
     private AppOrderMapper appOrderMapper;
     @Resource
     private AppSitePlaceMapper appSitePlaceMapper;
+    @Resource
+    private AppCategoryMapper appCategoryMapper;
 
     @Override
     public PlaceInfoVO getPlaceInfo(String id) {
@@ -117,6 +121,21 @@ public class DetailServiceImpl implements IDetailService {
         return courseInfoVOList;
     }
 
+    @Override
+    public PlaceInfoVO.theGymnasiumIsCharteredVO getPlaceInfoNoFixation(String id, String categoryId) {
+        AppSitePlace appSitePlace = appSitePlaceMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery()
+                .eq(AppSitePlace::getSiteId, id)
+                .eq(AppSitePlace::getStatus, 0)
+                .eq(AppSitePlace::getDelFlag, 0)
+                .last("LIMIT 1"));
+        List<PlaceInfoVO.theGymnasiumIsCharteredInfoVO> collect = appSitePriceRulesMapper.theGymnasiumIsCharteredInfo(appSitePlace.getOrgCode(), categoryId);
+        return new PlaceInfoVO.theGymnasiumIsCharteredVO()
+                .setCategory(getCategoryName(categoryId))
+                .setEarlyRefundTime(appSitePlace.getEarlyRefundTime())
+                .setVr(appSiteMapper.selectById(id).getVr())
+                .setTimeSlot(collect);
+    }
+
     /**
      * @return
      * @Author SheepHy
@@ -190,4 +209,22 @@ public class DetailServiceImpl implements IDetailService {
             return 0;
         }
     }
+
+    /**
+     * @Author SheepHy
+     * @Description 根据类目ID获取完整的类目名称
+     * @Date 13:31 2025/7/7
+     * @Param categoryId 类目ID
+     * @return List<String>
+     **/
+    private List<String> getCategoryName(String categoryId) {
+        List<String> list = new ArrayList<>();
+        if(null != categoryId){
+            String[] split = categoryId.split(",");
+            Arrays.stream(split).forEach(id -> {
+                list.add(appCategoryMapper.selectById(id).getName());
+            });
+        }
+        return list;
+    }
 }

+ 31 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/PlaceInfoVO.java

@@ -23,8 +23,6 @@ public class PlaceInfoVO {
     private Boolean isOpen;
     @Schema(description = "封面")
     private String cover;
-    @Schema(description = "背景图;可能数组")
-    private String backgroundImage;
     @Schema(description = "地址")
     private String address;
     @Schema(description = "类型;0学校 1包场体育馆 2不固定场体育馆")
@@ -118,4 +116,35 @@ public class PlaceInfoVO {
         @Schema(description = "擅长说明")
         private String excelMsg;
     }
+
+    @Data
+    @Accessors(chain = true)
+    @EqualsAndHashCode(callSuper = false)
+    @Schema(description="根据类目类型查询体育馆场地空闲时间段(包场 -门店详情页使用)")
+    public static class theGymnasiumIsCharteredVO{
+        @Schema(description = "体育馆包场提前退款时间;单位:分钟")
+        private int earlyRefundTime;
+        @Schema(description = "类目")
+        private List<String> category;
+        @Schema(description = "VR实景")
+        private String vr;
+        @Schema(description = "时间段")
+        private List<theGymnasiumIsCharteredInfoVO> timeSlot;
+    }
+
+    @Data
+    @Accessors(chain = true)
+    @EqualsAndHashCode(callSuper = false)
+    public static class theGymnasiumIsCharteredInfoVO{
+        @Schema(description = "场馆id")
+        private String id;
+        @Schema(description = "日期")
+        private String timeRange;
+        @Schema(description = "最早可订")
+        private String startTime;
+        @Schema(description = "排序说明")
+        private String dateLabel;
+        @Schema(description = "价格")
+        private BigDecimal sellingPrice;
+    }
 }

+ 9 - 6
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/SearchVO.java

@@ -60,7 +60,7 @@ public class SearchVO{
     @Data
     @Accessors(chain = true)
     @EqualsAndHashCode(callSuper = false)
-    @Schema(description="教练课程信息返回参数")
+    @Schema(description="课程信息返回参数")
     public static class CourseInfoVO {
         @Schema(description = "主键id")
         private String id;
@@ -68,10 +68,9 @@ public class SearchVO{
         private String name;
         @Schema(description = "课程价格")
         private String sellingPrice;
-        @Schema(description = "课程类型")
-        private String type;
-        @Schema(description = "课程简介")
-        private String intro;
+        @Schema(description = "年售")
+        private String  sales;
+
     }
 
     @Data
@@ -83,6 +82,8 @@ public class SearchVO{
         private String id;
         @Schema(description = "名称")
         private String name;
+        @Schema(description = "门店名称")
+        private String placeName;
         @Schema(description = "课程售价")
         private BigDecimal sellingPrice;
         @Schema(description = "图片")
@@ -101,7 +102,7 @@ public class SearchVO{
         @Schema(description = "距离(KM)")
         private double km;
         @Schema(description = "赛事是否结束")
-        private boolean isRegistrationOpen;
+        private boolean registrationOpen;
     }
 
     @Data
@@ -168,6 +169,8 @@ public class SearchVO{
         private String categoryId;
         @Schema(description = "是否有票")
         private boolean ticketWhether;
+        @Schema(description = "课程")
+        private List<CourseInfoVO> course;
     }
     @Data
     @Accessors(chain = true)

+ 14 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppSitePriceRulesMapper.java

@@ -1,7 +1,11 @@
 package org.jeecg.modules.system.app.mapper;
 
-import org.jeecg.modules.system.app.entity.AppSitePriceRules;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.system.app.entity.AppSitePriceRules;
+
+import java.util.List;
 
 /**
  * @Description: 场地价格规则表
@@ -11,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface AppSitePriceRulesMapper extends BaseMapper<AppSitePriceRules> {
 
+    /**
+     * @Author SheepHy
+     * @Description 计算包场信息自动排序今天、明天、后天、周一到周天
+     * @Date 15:26 2025/7/10
+     * @Param
+     * @return
+     **/
+    List<PlaceInfoVO.theGymnasiumIsCharteredInfoVO> theGymnasiumIsCharteredInfo(@Param("orgCode")String orgCode, @Param("categoryId")String categoryId);
+
 }

+ 4 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppGameMapper.xml

@@ -10,14 +10,13 @@
         a.org_code,
         a.start_time,
         a.end_time,
-        CASE
-
-        WHEN a.application_end_time >= NOW() THEN
-        TRUE ELSE FALSE
-        END AS isRegistrationOpen
+        e.address AS placeName,
+        (
+        a.application_end_time >= NOW()) AS registrationOpen
         FROM
         nm_game a
         LEFT JOIN ( SELECT game_id, MIN( selling_price ) AS min_selling_price FROM nm_game_price_rules GROUP BY game_id ) g ON a.id = g.game_id
+        LEFT JOIN sys_depart e ON a.org_code = e.org_code
         WHERE
         a.end_time > NOW()
         <if test="searchDTO.keyword != null and searchDTO.keyword != ''">

+ 0 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSiteMapper.xml

@@ -66,7 +66,6 @@
             b.depart_name,
             a.good_rate,
             a.cover,
-            a.background_image,
             b.address,
             a.type,
             a.facility,

+ 54 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSitePriceRulesMapper.xml

@@ -1,5 +1,59 @@
 <?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="org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper">
+    <select id="theGymnasiumIsCharteredInfo" resultType="org.jeecg.modules.app.vo.PlaceInfoVO$theGymnasiumIsCharteredInfoVO">
+        WITH RECURSIVE dates AS (
+        SELECT
+        0 AS offset_day,
+        CURDATE() AS date_val,
+        DAYOFWEEK(
+        CURDATE()) - 1 AS dow UNION ALL
+        SELECT
+        offset_day + 1,
+        date_val + INTERVAL 1 DAY,
+        DAYOFWEEK( date_val + INTERVAL 1 DAY ) - 1
+        FROM
+        dates
+        WHERE
+        offset_day &lt;6
+        ),
+        earliest_slots AS (
+        SELECT
+        r.id,
+        r.start_time,
+        r.end_time,
+        r.selling_price,
+        r.day_of_week
+        FROM
+        nm_site_peice_rules r
+        JOIN ( SELECT day_of_week, MIN( start_time ) AS min_start_time FROM nm_site_peice_rules WHERE view_status = 0 GROUP BY day_of_week ) AS grouped ON r.day_of_week = grouped.day_of_week
+        AND r.start_time = grouped.min_start_time
+        WHERE
+        r.view_status = 0
+        AND r.org_code = #{orgCode} AND r.category_id = #{categoryId}
+        ) SELECT
+        es.id,
+        es.start_time,
+        CONCAT( es.start_time, '-', es.end_time ) AS time_range,
+        es.selling_price,
+        CASE
 
+        WHEN dm.offset_day = 0 THEN
+        CONCAT( '今天(', DATE_FORMAT( dm.date_val, '%m-%d' ), ')' )
+        WHEN dm.offset_day = 1 THEN
+        CONCAT( '明天(', DATE_FORMAT( dm.date_val, '%m-%d' ), ')' )
+        WHEN dm.offset_day = 2 THEN
+        CONCAT( '后天(', DATE_FORMAT( dm.date_val, '%m-%d' ), ')' ) ELSE CONCAT(
+        ELT( dm.dow + 1, '星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日' ),
+        '(',
+        DATE_FORMAT( dm.date_val, '%m-%d' ),
+        ')'
+        )
+        END AS date_label
+        FROM
+        earliest_slots es
+        JOIN ( SELECT offset_day, date_val, dow FROM dates ) AS dm ON es.day_of_week = dm.dow
+        ORDER BY
+        dm.offset_day;
+    </select>
 </mapper>