1
0

3 Commits d900f11794 ... 431252010f

Autor SHA1 Nachricht Datum
  zhangxin 431252010f 场次选择 vor 2 Wochen
  zhangxin 5feeaff1c2 Merge branch 'master' of http://git.zonelife.cn:3000/huangyang/national-motion-backend vor 2 Wochen
  zhangxin ea69273942 选择场次 vor 2 Wochen

+ 43 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/stadium/StadiumController.java

@@ -0,0 +1,43 @@
+package org.jeecg.modules.app.controller.stadium;
+
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.app.service.IDetailService;
+import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.app.vo.stadium.StadiumConcertsVO;
+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;
+
+import java.util.List;
+
+
+@Slf4j
+@Tag(name = "App首页体育馆")
+@RestController
+@RequestMapping("/app/stadium")
+public class StadiumController {
+
+    @Autowired
+    IDetailService iDetailService;
+
+
+    /**
+     * @Description 体育馆场次查询
+     * @Date 19:41 2025/7/11
+     * @Param id 门店id
+     * @return PlaceInfoVO {@link PlaceInfoVO}
+     **/
+    @GetMapping("/getPlaceInfo")
+    @Operation(summary = "场次详情查询-缺少已定状态和可预约数逻辑 ")
+    public Result<List<StadiumConcertsVO>> findConcerts(){
+        String site_id = "1942781931946946561";
+        String category_id = "1942391828774895617";
+        return iDetailService.findConcerts(site_id,category_id);
+    }
+
+}

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

@@ -1,8 +1,10 @@
 package org.jeecg.modules.app.service;
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.app.vo.CourseInfoVO;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
 import org.jeecg.modules.system.app.entity.AppCategory;
+import org.jeecg.modules.app.vo.stadium.StadiumConcertsVO;
 
 import java.util.List;
 
@@ -43,6 +45,8 @@ public interface IDetailService {
      **/
     PlaceInfoVO.theGymnasiumIsCharteredVO getPlaceInfoNoFixation(String id, String categoryId);
 
+    Result<List<StadiumConcertsVO>> findConcerts(String siteId, String categoryId);
+
     /**
      * @Author SheepHy
      * @Description 获取所有类目

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

@@ -3,12 +3,17 @@ package org.jeecg.modules.app.service.impl;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.extern.log4j.Log4j2;
 import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.app.service.IDetailService;
 import org.jeecg.modules.app.vo.CourseInfoVO;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.app.vo.stadium.ConcertsVO;
+import org.jeecg.modules.app.vo.stadium.StadiumConcertsVO;
 import org.jeecg.modules.system.app.entity.*;
 import org.jeecg.modules.system.app.mapper.*;
+import org.jeecg.modules.system.app.utils.TimeRangeFinder;
+import org.jeecg.modules.system.app.vo.time.NextSevenDayVo;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.mapper.SysUserMapper;
 import org.jeecg.modules.system.util.PositionUtil;
@@ -145,6 +150,25 @@ public class DetailServiceImpl implements IDetailService {
                 .setTimeSlot(collect);
     }
 
+    @Override
+    public Result<List<StadiumConcertsVO>> findConcerts(String siteId, String categoryId) {
+        List<NextSevenDayVo> nextSevenDays = TimeRangeFinder.getNextSevenDays();
+        List<StadiumConcertsVO> stadiumConcertsVOS = new ArrayList<>();
+        for (NextSevenDayVo nextSevenDay : nextSevenDays) {
+            StadiumConcertsVO stadiumConcertsVO = new StadiumConcertsVO();
+            BeanUtils.copyProperties(nextSevenDay,stadiumConcertsVO);
+            //
+            //查询预约总数
+//            appSitePlaceMapper.findCount();
+//            查询过期和已预约数
+            //查询当天所有场地和场次
+            List<ConcertsVO>  concertsVOList= appSitePlaceMapper.findByConcerts(stadiumConcertsVO.getWeekDay(),siteId,categoryId);
+            stadiumConcertsVO.setConcertsVOList(concertsVOList);
+            stadiumConcertsVOS.add(stadiumConcertsVO);
+        }
+        return Result.ok(stadiumConcertsVOS);
+    }
+
     @Override
     public List<AppCategory> getAllCategory(String id) {
         AppSite appSite = appSiteMapper.selectById(id);

+ 38 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/ConcertsDetailsVO.java

@@ -0,0 +1,38 @@
+package org.jeecg.modules.app.vo.stadium;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="体育馆场次")
+public class ConcertsDetailsVO {
+    @Schema(description = "场所明细id")
+    private String id;
+    /**场所名称*/
+    @Schema(description = "场所开始时间")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    private Date startTime;
+    /**场所明细*/
+    @Schema(description = "场所结束时间")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    private Date endTime;
+    /**当天场次已预约数*/
+    @Schema(description = "场所状态0-未预约;1-已预约")
+    private Integer concertStatus;
+
+    @Schema(description = "价格")
+    private BigDecimal price;
+
+
+}

