From 92e2be60c2d92ab5c8524c76f97712cd9f66502d Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期三, 18 十月 2023 11:44:35 +0800
Subject: [PATCH] 10.18.1

---
 cloud-server-other/src/main/java/com/dsh/other/service/ISiteService.java         |    2 +-
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java |   30 +++++++++++++++++++++++-------
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java    |    6 ++++--
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index 068ed97..8fcd7e0 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -205,10 +205,12 @@
     @ApiImplicitParams({
             @ApiImplicitParam(value = "场地id", name = "id", dataType = "int", required = true),
             @ApiImplicitParam(value = "日期(2023-01-01)", name = "day", dataType = "string", required = true),
+            @ApiImplicitParam(value = "选择场地的名称", name = "day", dataType = "string", required = true),
+            @ApiImplicitParam(value = "半场名称", name = "day", dataType = "string", required = false)
     })
-    public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day){
+    public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day,String halfName,String siteName){
         try {
-            List<QuerySiteTimes> list = siteService.querySiteTimes(id, day);
+            List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName);
             return ResultUtil.success(list);
         }catch (Exception e){
             e.printStackTrace();
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/ISiteService.java b/cloud-server-other/src/main/java/com/dsh/other/service/ISiteService.java
index 7c7cefd..86c17e6 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/ISiteService.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/ISiteService.java
@@ -41,7 +41,7 @@
      * @return
      * @throws Exception
      */
-    List<QuerySiteTimes> querySiteTimes(Integer id, String day) throws Exception;
+    List<QuerySiteTimes> querySiteTimes(Integer id, String day,String halfName,String siteName) throws Exception;
 
 
     /**
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
index a410b0b..0a7c8a6 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -167,7 +167,7 @@
      * @throws Exception
      */
     @Override
-    public List<QuerySiteTimes> querySiteTimes(Integer id, String day) throws Exception {
+    public List<QuerySiteTimes> querySiteTimes(Integer id, String day,String halfName,String siteName) throws Exception {
 //        Site site = this.getById(id);
 //        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 //        Calendar s = Calendar.getInstance();
@@ -224,15 +224,31 @@
         List<String> strings = new ArrayList<>();
 
 //        List<SiteBooking> siteBookings = siteClient.listBooks(id);
-        List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).like("times",day));
+        List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).eq("nextName",siteName).like("times",day));
         System.out.println("=======siteBookings======"+siteBookings);
         for (SiteBooking siteBooking : siteBookings) {
-            String[] split = siteBooking.getTimes().split(";");
-            for (String s : split) {
 
-                String convertedValue = s.substring(11);
-                strings.add(convertedValue);
+
+            String[] split = siteBooking.getTimes().split(";");
+
+            if (siteBooking.getIsHalf() == 2) {
+                for (String s : split) {
+                    String convertedValue = s.substring(11);
+                    strings.add(convertedValue);
+                }
+            }else {
+
+                if (siteBooking.getHalfName().equals(halfName)){
+                    for (String s : split) {
+                        String convertedValue = s.substring(11);
+                        strings.add(convertedValue);
+                    }
+
+                }
+
+
             }
+
 
         }
         System.out.println("======strings======="+strings);
@@ -333,7 +349,7 @@
         for (String s : split) {
             String day = s.split(" ")[0];
             String time = s.split(" ")[1];
-            List<QuerySiteTimes> querySiteTimes = querySiteTimes(reservationSite.getId(), day);
+            List<QuerySiteTimes> querySiteTimes = querySiteTimes(reservationSite.getId(), day,reservationSite.getHalfName(),reservationSite.getNextName());
             for (QuerySiteTimes querySiteTime : querySiteTimes) {
                 if(querySiteTime.getTime().equals(time) && querySiteTime.getSelectable() == 0){
                     return ResultUtil.error("【" + s + "】时间段已被使用");

--
Gitblit v1.7.1