+ 25 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/ConcertsVO.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.app.vo.stadium;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="体育馆场次")
+public class ConcertsVO {
+    @Schema(description = "场所id")
+    private String sitePlaceId;
+    /**场所名称*/
+    @Schema(description = "场所名称")
+    private String sitePlaceName;
+    /**场所明细*/
+    @Schema(description = "场所明细")
+    private List<ConcertsDetailsVO> concertsDetailsVOList;
+
+
+}

+ 38 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/StadiumConcertsVO.java

@@ -0,0 +1,38 @@
+package org.jeecg.modules.app.vo.stadium;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="体育馆场次")
+public class StadiumConcertsVO {
+
+    @Schema(description = "门店id")
+    private Integer siteId;
+    @Schema(description = "运动类型Id")
+    private Integer categoryId;
+    @Schema(description = "星期")
+    private Integer weekDay;
+    /**事件类型(0: 网页链接, 1: 内部页面跳转)*/
+    @Schema(description = "日期加星期")
+    private String weekDayAndDate;
+//    /**当天场次总数*/
+//    @Schema(description = "当天场次总数")
+//    private String dayConcertsTotal;
+//    /**当天场次已预约数*/
+//    @Schema(description = "当天场次已预约数")
+//    private String dayConcertsReservationNum;
+    @Schema(description = "当天场次未预约数")
+    private String noDayConcertsReservationNum;
+    /**当天场次已预约数*/
+    @Schema(description = "当天场所明细")
+    private List<ConcertsVO> concertsVOList;
+
+
+}

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppSitePlaceMapper.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.app.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.app.vo.stadium.ConcertsVO;
 import org.jeecg.modules.system.app.entity.AppSitePlace;
 import org.apache.ibatis.annotations.Param;
 import java.util.List;
@@ -21,4 +22,6 @@ public interface AppSitePlaceMapper extends BaseMapper<AppSitePlace> {
      * @return
      **/
     List<PlaceInfoVO.PlaceInfoGymMsgVO> getPlaceInfoNoFixation(@Param("id")String id);
+
+    List<ConcertsVO> findByConcerts(Integer weekDay, String siteId, String categoryId);
 }

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

@@ -1,6 +1,18 @@
 <?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.AppSitePlaceMapper">
+    <resultMap id="ConcertsVOResult" type="org.jeecg.modules.app.vo.stadium.ConcertsVO">
+        <result property="sitePlaceId" column="site_place_id"/>
+        <result property="sitePlaceName" column="site_place_name"/>
+        <collection property="concertsDetailsVOList" ofType="org.jeecg.modules.app.vo.stadium.ConcertsDetailsVO" javaType="java.util.List">
+            <result property="id" column="id" />
+            <result property="startTime" column="start_time" />
+            <result property="endTime" column="end_time"/>
+            <result property="concertStatus" column="concertStatus" />
+            <result property="price" column="selling_price" javaType="java.math.BigDecimal"/>
+        </collection>
+    </resultMap>
+
     <select id="getPlaceInfoNoFixation" resultType="org.jeecg.modules.app.vo.PlaceInfoVO$PlaceInfoGymMsgVO">
         SELECT
             a.id,
@@ -21,4 +33,10 @@
         ORDER BY
             selling_price ASC;
     </select>
+    <select id="findByConcerts" resultMap="ConcertsVOResult" >
+        select b.site_place_id,a.name as site_place_name,
+        b.id,b.start_time,b.end_time ,b.selling_price
+        from nm_site_place a left join  nm_site_price_rules b on a.id = b.site_place_id
+        where a.site_id = #{siteId} and b.category_id =#{categoryId} and b.day_of_week =#{weekDay}
+    </select>
 </mapper>

+ 47 - 8
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/utils/TimeRangeFinder.java

@@ -1,11 +1,13 @@
 package org.jeecg.modules.system.app.utils;
 
-import org.apache.poi.ss.formula.functions.T;
-import org.jeecg.modules.system.app.dto.AppCoursesRuleDTO;
-import org.w3c.dom.stylesheets.LinkStyle;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.system.app.vo.time.NextSevenDayVo;
 
+import java.time.DayOfWeek;
+import java.time.LocalDate;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
+import java.time.format.TextStyle;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -79,13 +81,50 @@ public class TimeRangeFinder {
         return merged.stream().map(TimeRange::toString).collect(Collectors.joining(","));
     }
 
+    //获取当前时间及后面6天的
+    public static List<NextSevenDayVo> getNextSevenDays() {
+        List<NextSevenDayVo> dates = new ArrayList<>();
+        LocalDate today = LocalDate.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM-dd");
+        for (int i = 0; i < 7; i++) { // 包含今天共8天
+            NextSevenDayVo nextSevenDayVo= new NextSevenDayVo();
+            LocalDate localDate = today.plusDays(i);
+            Locale locale = Locale.CHINA;
+            String format = localDate.format(formatter);
+            DayOfWeek dayOfWeek = localDate.getDayOfWeek();
+            int dayOfWeekNum = dayOfWeek.getValue();
+            String display;
+            switch (i) {
+                case 0:
+                    display = "今天(" + format + ")";
+                    break;
+                case 1:
+                    display = "明天(" + format + ")";
+                    break;
+                case 2:
+                    display = "后天(" + format + ")";
+                    break;
+                default:
+
+                    String weekday = dayOfWeek.getDisplayName(TextStyle.SHORT, locale);
+                    display = weekday + "(" + format + ")";
+            }
+            nextSevenDayVo.setWeekDay(dayOfWeekNum);
+            nextSevenDayVo.setWeekDayAndDate(display);
+            dates.add(nextSevenDayVo);
+        }
+        return dates;
+    }
+
     // 主方法示例
     public static void main(String[] args) {
-        String input = "6:00-7:00, 6:30-8:00, 18:00-20:00, 19:30-21:00";
-        List<TimeRange> parsed = parseTimeRanges(input);
-        List<TimeRange> merged = mergeTimeRanges(parsed);
-        String result = formatMergedRanges(merged);
-        System.out.println(result); // 输出:6:00-8:00,18:00-21:00
+//        String input = "6:00-7:00, 6:30-8:00, 18:00-20:00, 19:30-21:00";
+//        List<TimeRange> parsed = parseTimeRanges(input);
+//        List<TimeRange> merged = mergeTimeRanges(parsed);
+//        String result = formatMergedRanges(merged);
+        List<NextSevenDayVo> nextSevenDays = getNextSevenDays();
+        System.out.println(JSONObject.toJSONString(nextSevenDays));
+//        System.out.println(result); // 输出:6:00-8:00,18:00-21:00
     }
 
 }

+ 27 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/vo/time/NextSevenDayVo.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.system.app.vo.time;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+/**
+ * @author DM
+ * @date 2025/7/7 15:41
+ * @description
+ */
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description="获取当前时间后续七天的日期")
+public class NextSevenDayVo {
+    @Schema(description ="星期几")
+    private Integer weekDay;
+    @Schema(description ="星期配合日期")
+    private String weekDayAndDate;
+}